text:
Q: Errors while compiling python code using selenium webdriver My code is:
import time
from selenium import webdriver

driver = webdriver.Chrome('/Useres/arsenijgoj/PycharmProjects/pythonProject/chromedriver')  # Optional argument, if not specified will search path.
driver.get('http://www.google.com/');
time.sleep(5) # Let the user actually see something!
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
time.sleep(5) # Let the user actually see something!
driver.quit()

Error is:
Traceback (most recent call last):
  File "/Users/arsenijgoj/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 947, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1819, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/Useres/arsenijgoj/PycharmProjects/pythonProject/chromedriver'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/arsenijgoj/PycharmProjects/pythonProject/main.py", line 4, in <module>
    driver = webdriver.Chrome('/Useres/arsenijgoj/PycharmProjects/pythonProject/chromedriver')  # Optional argument, if not specified will search path.
  File "/Users/arsenijgoj/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/Users/arsenijgoj/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Don't know what to do.
Everything is installed properly, path to the chromedriver is correct too (it's even in the same directory as project is).
Using mac air m1, PyCharm
Any suggestions?

A: You have a typo in the chromedriver's path. "users" instead of "useres".
Change
webdriver.Chrome('/Useres/arsenijgoj/PycharmProjects/pythonProject/chromedriver')
to
webdriver.Chrome('/Users/arsenijgoj/PycharmProjects/pythonProject/chromedriver')


text:
Q: calculate ORs at fixed interaction levels for logistic regression? SAS has a nice way to analyze ORs from interactions like below, which I found here:
proc logistic data = exercise descending;
class prog / param=glm order=internal;
model satisfied = prog|hours / expb;
oddsratio prog / at(hours = 1.51 2 2.5), at(prog=all);
store logit;
run;

where hours is continuous and prog is a three-level categorical variable.
I found a way to calculate ORs in R comparing unit increase of hours at the different levels of prog which returns the same output in SAS, but I can't find a way to compare prog at specified hours in R.

redpajama_set_name: RedPajamaStackExchange


text:
Q: firewalld command alternative of iptables -P FORWARD ACCEPT firewalld command alternative of iptables -P FORWARD ACCEPT
I have to run iptables -P FORWARD ACCEPT in order to run kubernetes cluster and communicate from pods using the service name.
Problem is that I have k8s cluster running on centos7 and using firewalld instead of iptables and that is default in cenots, without iptables service running i can't save rule iptables -P FORWARD ACCEPT and that take effect after  reboot, if can get firwalld alternative of iptables -P FORWARD ACCEPT then I can persist it easily on reboot.

A: sudo firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -d 0.0.0.0/0 -j ACCEPT
sudo firewall-cmd --reload


text:
Q: Android java.lang.IllegalArgumentException: Service not registered I have a setup that looks something like this:
class MyFragment implements SomeEventListener {

    Application mAppContext;

    boolean mBound;
    boolean mDidCallUnbind;
    MyIBinder mBinder;
    ServiceConnection mConnection = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            mBound = true;
            mBinder = (MyIBinder) service;
            mBinder.getThings();...
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
            mDidCallUnbind = false;
            mBound = false;
            mBinder = null;
        }
    };

    ...

    @Override
    public void onSomeEvent() {
        mAppContext.bindService(...);
    }

    void unbindService() {
        if (mBound && !mDidCallUnbind) {
            mDidCallUnbind = true;
            mAppContext.unbindService(mConnection);
        }
    }

    @Override
    public void onPause() {
        unbindService();
        super.onPause();
    }
}

However, I am still seeing the error in the title from time to time: java.lang.IllegalArgumentException: Service not registered being generated when unbindService() is called.  Am I missing something silly, or is there more going on?  I should note that there may be more than one of this same fragment in existence.
Edit
Since no one actually seems to be reading the code, let me explain.  unbindService() does not call Context.unbindService(ServiceConnection) unless the service is bound (mBound) and it had not previously been called before the onServiceDisconnected(...) callback was hit from a possible previous call to unbindService().
That in mind, are there any cases where Android will unbind your service for you such that the service would become unbound but onServiceDisconnected would not be called thus leaving me in a stale state?
Also, I am using my Application context to do the initial binding.  Assume something like:
@Override
public void onCreate() {
    mApplication = getContext().getApplicationContext();
}

A: java.lang.IllegalArgumentException: Service not registered means that you weren't bound to service when unbindService() was called.
So in your case, onSomeEvent() was never called before call to unbindService() in onPause()

A: Reason?
If in your Activity, unbindService() gets called before bindService() then you will get this IllegalArgumentException.
How to avoid it?
It's simple. You would not need a boolean flag if you bind and unbind service in this order.

Solution 1:
Bind in onStart() and unbind in onStop()

Your Activity {

    @Override
    public void onStart()
    {
        super.onStart();
        bindService(intent, mConnection , Context.BIND_AUTO_CREATE);
    }

    @Override
    public void onStop()
    {
        super.onStop();
        unbindService(mConnection);
    }

 }

Solution 2:
  Bind in onCreate() and unbind in onDestroy()

 Your Activity {

    @Override
    public void onCreate(Bindle sis)
    {
        super.onCreate(sis);
        ....
        bindService(intent, mConnection , Context.BIND_AUTO_CREATE);
    }

    @Override
    public void onDestroy()
    {
        super.onDestroy();
        unbindService(mConnection);
    }

 }

Relevant Link:
Android official documentation suggests that
If you need to interact with the service only while your activity is visible then go with Solution1.
If you want your activity to receive responses even while it is stopped in the background then go with Solution2.

A: In my case, I called bindService using Activity Context and trying to unbind it using ApplicationContext. Don't do it.

A: Use mIsBound inside doBindService() and doUnbindService() instead of in the ServiceConnection instance.
ServiceConnection mConnection = new ServiceConnection() {
    @Override
    public void onServiceConnected(ComponentName name, IBinder service) {
        mBinder = (MyIBinder) service;
    }

    @Override
    public void onServiceDisconnected(ComponentName name) {
        mBinder = null;
    }
};

...

public void doBindService() {
    mIsBound =bindService(new Intent(this, MyService.class),
        mConnection, Context.BIND_AUTO_CREATE);
}

public void doUnbindService() {
    if (mIsBound) {
        unbindService(mConnection);
        mIsBound = false;
    }
}

This is how it's done in http://developer.android.com/reference/android/app/Service.html

A: I realize this question has already been answered. But I think there is reason to go into why people are making this mistake.
The issue is really with the training docs. http://developer.android.com/reference/android/app/Service.html shows a correct implementation while https://developer.android.com/guide/components/bound-services.html in the 'ActivityMessenger' shows a Very INCORRECT implementation.
In the 'ActivityMessenger' example onStop() could potentially be called before the service has actually been bound.
The reason for this confusion is they are using the bound service boolean to mean different things in different examples. (mainly, was bindService() called OR is the Service actually connected)
In the correct examples where unbind() is done based on the value of the bound boolean, the bound boolean indicates that the bindService() was called. Since it's queued up for main thread execution, then unbindService() needs to be called (so queued to be executed), regardless of when (if ever) onServiceConnected() happens.
In other examples, such as the one in http://developer.android.com/reference/android/app/Service.html. The bound indicates that the Services is Actually bound so that you can use it and not get a NullPointerException. Note that in this example, the unbindService() call is still made and the bound boolean doesn't determine whether to unbind or not.

A: Another possible reason for this exception might be that unbindService is called by the wrong Context. Because services can be bound not only by Activities, but also by other instances inherited by Context (with the exception of BroadcastReceivers), even by other Services, be sure that unbindService is called by the context that has bound the Service and not by the bound Service itself. This would yield directly the above exception "Service not registered".

A: I have the exact same issue with my application. Every now and then I get IllegalArgumentException. I guess the special case is caused when the service is unbound and the onPause is called before onServiceDisconnected. So I would try Synchronized things to ensure correct execution.

A: class ServiceBindManager<T>(val context: Context, clazz: Class<T>) {

    val TAG: String = "ServiceBindManager"

    private val isBound: AtomicBoolean = AtomicBoolean(false)

    private var intent: Intent = Intent(context, clazz)

    private val connection: ServiceConnection = object : ServiceConnection {
        override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
            Log.d(TAG, "onServiceConnected: $context")
            isBound.set(true)
        }

        override fun onServiceDisconnected(name: ComponentName?) {
            Log.d(TAG, "onServiceDisconnected: $context")
            isBound.set(false)
        }

        override fun onBindingDied(name: ComponentName?) {
            isBound.set(false)
        }

        override fun onNullBinding(name: ComponentName?) {
            isBound.set(false)
        }
    }

     fun bindService() {
        Log.e(TAG, "bindService: $context")
        isBound.set(context.bindService(intent, connection, BIND_AUTO_CREATE))
    }

     fun unbindService() {
        Log.e(TAG, "unbindService: $context")
        if (isBound.get()) {
            isBound.set(false)
            context.unbindService(connection)
        }
    }

}

Usage:

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        serviceBindManager = ServiceBindManager(this@MyActivity, MyService::class.java)
}

 override fun onStart() {
        super.onStart()
        serviceBindManager.bindService()
}

 override fun onStop() {
        super.onStop()
        serviceBindManager.unbindService()
}


text:
Q: entity framework 5, delete one to many relationship? The relationship of entity A,B is one-to-many, (A has many Bs, B must belong to A).
I disabled lazy loading and load A, B like this:
dbContext.As.Load();
//**particaly load B**
dbContext.Bs.Where(predicateX).Load();

When I use
dbContext.As.Remove(someA)

To delete A, I encounter the following error message
The relationship could not be changed because one or more of the foreign-key properties is non-nullable
Instead, if I use:
//remove all B in someA
foreach(B b in someA.Bs.ToList())
{
   dbContext.Bs.Remove(b);
}
dbContext.As.Remove(someA)

everything is ok.
Is there a better way to do this?
Edit

i am using Database First and add foreign key constraint of B (on delete cascade) at the database side.
i think "the foreign key constraint" is just equal to the code "OnModelCreating". but the code "dbContext.As.Remove(someA)" doesn't work as expected.
things get worse when there is A-B-C cascade one to many relation.in order to delete someA,you need to do like this
foreach(B b in someA.Bs.ToList())
{
  foreach(C c in b.Cs.ToList())
  {
    dbContext.Cs.Remove(c);
  }
  dbContext.Bs.Remove(b);
}
dbContext.As.Remove(someA);

Solved:

i use database first(sqlite) and add foreign key constraint at database side.
use vs2012 to create edmx from sqlite database file,
vs2012 failed to set the "on delete cascade" property of the relationship.
after manual set the property,single call to "dbContext.As.Remove(someA)" work as expected!

