text:
Q: How to drop float feature where % NANs is higher than a certain number? I'm trying to drop a feature which if float and a number of missing values is higher than certain number.
I've tried:
# Define threshold to 1/6
threshold = 0.1667

# Drop float > threshold
for f in data:
if data[f].dtype==float & data[f].isnull().sum() / data.shape[0] > threshold: del data[f]

..which raises an error:

TypeError: unsupported operand type(s) for &: 'type' and
  'numpy.float64'

Help would be aprreciated.

A: Use DataFrame.select_dtypes for only floats columns, check missing values and get mean - sum/count and add another non floats columns by Series.reindex, last filter by inverse condition > to <= by boolean indexing:
np.random.seed(2019)
df = pd.DataFrame(np.random.choice([np.nan,1], p=(0.2,0.8),size=(10,10))).assign(A='a')
print (df)
     0    1    2    3    4    5    6    7    8    9  A
0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  a
1  1.0  1.0  NaN  1.0  NaN  1.0  NaN  1.0  1.0  1.0  a
2  1.0  1.0  1.0  1.0  1.0  NaN  1.0  NaN  1.0  1.0  a
3  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  NaN  1.0  a
4  1.0  NaN  1.0  1.0  1.0  1.0  1.0  NaN  1.0  1.0  a
5  1.0  1.0  1.0  1.0  1.0  1.0  NaN  1.0  1.0  1.0  a
6  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  a
7  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  a
8  1.0  NaN  1.0  1.0  1.0  1.0  NaN  1.0  1.0  1.0  a
9  NaN  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  NaN  a

threshold = 0.1667
df1 = df.select_dtypes(float).isnull().mean().reindex(df.columns, fill_value=False)
df = df.loc[:, df1 <= threshold]
print (df)
     0    2    3    4    5    8    9  A
0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  a
1  1.0  NaN  1.0  NaN  1.0  1.0  1.0  a
2  1.0  1.0  1.0  1.0  NaN  1.0  1.0  a
3  1.0  1.0  1.0  1.0  1.0  NaN  1.0  a
4  1.0  1.0  1.0  1.0  1.0  1.0  1.0  a
5  1.0  1.0  1.0  1.0  1.0  1.0  1.0  a
6  1.0  1.0  1.0  1.0  1.0  1.0  1.0  a
7  1.0  1.0  1.0  1.0  1.0  1.0  1.0  a
8  1.0  1.0  1.0  1.0  1.0  1.0  1.0  a
9  NaN  1.0  1.0  1.0  1.0  1.0  NaN  a


text:
Q: do calculations for specific rows in R I am so new to R, tried many things but did not work. My table looks like this:
data temp
11.01.15 11am 15
11.01.15 12am 16
11.01.15 13am 14
12.01.15 11am 13
12.01.15 12am 11
12.01.15 13am 11

and it goes on for 5192 rows and many days, I have to calculate mean of the same day, the measurements are always done 3 times a day. So I need a loop that will calculate mean of values on rows 1-3, 4-6, 7-9 etc., and keep track of them and save in file.

A: If you always have 3 observations, you can just calculate mean of temp over a module of 3. Assuming your data called df
tapply(df$temp, cumsum(seq(nrow(df)) %% 3 == 1L), mean)
#        1        2
# 15.00000 11.66667

Another way is to convert data into a Date class an calculate mean over it. Here's an example using data.table
library(data.table)
setDT(df)[, mean(temp), by = as.Date(data, "%d.%m.%y")]
#       as.Date       V1
# 1: 2015-01-11 15.00000
# 2: 2015-01-12 11.66667

A: Use the dplyr package and its functions. I'm going to guess that you have a variable called "day" or "date" and another variable "x" that you want daily means on. The code:
group_by(data, day) %>%
  summarize(meanX = mean(x))

will return a dataframe with a mean value of x for each day in the data set called data.

A: You can use lapply to do this
req.out = do.call(rbind,
          lapply(split(data, f = data$date),
          function(x){
          out = mean(x$measurement)
          }))

Where, data is your data frame containing date and the column (I called it as measurement above) for which you need to compute the mean.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is there a generalization of the nested interval theorem in $\mathbb{R}^n$? I'm familiar with the nested interval theorem on the real line. But is there a generalization of such a theorem in literature?

A: There is a generalization to metric and Hausdorff topological spaces. Any nested sequence of non-empty compact subsets has  non-empty intersection. For metric spaces, if the diameter approaches zero, the intersection is one point. So for $\mathbb{R}^n$, any nested sequence of (closed) boxes or closed balls has non-empty intersection.
Actually, more is true (finite intersection property): If a family of compact sets has the property that the intersection of any finite number of them is non-empty, then their intersection is non-empty. Obviously nested families enjoy the finite intersection property.

A: More generally, suppose we have compact sets $X = U_0\supset U_1\supset U_2 \supset \cdots$ in some arbitrary compact, Hausdorff space $X$. If $\bigcap U_i$ is empty, then the sets $V_i = X\setminus U_i$ form an open cover of $X$ and must therefore admit a finite subcover; that is, some $U_i$ is empty.
(If you're not familiar with compact spaces, the key points are that bounded, closed subspsaces of $\mathbb{R}^N$ (e.g., closed boxes) satisfy the hypothesis above; and for $X$ compact, by definition any open sets $U_i\subset X$ with $\bigcup U_i = X$ have $\bigcup_{i\in S} U_i = X$ for a finite set $S$.)


text:
Q: How to use values from a list aggregated field in a table to a filter in Quicksight? I have a dashboard in Quick-sight where a table is being used which contains a field that has values list aggregated.(Please refer the attached image).
I need to create a filter in a dashboard that will have a dropdown with distinct values from the list aggregated values so that if i select/check a particular value from a dropdown then it should filter out the list aggregated record by matching the string i selected in a drop down.
I tried to use the split function to get the distinct values from the list aggregated values from the field. However, the filter did not work as i expected.
Please suggest possible solution. Will appreciate any suggestions.


text:
Q: How to get the width and height of an img element where width and height have not been set? How to get the width and height of an img element where width and height have not been set?

A: They don't have to be explicitly set by CSS:
var img = document.getElementById("my_img");
var height = img.height;
var width = img.width;

Just like that, you have the height and width of your image element.

A: Give an Id to the image(myImage) in the HTML and then ,
<img src="myimagejpg" id="myImage"/>

the following script will give the actuall height and width of the image...
var myImage = document.getElementById("myImage ");
var myheight= myImage .height;
var mywidth = myImage .width;


text:
Q: Decrypting AES hex message to complete mutual authentication with server I am trying to follow these instructions provided by a reference document:
Variable A contains a sequence of 16-byte random numbers encrypted using Variable B.
You should decrypt it using Variable B and pads it to the end of Variable A.
The overall 32-byte Variable will be decrypted using Variable B and sent back to the server in order to have a successful authentication.
You should use AES128 CBC cipher mode for decrypting.
Variable A (16 bytes): e06e3e2ea024bba1185c33d64d2033b6
Variable B (16 bytes): 41435231323535552d4a312041757468
My attempt in CryptoJS
const message = 'e06e3e2ea024bba1185c33d64d2033b6';
const key = '41435231323535552d4a312041757468';

const decryptedMsg = CryptoJS.AES.decrypt(
  message,
  key,
  {
    mode: CryptoJS.mode.CBC,
  }
);

console.log(decryptedMsg.toString());

All this produces is an empty string. I don't have much experience in the way of encryption and would appreciate any assistance finding a solution so that I can build the finished 32-byte hexadecimal value and authenticate successfully.

A: *

*The following applies to the parameters of the decrypt-method, here:

*

*parameter: ciphertext as CipherParams (if a string is passed here, it's Base64-decoded by default what is not intended here)

*parameter: key as WordArray (if a string is passed here, it's interpreted as a passphrase from which key and IV are derived what is not intended here)

*parameter: mode, initialization vector (IV) and padding

Then you can decrypt as follows:
var CryptoJS = require("crypto-js");

function decrypt(hexCiphertext, hexKey, hexIV){
    var cipherParams = CryptoJS.lib.CipherParams.create(
        {ciphertext: CryptoJS.enc.Hex.parse(hexCiphertext)}
    );
    var key = CryptoJS.enc.Hex.parse(hexKey);
    var iv = CryptoJS.enc.Hex.parse(hexIV);
    var decrypted = CryptoJS.AES.decrypt(
        cipherParams,
        key,
        {iv: iv, padding: CryptoJS.pad.NoPadding, mode: CryptoJS.mode.CBC}
    );
    return decrypted;
}

*The CBC mode uses an IV, which should be taken from the specification. The result depends on this IV, i.e. if you are using a wrong IV, the decryption will give a wrong result. If there is no IV in the specification, you can only guess and try e.g. a 0-vector on luck. The padding must also be taken from the specification. Since according to the description of the first part of the decryption, the encrypted and the decrypted message have the same length (namely 16 byte), obviously no padding (CryptoJS.pad.NoPadding) is used.

*The following applies to the first part of the decryption (assuming a 0-vector for the IV):
var hexMessage = 'e06e3e2ea024bba1185c33d64d2033b6';
var hexKey = '41435231323535552d4a312041757468';
var hexIV = '00000000000000000000000000000000';
var decryptedStep1 = decrypt(hexMessage, hexKey, hexIV);
var hexDecryptedStep1 = CryptoJS.enc.Hex.stringify(decryptedStep1)
console.log(hexDecryptedStep1);

with the following output:
93fd6fa1ee388d326535abf7bd66310a

and for the second part (assuming a 0-vector for the IV):
var hexMessageStep2 = hexMessage + hexDecryptedStep1;
var decryptedStep2 = decrypt(hexMessageStep2, hexKey, hexIV);
var hexDecryptedStep2 = CryptoJS.enc.Hex.stringify(decryptedStep2);
console.log(hexDecryptedStep2);

with the following output:
93fd6fa1ee388d326535abf7bd66310ac57db5bd524becba57445a9dbc536d0d


text:
Q: Loading Alternative UITabBarController for iPhone5 support I have to add support for iPhone5 to my app.  Currently the appdelegate uses a nib that is a UITabBarController, and code like this.  Works fine.
[window addSubview:rootController.view];
[window makeKeyAndVisible];

rootController is an instance of UITabBarController.
So I have created a new nib for iPhone5 and changed the code to...
if ([self IsTall])
    rootController = [[[UITabBarController alloc] initWithNibName:@"MainWindow_5" bundle:nil] autorelease];
else
    rootController = [[[UITabBarController alloc] initWithNibName:@"MainWindow" bundle:nil] autorelease];
[window addSubview:rootController.view];
[window makeKeyAndVisible];

But, the screen is blank with this code, like the nib is not loading.
If I try this I get the correct nibs loading and displaying on the screen but the "MORE" button is not shown and only the first 4 tabs are shown (there are 7 tabs in the tabBarController
if ([self IsTall])
    rootController = [[rootController initWithNibName:@"MainWindow_5" bundle:nil] autorelease];
else
    rootController = [[rootController initWithNibName:@"MainWindow" bundle:nil] autorelease];
[window addSubview:rootController.view];
[window makeKeyAndVisible];

I also tried...
if ([self IsTall])
    [[NSBundle mainBundle] loadNibNamed:@"MainWindow_5" owner:rootController options:nil];
else
    [[NSBundle mainBundle] loadNibNamed:@"MainWindow" owner:rootController options:nil];

But this causes a crash on the tab buttons for the nib not declared in the plist under Main
"nib file base name" setting.
Any help very much greatly appreciated.  This has stumped me for a couple of days now.
Kind Regards
Rob.

A: Here is the method I use
+ (BOOL)isPad{
    BOOL result = NO;
    if ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)]){
        result = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
    }
    return result;
}

+ (BOOL) isPhone{
    BOOL result = NO;
    static NSString *model;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        model = [UIDevice currentDevice].model;
    });
    if ([model hasPrefix:@"iPhone"]){
        result = YES;
    }
    return result;
}

