base
CSS base styles for web apps (a thin layer on top of normalize.css)
SUIT CSS base
I am pretty sure I understand the general difference between upcasting and downcasting, particularly in C++. I understand that we can't always downcast because casting a base class pointer to a derived class pointer would assume that the base class object being pointed to has all the members of the derived class.
Early in the semester, my professor told the class that is also sometimes illegal to upcast in C++, but I seem to have missed the reason why in my notes and I can't remember when this occurs.
Can anyone tell me when it is illegal to upcast in C++?
Source: (StackOverflow)
Possible Duplicate:
C# constructor execution order
class Foo
{
public int abc;
Foo()
{
abc = 3;
}
}
class Bar : Foo
{
Bar() : base()
{
abc = 2;
}
}
In the example above, when an object of Bar is created, what will be the value of BarObject.abc? Is the base constructor called first, or is Bar() run, /then/ the base() constructor?
Source: (StackOverflow)
When it comes to implementation, how should i decide to go for an base type or an Interface ? I tried to work out on few examples but i don't get the complete idea :(
Examples on how and why would be greatly appreciated..
Source: (StackOverflow)
Thus for used base class for some commom reusable methods in every page of my application...
public class BaseClass:System.Web.UI.Page
{
public string GetRandomPasswordUsingGUID(int length)
{
string guidResult = System.Guid.NewGuid().ToString();
guidResult = guidResult.Replace("-", string.Empty);
return guidResult.Substring(0, length);
}
}
So if i want to use this method i would just do,
public partial class forms_age_group : BaseClass
{
protected void Page_Load(object sender, EventArgs e)
{
//i would just call it like this
string pass = GetRandomPasswordUsingGUID(10);
}
}
It does what i want but there is a "Base" keyword that deals with base class in c# ...
I really want to know when should use base keyword in my derived class....
Any good example...
Source: (StackOverflow)
I would like to generate a figure that has a combination of base and ggplot graphics. The following code shows my figure using the base plotting functions of R:
t <- c(1:(24*14))
P <- 24
A <- 10
y <- A*sin(2*pi*t/P)+20
par(mfrow=c(2,2))
plot(y,type = "l",xlab = "Time (hours)",ylab = "Amplitude",main = "Time series")
acf(y,main = "Autocorrelation",xlab = "Lag (hours)", ylab = "ACF")
spectrum(y,method = "ar",main = "Spectral density function",
xlab = "Frequency (cycles per hour)",ylab = "Spectrum")
require(biwavelet)
t1 <- cbind(t, y)
wt.t1=wt(t1)
plot(wt.t1, plot.cb=FALSE, plot.phase=FALSE,main = "Continuous wavelet transform",
ylab = "Period (hours)",xlab = "Time (hours)")
Which generates
Most of these panels look sufficient for me to include in my report. However, the plot showing the autocorrelation needs to be improved. This looks much better by using ggplot:
require(ggplot2)
acz <- acf(y, plot=F)
acd <- data.frame(lag=acz$lag, acf=acz$acf)
ggplot(acd, aes(lag, acf)) + geom_area(fill="grey") +
geom_hline(yintercept=c(0.05, -0.05), linetype="dashed") +
theme_bw()
However, seeing as ggplot is not a base graphic, we cannot combine ggplot with layout or par(mfrow). How could I replace the autocorrelation plot generated from the base graphics with the one generated by ggplot? I know I can use grid.arrange if all of my figures were made with ggplot but how do I do this if only one of the plots are generated in ggplot?
Source: (StackOverflow)
I have and old(ish) C# method I wrote that takes a number and converts it to any base:
string ConvertToBase(int number, char[] baseChars);
It's not all that super speedy and neat. Is there a good, known way of achieving this in .NET?
I'm looking for something that allows me to use any base with an arbitrary string of characters to use.
This only allows bases 16, 10, 8 and 2:
Convert.ToString(1, x);
I want to use this to achieve a massively high base taking advantage of numbers, all lower case and all upper case letters. Like in this thread, but for C# not JavaScript.
Does anyone know of a good and efficient way of doing this in C#?
Source: (StackOverflow)
Python allows easy creation of an integer from a string of a given base via
int(str,base).
I want to perform the inverse: creation of a string from an integer.
i.e. I want some function int2base(num,base)
such that:
int( int2base( X , BASE ) , BASE ) == X
the function name/argument order is unimportant
For any number X and base BASE that int() will accept.
This is an easy function to write -- in fact easier than describing it in this question -- however, I feel like I must be missing something.
I know about the functions bin,oct,hex; but I cannot use them for a few reasons:
- Those functions are not available on older versions of python with which I need compatibility (2.2)
- I want a general solution that can be called the same way for different bases
- I want to allow bases other than 2,8,16
Related
Source: (StackOverflow)
greetings. i have the following class:
public class Ship
{
public enum ValidShips
{
Minesweeper,
Cruiser,
Destroyer,
Submarine,
AircraftCarrier
}
public enum ShipOrientation
{
North,
East,
South,
West
}
public enum ShipStatus
{
Floating,
Destroyed
}
public ValidShips shipType { get; set; }
public ShipUnit[] shipUnit { get; set; }
public ShipOrientation shipOrientation { get; set; }
public ShipStatus shipStatus { get; set; }
public Ship(ValidShips ShipType, int unitLength)
{
shipStatus = ShipStatus.Floating;
shipType = ShipType;
shipUnit = new ShipUnit[unitLength];
for (int i = 0; i < unitLength; i++)
{
shipUnit[i] = new ShipUnit();
}
}
}
i would like to inherit this class like so:
public class ShipPlacementArray : Ship
{
}
this makes sense.
what i would like to know is how do i remove certain functionality of the base class?
for example:
public ShipUnit[] shipUnit { get; set; } // from base class
i would like it to be:
public ShipUnit[][] shipUnit { get; set; } // in the derived class
my question is how do i implement the code that hides the base class shipUnit completely?
otherwise i will end up with two shipUnit implementation in the derived class.
thank you for your time.
ShipPlacementArray deals with only one ship. but the array reflects the directions the ship can be placed at.
Source: (StackOverflow)
So I'm trying to upload my first package to Hackage (yay!), and I got this error:
The dependency 'build-depends: base' does not specify an upper bound on the version number. Each major release of the 'base' package changes the API in various ways and most packages will need some changes to compile with it. The recommended practise is to specify an upper bound on the version of the 'base' package. This ensures your package will continue to build when a new major version of the 'base' package is released. If you are not sure what upper bound to use then use the next major version. For example if you have tested your package with 'base' version 2 and 3 then use 'build-depends: base >= 2 && < 4'.
Which seems like a perfectly cromulent reason to decline my package.
Is there a good tool to test my package against various versions of base
so I can see what the bounds are (rather than just guessing)? The best I can think of is to use some shell scripting to do something like:
% for v in $BASE_VERSIONS
do
cabal install base-$v &&\
cabal configure --enable-tests &&\
cabal build &&\
cabal test && echo "$v ok" || echo "$v fail"
done
But I feel like there should be something better.
Source: (StackOverflow)
In this font-size resizing tutorial:
Quick and easy font resizing
the author uses parseFloat with a second argument, which I read here:
parseFloat() w/two args
Is supposed to specify the base of the supplied number-as-string, so that you can feed it '0x10' and have it recognized as HEX by putting 16 as the second argument.
The thing is, no browser I've tested seems to do this.
Are these guys getting confused with Java?
Source: (StackOverflow)
Possible Duplicate:
How to convert a hexadecimal string to long in java?
I know that Java can't handle this:
Integer.parseInt("0x64")
Instead you have to do this:
Integer.parseInt("64", 16)
Is there something built into Java that can automatically parse integer strings for me using the standard prefixes for hex, octal, and lack of prefix for decimal (so that I don't have to strip off the prefix and explicitly set the base)?
Source: (StackOverflow)
I'm interested to specify types of missing values. I have data that have different types of missing and I am trying to code these values as missing in R, but I am looking for a solution were I can still distinguish between them.
Say I have some data that looks like this,
set.seed(667)
df <- data.frame(a = sample(c("Don't know/Not sure","Unknown","Refused","Blue", "Red", "Green"), 20, rep=TRUE), b = sample(c(1, 2, 3, 77, 88, 99), 10, rep=TRUE), f = round(rnorm(n=10, mean=.90, sd=.08), digits = 2), g = sample(c("C","M","Y","K"), 10, rep=TRUE) ); df
# a b f g
# 1 Unknown 2 0.78 M
# 2 Refused 2 0.87 M
# 3 Red 77 0.82 Y
# 4 Red 99 0.78 Y
# 5 Green 77 0.97 M
# 6 Green 3 0.99 K
# 7 Red 3 0.99 Y
# 8 Green 88 0.84 C
# 9 Unknown 99 1.08 M
# 10 Refused 99 0.81 C
# 11 Blue 2 0.78 M
# 12 Green 2 0.87 M
# 13 Blue 77 0.82 Y
# 14 Don't know/Not sure 99 0.78 Y
# 15 Unknown 77 0.97 M
# 16 Refused 3 0.99 K
# 17 Blue 3 0.99 Y
# 18 Green 88 0.84 C
# 19 Refused 99 1.08 M
# 20 Red 99 0.81 C
If I now make two tables my missing values ("Don't know/Not sure","Unknown","Refused"
and 77, 88, 99
) are included as regular data,
table(df$a,df$g)
# C K M Y
# Blue 0 0 1 2
# Don't know/Not sure 0 0 0 1
# Green 2 1 2 0
# Red 1 0 0 3
# Refused 1 1 2 0
# Unknown 0 0 3 0
and
table(df$b,df$g)
# C K M Y
# 2 0 0 4 0
# 3 0 2 0 2
# 77 0 0 2 2
# 88 2 0 0 0
# 99 2 0 2 2
I now recode the three factor levels "Don't know/Not sure","Unknown","Refused"
into <NA>
is.na(df[,c("a")]) <- df[,c("a")]=="Don't know/Not sure"|df[,c("a")]=="Unknown"|df[,c("a")]=="Refused"
and remove the empty levels
df$a <- factor(df$a)
and the same is done with the numeric values 77, 88,
and 99
is.na(df) <- df=="77"|df=="88"|df=="99"
table(df$a, df$g, useNA = "always")
# C K M Y <NA>
# Blue 0 0 1 2 0
# Green 2 1 2 0 0
# Red 1 0 0 3 0
# <NA> 1 1 5 1 0
table(df$b,df$g, useNA = "always")
# C K M Y <NA>
# 2 0 0 4 0 0
# 3 0 2 0 2 0
# <NA> 4 0 4 4 0
Now the missing categories are recode into NA
but they are all lumped together. Is there a way in a to recode something as missing, but retain the original values? I want R to thread "Don't know/Not sure","Unknown","Refused"
and 77, 88, 99
as missing, but I want to be able to still have the information in the variable.
Source: (StackOverflow)
Actually what is the Equivalent keyword of super keyword (java) in C#
My java code :
public class PrintImageLocations extends PDFStreamEngine
{
public PrintImageLocations() throws IOException
{
super( ResourceLoader.loadProperties( "org/apache/pdfbox/resources/PDFTextStripper.properties", true ) );
}
protected void processOperator( PDFOperator operator, List arguments ) throws IOException
{
super.processOperator( operator, arguments );
}
Now what exactly I need equivalent of super keyword in C#
initially tried with base
whether the way I have used the keyword base in right way
class Imagedata : PDFStreamEngine
{
public Imagedata() : base()
{
ResourceLoader.loadProperties("org/apache/pdfbox/resources/PDFTextStripper.properties", true);
}
protected override void processOperator(PDFOperator operations, List arguments)
{
base.processOperator(operations, arguments);
}
}
Can any one help me out
Thanks
Source: (StackOverflow)
I would like to remove the category & tag base from wordpress URL. I have come across other posts and solutions which used plugins. I would like to stay away from plugins and have a solution from within functions.php. This would prevent any future plugin updates or wordpress default files from being changed.
Any help would be appreciated. Thanks!
I have tried these solutions so far:
Source: (StackOverflow)
Here is my code -
#include<iostream>
using namespace std;
class base
{
private:
public:
void sid()
{
cout<<"base";
}
};
class derived : private base
{
private:
public:
void sid()
{
cout<<"derived";
}
};
int main()
{
base * ptr;
ptr = new derived; // error: 'base' is an inaccessible base of 'derived'
ptr->sid();
return 0;
}
This gives a compile time error.
error: 'base' is an inaccessible base of 'derived'
Since the compiler will try and call the base class sid()
why do I get this error? Can someone please explain this.
Source: (StackOverflow)