A: Sadly, there is (currently) no batch support in Entity Framework, so you're stuck foreach-ing through multiple properties. You might want to look at the EntityFramework.Extended project, which adds various batch operations to tidy up code like this (as well as improving performance).
If you're sure you'll always want to delete the related B's when an A is deleted, then configure this relationship to use "on delete cascade" behaviour. What that means is that when a parent A is deleted, all of its child B's are automatically deleted as well. How to do that depends on how you've created the database. If you're using Code First, it'll be something like this:
public class MyContext : DbContext
{
    public DbSet<A> As { get; set; }
    public DbSet<B> Bs { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Entity<A>()
                    .HasMany(a => a.Bs)
                    .WithRequired(b => b.A)
                    .WillCascadeOnDelete();
    }
}


text:
Q: UITextfield and UIButton not clicking inside UIView I have a few textfield and button inside a UIView but the click event is not getting called I have checked the Height of the UIView its more than my button and textview. As you can see in the screenshot of UIView:
Frame of UIView
These are the screenshot of TextField and button
This is the first Label
And this is the last button
And in between there are lots of labels and textfield. As you can see in this image
    This is the image of my view
Also I have set
userInteractionEnabled=NO

for the UIView and
userInteractionEnabled=YES;

for the TextField and Button but still no luck. I have no clue what to do next.This is my code
- (void)addChemicalTapped:(UIButton *)sender {

    _ans6Constraint.constant = 750;
//    [self.addChemical addTarget:self action:@selector(fixDelaysContentTouches:) forControlEvents:UIControlEventTouchUpInside];

   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleTextBeginEditing:) name:UITextFieldTextDidBeginEditingNotification object:_Ans6Text1new1];

    _chemicalUIview.userInteractionEnabled=NO;
//    _chemical1scroll.userInteractionEnabled=false;
    _Ans6Text4new1.userInteractionEnabled=YES;
    _Ans6Text2new1.userInteractionEnabled=YES;
    _Ans6Text1new1.userInteractionEnabled=YES;
    _Ans6Text3new1.userInteractionEnabled=YES;
    [_RemoveChemical1 setTag:1234];
    [_RemoveChemical1 addTarget:self action:@selector(RemoveChemical1Tapped:) forControlEvents:UIControlEventTouchUpInside];
     [self reloadTable];
}

There is no problem with click event because the id of same textfield and button is getting called in different UIView. So there is some thing wrong with my UIView code. This is my UIView code
UIView *paddingView3 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 20)];
    [_ans6Text1 setClipsToBounds:NO];
    [_ans6Text1.layer setBorderWidth:1.0];
    [_ans6Text1.layer setBorderColor:[UIColor whiteColor].CGColor];
    [_ans6Text1.layer setCornerRadius:4.0];
    [_ans6Text1 setLeftView:paddingView3];
    [_ans6Text1 setLeftViewMode:UITextFieldViewModeAlways];
        UIView *paddingView3new1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 20)];
        [_Ans6Text1new1 setClipsToBounds:NO];
        [_Ans6Text1new1.layer setBorderWidth:1.0];
        [_Ans6Text1new1.layer setBorderColor:[UIColor whiteColor].CGColor];
        [_Ans6Text1new1.layer setCornerRadius:4.0];
        [_Ans6Text1new1 setLeftView:paddingView3new1];
        [_Ans6Text1new1 setLeftViewMode:UITextFieldViewModeAlways];

    UIView *paddingView4 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 20)];
    [_ans6Text2 setClipsToBounds:NO];
    [_ans6Text2.layer setBorderWidth:1.0];
    [_ans6Text2.layer setBorderColor:[UIColor whiteColor].CGColor];
    [_ans6Text2.layer setCornerRadius:4.0];
    [_ans6Text2 setLeftView:paddingView4];
    [_ans6Text2 setLeftViewMode:UITextFieldViewModeAlways];
    [_ans6Text2 setInputView:_datePicker];
        UIView *paddingView4new1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 20)];
        [_Ans6Text2new1 setClipsToBounds:NO];
        [_Ans6Text2new1.layer setBorderWidth:1.0];
        [_Ans6Text2new1.layer setBorderColor:[UIColor whiteColor].CGColor];
        [_Ans6Text2new1.layer setCornerRadius:4.0];
        [_Ans6Text2new1 setLeftView:paddingView4new1];
        [_Ans6Text2new1 setLeftViewMode:UITextFieldViewModeAlways];
        [_Ans6Text2new1 setInputView:_datePicker];

    UIView *paddingView5 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 20)];
    [_ans6Text3 setClipsToBounds:NO];
    [_ans6Text3.layer setBorderWidth:1.0];
    [_ans6Text3.layer setBorderColor:[UIColor whiteColor].CGColor];
    [_ans6Text3.layer setCornerRadius:4.0];
    [_ans6Text3 setLeftView:paddingView5];
    [_ans6Text3 setLeftViewMode:UITextFieldViewModeAlways];
        UIView *paddingView5new1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 20)];
        [_Ans6Text3new1 setClipsToBounds:NO];
        [_Ans6Text3new1.layer setBorderWidth:1.0];
        [_Ans6Text3new1.layer setBorderColor:[UIColor whiteColor].CGColor];
        [_Ans6Text3new1.layer setCornerRadius:4.0];
        [_Ans6Text3new1 setLeftView:paddingView5new1];
        [_Ans6Text3new1 setLeftViewMode:UITextFieldViewModeAlways];

    UIView *paddingView6 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 20)];
    [_ans6Text4 setClipsToBounds:NO];
    [_ans6Text4.layer setBorderWidth:1.0];
    [_ans6Text4.layer setBorderColor:[UIColor whiteColor].CGColor];
    [_ans6Text4.layer setCornerRadius:4.0];
    [_ans6Text4 setLeftView:paddingView6];
    [_ans6Text4 setLeftViewMode:UITextFieldViewModeAlways];
        UIView *paddingView6new1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 20)];
        [_Ans6Text4new1 setClipsToBounds:NO];
        [_Ans6Text4new1.layer setBorderWidth:1.0];
        [_Ans6Text4new1.layer setBorderColor:[UIColor whiteColor].CGColor];
        [_Ans6Text4new1.layer setCornerRadius:4.0];
        [_Ans6Text4new1 setLeftView:paddingView6new1];
        [_Ans6Text4new1 setLeftViewMode:UITextFieldViewModeAlways];

Ans6Text1new1,Ans6Text2new1,Ans6Text3new1 and Ans6Text4new1 are the textfields which are not getting selected.
This is code for second textfield where we get the date.
-(void)textFieldDidEndEditing:(UITextField *)textField {
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"dd-MM-yyyy"];
    NSString *selectedDate = [formatter stringFromDate:[self.datePicker date]];
    NSString *pastDate = [formatter stringFromDate:[self.datePickerPast date]];

    if ([textField isEqual:_ans6Text2]) {
        [self.ans6Text2 setText:selectedDate];
        [self.ans6Text2 setBackgroundColor:[UIColor whiteColor]];
        [self.ans6Text2 setTextColor:[UIColor colorWithRed:5.0/255.0 green:85.0/255.0 blue:160.0/255.0 alpha:1.0]];
    }
    if ([textField isEqual:_Ans6Text2new1]) {
        [self.Ans6Text2new1 setText:selectedDate];
        [self.Ans6Text2new1 setBackgroundColor:[UIColor whiteColor]];
        [self.Ans6Text2new1 setTextColor:[UIColor colorWithRed:5.0/255.0 green:85.0/255.0 blue:160.0/255.0 alpha:1.0]];
    }

    else if ([textField isEqual:_ans4Text2]) {
        [self.ans4Text2 setText:pastDate];
        [self.ans4Text2 setBackgroundColor:[UIColor whiteColor]];
        [self.ans4Text2 setTextColor:[UIColor colorWithRed:5.0/255.0 green:85.0/255.0 blue:160.0/255.0 alpha:1.0]];
    }
    else if ([textField isEqual:_ans7Text2]) {
        [self.ans7Text2 setText:pastDate];
        [self.ans7Text2 setBackgroundColor:[UIColor whiteColor]];
        [self.ans7Text2 setTextColor:[UIColor colorWithRed:5.0/255.0 green:85.0/255.0 blue:160.0/255.0 alpha:1.0]];
    }
    else if ([textField isEqual:_ans7Text4]) {
        [self.ans7Text4 setText:pastDate];
        [self.ans7Text4 setBackgroundColor:[UIColor whiteColor]];
        [self.ans7Text4 setTextColor:[UIColor colorWithRed:5.0/255.0 green:85.0/255.0 blue:160.0/255.0 alpha:1.0]];
    }
    else if ([textField isEqual:_ans7Text5]) {
        [self.ans7Text5 setText:pastDate];
        [self.ans7Text5 setBackgroundColor:[UIColor whiteColor]];
        [self.ans7Text5 setTextColor:[UIColor colorWithRed:5.0/255.0 green:85.0/255.0 blue:160.0/255.0 alpha:1.0]];
    }
    else if ([textField isEqual:_ans8Text1]) {
        [self.ans8Text1 setText:pastDate];
        [self.ans8Text1 setBackgroundColor:[UIColor whiteColor]];
        [self.ans8Text1 setTextColor:[UIColor colorWithRed:5.0/255.0 green:85.0/255.0 blue:160.0/255.0 alpha:1.0]];
    }
}

Ans6Text2new1 is the textfield which is not getting clicked. The screenshot of my Layout is below
The UIView is marked in Red. There are two UIView. In first UIView all the TextField and button is working and in the second UIView which is inside First UIView there no Button or textfield is working. This is the code for my Button click in UIView which is also not working
- (void)add1ChemicalTapped:(UIButton *)sender {

   NSLog(@"ADDnew tapped");
}