+ (BOOL)isWidescreen{
    BOOL result = NO;
    static CGFloat ratio;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        CGSize size = [UIScreen mainScreen].bounds.size;
        CGFloat numerator = MAX(size.height, size.width);
        CGFloat denominator = MIN(size.height, size.width);

        ratio = numerator / denominator;
    });

    if (ratio > 1.77 && ratio < 1.78){
        result = YES;
    }

    return result;
}

I then have Define statements to make them easier to reach
#define IS_IPAD() [StaticContainer isPad]
#define IS_WIDESCREEN() [StaticContainer isWidescreen]
#define IS_IPHONE() [StaticContainer isPhone]

I also have a UIViewController category
@implementation UIViewController (initHelpers)

- (id) initClassDevice{
    NSString *device = @"";
    if (IS_IPAD()) {
        device = @"iPad";
    }
    else if (IS_WIDESCREEN()){
        device = @"iPhone5";
    }
    else {
        device = @"iPhone";
    }

    NSString *nibName = [NSString stringWithFormat:@"%@_%@",[self class],device];

    self = [self initWithNibName:nibName bundle:nil];

    return self;

}

@end

You will need to have a nib file for each one that has the different items in it. and they need to be connected to everything separately.
Mine currently only separates iphone and ipad so for a view controller i would have
MyMagicViewController.h/MyMagicViewController.m
and for the xib files i would have
MyMagicViewController_iPad.xib, MyMagicViewController_iPhone5.xib and MyMagicViewController_iPhone.xib
the important thing is to match the name of the xib file with the call to initWithNibName:
Also Another thing to think of. is the View you are initializing needs to be the same size as the View it is going into .
view.frame = superView.bounds;

then it will fit properly

A: Miscellaneous thoughts:
iPhone 5 is iOS 6. Was your app working under iOS 6 before? If not, get it working for iOS 6 first. My apps came up blank when linked against iOS 6 even if no other changes were made. That's because view controllers work in a whole different way. So step one is to get the simple of act of launch ironed out for iOS 6. This is particularly true if you are launching into landscape; everything is totally changed in this regard.
Do not add the subview yourself. Just set the window's rootViewController. It adds the subview for you.
On the whole you should NOT be loading a different nib in any case. You should be using layout to lay out the same interface in such a way that it doesn't matter whether the screen is tall or not.
Hope something in there will help...
Your second code is totally illegal. Never never never say "init" except in the very same line where you just said "alloc" (except in an initializer, of course).

A: for me adding Default-568h@2x.png to my project resolved it.


text:
Q: Mouse doubleclick not work in textbox using Selenium WebDriver I try to double click on the text box by which the text will be selected.....The code looks like
    WebDriver driver=new FirefoxDriver();
    driver.manage().window().maximize();
    driver.get("https://www.facebook.com/");
    WebElement txtBoxElement=driver.findElement(By.xpath("//*[@id='email']"));
    txtBoxElement.sendKeys("abc");
    System.out.println("Test start");
    Actions builder=new Actions(driver);
    Action a=builder.moveToElement(txtBoxElement).doubleClick(txtBoxElement).build();
    a.perform();

    //This is for another way to double click on the text field

    Locatable locatable = (Locatable) driver.findElement(By.name("email"));
    Mouse mouse = ((HasInputDevices) driver).getMouse();
    mouse.mouseMove(locatable.getCoordinates());
    mouse.doubleClick(locatable.getCoordinates());

    System.out.println("Test Complete");
}

but both of this way was not working I bypass this problem using this
    Action a=builder.moveToElement(txtBoxElement).sendKeys(txtBoxElement,Keys.chord(Keys.CONTROL,"a")).build();
    a.perform();

my question is why double click is not working?
I also try this for google search textbox it was also not working.
Here I want to mention one thing that I use Selenium 2.37 and firefox 26 .
I did not get any error but not double click on this element.I also observe that if I commented out the txtBoxElement.sendKeys("abc"); part and then sendkeys using Actions event,it write the text on browser address bar.

A: I believe you must be seeing following error while double clicking an element:
Cannot perform native interaction: Could not load native events component.

This is always issue with latest version of Firefox with latest verion of Selenium WebDriver(For more details please refer to link).
You can resolve this issue by downgrading Firefox from 26 to 25.  With Firefox 25 your code will work.

A: It may be that you have the Action statement incorrect for the double-click. I did a double-click with simple statements like this:
Actions a = new Actions(driver);

a.doubleClick(txtBoxElement);

a.perform();

A: If you are trying to select all of the text in the text box try:
WaitUntil.elementReady(driver, 2,".//span[@class='scale-input-box']/input").sendKeys(Keys.CONTROL + "a");

To overcome problems with doubleclicking in Selenium try Alternative workaround Source
Simplified to this:
((JavascriptExecutor) driver).executeScript("document.getElementById('map_container').dispatchEvent(new Event('dblclick'));");


text:
Q: How to create a standing up 3D text effect with Css3 transforms I'm looking to recreate an effect like this with CSS 3D Transforms:
How do I achieve this? Here's what I've got so far

body {
  perspective: 400px;
  transition: perspective 1s;
}
.grid {
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: url("http://i.imgur.com/3ACizko.jpg");
  background-size: cover;
  height: 400px;
  width: 400px;
  transform: rotateX(60deg);
  margin: 0 auto;
  transition: transform 1s;
  perspective: 400px;
}
.grid p {
  transition: transform 1s;
  transform: rotateX(-60deg);
}

Hello

I thought that if I rotated the background surface 60 degrees and rotated the text -60 degrees it would cancel out the effect but apparently not?
Anyway, thanks in advance.

A: Yes, ther solution to your problem is using transform-style: preserve-3d.
But the problem with this is that IE does not support this property
A way to make it work in IE is to use a pseudo element on the p

.grid {
  font-size: 30px;
  position: relative;
  left: 100px;
  top: 200px;
  perspective: 200px;
  perspective-origin: 0% 50%;
 }

.grid:after {
  content: "";
  position: absolute;
  width: 300px;
  height: 200px;
  top: -100px;
  left: -100px;
  transform: rotateX(30deg);
  background-image: repeating-linear-gradient(0deg, transparent 0px, transparent 47px, black 47px, black 50px),
    repeating-linear-gradient(90deg, transparent 0px, transparent 47px, black 47px, black 50px);
  }

Hello

A: After a bit of research, I am confident to post my own answer.
This effect can be achieved using the transform-style property, and setting it to preserve-3d. This would be set to the parent element (in this case, .grid). I also use transform-origin:bottom to raise the text from inside the grid. Here's the snippet:

body {
  perspective: 400px;
  transition: perspective 1s;
}
.grid {
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: url("http://i.imgur.com/3ACizko.jpg");
  background-size: cover;
  height: 400px;
  width: 400px;
  transform: rotateX(60deg);
  margin: 0 auto;
  transition: transform 1s;
  perspective: 400px;
  transform-style:preserve-3d;
}
.grid p {
  transition: transform 1s;
  transform-origin:bottom;
  transform: rotateX(-60deg);
}

Hello


text:
Q: Decimal/Hexadecimal/Binary Conversion Right now I'm preparing for my AP Computer Science exam, and I need some help understanding how to convert between decimal, hexadecimal, and binary values by hand. The book that I'm using (Barron's) includes an example but does not explain it very well.
What are the formulas that one should use for conversion between these number types?

A: Are you happy that you understand number bases? If not, then you will need to read up on this or you'll just be blindly following some rules.
Plenty of books would spend a whole chapter or more on this...
Binary is base 2, Decimal is base 10, Hexadecimal is base 16.
So Binary uses digits 0 and 1, Decimal uses 0-9, Hexadecimal uses 0-9 and then we run out so we use A-F as well.
So the position of a decimal digit indicates units, tens, hundreds, thousands... these are the "powers of 10"
The position of a binary digit indicates units, 2s, 4s, 8s, 16s, 32s...the powers of 2
The position of hex digits indicates units, 16s, 256s...the powers of 16
For binary to decimal, add up each 1 multiplied by its 'power', so working from right to left:
1001 binary = 1*1 + 0*2 + 0*4 + 1*8 = 9 decimal

For binary to hex, you can either work it out the total number in decimal and then convert to hex, or you can convert each 4-bit sequence into a single hex digit:
1101 binary = 13 decimal = D hex

1111 0001 binary = F1 hex

For hex to binary, reverse the previous example - it's not too bad to do in your head because you just need to work out which of 8,4,2,1 you need to add up to get the desired value.
For decimal to binary, it's more of a long division problem - find the biggest power of 2 smaller than your input, set the corresponding binary bit to 1, and subtract that power of 2 from the original decimal number. Repeat until you have zero left.
E.g. for 87:

*

*the highest power of two there is 1,2,4,8,16,32,64!

*64 is 2^6 so we set the relevant bit to 1 in our result: 1000000

*87 - 64 = 23

*the next highest power of 2 smaller than 23 is 16, so set the bit: 1010000

*repeat for 4,2,1

*final result 1010111 binary

*i.e. 64+16+4+2+1 = 87 in decimal

For hex to decimal, it's like binary to decimal, only you multiply by 1,16,256... instead of 1,2,4,8...
For decimal to hex, it's like decimal to binary, only you are looking for powers of 16, not 2. This is the hardest one to do manually.

A: This is a very fundamental question, whose detailed answer, on an entry level could very well be a couple of pages. Try to google it :-)


text:
Q: Use "score" instead of "votes" in the list of questions When viewing questions in the normal, "Interesting Questions" tab, (or any other view for that matter), the question's score is displayed to its left, and is labeled "votes".

But is it the correct word to use? Wouldn't "Score" be more appropriate (because a score of "1" doesn't necessarily mean "1 votes", it could mean "100 upvotes and 99 downvotes").
My suggestion, use "score"

Your thoughts?

A: Not only would this be a more accurate term, it would also avoid the famous pluralization bug! "1 Score" is just as proper as "2 Score", but "1 Votes" just looks terrible.

A: Looking at what done for this question, https://meta.stackoverflow.com/questions reports 4 votes, but the question actually got 6 votes: 5 up-votes, and 1 down-vote.

4 is really the score of the question: the difference between the number of up-votes, and the number of down-votes. Votes for me means the number of votes, not the score a post has.
Score should be an understood word, on Stack Exchange, as it is already used in the description of some badges, such as Convention ("10 posts with a score of 2 on meta"), or Disciplined ("Deleted own post with score of 3 or higher"). I would not say it is a word that Stack Exchange users don't see in other places on Stack Exchange.

A: This has been a long time coming, and we're not quite done yet! However I'd like to update you folks that we've just pushed some changes to wording all around the website regarding "votes".
Our main goal was to switch to "Score" where it made sense, which on this first pass meant:

*

*The layout doesn't display the word "Score" as a unit. (e.g.: "15 score" as opposed to "15 votes" just seem weird to us right now)

*The number displayed is an actual "Score", which as described by you folks, is the combination of upvotes and downvotes

Unfortunately these restrictions mean that question listings all around the website will remain unchanged for now. We are working to find better wording for "Score" that can also be used as a unit (e.g.: "points"), and on a plan to implement those with minimum negative impact to you.
As usual, thanks for reporting this issue, we appreciate the help! Ironing out inconsistencies that make the website more confusing and less welcoming is one of our priorities for this year.

A: It's been pointed out that "score" is a bit confusing for new users, especially given that it already has a perfectly ordinary meaning that's not obviously out of scope. But the OP is correct that "votes" is not merely a bit confusing, but wrong and misleading in important ways. And "vote score" or similar, while neither misleading nor confusing, is too long to fit.
Instead of any of those, then, I suggest using "voting". This has the advantage of clearly tying back to concept of votes up or down, but without implying that it actually counts the total number of votes. Its meaning is deliberately skewed from the normal in an obvious way, so users unfamiliar with it, rather than being misled, will know that the site is using it in an idiosyncratic way, and will know to find out what the actual meaning is. A tooltip can then inform them efficiently that it's the sum of up and down votes.
In other words, treat it as a short caption for a figure ("for question quality, see fig 1-21, voting"), rather than an inline phrase ("24 votes", "Score 2").


text:
Q: CaseSenstive Table names hi there i made track star application and everything works fine except for one issue that i face error
CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'devnmark_root.AuthAssignment' doesn't exist. The SQL statement executed was: SELECT *
FROM 'AuthAssignment'
WHERE userid=:userid
now this was automatically generated by Yii when i checked for if(Yii::app()->user->checkAccess('createUser',array('project'=>$model)))
18 {
19     $this->menu[] = array('label'=>'Add User To Project','url'=>array('adduser', 'id'=>$model->id));
20 }
then i went to phpmyadmin and executed this query manually
SELECT * FROMAuthAssignmentWHERE userid=4 and there is error which says same that table does not exist.
if i use small case letter for table name then no error.
i executed same query on local wamp 's phpmyadmin same query does not show any error there so this is clear that there is error with my sql .any idea what can i do to solve?

A: I suggest you hitting up SQL_MODE documentation for setting your final options.  http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html
For testing you can just do a:
SET sql_mode = '';

Or adjust your command line:
--sql-mode=""

A: You may try to set the system variable *lower_case_table_names* to 1.

A: My local application was developed under Windows, howerver production is under Linux and I caused the same problem.
For me it happened because of case sensitivity - table AuthAssignment in database was actually authassignment.
I have found two options to solve it:
rename database table from authassignment to AuthAssignment
or
edit config file component section:
'components'=>array(
...
    'user'=>array(...
    ),
    'authManager'=>array(
     ...
     'assignmentTable'=>'authassignment' //THIS LINE SOLVED MY PROBLEM
),

A: I had the same problem of non-existent authassignment table, I had forgotten running the rights installation which in my case was by following URL i.e.
/index.php/rights/install
and then the setup was like a breeze and self explanatory :)

A: For me this answer helped the most: original source.
In the authManager in config/main.php you can add lowercased names of the tables like this:
'components'=>array(
    'authManager'=>array(
        'defaultRoles'=>array('guest'),
        'class'=>'RDbAuthManager',
        'assignmentTable'=>'authassignment',
        'itemTable'=>'authitem',
        'rightsTable'=>'rights',
        'itemChildTable'=>'authitemchild',
),


text:
Q: how would i go about counting consecutive items that share the same value in an array? vb.net i'm trying to create a RLE compression & decompression tool, problem is that i don't know how to count each consecutive items in an array, that share the same value.
suppose a file with this byte string:
00 00 00 FF 99 88 88 77 22 00 00 00 00 00 00 00 00 00 00
how'd i receive something like 3 00 1 FF 1 99 2 88 1 77 1 22 10 00?
and how would i split the count like 255 0 5 0 instead of 260 0?
here is my compressRLE() function right now:
Public Sub compressRLE(org As String, cmp As String)
        Dim inputFile = IO.File.Open(org, IO.FileMode.Open)
        Dim bytes = New Byte(2147483647 - 1) {}
        Dim bytearray = bytes.ToArray()
        Dim nbytes As Array = {}

        While inputFile.Read(bytes, 0, 2147483647) > 0
            My.Computer.FileSystem.WriteAllBytes(2147483647, bytes, True)
        End While

        For i = 0 To bytearray.Length
            If bytearray(i) = bytearray(i + 1) Then

            End If
        Next i

        inputFile.Close()
    End Sub

A: You will need to do several things:

*

*Split the byte array string

*Loop over the items returned from the split

*Keep track of the current "consecutive" item

*If the currently looped item matches the current consecutive item, then increase it's total

*Otherwise, start a new total and set the new current consecutive item

Here is an example:
Private Function ConsecutiveItemCount(delimitter As String, input As String) As IEnumerable(Of KeyValuePair(Of String, Integer))
    If (String.IsNullOrEmpty(delimitter)) Then
        Throw New ArgumentNullException(NameOf(delimitter))
    End If
    If (String.IsNullOrWhiteSpace(input)) Then
        Throw New ArgumentNullException(NameOf(input))
    End If

    Dim everyItem = input.Split({ delimitter }, StringSplitOptions.RemoveEmptyEntries)
    Dim consecutiveItems = New List(Of KeyValuePair(Of String, Integer))()
    For index As Integer = 0 To everyItem.Length - 1
        Dim currentlyIteratedItem = everyItem(index)
        If (consecutiveItems.Count = 0) Then
            consecutiveItems.Add(New KeyValuePair(Of String, Integer)(currentlyIteratedItem, 1))
            Continue For
        End If

        Dim currentlyIncrementingItem = consecutiveItems.Last()
        If (currentlyIncrementingItem.Key() = currentlyIteratedItem) Then
            Dim newConsecutiveTotal = currentlyIncrementingItem.Value + 1
            consecutiveItems.Item(consecutiveItems.Count - 1) = New KeyValuePair(Of String, Integer)(currentlyIteratedItem, newConsecutiveTotal)
        Else
            consecutiveItems.Add(New KeyValuePair(Of String, Integer)(currentlyIteratedItem, 1))
        End If
    Next

    Return consecutiveItems
End Function

Live Demo: https://dotnetfiddle.net/BCSe3N

A: Something like this,
Public Function DoCountsEx(byts() As Byte) As List(Of Counts)
    Dim cts As New List(Of Counts)
    If byts.Length > 0 Then
        Dim aCT As New Counts(byts(0), 0)
        Dim idx As Integer = 1
        Do While idx < byts.Length
            If byts(idx) = aCT.bytVal Then
                aCT.count += 1
            Else
                cts.Add(aCT)
                aCT = New Counts(byts(idx), idx)
            End If
            idx += 1
        Loop
        cts.Add(aCT)
    End If
    Return cts
End Function

Public Class Counts
    Public bytVal As Byte
    Public count As Integer
    Public bytLoc As Integer  'location start in buffer
    Public Sub New(val As Byte, loc As Integer)
        Me.bytVal = val
        Me.bytLoc = loc
        Me.count = 1
    End Sub
End Class

Test
    ' byts() = 00 00 00 FF 99 88 88 77 22 00 00 00 00 00 00 00 00 00 00
    Dim cts As List(Of Counts) = DoCountsEx(byts)
    'check
    Debug.WriteLine("")
    For Each c As Counts In cts
        Dim hex As String = Convert.ToString(c.bytVal, 16).PadLeft(2, "0"c)
        Debug.WriteLine("Value:{0}  Count:{1}  Location:{2}", hex, c.count, c.bytLoc)
    Next

Debug Output
Value:00  Count:3  Location:0
Value:ff  Count:1  Location:3
Value:99  Count:1  Location:4
Value:88  Count:2  Location:5
Value:77  Count:1  Location:7
Value:22  Count:1  Location:8
Value:00  Count:10  Location:9


text:
Q: Sonar analysis failing - unable to request /batch_bootstrap/properties We've been analyzing our projects with SonarQube for several months now without any problems. Since this morning, analysis is failing with this error:
Unable to request: /batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false

This is happening since we upgraded our Amazon EC2 instance to Ubuntu 14.04 and Oracle JDK8. We're running SonarQube 4.3.2 against a MySQL database, Maven 3.1 and Jenkins 1.571.
Following is the logs from running Maven on our project:
[DEBUG] [13:12:25.839] Download: http://ec2-0.0.0.0.compute-1.amazonaws.com:9000/batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false (no proxy)
[DEBUG] [13:12:29.334] Updating semaphore batch-TalkManagement:TalkManagement-parent
[DEBUG] [13:12:39.372] Updating semaphore batch-TalkManagement:TalkManagement-parent
[DEBUG] [13:12:46.127] Release semaphore on project : org.sonar.api.resources.Project@2fa1044d[id=429,key=TalkManagement:TalkManagement-parent,qualifier=TRK], with key batch-TalkManagement:TalkManagement-parent
[DEBUG] [13:12:46.531] To prevent a memory leak, the JDBC Driver [com.mysql.jdbc.Driver] has been forcibly deregistered
[ERROR] Unable to request: /batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Talk Management System ............................ FAILURE [12:22.555s]
[INFO] TalkManagement .................................... SUCCESS [1:17.314s]
[INFO] TalkManagementServiceApi .......................... SUCCESS [13.759s]
[INFO] TalkManagementService ............................. SUCCESS [6:07.446s]
[INFO] TalkUIAutomationTest .............................. SUCCESS [7.225s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20:53.855s
[INFO] Finished at: Wed Aug 06 13:13:00 EDT 2014
[INFO] Final Memory: 39M/494M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.3.1:sonar (default-cli) on project TalkManagement-parent: Unable to request: /batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false: Read timed out -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.3.1:sonar (default-cli) on project TalkManagement-parent: Unable to request: /batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
    at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:331)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:328)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to request: /batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false
    at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:37)
    at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:136)
    at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:194)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 30 more