And in viewDidLoad
- (void)viewDidLoad {
    @try{
    [super viewDidLoad];

    if(self.isReceived==true){
        [_HSSwitch setEnabled:NO];
    }

        [_Add1Chemical addTarget:self action:@selector(add1ChemicalTapped:) forControlEvents:UIControlEventTouchUpInside];
}

A: no need to call
userInteractionEnabled=NO

because if you call this for Parent UIView then it disable user interaction for child views as well.


text:
Q: How can I delete sharing links using Power Automate? I have created a flow with the following steps:

*

*Get all document sets in a library

*For each document set (all steps using Send an HTTP Request to SharePoint)

*

*Reset Role inheritance

*Break Role inheritance  breakroleinheritance(copyRoleAssignments=false,clearSubscopes=true)

*Set new permissions

This flow works mostly as expected. The permissions are set correctly, but if i look at a document inside the document set that has been shared previously, there are remnants of the sharing link which I would prefer wasn't there, with a message stating "This link is broken. Delete it and share the item again"

Question: Is there a way to remove all potential sharing links for documents inside a document set as part of the flow?

A: We can choose to terminate the sharing of this file.
Make a flow on a schedule that is daily
Get the items
If StopSharingDate = Today
Execute StopSharing Action


text:
Q: Microsoft Graph Webhook subscription for Teams Chat The Microsoft Graph request me/messages does not only contain emails but also Skype chats (from the folder conversation history) and  Microsoft Teams chats.
I have set up a Microsoft Graph Webhook to monitor changes in messages, it works fine for emails and Skype Chat but not for Teams Chat, I do not receive notifications when a new Chat is sent.

A: By Skype, you mean Skype for Business. That's because Skype for Business archives chats into the user's inbox.
Teams does archive all chats into the user's Exchange inbox for e-discovery/retention/legislative hold features in certain SKUs of Office 365, but they are not stored in the IPM Subtree portion of the user's mailbox which is where webhooks come from.
In other words, this won't work, and that's by design.
We will be supporting this capability via dedicated APIs for Teams in Microsoft Graph but we have not yet announced a timeframe.

A: I think you want /me/chats for Teams chat.
Or /user../chats


text:
Q: Int version of Id.CharAt() I'm trying to create a username which contains the last 2 digits of the person's birth year, but it says an int can't be dereferenced. What would be the int version of id.charAt()? This is a section of my code.
Scanner by = new Scanner (System.in);
System.out.println ("Please enter your birth year:");
int byear = by.nextInt();
if (byear >= 2008){
//the next 2 lines are what I'm having problems with:
    char yeara = byear.charAt(2);
    char yearb = byear.charAt(3);
//the 2 lines above ^^^
} else {
    System.out.println ("Sorry, you're too young to use this website");
}

A: The last two digits can be obtained with:
int lastTwo = byear % 100;

Of course, if you need them separately, some extra work is required:
int last = byear % 10;
int beforeLast = (byear/10) % 10;


text:
Q: Encoding UTF-8 when exporting HTML table to Excel I am trying to export an HTML table to Excel using javascript. This is the javascript code

This is my header
<meta http-equiv="content-type" content="application/vnd.ms-excel;" charset="UTF-8">
<meta charset="UTF-8">

This is my table

      José
      María

And this is the button which triggers the export
<input type="button" onclick="tableToExcel('tblExport', 'W3C Example Table')" value="Export to Excel">

I can't export the UTF-8 characters correctly, like é or í. I try this Importing HTML table into OO Calc as UTF8 without converting to entities but not works. I have MS-Excel 2010 and Win7 64 bits.
How can I do to export UTF-8 chars correctly?
Thanks!

A: First: Your header is malformed. It should be:
<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">

And second: It should be into your template, because it contains charset information for Excel.

A: You could prepend the content string with the UTF-8 BOM definition:
function ExportToExcel() {
    var BOM = "\uFEFF";
    var htmltabel = document.getElementById("tabella_finale");
    var html = htmltabel.outerHTML;
    window.open('data:application/vnd.ms-excel,'+ encodeURI(BOM + html));
}

A: function exportData(report_id){
    var blob = new Blob([document.getElementById(report_id).innerHTML], {
        type: "text/plain;charset=utf-8;"
    });
    saveAs(blob, "Report.xls");
}

Takes table data as plain text and save as Excel without encoding problem

A: if you want to change default file name according to @Axel Richter's answer, try this:
var link = document.createElement('a');
link.download = 'filename.xls';
...
link.href = uri + base64(format(template, ctx));
link.click();
...

replace window.location.href with link.href

A: I will cite again a respect that was indicated above. You need to include the meta tag code inside the head tag:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8" />

<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">

<title>Ver Listado Pago</title>
<link href="/Images/Decretos.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
<link href="/Content/site.css" rel="stylesheet" />
<link href="~/Content/booostrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/Content/booostrap/bootstrap-theme.css" rel="stylesheet" />
<link href="~/Content/booostrap/bootstrap-theme.min.css" rel="stylesheet" />

This has worked for me. But IE and WIN10 have some conflicts for download because of the xls extension.
However, the problem of special characters is corrected

A: after googling I found a solution edit file /tableExport/tableExport.js line 280
var base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) } // New base64

// var base64data = "base64," + $.base64.encode(excelFile); OLD LINE
var base64data = "base64," + base64(excelFile); // New line with new base64

that is all

A: Use the code below in the var uri:
var uri = 'data:application/vnd.ms-excel;charset=UTF-8;base64,'

Output


text:
Q: Show catched JSON object from PHP in android application I'm going to create a simple register form app that when user insert their username and password, EditText in UI shows the id of their record in database.
My app insert users into database correctly and show JSON output into EditText.
For Example when I insert first user to my database, EditText show this:
{
    "id": "1", "0":"1"
}

But, I want show this in EditText:
1 instead of
    {
        "id" : "1", "0" : "1"
    }
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00aeef"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<TextView
    android:id="@+id/textView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="50dp"
    android:layout_marginTop="18dp"
    android:text="Register Example"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="#ffffff" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/textView3"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="45dp"
    android:text="Username:"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="#ffffff" />

<EditText
    android:id="@+id/edt_username"
    android:layout_width="250dp"
    android:layout_height="40dp"
    android:layout_below="@+id/textView3"
    android:layout_centerHorizontal="true"
    android:background="#ffffff"
    android:ems="10"
    android:padding="5dp" >

    <requestFocus />
</EditText>

<Button
    android:id="@+id/btn_insert"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/edt_result"
    android:layout_below="@+id/edt_password"
    android:layout_marginTop="16dp"
    android:background="#ffffff"
    android:text="Insert"
    android:textColor="#00aeef" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignRight="@+id/textView1"
    android:layout_below="@+id/edt_username"
    android:text="Password:"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="#ffffff" />

<EditText
    android:id="@+id/edt_password"
    android:layout_width="250dp"
    android:layout_height="40dp"
    android:layout_alignLeft="@+id/edt_username"
    android:layout_below="@+id/textView2"
    android:background="#ffffff"
    android:ems="10"
    android:padding="5dp" />

<EditText
    android:id="@+id/edt_result"
    android:layout_width="match_parent"
    android:layout_height="40dp"
    android:layout_below="@+id/btn_insert"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="22dp"
    android:background="#ffffff"
    android:ems="10"
    android:padding="5dp" />

</RelativeLayout>

InsertClass.java
package com.example.testphp;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;

public class InsertClass extends AsyncTask<String, Void, String>{

private Context context;
private ProgressDialog pDialog;
private EditText edt;
private String json = "";
private JSONObject jObj = null;

public InsertClass(Context context, EditText edt)
{
    this.context = context;
    pDialog = new ProgressDialog(context);
    this.edt = edt;
}

@Override
protected void onPreExecute() {
    pDialog.setMessage("Loading... Please wait");
    pDialog.show();
    super.onPreExecute();
}

@Override
protected String doInBackground(String... arg0) {

    try
    {
    String username = (String)arg0[0];
    String password = (String)arg0[1];
    String link = "http://10.0.2.2:8020/test/test.php";
    String data = URLEncoder.encode("username","utf-8") +
    "=" + URLEncoder.encode(username,"utf-8");
    data += "&" + URLEncoder.encode("password","utf-8") +
            "=" + URLEncoder.encode(password,"utf-8");
    URL url = new URL(link);
    URLConnection conn = url.openConnection();
    conn.setDoOutput(true);
    OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
    wr.write(data);
    wr.flush();
    BufferedReader reader = new BufferedReader
            (new InputStreamReader(conn.getInputStream()));
    StringBuilder sb = new StringBuilder();
    String line = null;
    while((line = reader.readLine()) != null)
    {
        sb.append(line);
        break;
    }
    json = sb.toString();
    jObj = new JSONObject(json);

    return sb.toString();
    }
    catch(JSONExeption e)
    {
        return new String("Exeption: " + e.getMessage());
    }
    catch(Exception e)
    {
        return new String("Exeption: " + e.getMessage());
    }
}

@Override
protected void onPostExecute(String result) {
    pDialog.dismiss();
    super.onPostExecute(result);
    try
    {
       edt.setText(jObj.getString("id"));
    }
    catch (JSONExeption e)
    { e.printStackTrace(); }
}
}

MainActivity.java
package com.example.testphp;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity {

String username;
String password;
EditText edtUsername;
EditText edtPassword;
EditText edtResult;
Button btnInsert;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    btnInsert = (Button) findViewById(R.id.btn_insert);
    edtPassword = (EditText) findViewById(R.id.edt_password);
    edtUsername = (EditText) findViewById(R.id.edt_username);
    edtResult = (EditText) findViewById(R.id.edt_result);

    btnInsert.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {

            username = edtUsername.getText().toString();
            password = edtPassword.getText().toString();
            new InsertClass(MainActivity.this, edtResult).execute(username,password);

        }
    });

}

    @Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

}

test.PHP
<?php
$con = mysqli_connect("localhost" , "root" , "","test");
if(mysqli_connect_errno($con))
{
    echo "Failed to connect to MySQL: " . mysqli_connect_errno();
}
$username = $_POST['username'];
$password = $_POST['password'];

$result = mysqli_query($con,"INSERT INTO test (username,pass) VALUES '$username','$password')") or die(mysqli_query($con));

if($result)
{
    $id_result = mysqli_query($con,"SELECT id FROM test WHERE username = '$username'") or die(mysqli_query($con));

    if($id_result)
    {
        $id_result = mysqli_fetch_array($id_result);
        $response = array("id" => $id_result);
        echo json_encode($response);
    }
}
mysqli_close($con);
?>

Any suggestion, would be appreciated ...

A: Your response from PHP for user id=17 is {"id":{"0":"17","id":"17"}}
Try to change in php script
//$response = array("id" => $id_result);
$response["id"] = $id_result["id"];

then your rsponse will be {"id":"17"}

A: In your class InsertClass and function doInBackground() where you are converting result string to JsonObject like
json = sb.toString();
jObj = new JSONObject(json);

Add code:
String result = jObj.getString ("id");
Return result;


text:
Q: XSD Duration under .Net Core I am porting code from .Net Framework to .Net Core 2.1 and have issues with porting SoapDuration class under System.Runtime.Remoting.Metadata.W3cXsd2001.
I tried to replace the logic with System.Xml.XmlConvert but it returns not the same format of XSD duration.
.Net Framework 4.0:
SoapDuration.ToString(new TimeSpan(1, 0, 0));
// returns "P0Y0M0DT1H0M0S"

.Net Core 2.1:
XmlConvert.ToString(new TimeSpan(1, 0, 0));
// returns "PT1H"

I was thinking about writing a conversion method but it would need to behave exact the same as SoapDuration.ToString().

A: I ended up creating an own implementation of the function:
// calcuate carryover points by ISO 8601 : 1998 section 5.5.3.2.1 Alternate format
// algorithm not to exceed 12 months, 30 day
// note with this algorithm year has 360 days.
private static void CarryOver(int inDays, out int years, out int months, out int days)
{
    years = inDays / 360;
    int yearDays = years * 360;
    months = Math.Max(0, inDays - yearDays) / 30;
    int monthDays = months * 30;
    days = Math.Max(0, inDays - (yearDays + monthDays));
    days = inDays % 30;
}