Caused by: org.sonar.api.utils.SonarException: Unable to request: /batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false
    at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:92)
    at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:82)
    at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:78)
    at org.sonar.batch.scan.ModuleSettings.downloadSettings(ModuleSettings.java:82)
    at org.sonar.batch.scan.ModuleSettings.addProjectProperties(ModuleSettings.java:77)
    at org.sonar.batch.scan.ModuleSettings.init(ModuleSettings.java:63)
    at org.sonar.batch.scan.ModuleSettings.<init>(ModuleSettings.java:59)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145)
    at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
    at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
    at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
    at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
    at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:698)
    at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:646)
    at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:677)
    at org.sonar.api.platform.ComponentContainer.getComponentByType(ComponentContainer.java:198)
    at org.sonar.batch.scan.ModuleScanContainer.addCoreComponents(ModuleScanContainer.java:86)
    at org.sonar.batch.scan.ModuleScanContainer.doBeforeStart(ModuleScanContainer.java:73)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:199)
    at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:194)
    at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:192)
    at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:187)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:56)
    at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:44)
    at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:175)
    at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:163)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
    at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
    at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
    at org.sonar.runner.api.Runner.execute(Runner.java:100)
    at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:132)
    ... 33 more
Caused by: java.net.SocketTimeoutException: Read timed out
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1888)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1883)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1882)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1455)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
[JENKINS] Archiving /home/ubuntu/.jenkins/workspace/TalkServiceCI/TalkUIAutomationTest/pom.xml to TalkManagement/TalkUIAutomationTest/1.1.8/TalkUIAutomationTest-1.1.8.pom
[JENKINS] Archiving /home/ubuntu/.jenkins/workspace/TalkServiceCI/TalkUIAutomationTest/target/TalkUIAutomationTest-1.1.8.jar to TalkManagement/TalkUIAutomationTest/1.1.8/TalkUIAutomationTest-1.1.8.jar
    at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:274)
    at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:235)
    at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:88)
    ... 88 more
Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:150)
    at java.net.SocketInputStream.read(SocketInputStream.java:121)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:701)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
    at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2929)
    at java.net.URLConnection.getContentEncoding(URLConnection.java:523)
    at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:272)
    ... 90 more

When accessing http://ec2-0.0.0.0.compute-1.amazonaws.com:9000/batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false directly through a browser or curl, the response is indeed slow but never longer than 10 seconds.
Edit Actually when getting this URL while an analysis is running, it can take over a minute to return an answer!
We have tried adding the following properties to our pom.xml file:
    <sonar.dryRun.readTimeout>60</sonar.dryRun.readTimeout>
    <sonar.preview.readTimeout>60</sonar.preview.readTimeout>

It doesn't look like it's helping.
This is a multi-module project and the /batch_bootstrap/properties URL has been called successfully on other modules before this last failure.
Any ideas?
Thanks!
Edit
Upgrading to Sonar 4.4, Maven Sonar plugin 2.4 and Jenkins 1.574 gives the same results.

A: It turns out that the EC2 instance was overloaded (CPU and memory were floored) and Sonar couldn't answer the /batch_bootstrap/properties URL in under 60 seconds, hence the failure. We migrated to a larger EC2 instance and the problem has disappeared.

A: Or simply try this,
select * from semaphores

This will list the stuck build, you'll be able to see project name, kee. If there is any row and that matches your project note down the id. Then delete it from the semaphores table
delete from semaphores where id  = $id

Sometimes, when job is killed with jenkins you get this problem.


text:
Q: Why do server vendors always ship them with disabled hardware virtualization support?
Possible Duplicate:
Enabling hardware virtualisation BIOS; anything to beware?

This, which seem to be common practice for all hardware vendors, has been bugging me for a while: why is hardware virtualization always by default disabled in a server's BIOS?
Can it lower the system's stability?
Can it create security risks?
Can it have compatibility problems with... anything?
It's always a pain to find it disabled and have your hypervisor refuse to work... especially if you don't have access to the server's BIOS and need to call other people to fix that.
Hardware-assisted virtualization is supported by all server CPUs today, and is by no means a "new" or "experimental" feature anymore. Is there any technical reason at all for this?

A: It's for security reasons. See http://odetocode.com/Blogs/scott/archive/2007/05/10/hardware-virtualization-off-by-default.aspx
If a virus can install itself and then run the main OS in virtualization then it is nearly undetectable. Or as the article said a rootkit could use VT Technology to run at a higher privilege level than the operating system itself!


text:
Q: Get object from [NSString: AnyObject] as UIViewAnimationCurve? I have the following code:
    let userInfo = notification.userInfo

    let animationCurve = userInfo?[UIKeyboardAnimationCurveUserInfoKey] as UIViewAnimationCurve
    let animationDuration = userInfo?[UIKeyboardAnimationDurationUserInfoKey] as NSTimeInterval
    let keyboardFrame = userInfo?[UIKeyboardFrameEndUserInfoKey] as CGRect

userInfo is a [NSObject: AnyObject]? dictionary and the UIKeyboardAnimationCurveUserInfoKey keys are all NSString!s. Now I want to get some elements from this dictionary. But it seems not all items I want to use inherit from AnyObject. UIViewAnimationCurve is an enum and CGRect is a struct.
I am translating this code from Objective-C, where the following syntax is used:
[[userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&animationCurve];

Now I want to know how I can get these elements from the dictionary without using (unsafe) pointers.

A: The value of UIKeyboardFrameEndUserInfoKey is a NSValue representing
a CGRect:
if let tmp = userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue {
    let keyboardFrame = tmp.CGRectValue()
}

The value of UIKeyboardAnimationCurveUserInfoKey is a NSNumber
representing the integer value of the enumeration:
if let tmp = userInfo?[UIKeyboardAnimationCurveUserInfoKey] as? NSNumber {
    let animationCurve = UIViewAnimationCurve(rawValue: tmp.integerValue)!
}

This can be combined into single expressions, using the nil-coalescing
operator ?? to provide default values:
let keyboardFrame = (userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.CGRectValue() ?? CGRectZero
let animationCurve = UIViewAnimationCurve(rawValue:
        (userInfo?[UIKeyboardAnimationCurveUserInfoKey] as? NSNumber)?.integerValue ?? 0
    ) ?? .Linear


text:
Q: How to train a Keras LSTM with a multidimensional input? This is the shape of my input data:
>> print(X_train.shape)
(1125, 75, 2)

Then I tried to build the model by this way:
model = Sequential()

model.add(LSTM(
    output_dim=50,
    input_shape = (75, 2),
    #input_shape = X_train.shape[1:],
    return_sequences=True))
model.add(Dropout(0.2))

model.add(LSTM(
    100,
    return_sequences=False))
model.add(Dropout(0.2))

model.add(Dense(
    output_dim=1))
model.add(Activation("linear"))

model.compile(loss="mse", optimizer="rmsprop")

model.fit(
    X_train,
    y_train,
    batch_size=512,
    nb_epoch=5,
    validation_split=0.1,
    verbose=0,
    shuffle=True)

But it returns the following error when fitting:

ValueError: Error when checking model target: expected activation_32
  to have 2 dimensions, but got array with shape (1125, 75, 2)

This is the full error's output:
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-48-b209fe29a91d> in <module>()
    152         verbose=0,
--> 153         shuffle=True)
    154

/usr/local/lib/python3.5/dist-packages/keras/models.py in fit(self, x, y, batch_size, nb_epoch, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, **kwargs)
    670                               class_weight=class_weight,
    671                               sample_weight=sample_weight,
--> 672                               initial_epoch=initial_epoch)
    673
    674     def evaluate(self, x, y, batch_size=32, verbose=1,

/usr/local/lib/python3.5/dist-packages/keras/engine/training.py in fit(self, x, y, batch_size, nb_epoch, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch)
   1114             class_weight=class_weight,
   1115             check_batch_axis=False,
-> 1116             batch_size=batch_size)
   1117         # prepare validation data
   1118         if validation_data:

/usr/local/lib/python3.5/dist-packages/keras/engine/training.py in _standardize_user_data(self, x, y, sample_weight, class_weight, check_batch_axis, batch_size)
   1031                                    output_shapes,
   1032                                    check_batch_axis=False,
-> 1033                                    exception_prefix='model target')
   1034         sample_weights = standardize_sample_weights(sample_weight,
   1035                                                     self.output_names)

/usr/local/lib/python3.5/dist-packages/keras/engine/training.py in standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix)
    110                                  ' to have ' + str(len(shapes[i])) +
    111                                  ' dimensions, but got array with shape ' +
--> 112                                  str(array.shape))
    113             for j, (dim, ref_dim) in enumerate(zip(array.shape, shapes[i])):
    114                 if not j and not check_batch_axis:

ValueError: Error when checking model target: expected activation_32 to have 2 dimensions, but got array with shape (1125, 75, 2)

What am I doing wrong? I've followed this tutorial of Keras documentation.

A: Your problem lies not in your input shape but output shape. You need to recheck if your y_train has the appropriate shape.


text:
Q: WordPress Error "A variable mismatch has been detected." I am receiving this WordPress error when I am trying to delete a gravity-form-coupon feed:
A variable mismatch has been detected.

Note: I am creating the feeds dynamically (PHP).
I tried to debug it with all the debugging plugins and enabled all the debug flags but I can't see why and what is causing this?
Can someone please explain why might be the cause and why this error triggers?

A: Phew...
WordPress shows this error on
elseif ( isset( $_GET[ $wpvar ] ) && isset( $_POST[ $wpvar ] ) && $_GET[ $wpvar ] !== $_POST[ $wpvar ] ) {
                wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
            }

https://github.com/WordPress/WordPress/blob/abcbee954f4d8baa5aff2df566a942c1b48ca2d7/wp-includes/class-wp.php
which means if any element is present in both arrays($_POST/$_GET) the value should be the same.
in my case the $_GET['page'] was not equals to $_POST['page'] which triggered this error.


text:
Q: looping through dates in hp unix via arthmatic operations Hello i am using hp unix, i am trying to loop through the last 20 days (with respect to the current date) using a for loop .
for (( c=1; c<=5; c++ ))
do
day$c=$(perl -e 'use POSIX;print strftime "%Y%m%d\n",localtime time-86400*$c;')
done
later do some operations with day$c

issue is that for some strange reason 86400*$c is not executing , can any one point out the mistake ? thanks in advance .

A: I believe you have to use spaces in between operator and operands
perl -e 'use POSIX; print strftime "%Y%m%d\n",localtime time - 86400 * $c;'

A: Try different quoting:
day$c=$(perl -e "use POSIX;print strftime qq(%Y%m%d\n),localtime time-86400*$c;")

(I'm not familiar with HPUX, but it looks like $c isn't getting interpolated by the shell.)
Edit: Or the slightly shorter:
day$c=$(perl -MPOSIX -le "print strftime '%Y%m%d',localtime time-86400*$c;")


text:
Q: JAVASCRIPT - Change Element CSS on click I have a navigation bar that when clicked, the page will be scrolled into that part of the page. I used this script.
$('li a').click(function(){
    $('html, body').animate({
        scrollTop: $( $(this).attr('href') ).offset().top
    }, 500);
    return false;
});

How do I change this element's style so that when it is clicked, it will slide into a certain part of the page as well as that navbar will have a different background image?
I tried adding an onclick() function in the links. It works but it does not scroll into the section of the page where it is suppose to slide. I tried adding the script inside the sliding script hoping it may have an effect but it does not work.

A: You can add this into that function.
$('li a').click(function(){
    var el = $(this);

    $('li a').removeClass('selected');
    el.addClass('selected');

    $('html, body').animate({
        scrollTop: $( el.attr('href') ).offset().top
    }, 500);
    return false;
});

Remove the "selected" class from any li then add it to the currently clicked one.

A: you can use the $(element).css(cssElement, value) to change the CSS.
Example:
$("#myDiv").click(function(){
    $(this).css("background-color", "Black");
});


text:
Q: Java Web: How use JSP with JSF and Ajax? i'm working in a project with jsp, i need to start to use ajax too.
i'm enjoying jsf , is possible work with these together (JSP, JSF and AJAX) ?
I'm asking this cause i could run jsf with ajax
<h:commandButton id="bt_save" value="Save" title="Save" action="#personMBean.clickSave()}">
    <f:ajax execute="@form" render="lblMessage" />
</h:commandButton>
<br/>

<h:outputLabel id="lblMessage" value="#{personMBean.message}" />

But when i try input this code in my jsp page it doesn't work, even if i insert on my jsp page:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

Any ideas ?

A: Ensure that you're using JSF 2.x (the <f:ajax> doesn't exist in JSF 1.x) and that you've a <h:head> instead of <head> in the master template (so that JSF can auto-include necessary Ajax JavaScripts).
Said that, you should really consider Facelets as replacement of JSP. JSP is an outdated view technology and ill suited for templating and has been replaced by Facelets as per JSF 2.0 / Java EE 6.

A: Yes - try richfaces or primefaces

A: I don't see why you couldn't do this but certainly not on the same page.
To do this you need to map the *.jsp extension to the JSP servlet while mapping the *.jsf or *.xhtml to FacesServlet.


text:
Q: grammar/ meaning "To look at him, you'd never think he was 80!" Is the title sentence the short form of

(If you were) To look at him, you'd never think he was 80!

Likewise,

In other part of the country again, to give the example of Minnesota, you would probably pay only half of that maybe $400 or 450 a month.

Is the short form of

------ ,(If I were) to give the example of Minnesota, ----

As far as the short form is concerned, what do you think the full sentences are for the following examples?

*

*Suffice it to say that they're having marital problems.

*Say what they will about our cafeteria, I still think they're the best tater tots money can buy.

*After that, the golfer thinks that because a certain method worked for them...it will automatically work for everybody. And to make matters worse, they believe that there are a lot of absolute imperatives to the golf swing that all golfers MUST do in order to hit the ball effectively.

My guess is:

*

*"If it" suffices to say that

*"Though they" say what they will about our cafeteria,

*"If they are" to make matters worse, ----(with a hint of irony ?)

Frankly, I really do not understand the sentence meanings of (2) and (3).

A: This is either "an expression of amazement" or "an expression of utter disbelief at a truly unfathomable circumstance". I think it's the former and in that case it means "Wow!", "Amazing!", or "What do you know!".

A: To answer your questions

*

*To look at him, you'd never think he was 80!
Means: When you look at the way he looks, you'd never think he was 80 - he looks a lot younger than that.

*In other part of the country again, to give the example of Minnesota, you would probably pay only half of that maybe $400 or 450 a month.
Means: If we again use Minnesota as an example for another part of the country, you would probably pay only half of that maybe $400 or 450 a month in such areas.

*

*Suffice it to say that they're having marital problems.
Means: To make you understand some of their issues, it is enough to tell you they're having marital problems. There is more but it is not important to this discussion.

*Say what they will about our cafeteria, I still think they're the best tater tots money can buy.
Means: Some people have complaints about our cafeteria, but I do not care, their deep-fried, grated potatoes served as a side dish are the best you can get.

*...And to make matters worse, they believe that there are a lot of absolute imperatives to the golf swing that all golfers MUST do in order to hit the ball effectively.
Means: Not only do they think certain methods work but they make even greater mistakes in their thinking when they believe the many ways they are told they MUST do when they swing.


text:
Q: -3dB passband on filters I know with most op amp based filters and passive filters its common that the passband is -3dB which I understand as like for example if I would to make a bandpass filter, the beginning and end of the passband is -3dB attenuated while the center part of the filter is mostly the same dB unless you are making a Chebyshev filter.
So the question I am basically asking, was the -3dB passband common when filters where made with vacuum tubes? or was this introduced sometime when filters started to be made with op amps?
EDIT:
The only reason why I am confused about the -3dB passband of filters, is there are some filters calculators for example that you can change the attenuation of the passband,  like if I wanted a -1dB instead of a -3dB passband for a bandpass filter A calculator that I have used can do that but it does default to -3dB.
There is another filter calculator that also ignores the passband attenuation and makes the entire frequency range the same gain instead of like a bandpass filter having -3dB at the ends of the passband, but this is only if you select Chebyshev type of filter.

A:
was the -3dB passband common when filters where made with vacuum tubes
aka before op amps existed, or was this introduced sometime when
filters started to be made with op amps?

Filters are fundamentally created by the interactions of resistors, capacitors and inductors. Active components can bring a bit more to the party but, fundamentally, it's the passive components that "make" the filter. The 3 dB point is equivalent to the power dropping by 50% on the filter output and this is true whether you use active devices or not.
For instance, a simple RC low pass filter produces a 3 dB drop in output signal level when the impedance of the capacitor in ohms equals the resistance of the resistor i.e.: -
$$R = \dfrac{1}{2\pi f C}$$
If you manipulate that formula you find that the "-3 dB" frequency: -
$$f = \dfrac{1}{2\pi R C}$$
The above has nothing to do with tubes, transistors or op-amps.

A: My short answer:
When - for a special application - I need a filter where the passband is characterized with "max damping of 1 dB for frequencies of interest", then I have the definition for the passband based on the "-1 dB criterion".
That means: The designer is free to define the passband within limits that are governed by the special application.
The same applies - as you know - for the stopband.
The only reason for a "common agreement" (3dB limits) is the wish to simplify the designers work - and tabulate some typical data (pole data or normalized parts values), based on passband edges which are given with the tables (3 dB for Butterworth and ripple values for Chebyshev).
But there is certainly no fixed "definition" for passband edges at -3dB points.

A: Using the -3dB point as the cutoff frequency applies to passive filters as well (those constructed with only resistors, inductors, and capacitors.) It really doesn't matter if it's an active filter (using an op-amp) or a passive filter with RLC components. The -3dB point applies in both cases.
Obviously tubes predate op-amps. There are tube designs, like the long tail pair, that function similar to an op-amp with inverting and non-inverting inputs. However, my understanding is that the idea of a global feedback loop (from the output back to the inverting input) came later. This may explain why many tube amplifier circuits use passive tone controls.


text:
Q: Compile for windows using mingw-w64 and autotools I've this project called librsync.
Installed ubuntu package called mingw-w64. Looked at automake manpage.
What I want to do is to build executable that runs on windows or dll, whichever I could get working.
./configure --host "what do i put here?"
By looking at ubuntu packages I can't figure it out. From automake manpage - If I had mingw32 it should be i586-mingw32msvc. But how do I figure that out on my own in the first place? At least, what should I put in hosts param if I have mingw-w64?