public static string ToSoapString(this TimeSpan timeSpan)
{
    StringBuilder sb = new StringBuilder(20)
    {
        Length = 0
    };
    if (TimeSpan.Compare(timeSpan, TimeSpan.Zero) < 1)
    {
        sb.Append('-');
    }

    CarryOver(Math.Abs(timeSpan.Days), out int years, out int months, out int days);

    sb.Append('P');
    sb.Append(years);
    sb.Append('Y');
    sb.Append(months);
    sb.Append('M');
    sb.Append(days);
    sb.Append("DT");
    sb.Append(Math.Abs(timeSpan.Hours));
    sb.Append('H');
    sb.Append(Math.Abs(timeSpan.Minutes));
    sb.Append('M');
    sb.Append(Math.Abs(timeSpan.Seconds));
    long timea = Math.Abs(timeSpan.Ticks % TimeSpan.TicksPerDay);
    int t1 = (int)(timea % TimeSpan.TicksPerSecond);
    if (t1 != 0)
    {
        string t2 = t1.ToString("D7");
        sb.Append('.');
        sb.Append(t2);
    }
    sb.Append('S');
    return sb.ToString();
}


text:
Q: Opencv cant access camera connected through video capture device I have a analog camera connected to EasyCap video capture device. When I run a basic code which opens webcam video using OPENCV, I can access my in-built webcam but not the other analog camera.
How would you connect any other camera (FPV, IR, etc) to the PC such that OPENCV can access it.
Thanks.

A: i struggled with the same problem and hope it helps!
the original thread + ANSWER
also relevant XKCD
one more observation: from your description it looks like you already have a webcam running on the laptop (in-built webcam maybe?) you might want to disable it in system manager so as to guarantee that your analog camera cam_index is zero for certain. Otherwise if you leave the webcam enabled as a device, then your analog cam will most likely be incremented to cam_index=1 which amusingly enough seems to be confirmed by it crashing on cam_index=1.
Arguable not a great method to find your camera's index but there you have it!

A: You can set which camera to connect to open by changing the following deviceID to the desired device you want:
CvCapture* capture = cvCaptureFromCAM(deviceID);

or new API:
VideoCapture cap(deviceID);

Check out documenation for more info.

A: Use the deviceID of the analog camera instead of the in-built one.


text:
Q: Bootstrap 3 fancyfile breaks when used in tab-pane I'm using the Fancyfile jQuery plugin for Twitter Bootstrap 3.2 (http://plugins.upbootstrap.com/bootstrap-fancyfile/) to theme my file inputs to be more Bootstrap-like.
When use it on an input in a tab-pane which isn't the visible tab-pane on load, the input breaks; It gets narrow, the placeholder text disappears, and clicking on the right part of the input can trigger a form submit. What is the conflict and is there a way to fix this?
jsFiddle: http://jsfiddle.net/dbailey/bv2swf2t/1/

Description

Photos

Contributors

            <input type="file" class="fancyfile"></input>

            <input type="file" class="fancyfile"></input>

            <input type="file" class="fancyfile"></input>

A: I couldn't find the exact source of the conflict. Somehow, the width is being set to 11px on the second two tabs. The placeholder text is still there, you just can't see it because of the size of the box.
Here's an easy fix, though: just manually set the width of the input box with css. You have to put the !important flag so the script doesn't override it.
.fake-input {
    width: 188px !important; /* same as first one
}

fiddle: http://jsfiddle.net/bv2swf2t/2/
edit: After reading your comment and looking again, the reason the button doesn't work is that the actual button does nothing. The 'fancyfile' input is supposed to take up the width of the input and the button, which opens up the 'choose file' dialogue. For some reason, the width is getting set to 0px in tabs 2 and 3. Fix is similar to above:
.fancyfile {
    width: 280px !important; /* same as first one
}

This extends the input box over the button, and matches the functionality of the first box.
Hope this helps!


text:
Q: How to subclass a class defined with G_DECLARE_DERIVABLE_TYPE (glib/gobject) Some flutter code does this:
G_BEGIN_DECLS

G_DECLARE_DERIVABLE_TYPE(FlTextureGL, fl_texture_gl, FL, TEXTURE_GL, FlTexture)

  gboolean (*populate)(FlTextureGL* texture,
                       uint32_t* target,
                       uint32_t* name,
                       uint32_t* width,
                       uint32_t* height,
                       GError** error);
};

I have to subclass the FlTextureGL class and define the populate function.
How to subclass a class defined with G_DECLARE_DERIVABLE_TYPE? How to define the method populate?

A: You can follow the tutorial on how to subclass with GObject, but the short answer is that you need to use the G_DEFINE_TYPE family of macros in your own code.
To define the populate method, you set the value of the function pointer in your class_init function:
static void
my_type_class_init (MyTypeClass *klass)
{
  FlTextureGLClass *fl_texture_gl_class = FL_TEXTURE_GL_CLASS (klass);
  fl_texture_gl_class->populate = my_type_populate;

  /* ... */
}


text:
Q: In a car, what is the difference between a 12-V and a 24-V system? As I understood, 12-V car system refers to automotive system that runs with a 12-V battery. What are the basic differences between a 12-V and a 24-V (actuators, ECU...) ?

A: 24V is used on trucks as the starter needs enough power for the big diesels : approximately 1000A. If that was at 12V then it's double the current which means thicker cables.
The disadvantage was that the bulbs needed longer filaments for 24V and the vibration (road and engine) caused them to fail often, this was helped by supported filament bulbs so that they lasted longer, now LEDs have helped even more.

A: In the automotive industry every single cent saved could be worth millions to a company because of the large volumes. Higher voltages saves copper by reducing the cable area. But for a small car 12V is usually the standard. Trucks usually use 24V. Working for a company that makes ECUs* we make the main regulator cover the whole range if it's used for both cars and trucks. Sensor inputs/outputs, voltage protection etc, are usually handled by mount options on the PCB.
*
Electronic Control Module NOT Engine Control Module

A: No major difference it is only that 12 volts drew double current of 24 volts , means u sing less cable cross section diameter with 24 volts.


text:
Q: using automated code not executing correctly I am needing a code to buy when 10 ema crosses over the 20 and 50 and sell when the 10 crosses under the 20 and 50.
The issues im having is with this code;
  // Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated

// Conditions to enter long positions
indicator1 = ExponentialAverage[10](close)
indicator2 = ExponentialAverage[20](close)
c1 = (indicator1 CROSSES OVER indicator2 and  )
  indicator3 = ExponentialAverage[10](close)
indicator4 = ExponentialAverage[50](close)
c2 = (indicator3 CROSSES OVER indicator4)

IF c1 and c2 THEN
BUY 10 CONTRACT AT MARKET
ENDIF

// Conditions to exit long positions
indicator5 = ExponentialAverage[10](close)
indicator6 = ExponentialAverage[20](close)
c3 = (indicator5 CROSSES UNDER indicator6)
indicator7 = ExponentialAverage[10](close)
indicator8 = ExponentialAverage[50](close)
c4 = (indicator7 CROSSES UNDER indicator8)

IF c3 AND c4 THEN
SELL AT MARKET
ENDIF

It is only buying when the 10 20 50 cross exactly at the same time. I do not want that, what i need is it to buy when it crosses both not necessarily at the same time. and the selling side the opposite.
Thank you


text:
Q: How to remove Microsoft.NETCore.App 6.0.0-rc.2.21480.5 I am trying to remove the preview versions of dot net 6.
if I run dotnet --info i see
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22000
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100\

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-rc.2.21480.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0-rc.2.21501.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

When I run dotnet-core-uninstall.exe list I see
This tool cannot uninstall versions of the runtime or SDK that are
    - SDKs installed using Visual Studio 2019 Update 3 or later.
    - SDKs and runtimes installed via zip/scripts.
    - Runtimes installed with SDKs (these should be removed by removing that SDK).
The versions that can be uninstalled with this tool are:

.NET Core SDKs:
  6.0.100  x64    [Used by Visual Studio. Specify individually or use —-force to remove]

.NET Core Runtimes:

ASP.NET Core Runtimes:

.NET Core Runtime & Hosting Bundles:

It does not show the preview versions, so how do I remove them?

A: I removed the folder directly from C:\Program Files\dotnet\shared\ which sems to do the trick


text:
Q: Why do we have to add a "clr" (clean input wire) while forming a T flip-flop in Verilog with Vivado? I am trying to form a T flip-flop in Verilog. I am studying verilog from "Digital System Design with FPGA: Implementation using verilog and vhdl" and the code for T flip-flop is here below:
module t_flip_flop(t,clk,clr,q,qn);

input t,clk,clr;
output reg q,qn;

always @(posedge clk or negedge clr)
begin
if(clr==0)
q<=0;qn<=1;
else
q<=q^t;
qn<=~(q^t);
end

I understand the xor part that we use this because of the toggle operation. I tried to form it without using "clr", but it didn't work. (I am using "clr" as clear input which is for resetting the flip-flop). Can't I do it without using "clr"?
I tried to change code like this below:
module t_flip_flop(t,clk,q,qn);

input t,clk;
output reg q,qn;

always @(posedge clk)
if(t)
begin
q<=q^t;
qn<=~(q^t);
end

But in the simulation, I get "x" for both q and qn in Vivado. I was expecting to get the same results as the code with "clr".

A: The clr signal is used to properly initialize q and qn.
You declared q as a reg type.  In Verilog simulations, reg is initialized to x (the "unknown" value).
Consider your code without clr.  At time 0, q=x.  Let's say the posedge of clk is at 10ns and t=1 at that time.  The assignment:
q<=q^t;

is evaluated like:
q <= x ^ 1;

Verilog evaluates x ^ 1 as x.  Since x could be 0 or 1, we don't know if the expression is 1^1 or 0^1,  which means that we don't know what the result of the expression should be.  This means that q will remain x for the rest of the simulation.  There will be no way to change its value.
Using the clr signal fixes that problem.  Typically, at the start of simulation (time=0), you would set clr=0 so that q is assigned a known value (0).  That prevents the x.
Even if you didn't start with clr=0, as soon as you do set clr=0 at a later time, that will resolve the x.
All of this applies to the qn signal as well.


text:
Q: Cross-browser CSS for left align and right align on the same line Cross-browser CSS that works to allow both left and right align of text on the same line?
Example (where each text quote should be aligned as far left or right as possible, respectively):
stuff on the right                                              stuff on the left

*

*No float's answer's please.. unless there is a way to make the text not break out of the parent div/container in a multicolumn css page...

A: With container tags:

stuff on the left

Tstuff on the right

With inline tags:

  stuff on the left
  Tstuff on the right

A: float:left for the one on the left, and float:right for the one on the right. Or absolute/relative positioning. Pretty sure both work across the main browers.

A: Let's assume this is the HTML code:

stuff on the left

Tstuff on the right

What you can do is use JQuery to find the highest div, then set the #left, #right divs with the highest div.
Here's a sample code:
if ($('#left').height()<$('#right').height()) {
  $('#left').height($('#right').height());
} else {
  $('#right').height($('#left').height());
}

Or you can Google with "equal heights jquery" for other solutions.

A: Without floats:

    Stuff on the left

    Stuff on the right


text:
Q: Pandoc converter : standalone : convert to PDF I want to know how to use Pandoc in standalone command line manner, to convert existing Excel reports in .xlsx format to PDF.
Hard to find examples on this.
And wondering if it has API interface with Python, to be able to embed this in Python.


text:
Q: Pause a SourceDataLine playback I want to play back WAV sound (audio track of some custom video format) in Java, however, I have trouble using Clip for that: it seems only one instance is hearable at a time. Therefore, I switchet to the plain old SourceDataLine way.
In this context, I want to pause and resume the audio as the video is paused and unpaused. Unfortunately. When I call stop() on the SDL, the playback thread finishes entirely and the sound buffer is emptied:
sdl.open();
sdl.start();
sdl.write(dataBuffer);
sdl.drain();
sdl.stop();

Issuing an asynchronous stop() while the audio thread is blocking on write() or drain() will practically loose the playback position.
How can I pause with SourceDataLine in a blocking way, and/or how can I know how many audio has been played through it to do a resume using write(databuffer, skip, len)?

A: The intended way is to call stop() on the SourceDataLine to pause it and start() to resume it. If you stop feeding the SourceDataLine with audio data when it's started, it will cause a buffer underrun which is generally regarded as an error condition. Only stop feeding data when it's in stopped state.
drain() should be called at the end when want to ensure that all data is played out that you've written into the SourceDataLine. Don't call it for "pause" functionality!
It is correct that you should write small buffers to the Source Data Line for better control. A good size is the equivalent of 50ms buffers -- use the open(AudioFormat, bufferSize) method to specify the buffer size in bytes (e.g. 8820 bytes for 44100Hz, 16-bit stereo).
Also I'd say that using a Clip is the preferred solution. Use start() and stop() on Clip and it should not swallow much. Most Java Sound implementations use a SourceDataLine internally for the Clip, so there should be no functional difference. Java Sound should make sure that you can play multiple Clip's at once.


text:
Q: Capture multiple jobs output with pgm=sdsf I've built a job to retrieve information from spool executions (with the utility PGM=SDSF), but I can only seem to do that for one job at a time, by doing:
//SDSFS1   EXEC PGM=SDSF
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//ISFOUT DD SYSOUT=*
//ISFIN DD *
OWNER
PREFIX JOBXPTO
ST
FILTER MAX-RC EQ 'CC 0000'
FIND 'JOBXPTO'
++?
RESET
FILTER PROCSTEP EQ 'FTPCMD'
FIND 'OUTPUT'
++S
RESET
PRT ODSN 'WRKPX.SDSFS1' * SHR
PRT
PRT CLOSE
END

I can only get one ddname for one job at a time, what if I want to retrieve multiple DDNAMES from one job execution or
if I want tghe same DDNAME for multiple jobs in spool (cyclic jobs or just all jobs that have a FTPCMD)?
Thank you!

A: I think you're stretching past the limits of what can be reasonably done with SDSF commands in batch.  You need to loop through a variable number of jobs and neither JCL nor SDSF commands provide for that.
Please take a look at the Rexx interface for SDSF.


text:
Q: How to remove the top rows of an Excel Spreadsheet on Import to a SQL Server Database Hello Stack Overflow community. I'm writing a small application in C# that can import an excel file directly into a SQL Database.  I can import files with the current headers that are in the Excel File as they match the column names (See 2nd Image link below) in my Database, however I am looking to add some flexibility to the excel files that I can Import.  Ex: Some of the excel files i need to import have a legend at the top, and this legend does not match the column headers in my database (See 1st image link)
In this Image you can see the portion of the excel sheet I want to remove with code
The Files that do not contain that Legend at the top are easily imported
Without the legend this is where the import can occur at line row 10 in the excel file
I'm looking for a way to remove the top 9 rows (The legend at the top of the file) on import.
Here is all the source code. Any help would be greatly appreciated.
using ExcelDataReader;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ProviderBreakfastExcelReader
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

      private void BtnOpen_Click(object sender, EventArgs e)
    {
        using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "Excel Workbook|*.xlsx", ValidateNames = true })
        {
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var ExcelData = ExcelFileRead(ofd.FileName);
                cboSheet.Items.Clear();
                foreach (DataTable dt in ExcelData.Tables)
                {
                    cboSheet.Items.Add(dt.TableName);
                }
            }
        }
    }
    private void CboSheet_SelectedIndexChanged(object sender, EventArgs e)
    {
        string path = @"C:\Desktop\Dir\filename.xlsx";
        FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read);
        IExcelDataReader reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
        DataSet result = reader.AsDataSet();
        dataGridView.DataSource = result.Tables[cboSheet.SelectedIndex];
    }

    private DataSet ExcelFileRead(string path)
    {
        using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Read))
        using (IExcelDataReader reader = ExcelReaderFactory.CreateOpenXmlReader(fs))
        {
            var result = reader.AsDataSet(new ExcelDataSetConfiguration()
            {
                UseColumnDataType = true,
                ConfigureDataTable = (_) => new ExcelDataTableConfiguration()
                {
                    EmptyColumnNamePrefix = "Column",
                    UseHeaderRow = true,
                }

            });
            return result;
        }
    }
   private void SendExcelToDatabase(string Filename)
    {
        var data = ExcelFileRead(Filename);
        using (var db = new ProviderBreakfastDBEntities())
        {
            foreach (DataRow record in data.Tables[0].Rows)
            {
                int rank;
                var isValidRank = int.TryParse(record["Ranking"].ToString(), out rank);
                db.ProviderBreakfastExcels.Add(new ProviderBreakfastExcel
                {
                    Ranking = isValidRank ? rank : new int?(),
                    Contact = record["Contact"].ToString(),
                    LastName = record["LastName"].ToString(),
                    FirstName = record["FirstName"].ToString(),
                    // Bedsize = isValidBedsize ? beds : new int?(),
                    Bedsize = Convert.ToInt32(record["Bedsize"].ToString()),
                    City = record["City"].ToString(),
                    Company = record["Company"].ToString(),
                    JobTitle = record["JobTitle"].ToString(),
                    State = record["State"].ToString()
                });
            }
            db.SaveChanges();
        }
    }

    private void import_Click(object sender, EventArgs e)
    {
        OpenFileDialog ofd2 = new OpenFileDialog();
        if (ofd2.ShowDialog() == DialogResult.OK)
        {
            string stringFileName = ofd2.FileName;
            textBox1.Text = stringFileName;
            SendExcelToDatabase(stringFileName);
        }
    }
}

}

A: static void GetDataTableFromCsv(string path, bool isFirstRowHeader)
    {
        string header = isFirstRowHeader ? "Yes" : "No";
        string pathOnly = Path.GetDirectoryName(path);
        string fileName = Path.GetFileName(path);
        string sql = @"SELECT [ColumnNamesFromExcelSpreadSheet] FROM [" + fileName + "]";
        using (OleDbConnection connection = new OleDbConnection(
                  @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pathOnly +
                  ";Extended Properties=\"Text;HDR=" + header + "\""))
        using (OleDbCommand command = new OleDbCommand(sql, connection))
        using (OleDbDataAdapter adapter = new OleDbDataAdapter(command))
        {
            DataTable dt = new DataTable();
            dt = CultureInfo.CurrentCulture

            adapter.Fill(dt);
            StringBuilder sb = new StringBuilder();
            foreach (DataRow dataRow in dt)
            {
                foreach (var item in dataRow.ItemArray)
                {
                    sb.Append(item);
                    sb.Append(',');
                }
            }
        }
    }

This is a great little function for moving an excel spreadsheet into a datatable you can then insert the datatable into your sql db. Only thing you need to change is removing x amount of rows.
EDIT:
private void SendExcelToDatabase(string Filename)
{
    int rowThread = HowManyRowsYouWouldLikeToSkipInExcel;
    var data = ExcelFileRead(Filename);
    using (var db = new ProviderBreakfastDBEntities())
    {
        foreach (DataRow record in data.Tables[0].Rows)
        {
            if (!(rowThreshold >= x))
            {

            int rank;
            var isValidRank = int.TryParse(record["Ranking"].ToString(), out rank);
            db.ProviderBreakfastExcels.Add(new ProviderBreakfastExcel
            {
                Ranking = isValidRank ? rank : new int?(),
                Contact = record["Contact"].ToString(),
                LastName = record["LastName"].ToString(),
                FirstName = record["FirstName"].ToString(),
                // Bedsize = isValidBedsize ? beds : new int?(),
                Bedsize = Convert.ToInt32(record["Bedsize"].ToString()),
                City = record["City"].ToString(),
                Company = record["Company"].ToString(),
                JobTitle = record["JobTitle"].ToString(),
                State = record["State"].ToString()
            });
        }
      }
        db.SaveChanges();
x++
        }
    }

See if something like this works.


text:
Q: couchDB sort result array by date if date is stored in an array of integers? I'm storing couchDB docs and they have an attribute date which I want to sort by.
{

  ...blahblah...

  "date": [
    2015,
    5,
    16
  ]
}

I can't seem to figure out how to make a view that allows me to supply a startdate=[2015,5,1]&enddate=[2015,5,31] query. I want to get the stuff for May (month 5)

A: It should be as simple as:
function (doc) {
  emit(doc.date);
}

Then your query needs to be: start_key=[2015,5,1]&end_key=[2015,5,31]
Check out the documentation