A: For building something with a cross compiler, you will use configuration-gcc as the C compiler with configuration being what you would pass to --host to build a library or executable.
ls /usr/bin/*mingw*gcc should give you the C compiler to use, allowing you to know what the configuration is.

*

*MinGW (aka mingw32): iX86-pc-mingw32 or iX86-mingw32msvc (X is a 4, 5, or 6 depending on how it was configured)

*mingw-w64: ARCH-w64-mingw32 (ARCH is one of i686 or x86_64)

I've honestly not seen anything else for mingw-w64, except in its earlier days when it used ARCH-pc-mingw64, but that shouldn't be used anymore.


text:
Q: Force scrollbar visible on overflow-x? I have a table that is horizontally scrollable, thanks to this
However, the horizontal scrollbar just hides after a few seconds. Meaning before user touches the table, there is no indication it could be scrollable. Is there a way to force the scollbar to be visible at all times?
I'm using Windows 10 and MS Edge (the Chromium one), but the same behavior happens on Firefox (both desktop and Chrome)

            ID
            Username
            Email
            Group
            Edit
            User Tickets

        <?php

        while($row = mysqli_fetch_assoc($res)){
            $rowid = $row["id"];
            ?>

                <?php echo $rowid?>
                <?php echo $row["nickname"]?>
                <?php echo $row["email"]?>
                <?php echo $row["usergroup"]?>

                    <a href="./?action=editUser&id=<?php echo($rowid) ?>">Edit #<?php echo($rowid)?>

                    <a href="./?action=viewTickets&id=<?php echo($rowid) ?>">View #<?php echo($rowid)?>

            <?php
        }
        $stmt->close();
        ?>

    .adminUserTable {
        width: 360px;
    }
    .adminUserTable table {
        width: 100%;
        border-collapse: collapse;
    }
    .adminUserTable td,
    .adminUserTable th {
        /*border: 1px solid black;*/
        min-width: 66px;
    }
    /* try removing the "hack" below to see how the table overflows the .body */
    .scroll1 {
        display: table;
        table-layout: fixed;
        width: 100%;
    }
    .scroll2 {
        display: table-cell;
        overflow-x: scroll;
        width: 100%;
    }


text:
Q: Possible to force merge a feature branch in git/GitHub I've got a GitHub repo that loosely follows git-flow. There are two long-standing branches: master and develop. A feature branch (feature/one)  was cut off of develop some time ago. A PR exists to merge feature/one back into develop, however there are lots of merge conflicts.
I'm 100% certain that I want all the changes in feature/one to trump and override any conflicts from develop. Is there any way to force git to just say "Hey, anything that's conflicting in feature/one and develop, just use the changes from feature/one" ?

A: During merging from feature/one into develop branch, you can use this:
git checkout develop
git merge -X theirs feature/one

The long form for -X theirs is --strategy-option=theirs. So the longer form is:
git merge --strategy-option=theirs feature/one

You can refer the git merge man page.


text:
Q: how to vertically align footer contents with css
This image can explain my issue. I am trying to get both the copyright text and my Font Awesome icons to be vertically aligned.
Here is my HTML

Copyright © 2016 Sample SIte

And CSS
footer
{
max-width:960px;
background-color:#fbfbfb;
border-radius:10px;
margin:15px auto 10px auto;
padding: 18px 20px 18px 20px;
}

#social
{
float:right;
}

.social_buttons
{
color:#575757;
}

Thanks in advance.

A: You can use Flexbox

footer{
  background-color: #fbfbfb;
  padding: 10px;
  display: flex;
  align-items: center;
}

#social {
  margin-left: auto;
}
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>

Copyright © 2016 Sample SIte

A: You could try adding vertical-align: middle; to the social_buttons class.
.social_buttons {
  color: #575757;
  vertical-align: middle;
}


text:
Q: ExecutorService with a fixed sized thread pool - how to block any more tasks being added until the pool size has space My current implementation counts how many tasks are added to the pool and decrements when the complete their task.
I then tell the main code to repeat + sleep until the active tasks drop below the thread pool size before I add another task.
I feel there must be a better way?
I do not want the tasks placed in a queue, but I would happily wait for the pool to tell me it's ready to receive more tasks.
For background, I have a web-service that I wish to invoke and it involves around 150,000 HTTP calls, I plan to do 50 at a time until the full 150,000 calls have been completed, this is why I can't queue all tasks as I will exhaust my RAM.
I do not want any blocking to be on a timeout - I'm happy to wait as long as necessary for the thread pool to have space for new tasks.
Any suggestions on how this can be achieved?

A: One method to handle this is to startup your own consumer threads that run against your own BlockingQueue, avoiding the use of an ExecutorService altogether.  I.e. declare an ArrayBlockingQueue with capacity of 50 and have a producer thread offering/putting elements to it (which will block when the queue is full) and the consumer threads pulling from it and doing the necessary work.
Alternatively there is an implementation of ThreadPoolExecutor which does what you want by adding a custom RejectedTaskHandler to adding blocking behavior to the execute call.  See NotifyingBlockingThreadPoolExecutor on github.  I can't vouch for its quality but it should do exactly what you need.


text:
Q: Adreno220 framebuffer object I made a sample JNI android app.
It works well on Galaxy Note(Mali 400MP) but don't work on SGS2LTE(Adreno 220).
I think its problem in making FBO.
cpp code is below
// Create Depth Buffer;
GL_CMD(glGenFramebuffers(1, &m_depthBuffer))
GL_CMD(glBindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer))
GL_CMD(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, m_width, m_height))
GL_CMD(glBindRenderbuffer(GL_RENDERBUFFER, 0))
// Create Stencil Buffer;
GL_CMD(glGenFramebuffers(1, &m_stencilBuffer))
GL_CMD(glBindRenderbuffer(GL_RENDERBUFFER, m_stencilBuffer))
GL_CMD(glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, m_width, m_height))
GL_CMD(glBindRenderbuffer(GL_RENDERBUFFER, 0))

// Construct FBO
GL_CMD(glGenFramebuffers(1, &m_fbo))
GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo))
GL_CMD(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureId, 0))
GL_CMD(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBuffer))
GL_CMD(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_stencilBuffer))

GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
    LOGE("Check Frame Buffer Status Failed : %x", status);
    return;
}

GL_CMD(glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT))

status represents 0x8CDD(GL_FRAMEBUFFER_UNSUPPORTED_EXT).
I attach Logcat.
01-03 03:59:32.829: D/libEGL(24851): loaded /system/lib/egl/libGLES_android.so
01-03 03:59:32.829: D/libEGL(24851): loaded /system/lib/egl/libEGL_adreno200.so
01-03 03:59:32.839: D/libEGL(24851): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
01-03 03:59:32.839: D/libEGL(24851): loaded /system/lib/egl/libGLESv2_adreno200.so
01-03 03:59:32.849: W/EglHelper(24851): createContext com.google.android.gles_jni.EGLContextImpl@40529b80 tid=1
01-03 03:59:32.869: D/Surface(24851): Surface is full screen
01-03 03:59:32.899: D/Surface(24851): Surface is full screen
01-03 03:59:32.899: W/EglHelper(24851): start() tid=1
01-03 03:59:32.909: W/EglHelper(24851): createContext com.google.android.gles_jni.EGLContextImpl@4052afc0 tid=1
01-03 03:59:32.909: W/EglHelper(24851): createSurface()  tid=1
01-03 03:59:32.939: D/dalvikvm(24851): Note: class Landroid/opengl/GLWrapperBase; has 211 unimplemented (abstract) methods
01-03 03:59:32.939: I/EGLUtils(24851): GL Version = OpenGL ES 2.0 1566933
01-03 03:59:32.939: I/EGLUtils(24851): GL Vendor = Qualcomm
01-03 03:59:32.949: I/EGLUtils(24851): GL Renderer = Adreno (TM) 220
01-03 03:59:32.949: I/EGLUtils(24851): GL Extensions = GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_QCOM_memory_monitor GL_AMD_compressed_3DC_texture
01-03 03:59:32.979: I/GLUtils(24851): EGL Extensions : EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_ANDROID_image_native_buffer EGL_ANDROID_swap_rectangle EGL_ANDROID_get_render_buffer
01-03 03:59:32.989: I/GLUtils(24851): GL Extensions : GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_QCOM_memory_monitor GL_AMD_compressed_3DC_texture
01-03 03:59:32.989: I/SharedTexture(24851): imageEGL: 0 syncKHR: 0
01-03 03:59:33.009: D/CLIPBOARD(24851): Hide Clipboard dialog at Starting input: finished by someone else... !
**01-03 03:59:33.039: E/AGRE(24851): Check Frame Buffer Status Failed : 8cdd**

How can it work on Adreno 220?

A: Have you checked the exact value glCheckFramebufferStatus() returns? If it is GL_FRAMEBUFFER_UNSUPPORTED, you should try simply ignoring the error and continuing with execution.

A: Try using GL_OES_packed_depth_stencil rather than separate depth/stencil render buffers. See http://www.khronos.org/registry/gles/extensions/OES/OES_packed_depth_stencil.txt for more details. You'll want to check that this extension is indeed supported by the device before using it. This would be the case for Adreno 220.


text:
Q: Page Size of Crystal Report when exporting to PDF I have an app that exports reports to crystal before attaching them to an email and sending. For some reason when I export the report via code, it no longer seems to fit on the page (A4). Printing from the reports designer works fine
cryReport.SetParameterValue(thisReportParamName, thisEmailJob.external_id);
crDiskFileDestinationOptions.DiskFileName = _pReportExportPath + thisEmailJob.external_id + ".pdf";
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crExportOptions.ExportFormatOptions = CrFormatTypeOptions;
cryReport.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4;
cryReport.Export();

Is there some way i can force the export to be A4 paper size?


text:
Q: Meaning of DistinctRow in this context? DELETE
        DISTINCTROW tbl1.*, tbl2.Name
    FROM
        tbl1 INNER JOIN tbl2 ON tbl1.EMP_NUM = tbl2.EMP_NUM
    WHERE
        (((tbl2.Name) Not Like [Forms]![formReports]![txtName]));