A: As an alternative, If the date field specified documents are created in order (that is doc with field date = "2015, 4, 16" was created before the doc with field date = "2015, 4, 20). In that scenario, you can also sort using the timestamp when the document was created.
function(doc) {

emit([doc.created_at,doc.date], doc);
}

http://wiki.apache.org/couchdb/View_collation


text:
Q: What could cause out_of_memory & __alloc_pages Sadly my server is permanently hangging due to out of memory:
Nov  8 07:30:43 crawler kernel:
Nov  8 07:30:43 crawler kernel: Call Trace:
Nov  8 07:30:43 crawler kernel:  [<ffffffff800cb625>] out_of_memory+0x8e/0x2f3
Nov  8 07:30:43 crawler kernel:  [<ffffffff8000f691>] __alloc_pages+0x27f/0x308
Nov  8 07:30:43 crawler kernel:  [<ffffffff80013074>] __do_page_cache_readahead+0x96/0x17b
Nov  8 07:30:43 crawler kernel:  [<ffffffff800139b5>] filemap_nopage+0x14c/0x360
Nov  8 07:30:43 crawler kernel:  [<ffffffff80008972>] __handle_mm_fault+0x1fd/0x103b
Nov  8 07:30:43 crawler kernel:  [<ffffffff8003ddfb>] lock_timer_base+0x1b/0x3c
Nov  8 07:30:43 crawler kernel:  [<ffffffff800671ae>] do_page_fault+0x499/0x842
Nov  8 07:30:43 crawler kernel:  [<ffffffff800638a7>] schedule_timeout+0x92/0xad
Nov  8 07:30:43 crawler kernel:  [<ffffffff8009aa88>] process_timeout+0x0/0x5
Nov  8 07:30:43 crawler kernel:  [<ffffffff800ff108>] sys_epoll_wait+0x42f/0x475
Nov  8 07:30:46 crawler kernel:  [<ffffffff8008f4a9>] default_wake_function+0x0/0xe
Nov  8 07:30:46 crawler kernel:  [<ffffffff8005ddf9>] error_exit+0x0/0x84
Nov  8 07:30:46 crawler kernel:
Nov  8 07:30:46 crawler kernel: Mem-info:
Nov  8 07:30:47 crawler kernel: Node 0 DMA per-cpu:
Nov  8 07:30:47 crawler kernel: cpu 0 hot: high 0, batch 1 used:0
Nov  8 07:30:47 crawler kernel: cpu 0 cold: high 0, batch 1 used:0
Nov  8 07:30:47 crawler kernel: cpu 1 hot: high 0, batch 1 used:0
Nov  8 07:30:47 crawler kernel: cpu 1 cold: high 0, batch 1 used:0
Nov  8 07:30:47 crawler kernel: Node 0 DMA32 per-cpu:
Nov  8 07:30:47 crawler kernel: cpu 0 hot: high 186, batch 31 used:27
Nov  8 07:30:47 crawler kernel: cpu 0 cold: high 62, batch 15 used:58
Nov  8 07:30:47 crawler kernel: cpu 1 hot: high 186, batch 31 used:62
Nov  8 07:30:47 crawler kernel: cpu 1 cold: high 62, batch 15 used:40
Nov  8 07:30:47 crawler kernel: Node 0 Normal per-cpu:
Nov  8 07:30:47 crawler kernel: cpu 0 hot: high 186, batch 31 used:124
Nov  8 07:30:48 crawler kernel: cpu 0 cold: high 62, batch 15 used:47
Nov  8 07:30:48 crawler kernel: cpu 1 hot: high 186, batch 31 used:32
Nov  8 07:30:48 crawler kernel: cpu 1 cold: high 62, batch 15 used:59
Nov  8 07:30:48 crawler kernel: Node 0 HighMem per-cpu: empty
Nov  8 07:30:48 crawler kernel: Free pages:       19904kB (0kB HighMem)
Nov  8 07:30:48 crawler kernel: Active:539752 inactive:442402 dirty:0 writeback:0 unstable:0 free:4976 slab:4557 mapped-file:1157 mapped-anon:981453 pagetables:14118
Nov  8 07:30:48 crawler kernel: Node 0 DMA free:10072kB min:16kB low:20kB high:24kB active:0kB inactive:0kB present:9676kB pages_scanned:0 all_unreclaimable? yes
Nov  8 07:30:48 crawler kernel: lowmem_reserve[]: 0 3511 4016 4016

http://pastebin.com/tySD9g5W

A: This occurs when your system memory is completely exhausted. System can no longer allocate space for any new variables as your physical memory and swap has been completely used up. The main reason for this is improper memory management in applications.


text:
Q: Trying to wrap up a keras model in a flask REST app but getting a ValueError I can create a simple keras model by running
python create-flask-model.py

create-flask-model.py
##points in square that are in or out of a quarter circle
import random
import math
import numpy as np
from keras.models import Sequential
from keras.layers import Dense

training_size = 8000
testing_size = 2000
batch_size = 10
epoch_no = 30
modelStructureFileName = 'simple-flask.json'
modelWeightFileName = 'simple-flask.h5'

def get_model():
    model = Sequential()
    model.add(Dense(4, input_dim=2, activation='tanh'))
    model.add(Dense(4, activation='tanh'))
    model.add(Dense(1, activation='sigmoid'))
    model.compile(loss='binary_crossentropy',optimizer='rmsprop')
    return model

def get_data_instances(size):
    result = []
    for i in range(0, size):
        number_1 = random.uniform(0,1)
        number_2 = random.uniform(0,1)
        squares = math.pow(number_1,2) + math.pow(number_2,2)
        target = 0
        if squares < 0.49:
            target = 1
        line = number_1,number_2,target
        result.append(line)
    return np.array(result)

##create data and split in to training and test, features and targets
data_instances = get_data_instances(training_size+testing_size)
train_x, train_y = data_instances[:training_size,0:2], data_instances[:training_size,-1]
test_x, test_y = data_instances[training_size:,0:2], data_instances[training_size:,-1]

##load model and train
model = get_model()
history = model.fit(train_x, train_y, batch_size=batch_size, epochs=epoch_no, validation_data=(test_x, test_y))

##save the model
model_json = model.to_json()
with open(modelStructureFileName, 'w') as json_file:
    json_file.write(model_json)
model.save_weights(modelWeightFileName)

##how to get prediction for an instance
#instance = np.array([0.3, 0.6])
#instance = instance.reshape(1,2)
#yhat = model.predict(instance)
#print(yhat)

I wish to load the resulting model in to a flask app and be able to pass instances as json objects and have predictions made and returned. Running
python flask-app.py

in the same directory as the model json and h5 files.
flask-app.py
import json
import numpy as np
from flask import Flask
from keras.models import model_from_yaml

app = Flask(__name__)
model = None
modelStructureFileName = 'simple-flask.json'
modelWeightFileName = 'simple-flask.h5'

def load_model():
    yaml_file = open(modelStructureFileName, 'r')
    loaded_model_yaml = yaml_file.read()
    yaml_file.close()
    global model
    model = model_from_yaml(loaded_model_yaml)
    model.load_weights(modelWeightFileName)

@app.route('/flask/<input>', methods=['GET'])
def predict(input):
    input_array = json.loads(input)
    instance = np.array(input_array)
    instance = instance.reshape(1,2)
    yhat = model.predict(instance)
    return str(yhat)

if __name__ == '__main__':
    load_model()
    app.run(port = 9000, debug = True)

If I navigate to http://localhost:9000/flask/[0.3,0.6] I get an error
builtins.ValueError
ValueError: Tensor Tensor("dense_3/Sigmoid:0", shape=(?, 1), dtype=float32) is not an element of this graph.

I think it's something to do with the scope of the model in the app, but can't figure it out. If I load the model in the request method it works once, but then fails with another error. I only want to load the model once. How can I get the flask app to work as expected?
EDIT: I ended up using bottle instead of flask and it worked no problem.
bottle-app.py
from bottle import route, run
import json
import numpy as np
from keras.models import model_from_yaml

modelStructureFileName = 'simple-flask.json'
modelWeightFileName = 'simple-flask.h5'

yaml_file = open(modelStructureFileName, 'r')
loaded_model_yaml = yaml_file.read()
yaml_file.close()
model = model_from_yaml(loaded_model_yaml)
model.load_weights(modelWeightFileName)
print('model loaded')

@route('/bottle/<input>')
def predict(input):
    input_array = json.loads(input)
    instance = np.array(input_array)
    instance = instance.reshape(1,2)
    yhat = model.predict(instance)
    print(input_array, yhat)
    return str(yhat[0][0])

run(host='localhost', port=9000, debug=True)

A: This happens because, you have multiple threads enabled in flask by default. Tensorflow models are not working well with multiple threads. You can read more about this in the below links

*

*https://github.com/keras-team/keras/issues/5640

*https://github.com/tensorflow/tensorflow/issues/14356
The following workaround worked for me
global graph
graph = tf.get_default_graph()

with graph.as_default():
   model.compile()
   model.fit()

with graph.as_default():
   model.predict()

A: This answer is with respect to flask API.
The problem is Flask API works only once and then after it gives errors. So, in that case, you should write K.clear_session() at the end of the API before the return statement.
And do not forget to write from keras import backend as K line at the top.


text:
Q: How to Install a Certificate With Arc Welder Trying to launch my app with Arc.  My app requires a certain certificate to be installed on the device.  Typically I do this through Android settings.  How do I install the certificate in Arc?
Thanks

A: Didn't seem possible, so ultimately I added the certificate as a raw resource and then using the following article, I loaded the certificate through code:
http://littlesvr.ca/grumble/2014/07/21/android-programming-connect-to-an-https-server-with-self-signed-certificate/
All worked well and can now run the app through ARC with use of the cert.
In case the article goes down in the future, here is the relevant code, with any minor modifications to support:
protected SSLSocketFactory getCertificateSocketFactory() throws Exception {

    InputStream certStrm = context.getResources().openRawResource(R.raw.cert_file)

    CertificateFactory cf = CertificateFactory.getInstance("X.509");
    Certificate ca = cf.generateCertificate(certStrm);

    String keyStoreType = KeyStore.getDefaultType();
    KeyStore keyStore = KeyStore.getInstance(keyStoreType);
    keyStore.load(null, null);
    keyStore.setCertificateEntry("ca", ca);

    String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
    TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmfAlgorithm);
    tmf.init(keyStore);

    SSLContext sslContext = SSLContext.getInstance("TLS");
    sslContext.init(null, tmf.getTrustManagers(), null);

    return sslContext.getSocketFactory();

}


text:
Q: How to get json object in android? I am developing an app in which i want to fetch some data which is in json format but i don't know how to fetch. Please guide me.
Json data:-
{
    "title":"title",
        "description":"description",
        "icon":{
    "url":"<image-url>",
            "aspectRatio":1,
            "height":75,
            "width":75
},
    "screenshots":{
    "url":"<image-url>",
            "aspectRatio":1.91,
            "height":627,
            "width":1200
},
    "landingURL":"LandingUrl",
        "cta":"cta",
        "rating":"rating"
}

A: Put your response in Jsonobject.
 JSONObject jsonObject = new JSONObject(response);

and parse your json.

A: JSONObject jsonObject = new JSONObject(data);
String title = jsonObject.getString("title");
String description = jsonObject.getString("description");
JSONObject iconObject = jsonObject.JSONObject("icon");

This is how you can parse your json data. but it is even better to use Gson.

A: Checkout the following code:
try {
     JSONObject jsonObject = new JSONObject(response);
     String title = jsonObject.getString("title");
     String description = jsonObject.getString("description");
     JSONObject jObj = new JSONObject("icon");
         if(jObj.has("url")) {
            String url = jObj.getString("url");
            int aspectRatio = jObj.getInt("aspectRatio");
            int height = jObj.getInt("height");
            int width = jObj.getInt("width");
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }


text:
Q: Inverse map measurable We said that a function $f:X \rightarrow \mathbb{R}$ is measurable iff we have that for all $I_a:=(a,\infty)$, $a \in \mathbb{R}$ $f^{-1}(a,\infty)$ is measurable.
Now I want to show that $\frac{1}{f}$ is also measurable, if $f$ was measurable.
Therefore I look at exactly those open intervals.
(i)If $a>0$ we have that  $(\frac{1}{f})^{-1}(a,\infty) = f^{-1}(0,\frac{1}{a})$ which is measurable.
(ii)If $a = 0$ we have that $(\frac{1}{f})^{-1}(0,\infty) = f^{-1}(0,\infty)$ which is measurable.
(iii)But what happens for $a <0$ then we have that $(\frac{1}{f})^{-1}(a,\infty) =(\frac{1}{f})^{-1}(a,0] \cup (\frac{1}{f})^{-1}(0,\infty)$
The last one is known from the second case (ii), but what happens with the first one? I mean, you cannot have  0 as an actual result. $(\frac{1}{f})^{-1}(a,0)$ would be just $f^{-1}(-\infty,\frac{1}{a})$. But what does this 0 and are my calculations correct so far?


text:
Q: How is the scalar $keys getting value 1 instead of undef? Folks,
As far as my understanding goes, exists function would check for existence of a key in a hash. So for the below mentioned situation, key1 or key2 have not been defined. Going by that the hash reference $var has no keys.
In which case upon calling keys(%{$var})  should return undef.
HOWEVER, its returning 1. How..what am I missing here ?
my $var;
if (exists $var->{key1}->{key2}) {
    $var->{key1}->{key2} = 1;
}

my $keys = keys(%{$var});

print $keys;   #prints 1 to output console

A: The fact that you're checking $var->{key1}->{key2} creates $var->{key1} as empty hashref. This can be seen by doing:
use Data::Dumper;
my $var = {};
if (exists $var->{key1}->{key2}) {
    print "cannot happen\n"
}
print Dumper($var);

Which prints:
$VAR1 = {
          'key1' => {}
        };

So, the scalar of keys is 1, because there is one key.

A: This is autovivification. Note that you can disable autovivification for your whole script, or for a particular lexical scope, by using the no autovification; pragma.


text:
Q: Jenkins on Windows returns unsupported JVM error when Java is updated to OpenJDK 11 I have been testing updating Oracle Java 8 to Red Hat OpenJDK Java 11 on a Windows Jenkins server, but I seem to have hit a wall. My Jenkins instance is stating that Java 11 is unsupported, returning the following error after I updated the JENKINS_HOME JRE files:
"We detected that your JVM is not supported by Jenkins. This is due to the limitation is one of the libraries that Jenkins uses, namely XStream. See this FAQ for more details."

Steps I've taken:
1. Stopped and disabled Jenkins service
2. Uninstalled Oracle Java 8 191 from control panel and removed remaining program files at Java\jdk1.8.0_191
3. Installed Red Hat OpenJDK 11.0.4 msi to Java\jdk11.0.4
4. Updated JAVA_HOME and PATH variables to point to new Java locations
5. Created JRE 11 from the JDK 11 files using all modules in JDK. Specifically I utilized this site for assistance creating the JRE. Placed JRE files on the server in the standard location, Java\jre11.0.4
5. Set Jenkins service to automatic and started it. Confirmed Jenkins site was working properly, then stopped and disabled service again
6. After backing up JENKINS_HOME, replaced the JRE folder there with the jre11.0.4 folder I created from the JDK 11 files.
7. Started Jenkins service. After navigating to the Jenkins site, I received the error message about the JVM being unsupported.
8. Stopped/disabled the Jenkins service, then updated the Jenkins.war to Jenkins 2.194 weekly release. (I was previously running Jenkins LTS 2.176.3.) Started Jenkins service, only to receive the same error.
I'm not sure how to proceed, the "Upgrading Jenkins Java version from 8 to 11" Jenkins documentation isn't much help at this point. The last step in the Upgrading Jenkins section says to "Use a package manager to install the new JVM" and to "Make sure the default JVM is the newly installed version. If it is not, use the correct java command in the Jenkins startup scripts". These instructions appear to be specific to Jenkins instances running on Linux OS. If they are for all OS types, I am unsure how to follow them in a Windows environment.
I've also reviewed Jenkins' documentation for Running Jenkins on Java 11, but didn't find any useful information there either.
And finally the FAQ hyperlink in the error message does not work, and the only information provided by this similarly named XStream site is a note stating XStream requires Java 8, which is in direct conflict with Jenkins' Java documentation that says Jenkins supports Java 8 and 11.
Any suggestions for getting any version of Jenkins to run with OpenJDK 11 or what my next steps should be here would be greatly appreciated.
Software and versions:
- Windows Server 2016
- Jenkins LTS 2.176.3
- Jenkins weekly release 2.194
- Oracle Java JDK and JRE 1.8.0.191
- Red Hat OpenJDK 1.11.0.4 and JRE created from all modules in the JDK files

A: So it seems I missed the following instructions in the Jenkins.xml file:

If you'd like to run Jenkins with a specific version of Java, specify
  a full path to java.exe.

Another member of my team saw this and added a JAVA11_HOME environment to the Jenkins.xml file:
<env name="JAVA11_HOME" value="D:\Java\jdk11.0.4"/>

And then updated the executable path in the Jenkins.xml:
From the default:
<executable>%BASE%\jre\bin\java</executable>

To:
<executable>%JAVA11_HOME%\bin\java</executable>

Jenkins is finally up and running on Java 11!


text:
Q: JQueryUI Datepicker in my asp.net mvc View I have this code in my view.
 $("#Effective Date").datepicker({
                showOn: "button",
                buttonText: "..."
            });

I am able to see the the date and I can select the date. But when I open the datepicker Iam not seeing the Arrows on the popup box. << <  March 2012 > >>
can anybody please help me out

A: Make sure you also have the CSS and images from the jQuery you downloaded.

A: These 'arrows' are backround image. Check the css.

A: It must be something to do with the CSS you're using.
Here is a jsFiddle.
http://jsfiddle.net/C9rCT/
It uses jQuery 1.7, jQuery UI and links to the jQuery UI CSS file from Google (http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css)


text:
Q: cant make marquee in recyclerview I'm trying to use marquee effect on the listitems of a recyclerview but it does not work even though i type holder.view.setSelected(true); and    android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"

in the xml file.

A: This works
<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:textSize="20dp"
        android:ellipsize="marquee"
        android:fadingEdge="horizontal"
        android:marqueeRepeatLimit="marquee_forever"
        android:scrollHorizontally="true"
        android:text="Im trying to use marquee effect on the listitems of a recyclerview but it does not work even though" />

A: Gradle
compile 'com.android.support:recyclerview-v7:24.2.0'
Create adapter for RecyclerView
Create adapter for RecyclerView. If you don't know how to create an adapter, please follow the link.
Make horizontal scroll
For RecyclerView, we have to use LayoutManager. There is a method, which is stated below.

*

*LinearLayoutManager linearLayoutManager = new LinearLayoutManager(MainActivity.this);

*linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
Use this in RecyclerView, stated below.

*yourRecyclerView.setLayoutManager(linearLayoutManager );
Your RecyclerView will be scrolled horizontally.
Creating auto scroll for RecyclerView
I want to make a list, which will auto scroll like a news feed. Hence, I use a thread auto scroll. There is a method in RecyclerView, which is smoothScrollToPosition(), as it takes the position for the scroll's present position to the desired position. The counter is incremented when all the items are incremented and counter is started from the beginning.

*Here, I use a thread, which will perform autoscroll for the items of RecyclerView. There is a method in RecyclerView, which is smoothScrollToPosition(), which takes the position of recyclerview to scroll the position to current position. Hence, I use a thread to increment the position automatically, so an autoscroll is happening because the position is incremented automatically. When all the incremented positions are equal to the total item size, start from the beginning. In this way, an autoscroll effect has happened.
Here, the code is mentioned below.

 public void autoScroll()
 {
    final int speedScroll = 0;
    final Handler handler = new Handler();
    final Runnable = new Runnable()
  {
    int count =0;
    @Override
    public void run()
    {
      if(count== scrollStockAdapter.getItemCount())
      count =0;
      if(count<scrollStockAdater.getItemCount())
      {
        rec_scroll_stock.smoothScrollPosition(++count);
      }
    }
  };
  handler.postDelayed(ruunable,speedScroll);
}

     LinearLayoutManager layoutmanager = new LinearLayoutManager(MainActivity.this)
    { @Override
     public void smoothScrollToPosition(RecyclerView    recyclerview, RecycleView.State state, int position)
     {LinearSmoothScroller smoothscroller = new  LinearSmoothScroller(MainActivity.this)
       {private static final float SPEED = 4000f; //default 25f
         @Override
           protected float calculatedSpeedPerPixel(DisplayMetrics  displaymetrics)
            {
              return SPEED/displaymetrics.densityDpi;
            }
       };
        smoothScroller.setTargetPosition(position);
        startSmoothScroller(smoothScroller);
        }
      }

<android.support.v7.widget.RecyclerView>
android : id="@+id/rec_all_stocks"
android : layout_width="match_parent"
android : layout_height="match_parent"
android: scrollbars="vertical"
android : layout_alignParentLeft="true"
android : layout_alignParentStart = "true"
</android.support.v7.widget.RecyclerView>

Create Smooth scroll automatically
Now, the main problem is auto scroll speed, which is too fast. For RecyclerView, we have to declare a LayoutManager. In LayoutManager, there is a method, which is smoothScrollToPosition(), which is responsible for smooth scrolling. For scrolling, there is a velocity, where the default speed is 25f. To change this velocity, you have to override this method. If you want a smooth scroll, increase this value as you want. In my case, I use 4000f.


text:
Q: Python - Nash Equilibrium computation - Error in lrs_nash.py I am trying to solve a 2x2 normal form game using the lrs_nash.py library by executing
import lrs_nash
row_matrix = [[-10, -20 ], [-100, -40]]
col_matrix = [[10, 20], [100, 40]]
g = lrs_nash.Normal_Form_Game(row_matrix, col_matrix)
g.solve()

which returns

%run /opt/local/bin/test_NE.py File "", line unknown ^ SyntaxError: unexpected EOF while parsing

Any ideas on how to sort out this problem ?


text:
Q: CREATE OR ALTER TABLE is failing with "Incorrect syntax near the keyword 'TABLE'" I am trying to make few tables in the database.
& the tool I`m using is Azure Data Studio.
Command that I`m using it:-
CREATE OR ALTER TABLE TABLE_NAME
(
    Date         datetime,
    Sequence         nvarchar(8),
    Code     nvarchar(3),
)
    GO

Error that I am getting:-

What I wanted to do is, create a table if not exist or if it does exist then alter it.
I`m unable to understand why its failing.
We already have something available on Stackover Flow itself Incorrect Syntax near the keyword 'OR' in CREATE OR ALTER PROCEDURE
We have create and alter for external tables here.
Why this isnt working?

A: I found out there is no CREATE OR ALTER syntax for tables. It works only for views, triggers, functions and stored procedures.
The corresponding MSSQL Tiger Team blog post  explains the situation:-

CREATE OR ALTER can be used in programmability objects such as:

*

*STORED PROCEDURES (including natively compiled)

*FUNCTIONS (Transact-SQL, including natively compiled)

*TRIGGERS

*VIEWS

But cannot be used in:
Objects that require storage (tables, indexes and indexed views)

*

*CLR user-defined functions

*Deprecated programmability objects (RULE and DEFAULT)

*Non-programmability objects (such as CREATE ASSEMBLY, CREATE TABLE or CREATE - SCHEMA). On these objects, the syntax for CREATE and ALTER is very different from a syntax and usability perspective.

Instead, we can create table if it doesn't exist (e.g like here) or explicitly drop it first:
DROP TABLE IF EXISTS FOO;
CREATE TABLE FOO (...)

OR
DROP TABLE IF EXISTS FOO;
    GO
CREATE TABLE FOO (...)

Both will work fine.
I hope this will help the community.


text:
Q: Order of the zero of a meromorphic function under the action of $Gal(\mathbb{C},\mathbb{Q})$ Let's take $X$ a Riemann surface as an algebraic curve in $\mathbb{P}^n$.
The group $Gal(\mathbb{C},\mathbb{Q})$ (automorphisms of $\mathbb{C}$ which act as the identity on $\mathbb{Q}$) acts on $X$ through the action on the coefficients of the equations defining $X$.
So, if for example $X$ is defined in $\mathbb{P}^2$ by the equation $\{F=0\}$ then $\sigma\in Gal(\mathbb{C},\mathbb{Q})$ sends $\{F=0\}$ to $\{F^\sigma=0\}$ and this action corresponds to the action of $\sigma$ on the coordinates of the points ($P\mapsto P^\sigma$).
Now let's take $f\in \mathcal{M}(X)$ i.e. a meromorphic function on $X$. If $P\in X$ is a zero for $f$, i want to prove that $ord_P(f)=ord_{P^\sigma}(f^\sigma)$.
If $X=\mathbb{P}^1$ this is straightforward, but i don't know how to deal with two ore more homogeneous variables (i think i'm forced to see $X$ as an algebraic curve in $\mathbb{P}^n$ to see the action of $Gal(\mathbb{C},\mathbb{Q})$, so $f$ is a rational function in the homogeneous coordinates of $\mathbb{P}^n$).

A: This question amounts to tracing the ideal-theoretic interpretations of all of the objects in question.  You have a coordinate ring $S$ for projective space, and a homogeneous ideal $I$ defining $X$.  Complex conjugation takes $I$ to $I^\sigma$ (i.e., the coefficients of all functions are conjugated), and the homogeneous coordinate ring $S/I$ of $X$ is taken to the homogeneous coordinate ring $S^\sigma/I^\sigma$ of $X^\sigma$.  Points in $X$ are in bijection with maximal relevant ideals $J$ containing $I$, and complex conjugation respects containment.
Any point $P \in X$ has a local ring $R$ composed of the meromorphic functions on $X$ that don't have a pole at $P$ (it is made by localizing $S/I$), and the maximal ideal $m$ is made from those functions that vanish at $P$.  The order of vanishing of a meromorphic function $f$ at $P$ is the supremum of integers $k$ such that $f \in m^k$.  For your question, it suffices to note that complex conjugation takes $R \to R^\sigma$ and hence $m$ to $m^\sigma$.  In particular, $f \in m^k$ if and only if $f^\sigma \in (m^\sigma)^k$.


text:
Q: What's the reason for the pre-image def. of Lebesgue measurable? What's the reason for the pre-image def. of Lebesgue measurable?
I.e. $f$ Lebesgue measurable if $\{ x : f(x) > c \in \mathbb{R}\}$ is measurable.
Like why is it significant that $f(x) > c$?


text:
Q: What is the chance of getting $100\%$ in $50$ questions paper If I have a test with one question which is true or false, the chances of getting $100\%$ in the exam is $50\%$ as I can select a right or wrong answer.
But what is the chance (exact percentage figure) of getting $100\%$  in a test where there are $50$ questions, each having true or false?
Thanks

A: Assuming that you're guessing on each question, so that the probability of getting any given question right is $\frac12$, the probability of guessing right on all $50$ questions is $\left(\frac12\right)^{50}$. This is a little more than $8.88\times 10^{-16}$.

A: Note that the probability of randomly choosing and answer/guessing and getting any ONE answer correct is $50\% = 1/2$.
But to get all $50$ answers correct, if guessing on each, the probability of getting $100\%$ is
$$\underbrace{\dfrac 12 \times \dfrac 12 \times \cdots \times \dfrac 12}_{\large 50\;\;\text{times}} \quad = \quad \left(\frac 12\right)^{50}$$

A: The probablility would be 1/2 for each question, you would multiply (1/2) by itself 50 times. That would equal 8.882*10^-16, a very small number. However, this would not be a real-life situation, because most of the time you would have at least some knowlege of the quesitons.Also, you would use guessing to eliminate incorrect choices, and that might increase your chances of getting a correct answer above the number mentioned.


text:
Q: Interbase DDEX provider for visual studio 2015 hi i'm working on creating entity framework DDEX provider for interbase db. i a'm following another opensource entity framework provider (Firebird) as a reference to my development. I have done necessary changes to my project and follo(https://github.com/cincuranet/FirebirdSql.Data.FirebirdClient/blob/master/DDEX/readme.txt).
I have two issues.

*

*When I try to add interbase database into server explorer I can see "Interbase data source"

. But when I am trying to add entity data model (.edmx) it doesn't show interbase data source
.

*When I try to go further by selecting "Interbase data source" in server explorer it prompts an exception saying "Failure has occurred while loading a type"

I can't debug on this because this is a dll that is in GAC. I would appreciate if someone can help me to figure out this issue.


text:
Q: File picker for uploading to Google Drive I'm learning about Google Api for uploading file on Android and did find the good sample about it.(you can take a look on that sample here:
https://github.com/sdivakarrajesh/Uploading-Files-to-Google-drive-using-java-client-api-in-Android/blob/master/app/src/main/java/com/dev/theblueorb/usingdrivejavaapi/DriveActivity.java)
 However, it's only show how to upload files, not how to select the file and upload it to GG drive. Here are the code for uploading and creating folder on GG drive:
private void uploadFile() throws IOException {
        File fileMetadata = new File();;
        fileMetadata.setName("Sample File");
        fileMetadata.setMimeType("application/vnd.google-apps.spreadsheet");

        // For mime type of specific file visit Drive Doucumentation

        file2 = new java.io.File(path);
        InputStream inputStream = getResources().openRawResource(R.raw.template);
        try {
            FileUtils.copyInputStreamToFile(inputStream,file2);
        } catch (IOException e) {
            e.printStackTrace();
        }

        FileContent mediaContent = new FileContent("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",file2);

        File file = mService.files().create(fileMetadata, mediaContent)
                .setFields("id")
                .execute();

        Log.e(this.toString(),"File Created with ID:"+ file.getId());

        Toast.makeText(getApplicationContext(),
                "File created:"+file.getId() , Toast.LENGTH_SHORT).show();
    }

}

private void createFolderInDrive() throws IOException {
        File fileMetadata = new File();
        fileMetadata.setName("Sample Folder");
        fileMetadata.setMimeType("application/vnd.google-apps.folder");

        File file = mService.files().create(fileMetadata)
                .setFields("id")
                .execute();
        System.out.println("Folder ID: " + file.getId());

        Log.e(this.toString(),"Folder Created with ID:"+ file.getId());
        Toast.makeText(getApplicationContext(),
                "Folder created:"+file.getId() , Toast.LENGTH_SHORT).show();
    }

Any body knows how to select the file on device, then upload it to selected folder on GG drive or the sample for that?

A: Referencing these docs for basic file upload, you should be able to "select the file on device" by specifying the complete file path as fileName in this line below:
java.io.File fileContent = new java.io.File(filename);.
For example, if you had a file called coolpic inside the directory media, you could use media/coolpic for the filename. The next doc I reference reinforces this strategy. The path will depend on the root location which, is something you can easily investigate.
Then, check out this doc for working with folders in Google Drive. You'll want to find the folder id and set this on upload using
fileMetadata.setParents(Collections.singletonList(folderId));
Note you can upload and then move in two steps, or use my method above and set the folder on upload.


text:
Q: 404 Page Not Found The page you requested was not found. in codeigniter 3 I need some help here.
The first page works just fine but other pages wont work at all when I click on them.
let me show you my code.
And even though I added .htacces but I cant open the website without index.php in URL
HELP!
I hope there is a solution cuz I searched a lot
Controller:
    <?php

class Pages extends CI_Controller{
    function __construct(){
        parent::__construct();
      }

    public function index(){
        $this->load->view('pages/intro');
    }

   public function Getincontact()
    {
        $this->load->view('pages/getincontact');
    }
    public function EDUCATION()
    {
        $this->load->view('pages/EDUCATION');

    }
    public function INTERNSHIP()
    {
        $this->load->view('pages/INTERNSHIP');

    }
    public function CERTIFICATES()
    {
        $this->load->view('pages/CERTIFICATES');

    }
    public function PROJECTSANDACHIEVEMENTS()
    {
        $this->load->view('pages/PROJECTSANDACHIEVEMENTS');

    }
}

intro page :
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ASAYLALAMAWI ^ CV</title>

    <?php
            $this->load->view('styles/introstyle');
    ?>

<input type="radio" name="toggle" id="radio1">

CV

ASAYL ALAMAWI

  <input type="radio" name="toggle" id="radio2">
X

      <a href="<?php echo base_url(); ?>pages/getincontact">GET IN CONTACT
      <a href="<?php echo base_url(); ?>pages/EDUCATION">EDUCATION
      <a href="<?php echo base_url(); ?>pages/INTERNSHIP">INTERNSHIP
      <a href="<?php echo base_url(); ?>pages/CERTIFICATES">CERTIFICATES
      <a href="<?php echo base_url(); ?>pages/PROJECTSANDACHIEVEMENTS">PROJECTS AND ACHIEVEMENTS

and here is the
.htaccsess file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]


text:
Q: wordpress custom rewrite rule I'm trying to get a custom rewrite rule to work, but at the moment it doesn't work. maybe someone can help?
speaking url I want looks like this: domain/the-brand/xyz
domain/?pagename=brand-2&brand=xyz is the working url...
i added already a custom tag to functions.php :
function custom_rewrite_tag() {
  add_rewrite_tag('%brand%', '([^&]+)');
}
add_action('init', 'custom_rewrite_tag', 10, 0);

and a custom rule, but there seems to be an error:
function custom_rewrite_rule() {
    add_rewrite_rule('/the-brand/([^/]*)' , 'index.php?pagename=brand-2&brand=$matches[1]', 'top');
}
add_action('init', 'custom_rewrite_rule', 10, 0);

A: It looks like you're doing the right thing, you'll just want to refresh your permalinks as noted here

Note that these rules are usually called inside the init hook.
  Furthermore, permalinks will need to be refreshed (you can do this
  from your admin under Settings > Permalinks) before the rewrite
  changes will take effect. Requires one-time use of flush_rules() to
  take effect. See also Flushing Rewrite on Activation.

A: try this:
add_rewrite_rule('^the-brand/([^/]*)/?' , 'index.php?pagename=brand-2&brand=$matches[1]', 'top');