I just need to verify that my description below makes sense or if it doesn't point out why and what the statement actually does. Here is what I think it does:
Join the tables using the EMP_NUM and delete the duplicate records based on the name being different from that entered into the view "txtName" on the form "formReports."
OR
Does it delete all values from the columns in tbl1 and only the values in the field Name in tbl2 where the name entered into the form is different from that in tbl2.
Any thoughts?

A: Because you are joining two tables and have fields from both tables, the DISTINCTROW is not doing anything.
You can see the documentation here that explicitly spells this out.


text:
Q: Replace character or fixing incorrect new line character in csv using UNIX command I have a Pipe-delimited CSV from a company report production. But there is a 'comment' field that the data inputted randomly by the employee and causes failed to load the data into database. How do i solve it using UNIX command or shell script?
The data sample is look like this :
Employee ID|Time Type|Start Date|End Date|Number Of Days|Comment|Approved
90006731|Leave|04/02/2019|04/02/2019|1|annual leaves|Y
90005267|Leave|04/02/2019|04/02/2019|1||Y
90007366|Leave|04/02/2019|04/02/2019|1|* Take care of vehicle taxes
* Vehicle Repair
* Community service
* Swimming|Y
90005052|Leave|04/02/2019|04/02/2019|1|Son's field trip|Y
90006253|Death of Wife/Husband/Child/Parent|04/01/2019|04/02/2019|2||Y
90007595|Leave|04/01/2019|04/01/2019|1|family plan|Y
90004064|Leave|08/18/2020|08/21/2020|3|Dear Mas Rama,
Please kindly approve, Mas Okto was oke.
Thanks.|Y
90007072|Sick Leave Without Certificate|04/01/2019|04/01/2019|1|Sick leave due to eye swelling|Y
90004371|Sick Leave|04/01/2019|04/05/2019|4||Y
90007431|Sick Leave|04/01/2019|04/01/2019|1||Y

Required Output :
Employee ID|Time Type|Start Date|End Date|Number Of Days|Comment|Approved
90006731|Leave|04/02/2019|04/02/2019|1|annual leaves|Y
90005267|Leave|04/02/2019|04/02/2019|1||Y
90007366|Leave|04/02/2019|04/02/2019|1|* Take care of vehicle taxes * Vehicle Repair * Community service * Swimming|Y
90005052|Leave|04/02/2019|04/02/2019|1|Son's field trip|Y
90006253|Death of Wife/Husband/Child/Parent|04/01/2019|04/02/2019|2||Y
90007595|Leave|04/01/2019|04/01/2019|1|family plan|Y
90004064|Leave|08/18/2020|08/21/2020|3|Dear Mas Rama, Please kindly approve, Mas Okto was oke. Thanks.|Y
90007072|Sick Leave Without Certificate|04/01/2019|04/01/2019|1|Sick leave due to eye swelling|Y
90004371|Sick Leave|04/01/2019|04/05/2019|4||Y
90007431|Sick Leave|04/01/2019|04/01/2019|1||Y

I have tried [this][1],
awk -F\| '{ while (NF < 7 || $NF == "") { brokenline=$0; getline; $0 = brokenline $0}; print }' cu_inf_20200902tst.csv > cu_inf_20200902tst1.csv

but i found the error warning :
awk: cmd. line:1: (FILENAME=cu_inf_20200902tst.csv FNR=19) fatal: grow_fields_arr: fields_arr: can't allocate 321069040 bytes of memory (Cannot allocate memory)

Any suggest to fix my problem?
[1]: https://unix.stackexchange.com/questions/434979/fixing-malformed-csv-with-incorrect-new-line-chars-using-sed-or-perl-only

A: Considering that your first field id will be always 8 digits and no other field will be of 8 digits like it, if this is the case then you could try following.
awk '
{
  printf("%s%s", (FNR>1 ? (/^[0-9]{8}/?ORS:OFS) : ""), $0)
}
END{
  print ""
}' Input_file

Explanation: Adding detailed explanation for above.
awk '                                                   ##Starting awk program from here.
{
  printf("%s%s",(FNR>1?(/^[0-9]{8}/?ORS:OFS) ""), $0)   ##Using printf statement from here where checking condition if line is first line then check if line starts from 8 digits then print new line else print space.
}
END{                                                    ##Starting END block of this program from here.
  print ""                                              ##Printing a new line in here.
}' Input_file                                           ##Mentioning Input_file name here.

OR(in case you want to keep header separate itself then keep its condition separate itself)
awk '
FNR==1{
  print
  next
}
{
  printf("%s%s",$0!~/^[0-9]{8}/?OFS:(FNR>2?ORS:""),$0)
}
END{
  print ""
}' Input_file

Explanation: Adding detailed explanation for above.
awk '                                                     ##Starting awk program from here.
FNR==1{                                                   ##Checking condition if this is first line then do following.
  print                                                   ##Printing current line here.
  next                                                    ##next will skip all further statements from here.
}
{
  printf("%s%s",$0!~/^[0-9]{8}/?OFS:(FNR>2?ORS:""),$0)    ##Using printf for printing where checking condition if line starts from 8 digits then print space else check if line number is more than 2 then print new line or nothing with current line.
}
END{                                                      ##Starting END block of this program from here.
  print ""                                                ##Printing a new line in here.
}' Input_file                                             ##Mentioning Input_file name here.

A: Please try the following.
Sed Solution
sed ':a;N;/\n[0-9]/!s/\n/ /;ta;P;D' input_file

awk Solution
awk '{printf "%s%s", (NR>1 ? (/^[0-9]/?ORS:OFS) : ""), $0} END{print ""}' input_file

Output of the following command
Employee ID|Time Type|Start Date|End Date|Number Of Days|Comment|Approved
90006731|Leave|04/02/2019|04/02/2019|1|annual leaves|Y
90005267|Leave|04/02/2019|04/02/2019|1||Y
90007366|Leave|04/02/2019|04/02/2019|1|* Take care of vehicle taxes  *Vehicle Repair  * Community service * Swimming|Y
90005052|Leave|04/02/2019|04/02/2019|1|Son's field trip|Y
90006253|Death of Wife/Husband/Child/Parent|04/01/2019|04/02/2019|2||Y
90007595|Leave|04/01/2019|04/01/2019|1|family plan|Y
90004064|Leave|08/18/2020|08/21/2020|3|Dear Mas Rama, Please kindly approve, Mas Okto was oke. Thanks.|Y
90007072|Sick Leave Without Certificate|04/01/2019|04/01/2019|1|Sick leave due to eye swelling|Y
90004371|Sick Leave|04/01/2019|04/05/2019|4||Y
90007431|Sick Leave|04/01/2019|04/01/2019|1||Y

for detail explanatiion: How to join lines not starting with specific pattern to the previous line in UNIX?

A: This might work for you (GNU sed):
sed ':a;s/[^|]*/&/7;t;N;s/\n//;ta' file

Check to see if the current line contains 7 fields, if not, append the next line, remove the newline and repeat.


text:
Q: how to track begin ride using uber API I am planning on making an application which will run in parallel with uber app.
I want to do something after the begin ride is clicked.
Is there a way to do that ? How should I communicate with uber to know if driver has begun the ride ?
The app which I am planning will be installed on Driver's mobile.

A: We currently do not have publicly available Driver API features. Thanks for expressing your interest! We always listen to our community in order to prioritize feature requests accordingly. Please stay tuned and check out our Developer Blog for future API announcements.
Having said that, I think you can still use our Rides API Webhooks to implement this feature in your app. The Webhook feature sends out POST requests to your server-side application with updates on the status of the Uber ride request. In other words, you would be notified if the ride starts (implies that the driver clicked on Begin Trip).


text:
Q: how to close the division below one anchor tag when we click on second anchor tag and anchor tags are generated dynamically When I clicked on 1st anchor tag the result is displayed below that but when I click on second anchor tag then the result of second anchor tag is displayed below second tag but the result below 1st anchor tag is not hiding and the result of both are displayed respectively. The anchor tag and division where we are printing results are generated dynamically .
Can anyone help me out of this
Here is my jQuery Code

Here is my HTML code :

                    &nbsp

                     Camp

                &nbsp

                Pimpri

A: Is this what you need?

$(document).ready(function() {

    var st = "1";
    var clLiID = 100;
    var fdevLiID = 300;
    var sdevLiID = 400;
    $('.p').click(function(e) {
        var bid = 2;
        var sta = "";
        var obj = [];
        obj.push({
            "branch_id": 2,
            "course_id": 100,
            "course_name": "course_1"
        });
        obj.push({
            "branch_id": 2,
            "course_id": 101,
            "course_name": "course_2"
        });
        obj.push({
            "branch_id": 1,
            "course_id": 102,
            "course_name": "course_3"
        });

        var result = "
";
        $.each(obj, function() {
            sta = this['branch_id'];
            //alert(this['course_name']);
            if (sta == 2) {
                result = result + "
" + this['course_name'] + "

";
                fdevLiID++;
                sdevLiID++;
                clLiID++;
            }
        });
        result = result + "
";
        //alert(result);
        if (st == "1") {
            $('#img3').attr("src", "https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-minus-empty-128.png");
            document.getElementById("cour1").innerHTML = result;
            st = "2";
        } else {
            $('#img3').attr("src", "https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-minus-empty-128.png");
            document.getElementById("cour1").innerHTML = "";
            st = "1";
        }
    });
});

var st1 = "1";
$(document).on('click', '.cours', function() {
    //  $('.cours').removeClass("visited");
    //  $(this).addClass("visited");
    $(".newCls").html('');
    var cid = $(this).attr("cid");
    var tempid = $(this).attr("temp_id");
    var tempid1 = $(this).attr("temp_id1");

    var bid = $(this).attr("bid");
    $(this).toggleClass('IsOpened');
    var IsShow = $(this).hasClass('IsOpened');
    $('.cours').removeClass('IsOpened');
    if (!IsShow) {
        document.getElementById(tempid).innerHTML = "";
        document.getElementById(tempid1).innerHTML = "";
        return;
    }
    $(this).addClass('IsOpened');
    var obj = [];
    obj.push({
        "batchtype": 2,
        "batch_code": "1001",
        "frequency": new Date().toString(),
        "new_start_date": "01-01-2017",
        "timings": "10.00",
        "faculty_Name": "faculty_1",
        "fees": "100",
        "duration": "10"
    });
    obj.push({
        "batchtype": 2,
        "batch_code": "1002",
        "frequency": new Date().toString(),
        "new_start_date": "02-01-2017",
        "timings": "11.00",
        "faculty_Name": "faculty_2",
        "fees": "50",
        "duration": "10"
    });
    obj.push({
        "batchtype": 1,
        "batch_code": "1003",
        "frequency": new Date().toString(),
        "new_start_date": "03-01-2017",
        "timings": "12.00",
        "faculty_Name": "faculty_3",
        "fees": "25",
        "duration": "10"
    });

    var heading = "";

    var status1 = "";
    var status2 = "";
    //var out="
    //<fieldset><legend>Confirmed Batches</legend>";

    var out = "

&nbsp&nbsp&nbsp&nbsp&nbspConfirmed Batches
";

    //out+="

Confirmed Batches

;
    out += "
";
    //out+="
Confirmed Batches
";
    out += "
&nbsp&nbspBatch Code	Start Date	Day	Batch time	Trainer	Frequency	Fees	Duration	";
    var out1 = "

&nbsp&nbsp&nbsp&nbsp&nbspTentative Batches

";
    out1 += "
&nbsp&nbspBatch Code	Start Date	Day	Batch time	Trainer	Frequency	Fees	Duration	";
    for (var i = 0; i < obj.length; i++) {

        var status = obj[i].batchtype;
        var b_c = obj[i].batch_code;
        var b_c = b_c.substring(0, 8);
        var day = obj[i].frequency;
        var day = day.substring(4, 9);

        if (status == '1') {
            out += "
&nbsp&nbsp" + b_c +
                "	" + obj[i].new_start_date +
                "	" + day +
                "	" + obj[i].timings +
                "	" + obj[i].faculty_Name +
                "	" + obj[i].frequency +
                "	" + obj[i].fees +
                "	" + obj[i].duration +
                "
";
            status1 = '1';
        }
        if (status == '2') {
            out1 += "
&nbsp&nbsp" + b_c +
                "	" + obj[i].new_start_date +
                "	" + day +
                "	" + obj[i].timings +
                "	" + obj[i].faculty_Name +
                "	" + obj[i].frequency +
                "	" + obj[i].fees +
                "	" + obj[i].duration +
                "
";
            status2 = '2';
        }
    }

    out += "

";
    out1 += "

";

    if (status1 == '1' && status2 == '2') {
        document.getElementById(tempid).innerHTML = out;
        document.getElementById(tempid1).innerHTML = out1;
    }
    if (status1 == '1') {
        document.getElementById(tempid).innerHTML = out;
    }
    if (status2 == '2') {
        document.getElementById(tempid1).innerHTML = out1;
    }
});

                    &nbsp

                     Camp

                &nbsp

                Pimpri

I have just hard coded all ajax calls with rough data.
The changes made are
$(this).toggleClass('IsOpened');
var IsShow = $(this).hasClass('IsOpened');
$('.cours').removeClass('IsOpened');
if (!IsShow) {
    document.getElementById(tempid).innerHTML = "";
    document.getElementById(tempid1).innerHTML = "";
    return;
}
$(this).addClass('IsOpened');

and removed
if (st1 == "1") {}

condition and added a css class'newCls' to

The final script with ajax calls:
$(document).ready(function() {

    var st = "1";
    var clLiID = 100;
    var fdevLiID = 300;
    var sdevLiID = 400;
    $('.p').click(function(e) {
        var bid = 2;
        var sta = "";
        $.ajax({
            url: "<?php echo base_url(); ?>/afcks/search",
            data: {'b_id': bid},
            type: "POST",
            cache: false,
            success: function (data)
            {
                var obj = $.parseJSON(data);
                var result = "
";
                $.each(obj, function() {
                    sta = this['branch_id'];
                    //alert(this['course_name']);
                    if (sta == 2) {
                        result = result + "
" + this['course_name'] + "

";
                        fdevLiID++;
                        sdevLiID++;
                        clLiID++;
                    }
                });
                result = result + "
";
                //alert(result);
                if (st == "1") {
                    $('#img3').attr("src", "https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-minus-empty-128.png");
                    document.getElementById("cour1").innerHTML = result;
                    st = "2";
                } else {
                    $('#img3').attr("src", "https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-minus-empty-128.png");
                    document.getElementById("cour1").innerHTML = "";
                    st = "1";
                }
            }
        });
    });
});

var st1 = "1";
$(document).on('click', '.cours', function() {
    //  $('.cours').removeClass("visited");
    //  $(this).addClass("visited");
    $(".newCls").html('');
    var cid = $(this).attr("cid");
    var tempid = $(this).attr("temp_id");
    var tempid1 = $(this).attr("temp_id1");

    var bid = $(this).attr("bid");
    $(this).toggleClass('IsOpened');
    var IsShow = $(this).hasClass('IsOpened');
    $('.cours').removeClass('IsOpened');
    if (!IsShow) {
        document.getElementById(tempid).innerHTML = "";
        document.getElementById(tempid1).innerHTML = "";
        return;
    }
    $(this).addClass('IsOpened');
    $.ajax({
        url: "<?php echo base_url(); ?>/afcks/search_course",
        data: {'c_id': cid, 'b_id': bid},
        type: "post",
        cache: false,
        success: function (data)
        {
            var obj = $.parseJSON(data);
            var heading = "";

            var status1 = "";
            var status2 = "";
            //var out="
            //<fieldset><legend>Confirmed Batches</legend>";

            var out = "

&nbsp&nbsp&nbsp&nbsp&nbspConfirmed Batches
";

            //out+="

Confirmed Batches

;
            out += "
";
            //out+="
Confirmed Batches
";
            out += "
&nbsp&nbspBatch Code	Start Date	Day	Batch time	Trainer	Frequency	Fees	Duration	";
            var out1 = "

&nbsp&nbsp&nbsp&nbsp&nbspTentative Batches

";
            out1 += "
&nbsp&nbspBatch Code	Start Date	Day	Batch time	Trainer	Frequency	Fees	Duration	";
            for (var i = 0; i < obj.length; i++) {

                var status = obj[i].batchtype;
                var b_c = obj[i].batch_code;
                var b_c = b_c.substring(0, 8);
                var day = obj[i].frequency;
                var day = day.substring(4, 9);

                if (status == '1') {
                    out += "
&nbsp&nbsp" + b_c +
                        "	" + obj[i].new_start_date +
                        "	" + day +
                        "	" + obj[i].timings +
                        "	" + obj[i].faculty_Name +
                        "	" + obj[i].frequency +
                        "	" + obj[i].fees +
                        "	" + obj[i].duration +
                        "
";
                    status1 = '1';
                }
                if (status == '2') {
                    out1 += "
&nbsp&nbsp" + b_c +
                        "	" + obj[i].new_start_date +
                        "	" + day +
                        "	" + obj[i].timings +
                        "	" + obj[i].faculty_Name +
                        "	" + obj[i].frequency +
                        "	" + obj[i].fees +
                        "	" + obj[i].duration +
                        "
";
                    status2 = '2';
                }
            }

            out += "

";
            out1 += "

";

            if (status1 == '1' && status2 == '2') {
                document.getElementById(tempid).innerHTML = out;
                document.getElementById(tempid1).innerHTML = out1;
            }
            if (status1 == '1') {
                document.getElementById(tempid).innerHTML = out;
            }
            if (status2 == '2') {
                document.getElementById(tempid1).innerHTML = out1;
            }
        }
    });
});


text:
Q: how to make a js script available globally? I can't find any question similar  to what I'm looking for, that is why I'm asking here.
The problem is very simple, since I do not have so much experience with js. I would like to solve this simple problem.
I have the follow JS Code
function valida()
{
    if (document.getElementById('contrato').value=='0')
    {
        alert('O contrato do cliente deve ser selecionado!');
        document.getElementById('contrato').focus();
        return false
    }
    if (document.getElementById('problema').value=='0')
    {
        alert('A tipo da ocorrência deve ser selecionado!');
        document.getElementById('problema').focus();
        return false
    }
    if (document.getElementById('descricao').value=='')
    {
        alert('A descrição do problema deve ser preenchido!');
        document.getElementById('descricao').focus();
        return false
    }
}

function mostra()
{
    if (document.getElementById("sumula").style.display != "none")
    {
        document.getElementById("sumula").style.display = "none";
    }
    else
    {
        document.getElementById("sumula").style.display = "block";
    }
}

Actually the above piece of code is in my HTML interface and work properly. But now I need to restructure my interface and separate it in 7 other small interfaces (No problem at this point).
Then I will have 7 distinct new interfaces, and I do not want to repeat the JS code as above, then I had created a new js file called protocol.js and I will include the protocol.js in all my 7 new interfaces.
I'm including like this ->
<script language="javascript" type="text/javascript" src="scripts/protocol.js">

but it is not working. Just this not work.
When I back the whole code in my HTML it works fine, I had try absolute path, relative path and nothing.
What could it be?
Any help?

A: Try this:
<script type="text/javascript" src="scripts/protocol.js"></script>

A: *

*The file is not accessible (Use the correct chmod)
Try to call it like http://DOMAIN/scripts/protocol.js

*The tag is not correct. It's not closed. Try
<script type="text/javascript" src="scripts/protocol.js"></script>


text:
Q: Ruby on Rails - jQuery.countdown no display Before I move to RoR I was using this great jQuery countdown and it worked fine.
I try to use it again in my Rails (4.0.8) application but I can't figure it why nothing is displayed.
I have in app/assets/javascripts (among others) :
application.js
jquery.countdown.min.js
jquery-2.1.1.min.js

In my application.js :
//= require_tree .
//= require jquery-2.1.1.min
//= require jquery.countdown.min

In my Gemfile :
gem 'jquery-rails', '3.0.4'

In my app/views/pages/page.html.erb :

--

--

Like documented on this page but nothing shows up.

Am I missing something obvious ? Thanks for your help.

A: I managed to display my countdown again !
I found (printing the javascript console) that I have the error $ is not defined. So I remove gem 'jquery-rails', '3.0.4' from my Gemfile and perform the command gem uninstall jquery-rails. Then I added those few lines in my header and restarted the server.
<%= javascript_include_tag "jquery-2.1.1.min" %>
<%= javascript_include_tag "jquery.countdown.min" %>