Friday 30 September 2016

Get int value from enum in C#



I have a class called Questions (plural). In this class there is an enum called Question (singular) which looks like this.



public enum Question
{
Role = 2,
ProjectFunding = 3,

TotalEmployee = 4,
NumberOfServers = 5,
TopBusinessConcern = 6
}


In the Questions class, I have a get(int foo) function that returns a Questions object for that foo. Is there an easy way to get the integer value from the enum so I can do something like Questions.Get(Question.Role)?


Answer



Just cast the enum, e.g.




int something = (int) Question.Role;


The above will work for the vast majority of enums you see in the wild, as the default underlying type for an enum is int.



However, as cecilphillip points out, enums can have different underlying types.
If an enum is declared as a uint, long, or ulong, it should be cast to the type of the enum; e.g. for



enum StarsInMilkyWay:long {Sun = 1, V645Centauri = 2 .. Wolf424B = 2147483649};



you should use



long something = (long)StarsInMilkyWay.Wolf424B;

r faq - How to make a great R reproducible example




When discussing performance with colleagues, teaching, sending a bug report or searching for guidance on mailing lists and here on Stack Overflow, a reproducible example is often asked and always helpful.



What are your tips for creating an excellent example? How do you paste data structures from in a text format? What other information should you include?



Are there other tricks in addition to using dput(), dump() or structure()? When should you include library() or require() statements? Which reserved words should one avoid, in addition to c, df, data, etc.?




How does one make a great reproducible example?


Answer



A minimal reproducible example consists of the following items:




  • a minimal dataset, necessary to demonstrate the problem

  • the minimal runnable code necessary to reproduce the error, which can be run on the given dataset

  • the necessary information on the used packages, R version, and system it is run on.

  • in the case of random processes, a seed (set by set.seed()) for reproducibility1




For examples of good minimal reproducible examples, see the help files of the function you are using. In general, all the code given there fulfills the requirements of a minimal reproducible example: data is provided, minimal code is provided, and everything is runnable. Also look at questions on with lots of upvotes.



Producing a minimal dataset



For most cases, this can be easily done by just providing a vector/data frame with some values. Or you can use one of the built-in datasets, which are provided with most packages.
A comprehensive list of built-in datasets can be seen with library(help = "datasets"). There is a short description to every dataset and more information can be obtained for example with ?mtcars where 'mtcars' is one of the datasets in the list. Other packages might contain additional datasets.



Making a vector is easy. Sometimes it is necessary to add some randomness to it, and there are a whole number of functions to make that. sample() can randomize a vector, or give a random vector with only a few values. letters is a useful vector containing the alphabet. This can be used for making factors.




A few examples :




  • random values : x <- rnorm(10) for normal distribution, x <- runif(10) for uniform distribution, ...

  • a permutation of some values : x <- sample(1:10) for vector 1:10 in random order.

  • a random factor : x <- sample(letters[1:4], 20, replace = TRUE)



For matrices, one can use matrix(), eg :




matrix(1:10, ncol = 2)


Making data frames can be done using data.frame(). One should pay attention to name the entries in the data frame, and to not make it overly complicated.



An example :



set.seed(1)
Data <- data.frame(
X = sample(1:10),

Y = sample(c("yes", "no"), 10, replace = TRUE)
)


For some questions, specific formats can be needed. For these, one can use any of the provided as.someType functions : as.factor, as.Date, as.xts, ... These in combination with the vector and/or data frame tricks.



Copy your data



If you have some data that would be too difficult to construct using these tips, then you can always make a subset of your original data, using head(), subset() or the indices. Then use dput() to give us something that can be put in R immediately :




> dput(iris[1:4, ]) # first four rows of the iris data set
structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6), Sepal.Width = c(3.5,
3, 3.2, 3.1), Petal.Length = c(1.4, 1.4, 1.3, 1.5), Petal.Width = c(0.2,
0.2, 0.2, 0.2), Species = structure(c(1L, 1L, 1L, 1L), .Label = c("setosa",
"versicolor", "virginica"), class = "factor")), .Names = c("Sepal.Length",
"Sepal.Width", "Petal.Length", "Petal.Width", "Species"), row.names = c(NA,
4L), class = "data.frame")


If your data frame has a factor with many levels, the dput output can be unwieldy because it will still list all the possible factor levels even if they aren't present in the the subset of your data. To solve this issue, you can use the droplevels() function. Notice below how species is a factor with only one level:




> dput(droplevels(iris[1:4, ]))
structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6), Sepal.Width = c(3.5,
3, 3.2, 3.1), Petal.Length = c(1.4, 1.4, 1.3, 1.5), Petal.Width = c(0.2,
0.2, 0.2, 0.2), Species = structure(c(1L, 1L, 1L, 1L), .Label = "setosa",
class = "factor")), .Names = c("Sepal.Length", "Sepal.Width",
"Petal.Length", "Petal.Width", "Species"), row.names = c(NA,
4L), class = "data.frame")



When using dput, you may also want to include only relevant columns:



> dput(mtcars[1:3, c(2, 5, 6)]) # first three rows of columns 2, 5, and 6
structure(list(cyl = c(6, 6, 4), drat = c(3.9, 3.9, 3.85), wt = c(2.62,
2.875, 2.32)), row.names = c("Mazda RX4", "Mazda RX4 Wag", "Datsun 710"
), class = "data.frame")


One other caveat for dput is that it will not work for keyed data.table objects or for grouped tbl_df (class grouped_df) from dplyr. In these cases you can convert back to a regular data frame before sharing, dput(as.data.frame(my_data)).




Worst case scenario, you can give a text representation that can be read in using the text parameter of read.table :



zz <- "Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa"


Data <- read.table(text=zz, header = TRUE)


Producing minimal code



This should be the easy part but often isn't. What you should not do, is:




  • add all kind of data conversions. Make sure the provided data is already in the correct format (unless that is the problem of course)

  • copy-paste a whole function/chunk of code that gives an error. First, try to locate which lines exactly result in the error. More often than not you'll find out what the problem is yourself.




What you should do, is:




  • add which packages should be used if you use any (using library())

  • if you open connections or create files, add some code to close them or delete the files (using unlink())

  • if you change options, make sure the code contains a statement to revert them back to the original ones. (eg op <- par(mfrow=c(1,2)) ...some code... par(op) )

  • test run your code in a new, empty R session to make sure the code is runnable. People should be able to just copy-paste your data and your code in the console and get exactly the same as you have.




Give extra information



In most cases, just the R version and the operating system will suffice. When conflicts arise with packages, giving the output of sessionInfo() can really help. When talking about connections to other applications (be it through ODBC or anything else), one should also provide version numbers for those, and if possible also the necessary information on the setup.



If you are running R in R Studio using rstudioapi::versionInfo() can be helpful to report your RStudio version.



If you have a problem with a specific package you may want to provide the version of the package by giving the output of packageVersion("name of the package").







1 Note: The output of set.seed() differs between R >3.6.0 and previous versions. Do specify which R version you used for the random process, and don't be surprised if you get slightly different results when following old questions. To get the same result in such cases, you can use the RNGversion()-function before set.seed() (e.g.: RNGversion("3.5.2")).


javascript - TypeError: "this..." is not a function




I define hostService as follows. The senario is I call first hostService.addListener() in the controller, then the controller may emit a message by $rootSceop.$emit, hostService is supposed to handle it.



app.service('hostService', ['$rootScope', function ($rootScope) {    
this.button = function () {
Office.context.ui.displayDialogAsync("https://www.google.com", {}, function () {});
}

this.addListener = function () {

$rootScope.$on("message", function (event, data) {
this.button()
})
}


However, the problem is the above code raises an error:



TypeError: this.button is not a function



Does anyone know how to fix it?


Answer



I solve this creating a self variable with this object, then you can call it from diferent scope:



app.service('hostService', ['$rootScope', function ($rootScope) {    

var self = this

this.button = function () {

Office.context.ui.displayDialogAsync("https://www.google.com", {}, function () {});
}

this.addListener = function () {
$rootScope.$on("message", function (event, data) {
self.button()
})
}

Iterating a JavaScript object's properties using jQuery



Is there a jQuery way to perform iteration over an object's members, such as in:



    for (var member in obj) {
...
}



I just don't like this for sticking out from amongst my lovely jQuery notation!


Answer



$.each( { name: "John", lang: "JS" }, function(i, n){
alert( "Name: " + i + ", Value: " + n );
});


each



c# - How to start programming from scratch?

I've never really had any experience with programming at all, my uncle told me to come to this site for help from total strangers if I wanted to start programming. I know the names of a couple of languages but I don't really know anything at all. I'm fourteen and I can type fast if that counts for anything. One of my uncles wanted me to learn c#. So my question is, is c# a good place to begin, and if not, where is a good place to begin and how do I learn it?

How to set limits for axes in ggplot2 R plots?



I plot the following:



library(ggplot2)    


carrots <- data.frame(length = rnorm(500000, 10000, 10000))
cukes <- data.frame(length = rnorm(50000, 10000, 20000))
carrots$veg <- 'carrot'
cukes$veg <- 'cuke'
vegLengths <- rbind(carrots, cukes)

ggplot(vegLengths, aes(length, fill = veg)) +
geom_density(alpha = 0.2)



Now say I only want to plot the region between x=-5000 to 5000, instead of the entire range.



How can I do that?


Answer



Basically you have two options



scale_x_continuous(limits = c(-5000, 5000))


or




coord_cartesian(xlim = c(-5000, 5000)) 


Where the first removes all data points outside the given range and the second only adjusts the visible area. In most cases you would not see the difference, but if you fit anything to the data it would probably change the fitted values.



You can also use the shorthand function xlim (or ylim), which like the first option removes data points outside of the given range:



+ xlim(-5000, 5000)



For more information check the description of coord_cartesian.



The RStudio cheatsheet for ggplot2 makes this quite clear visually. Here is a small section of that cheatsheet:



enter image description here



Distributed under CC BY.


assembly - How does division by constant work in avr-gcc?





In avr assembly, I wanted to divide a number by a constant.
I checked how to see how avr-gcc does it.
So in a c file I have :



#include 


uint8_t divide_by_6(uint8_t x) {
return x / 6;
}


and when I run avr-gcc -O3 -mmcu=atmega16 -D__AVR_ATmega16__ -S main.c it gives me:



divide_by_6:
ldi r25,lo8(-85)
mul r24,r25

mov r24,r1
clr r1
lsr r24
lsr r24
ret


But I do not understand what this assembly is doing.
How does this assembly code perform division?


Answer




-85 is 0xFFFFFFFFFFFFFFAB, so lo8(-85) is 0xAB, which is 171.



The code is multiplying the argument by 171, and then returning the most significant byte of the product, shifted right by 2 (i.e. divided by 4).



So it's effectively returning x * 171 / (256 * 4) == x * 171 / 1024, which is approximately == x * 1 / 6 == x / 6.


c++ - Where and why do I have to put the "template" and "typename" keywords?



In templates, where and why do I have to put typename and template on dependent names? What exactly are dependent names anyway? I have the following code:



template  // Tail will be a UnionNode too.
struct UnionNode : public Tail {

// ...
template struct inUnion {
// Q: where to add typename/template here?
typedef Tail::inUnion dummy;
};
template< > struct inUnion {
};
};
template // For the last node Tn.
struct UnionNode {

// ...
template struct inUnion {
char fail[ -2 + (sizeof(U)%2) ]; // Cannot be instantiated for any U
};
template< > struct inUnion {
};
};


The problem I have is in the typedef Tail::inUnion dummy line. I'm fairly certain that inUnion is a dependent name, and VC++ is quite right in choking on it. I also know that I should be able to add template somewhere to tell the compiler that inUnion is a template-id. But where exactly? And should it then assume that inUnion is a class template, i.e. inUnion names a type and not a function?



Answer



In order to parse a C++ program, the compiler needs to know whether certain names are types or not. The following example demonstrates that:



t * f;


How should this be parsed? For many languages a compiler doesn't need to know the meaning of a name in order to parse and basically know what action a line of code does. In C++, the above however can yield vastly different interpretations depending on what t means. If it's a type, then it will be a declaration of a pointer f. However if it's not a type, it will be a multiplication. So the C++ Standard says at paragraph (3/7):




Some names denote types or templates. In general, whenever a name is encountered it is necessary to determine whether that name denotes one of these entities before continuing to parse the program that contains it. The process that determines this is called name lookup.





How will the compiler find out what a name t::x refers to, if t refers to a template type parameter? x could be a static int data member that could be multiplied or could equally well be a nested class or typedef that could yield to a declaration. If a name has this property - that it can't be looked up until the actual template arguments are known - then it's called a dependent name (it "depends" on the template parameters).



You might recommend to just wait till the user instantiates the template:




Let's wait until the user instantiates the template, and then later find out the real meaning of t::x * f;.





This will work and actually is allowed by the Standard as a possible implementation approach. These compilers basically copy the template's text into an internal buffer, and only when an instantiation is needed, they parse the template and possibly detect errors in the definition. But instead of bothering the template's users (poor colleagues!) with errors made by a template's author, other implementations choose to check templates early on and give errors in the definition as soon as possible, before an instantiation even takes place.



So there has to be a way to tell the compiler that certain names are types and that certain names aren't.



The "typename" keyword



The answer is: We decide how the compiler should parse this. If t::x is a dependent name, then we need to prefix it by typename to tell the compiler to parse it in a certain way. The Standard says at (14.6/2):




A name used in a template declaration or definition and that is dependent on a template-parameter is

assumed not to name a type unless the applicable name lookup finds a type name or the name is qualified
by the keyword typename.




There are many names for which typename is not necessary, because the compiler can, with the applicable name lookup in the template definition, figure out how to parse a construct itself - for example with T *f;, when T is a type template parameter. But for t::x * f; to be a declaration, it must be written as typename t::x *f;. If you omit the keyword and the name is taken to be a non-type, but when instantiation finds it denotes a type, the usual error messages are emitted by the compiler. Sometimes, the error consequently is given at definition time:



// t::x is taken as non-type, but as an expression the following misses an
// operator between the two names or a semicolon separating them.
t::x f;



The syntax allows typename only before qualified names - it is therefor taken as granted that unqualified names are always known to refer to types if they do so.



A similar gotcha exists for names that denote templates, as hinted at by the introductory text.



The "template" keyword



Remember the initial quote above and how the Standard requires special handling for templates as well? Let's take the following innocent-looking example:



boost::function< int() > f;



It might look obvious to a human reader. Not so for the compiler. Imagine the following arbitrary definition of boost::function and f:



namespace boost { int function = 0; }
int main() {
int f = 0;
boost::function< int() > f;
}



That's actually a valid expression! It uses the less-than operator to compare boost::function against zero (int()), and then uses the greater-than operator to compare the resulting bool against f. However as you might well know, boost::function in real life is a template, so the compiler knows (14.2/3):




After name lookup (3.4) finds that a name is a template-name, if this name is followed by a <, the < is
always taken as the beginning of a template-argument-list and never as a name followed by the less-than
operator.




Now we are back to the same problem as with typename. What if we can't know yet whether the name is a template when parsing the code? We will need to insert template immediately before the template name, as specified by 14.2/4. This looks like:




t::template f(); // call a function template


Template names can not only occur after a :: but also after a -> or . in a class member access. You need to insert the keyword there too:



this->template f(); // call a function template






Dependencies



For the people that have thick Standardese books on their shelf and that want to know what exactly I was talking about, I'll talk a bit about how this is specified in the Standard.



In template declarations some constructs have different meanings depending on what template arguments you use to instantiate the template: Expressions may have different types or values, variables may have different types or function calls might end up calling different functions. Such constructs are generally said to depend on template parameters.



The Standard defines precisely the rules by whether a construct is dependent or not. It separates them into logically different groups: One catches types, another catches expressions. Expressions may depend by their value and/or their type. So we have, with typical examples appended:





  • Dependent types (e.g: a type template parameter T)

  • Value-dependent expressions (e.g: a non-type template parameter N)

  • Type-dependent expressions (e.g: a cast to a type template parameter (T)0)



Most of the rules are intuitive and are built up recursively: For example, a type constructed as T[N] is a dependent type if N is a value-dependent expression or T is a dependent type. The details of this can be read in section (14.6.2/1) for dependent types, (14.6.2.2) for type-dependent expressions and (14.6.2.3) for value-dependent expressions.



Dependent names



The Standard is a bit unclear about what exactly is a dependent name. On a simple read (you know, the principle of least surprise), all it defines as a dependent name is the special case for function names below. But since clearly T::x also needs to be looked up in the instantiation context, it also needs to be a dependent name (fortunately, as of mid C++14 the committee has started to look into how to fix this confusing definition).




To avoid this problem, I have resorted to a simple interpretation of the Standard text. Of all the constructs that denote dependent types or expressions, a subset of them represent names. Those names are therefore "dependent names". A name can take different forms - the Standard says:




A name is a use of an identifier (2.11), operator-function-id (13.5), conversion-function-id (12.3.2), or template-id (14.2) that denotes an entity or label (6.6.4, 6.1)




An identifier is just a plain sequence of characters / digits, while the next two are the operator + and operator type form. The last form is template-name . All these are names, and by conventional use in the Standard, a name can also include qualifiers that say what namespace or class a name should be looked up in.



A value dependent expression 1 + N is not a name, but N is. The subset of all dependent constructs that are names is called dependent name. Function names, however, may have different meaning in different instantiations of a template, but unfortunately are not caught by this general rule.




Dependent function names



Not primarily a concern of this article, but still worth mentioning: Function names are an exception that are handled separately. An identifier function name is dependent not by itself, but by the type dependent argument expressions used in a call. In the example f((T)0), f is a dependent name. In the Standard, this is specified at (14.6.2/1).



Additional notes and examples



In enough cases we need both of typename and template. Your code should look like the following



template 

struct UnionNode : public Tail {
// ...
template struct inUnion {
typedef typename Tail::template inUnion dummy;
};
// ...
};


The keyword template doesn't always have to appear in the last part of a name. It can appear in the middle before a class name that's used as a scope, like in the following example




typename t::template iterator::value_type v;


In some cases, the keywords are forbidden, as detailed below




  • On the name of a dependent base class you are not allowed to write typename. It's assumed that the name given is a class type name. This is true for both names in the base-class list and the constructor initializer list:



     template 

    struct derive_from_Has_type : /* typename */ SomeBase::type
    { };

  • In using-declarations it's not possible to use template after the last ::, and the C++ committee said not to work on a solution.



     template 
    struct derive_from_Has_type : SomeBase {
    using SomeBase::template type; // error
    using typename SomeBase::type; // typename *is* allowed
    };



security - Best Practices: Salting & peppering passwords?




I came across a discussion in which I learned that what I'd been doing wasn't in fact salting passwords but peppering them, and I've since begun doing both with a function like:



hash_function($salt.hash_function($pepper.$password)) [multiple iterations]


Ignoring the chosen hash algorithm (I want this to be a discussion of salts & peppers and not specific algorithms but I'm using a secure one), is this a secure option or should I be doing something different? For those unfamiliar with the terms:




  • A salt is a randomly generated value usually stored with the string in the database designed to make it impossible to use hash tables to crack passwords. As each password has its own salt, they must all be brute-forced individually in order to crack them; however, as the salt is stored in the database with the password hash, a database compromise means losing both.


  • A pepper is a site-wide static value stored separately from the database (usually hard-coded in the application's source code) which is intended to be secret. It is used so that a compromise of the database would not cause the entire application's password table to be brute-forceable.





Is there anything I'm missing and is salting & peppering my passwords the best option to protect my user's security? Is there any potential security flaw to doing it this way?



Note: Assume for the purpose of the discussion that the application & database are stored on separate machines, do not share passwords etc. so a breach of the database server does not automatically mean a breach of the application server.


Answer



Ok. Seeing as I need to write about this over and over, I'll do one last canonical answer on pepper alone.






It seems quite obvious that peppers should make hash functions more secure. I mean, if the attacker only gets your database, then your users passwords should be secure, right? Seems logical, right?



That's why so many people believe that peppers are a good idea. It "makes sense".





In the security and cryptography realms, "make sense" isn't enough. Something has to be provable and make sense in order for it to be considered secure. Additionally, it has to be implementable in a maintainable way. The most secure system that can't be maintained is considered insecure (because if any part of that security breaks down, the entire system falls apart).



And peppers fit neither the provable or the maintainable models...






Now that we've set the stage, let's look at what's wrong with peppers.




  • Feeding one hash into another can be dangerous.



    In your example, you do hash_function($salt . hash_function($pepper . $password)).



    We know from past experience that "just feeding" one hash result into another hash function can decrease the overall security. The reason is that both hash functions can become a target of attack.




    That's why algorithms like PBKDF2 use special operations to combine them (hmac in that case).



    The point is that while it's not a big deal, it is also not a trivial thing to just throw around. Crypto systems are designed to avoid "should work" cases, and instead focus on "designed to work" cases.



    While this may seem purely theoretical, it's in fact not. For example, Bcrypt cannot accept arbitrary passwords. So passing bcrypt(hash(pw), salt) can indeed result in a far weaker hash than bcrypt(pw, salt) if hash() returns a binary string.


  • Working Against Design



    The way bcrypt (and other password hashing algorithms) were designed is to work with a salt. The concept of a pepper was never introduced. This may seem like a triviality, but it's not. The reason is that a salt is not a secret. It is just a value that can be known to an attacker. A pepper on the other hand, by very definition is a cryptographic secret.




    The current password hashing algorithms (bcrypt, pbkdf2, etc) all are designed to only take in one secret value (the password). Adding in another secret into the algorithm hasn't been studied at all.



    That doesn't mean it is not safe. It means we don't know if it is safe. And the general recommendation with security and cryptography is that if we don't know, it isn't.



    So until algorithms are designed and vetted by cryptographers for use with secret values (peppers), current algorithms shouldn't be used with them.


  • Complexity Is The Enemy Of Security



    Believe it or not, Complexity Is The Enemy Of Security. Making an algorithm that looks complex may be secure, or it may be not. But the chances are quite significant that it's not secure.








  • It's Not Maintainable



    Your implementation of peppers precludes the ability to rotate the pepper key. Since the pepper is used at the input to the one way function, you can never change the pepper for the lifetime of the value. This means that you'd need to come up with some wonky hacks to get it to support key rotation.



    This is extremely important as it's required whenever you store cryptographic secrets. Not having a mechanism to rotate keys (periodically, and after a breach) is a huge security vulnerability.



    And your current pepper approach would require every user to either have their password completely invalidated by a rotation, or wait until their next login to rotate (which may be never)...




    Which basically makes your approach an immediate no-go.


  • It Requires You To Roll Your Own Crypto



    Since no current algorithm supports the concept of a pepper, it requires you to either compose algorithms or invent new ones to support a pepper. And if you can't immediately see why that's a really bad thing:




    Anyone, from the most clueless amateur to the best cryptographer, can create an algorithm that he himself can't break.







    NEVER roll your own crypto...






So, out of all the problems detailed above, there are two ways of handling the situation.





  • Just Use The Algorithms As They Exist



    If you use bcrypt or scrypt correctly (with a high cost), all but the weakest dictionary passwords should be statistically safe. The current record for hashing bcrypt at cost 5 is 71k hashes per second. At that rate even a 6 character random password would take years to crack. And considering my minimum recommended cost is 10, that reduces the hashes per second by a factor of 32. So we'd be talking only about 2200 hashes per second. At that rate, even some dictionary phrases or modificaitons may be safe.



    Additionally, we should be checking for those weak classes of passwords at the door and not allowing them in. As password cracking gets more advanced, so should password quality requirements. It's still a statistical game, but with a proper storage technique, and strong passwords, everyone should be practically very safe...


  • Encrypt The Output Hash Prior To Storage



    There exists in the security realm an algorithm designed to handle everything we've said above. It's a block cipher. It's good, because it's reversible, so we can rotate keys (yay! maintainability!). It's good because it's being used as designed. It's good because it gives the user no information.



    Let's look at that line again. Let's say that an attacker knows your algorithm (which is required for security, otherwise it's security through obscurity). With a traditional pepper approach, the attacker can create a sentinel password, and since he knows the salt and the output, he can brute force the pepper. Ok, that's a long shot, but it's possible. With a cipher, the attacker gets nothing. And since the salt is randomized, a sentinel password won't even help him/her. So the best they are left with is to attack the encrypted form. Which means that they first have to attack your encrypted hash to recover the encryption key, and then attack the hashes. But there's a lot of research into the attacking of ciphers, so we want to rely on that.







Don't use peppers. There are a host of problems with them, and there are two better ways: not using any server-side secret (yes, it's ok) and encrypting the output hash using a block cipher prior to storage.


How to get today's Date in java in the following pattern dd/MM/yyyy?

I am trying the code



    Date today = new Date();
Date todayWithZeroTime;
{
try {
todayWithZeroTime = formatter.parse(formatter.format(today));
} catch (ParseException e) {
e.printStackTrace();

}
}
String date = todayWithZeroTime.toString();


it is giving output :- Wed Dec 11 00:00:00 IST 2019
where I want 11/12/2019
where 11/12/2019 is today's date

android - How to change the font on the TextView?



How to change the font in a TextView, as default it's shown up as Arial? How to change it to Helvetica?


Answer



First, the default is not Arial. The default is Droid Sans.




Second, to change to a different built-in font, use android:typeface in layout XML or setTypeface() in Java.



Third, there is no Helvetica font in Android. The built-in choices are Droid Sans (sans), Droid Sans Mono (monospace), and Droid Serif (serif). While you can bundle your own fonts with your application and use them via setTypeface(), bear in mind that font files are big and, in some cases, require licensing agreements (e.g., Helvetica, a Linotype font).



EDIT




The Android design language relies on traditional typographic tools
such as scale, space, rhythm, and alignment with an underlying grid.

Successful deployment of these tools is essential to help users
quickly understand a screen of information. To support such use of
typography, Ice Cream Sandwich introduced a new type family named
Roboto, created specifically for the requirements of UI and
high-resolution screens.



The current TextView framework offers Roboto in thin, light, regular
and bold weights, along with an italic style for each weight. The
framework also offers the Roboto Condensed variant in regular and bold
weights, along with an italic style for each weight.





After ICS, android includes Roboto fonts style,
Read more Roboto



EDIT 2




With the advent of Support Library 26, Android now supports custom fonts by
default. You can insert new fonts in res/fonts which can be set to TextViews individually either in XML or programmatically. The default font for the whole application can also be changed by defining it styles.xml The android developer documentation has a clear guide on this here




function - What is the scope of variables in JavaScript?



What is the scope of variables in javascript? Do they have the same scope inside as opposed to outside a function? Or does it even matter? Also, where are the variables stored if they are defined globally?



Answer



I think about the best I can do is give you a bunch of examples to study.
Javascript programmers are practically ranked by how well they understand scope.
It can at times be quite counter-intuitive.




  1. A globally-scoped variable



    // global scope
    var a = 1;


    function one() {
    alert(a); // alerts '1'
    }

  2. Local scope



    // global scope
    var a = 1;


    function two(a) { // passing (a) makes it local scope
    alert(a); // alerts the given argument, not the global value of '1'
    }

    // local scope again
    function three() {
    var a = 3;
    alert(a); // alerts '3'
    }


  3. Intermediate: No such thing as block scope in JavaScript (ES5; ES6 introduces let and const)



    a.



    var a = 1;

    function four() {
    if (true) {
    var a = 4;
    }


    alert(a); // alerts '4', not the global value of '1'
    }


    b.



    var a = 1;

    function one() {

    if (true) {
    let a = 4;
    }

    alert(a); // alerts '1' because the 'let' keyword uses block scoping
    }


    c.




    var a = 1;

    function one() {
    if (true) {
    const a = 4;
    }

    alert(a); // alerts '1' because the 'const' keyword also uses block scoping as 'let'
    }


  4. Intermediate: Object properties



    var a = 1;

    function Five() {
    this.a = 5;
    }

    alert(new Five().a); // alerts '5'


  5. Advanced: Closure



    var a = 1;

    var six = (function() {
    var a = 6;

    return function() {
    // JavaScript "closure" means I have access to 'a' in here,
    // because it is defined in the function in which I was defined.

    alert(a); // alerts '6'
    };
    })();

  6. Advanced: Prototype-based scope resolution



    var a = 1;

    function seven() {
    this.a = 7;

    }

    // [object].prototype.property loses to
    // [object].property in the lookup chain. For example...

    // Won't get reached, because 'a' is set in the constructor above.
    seven.prototype.a = -1;

    // Will get reached, even though 'b' is NOT set in the constructor.
    seven.prototype.b = 8;


    alert(new seven().a); // alerts '7'
    alert(new seven().b); // alerts '8'




  7. Global+Local: An extra complex Case



    var x = 5;


    (function () {
    console.log(x);
    var x = 10;
    console.log(x);
    })();


    This will print out undefined and 10 rather than 5 and 10 since JavaScript always moves variable declarations (not initializations) to the top of the scope, making the code equivalent to:



    var x = 5;


    (function () {
    var x;
    console.log(x);
    x = 10;
    console.log(x);
    })();

  8. Catch clause-scoped variable




    var e = 5;
    console.log(e);
    try {
    throw 6;
    } catch (e) {
    console.log(e);
    }
    console.log(e);



    This will print out 5, 6, 5. Inside the catch clause e shadows global and local variables. But this special scope is only for the caught variable. If you write var f; inside the catch clause, then it's exactly the same as if you had defined it before or after the try-catch block.



unit testing - What is Mocking?



What is Mocking?                                                                                                    .


Answer



Prologue: If you look up the noun mock in the dictionary you will find that one of the definitions of the word is something made as an imitation.






Mocking is primarily used in unit testing. An object under test may have dependencies on other (complex) objects. To isolate the behavior of the object you want to replace the other objects by mocks that simulate the behavior of the real objects. This is useful if the real objects are impractical to incorporate into the unit test.



In short, mocking is creating objects that simulate the behavior of real objects.






At times you may want to distinguish between mocking as opposed to stubbing. There may be some disagreement about this subject but my definition of a stub is a "minimal" simulated object. The stub implements just enough behavior to allow the object under test to execute the test.



A mock is like a stub but the test will also verify that the object under test calls the mock as expected. Part of the test is verifying that the mock was used correctly.



To give an example: You can stub a database by implementing a simple in-memory structure for storing records. The object under test can then read and write records to the database stub to allow it to execute the test. This could test some behavior of the object not related to the database and the database stub would be included just to let the test run.



If you instead want to verify that the object under test writes some specific data to the database you will have to mock the database. Your test would then incorporate assertions about what was written to the database mock.


plot explanation - Why did Grandfather insist on Albert knowing Emilie's name before giving him the horse? - Movies & TV



Towards the end of the film "War Horse," Albert is attempting to bid on the horse, Joey, before it is auctioned off by the military. Also present at the auction is Emilie's grandfather (unnamed), who ultimately wins the horse with a high bid.



At first, Grandfather tries to leave with Joey, but the horse insists on returning to Albert's side. Initially, Grandfather only offers Albert his father's military regalia, which Albert had tied to the horse before it was sold to the army in the first place.



Finally, Grandfather relents on giving the horse to Albert, but not after emphatically offering that "[His granddaugher's] name was Emilie." This seems to be the final condition for handing over the horse. Albert nods in understanding, and the exchange is made. As Grandfather is walking away, he again repeats "Her name is Emilie" (which, as an aside, I have seen interpreted as an admission that she's alive).




Why is Grandfather so insistent upon Albert knowing her name? Was it an attempt to guilt Albert into giving him the horse after all? Or, if she was in fact dead, did he use it to humanize a victim of war? Or was it simply to clue us into Emilie's status and illustrate the lengths to which Grandfather would go to get the horse for her?


Answer



Actually it is Albert that insists upon knowing his granddaughters name, not the other way around. I think Albert wants to know her name because he wants to show the old man that he actually cares- and he isn't just using him for getting Joey. He is just trying to honour the little girl's memory a bit by taking interest in her. And Albert's probably thankful to the little girl for her taking care of Joey. He's just asking for her name so she can be remembered when the old man is dead because Albert probably knows that won't be long, since the old man will either die soon of old age or kill himself because he has nothing now.


A quick and easy way to join array elements with a separator (the opposite of split) in Java




See Related .NET question




I'm looking for a quick and easy way to do exactly the opposite of split
so that it will cause ["a","b","c"] to become "a,b,c"



Iterating through an array requires either adding a condition (if this is not the last element, add the seperator) or using substring to remove the last separator.



I'm sure there is a certified, efficient way to do it (Apache Commons?)



How do you prefer doing it in your projects?


Answer



Using Java 8 you can do this in a very clean way:




String.join(delimiter, elements);


This works in three ways:



1) directly specifying the elements



String joined1 = String.join(",", "a", "b", "c");



2) using arrays



String[] array = new String[] { "a", "b", "c" };
String joined2 = String.join(",", array);


3) using iterables



List list = Arrays.asList(array);

String joined3 = String.join(",", list);

angular - What is the difference between Promises and Observables?



Can someone please explain the difference between Promise and Observable in Angular?



An example on each would be helpful in understanding both the cases.
In what scenario can we use each case?


Answer



Promise




A Promise handles a single event when an async operation completes or fails.



Note: There are Promise libraries out there that support cancellation, but ES6 Promise doesn't so far.



Observable



An Observable is like a Stream (in many languages) and allows to pass zero or more events where the callback is called for each event.



Often Observable is preferred over Promise because it provides the features of Promise and more. With Observable it doesn't matter if you want to handle 0, 1, or multiple events. You can utilize the same API in each case.




Observable also has the advantage over Promise to be cancelable. If the result of an HTTP request to a server or some other expensive async operation isn't needed anymore, the Subscription of an Observable allows to cancel the subscription, while a Promise will eventually call the success or failed callback even when you don't need the notification or the result it provides anymore.



Observable provides operators like map, forEach, reduce, ... similar to an array



There are also powerful operators like retry(), or replay(), ... that are often quite handy.


Please explain the use of JavaScript closures in loops




I have read a number of explanations about closures and closures inside loops. I have a hard time understanding the concept. I have this code: Is there a way to reduce the code as much as possible so the concept of closure can be made clearer. I am having a hard time understanding the part in which the i is inside two parenthesis. Thanks



function addLinks () {
for (var i=0, link; i<5; i++) {

link = document.createElement("a");
link.innerHTML = "Link " + i;



link.onclick = function (num) {
return function () {
alert(num);
};
}(i);
document.body.appendChild(link);

}
}
window.onload = addLinks;


Answer



WARNING: Long(ish) Answer



This is copied directly from an article I wrote in an internal company wiki:



Question: How to properly use closures in loops?
Quick answer: Use a function factory.



  for (var i=0; i<10; i++) {

document.getElementById(i).onclick = (function(x){
return function(){
alert(x);
}
})(i);
}


or the more easily readable version:




  function generateMyHandler (x) {
return function(){
alert(x);
}
}

for (var i=0; i<10; i++) {
document.getElementById(i).onclick = generateMyHandler(i);
}



This often confuse people who are new to javascript or functional programming. It is a result of misunderstanding what closures are.



A closure does not merely pass the value of a variable or even a reference to the variable. A closure captures the variable itself! The following bit of code illustrates this:



  var message = 'Hello!';
document.getElementById('foo').onclick = function(){alert(message)};
message = 'Goodbye!';



Clicking the element 'foo' will generate an alert box with the message: "Goodbye!". Because of this, using a simple closure in a loop will end up with all closures sharing the same variable and that variable will contain the last value assigned to it in the loop. For example:



  for (var i=0; i<10; i++) {
document.getElementById('something'+i).onclick = function(){alert(i)};
}


All elements when clicked will generate an alert box with the number 10. In fact, if we now do i="hello"; all elements will now generate a "hello" alert! The variable i is shared across ten functions PLUS the current function/scope/context. Think of it as a sort of private global variable that only the functions involved can see.



What we want is an instance of that variable or at least a simple reference to the variable instead of the variable itself. Fortunately javascript already has a mechanism for passing a reference (for objects) or value (for strings and numbers): function arguments!




When a function is called in javascript the arguments to that function is passed by reference if it is an object or by value if it is a string or number. This is enough to break variable sharing in closures.



So:



  for (var i=0; i<10; i++) {
document.getElementById(i).onclick =
(function(x){ /* we use this function expression simply as a factory
to return the function we really want to use: */


/* we want to return a function reference
so we write a function expression*/
return function(){
alert(x); /* x here refers to the argument of the factory function
captured by the 'inner' closure */
}

/* The brace operators (..) evaluates an expression, in this case this
function expression which yields a function reference. */


})(i) /* The function reference generated is then immediately called()
where the variable i is passed */
}

php - Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted (CodeIgniter + XML-RPC)

I have a bunch of client point of sale (POS) systems that periodically send new sales data to one centralized database, which stores the data into one big database for report generation.




The client POS is based on PHPPOS, and I have implemented a module that uses the standard XML-RPC library to send sales data to the service. The server system is built on CodeIgniter, and uses the XML-RPC and XML-RPCS libraries for the webservice component. Whenever I send a lot of sales data (as little as 50 rows from the sales table, and individual rows from sales_items pertaining to each item within the sale) I get the following error:



Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 54 bytes)


128M is the default value in php.ini, but I assume that is a huge number to break. In fact, I have even tried setting this value to 1024M, and all it does is take a longer time to error out.



As for steps I've taken, I've tried disabling all processing on the server-side, and have rigged it to return a canned response regardless of the input. However, I believe the problem lies in the actual sending of the data. I've even tried disabling the maximum script execution time for PHP, and it still errors out.

Thursday 29 September 2016

VBA deleting a duplicate copy of chart object fails in Excel 2013



I have a VBA code that is intended to copy the contents of a range into a chart, to be able to export it to a PNG file (+some post-processing using an external command). Here is the relevant part:



Sub GenererImage()  ' Entry point
getparams ' Collect parameters and define global variables
MiseEnPage.Range(ZoneImage).CopyPicture Appearance:=xlScreen,Format:=xlPicture
Application.DisplayAlerts = False

With ObjetGraphique.Duplicate
.Chart.Paste
.Chart.Export Filename:=CheminImage, Filtername:="PNG"
.Select
.Delete
End With
Application.DisplayAlerts = True
End Sub


The getparams procedure called in there is just collecting some parameters from another worksheet to define:




  • "MiseEnPage": reference to the worksheet object where the range I want to copy exists,

  • "ZoneImage" is set to the "B4:F11" string (refers to the range address),

  • "ObjetGraphique" is a reference to a ChartObject inside the "MiseEnPage" sheet. This ChartObject is an empty container (I am mainly using it to easily set the width and height).

  • "CheminImage" is a string containing the path to the picture filename on disk.



This code used to work perfectly in Excel 2010. Now my company has deployed Excel 2013 and my code now fails on the .Delete line, leaving the copy of the ChartObject (with the range picture pasted inside it) on the sheet and stopping macro execution.



I have tried activating the worksheet first, selecting the duplicate prior to deleting it and other things, to no avail. When tracing the execution in the debugger it chokes on the delete line with error 1004.



I am frustratingly stuck. Any clue?


Answer



If this works



 With ObjetGraphique.Duplicate
.Chart.Paste
.Chart.Export Filename:=CheminImage, Filtername:="PNG"
.Select
End With
Selection.Delete


we have to assume that either the With is holding a reference and preventing the delete, or that the delete routine called by the selection object is not the same delete that's called by ObjetGraphique.Duplicate.delete, or that it's a subtle timing bug and that the extra time it takes to retrieve the selected object is enough to fix it.


floating point - General way of comparing numerics in Python




I have been looking around to find a general way of comparing two numerics in Python. In particular, I want to figure out whether they are the same or not.




The numeric types in Python are:



int, long, float & complex


For example, I can compare 2 integers (a type of numeric) by simply saying:



a == b



For floats, we have to be more careful due to rounding precision, but I can compare them within some tolerance.



Question



We get 2 general numerics a and b: How do we compare them? I was thinking of casting both to complex (which would then have a 0 imaginary part if the type is, say, int) and compare in that domain?



This question is more general than simply comparing floats directly. Certainly, it is related to this problem, but it is not the same.


Answer



In Python 3.5 (and in Numpy) you can use isclose




Read the PEP 485 that describes it, Python 3.5 math library listing and numpy.isclose for more. The numpy version works in all versions of Python that numpy is supported.



Examples:



>>> from math import isclose
>>> isclose(1,1.00000000001)
True
>>> isclose(1,1.00001)
False



The relative and absolute tolerance can be changed.



Relative tolerance can be thought of as +- a percentage between the two values:



>>> isclose(100,98.9, rel_tol=0.02)
True
>>> isclose(100,97.1, rel_tol=0.02)
False



The absolute tolerance is a absolute value between the two values. It is the same as the test of abs(a-b)<=tolerance



All numeric types of Python are support with the Python 3.5 version. (Use the cmath version for complex)



I think longer term, this is your better bet for numerics. For older Python, just import the source. There is a version on Github.



Or, (forgoing error checking and inf and NaN support) you can just use:



def myisclose(a, b, *, rel_tol=1e-09, abs_tol=0.0):

return abs(a-b) <= max( rel_tol * max(abs(a), abs(b)), abs_tol )

php - Parse error: syntax error, unexpected 'endif' (T_ENDIF)

SOLVED: short_open_tag was off, that's the problem. Turning it on and everything work now!



I'm currently making a theme and this happens. I don't understand why the code did not work. I've read some similar topic about this but they don't help resolving my problem:



Parse error: syntax error, unexpected 'endif' (T_ENDIF) in C:\xampp\htdocs\wp\wp-content\themes\boxtruyen\single-ngan.php on line 105



Please help, I could not figure out the error!



















Đăng bởi , lúc , tại

Đọc:




<?the_title()?>












Bình luận










Cùng Chuyên Mục





array('ngan'), 'post_status' => 'publish', 'posts_per_page' => $related_number, 'post__not_in' => array($ID_parent), 'orderby' => 'RAND' ); $list = new wp_query($args); ?>
have_posts()):?>
the_post()?>



  • <?the_title()?>















  • excel - Select multiple ranges with VBA



    I need to select multiple ranges in a worksheet to run various VBA code on them. The ranges will always begin on row 84 but the end depends on how far down the data goes. I've been selecting these ranges separately using code like this:




    Sub SelectRange()
    Dim LastRow As Integer
    LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
    Range("A84:B" & LastRow).Select
    End Sub


    That works fine, but I can't figure out how to select multiple ranges at once. I've tried everything I can think of:





    • Range("A84:B", "D84:E", "H84:J" & LastRow).Select

    • Range("A84:B,D84:E,H84:J" & LastRow).Select

    • Range("A84:B & LastRow,D84:E & LastRow,H84:J & LastRow").Select



    Nothing works. I get a run-time error when running any of those.


    Answer



    Use UNION:




    Dim rng as Range
    With ActiveSheet
    set rng = Union(.Range("A84:B" & LastRow),.Range("D84:E" & LastRow),.Range("H84:J" & LastRow))
    End With
    rng.select


    But if you intend on doing something with that range then skip the .Select and just do what is wanted, ie rng.copy


    c# - How would I run an async Task method synchronously?

    I'm learning about async/await, and ran into a situation where I need to call an async method synchronously. How can I do that?


    Async method:


    public async Task GetCustomers()
    {
    return await Service.GetCustomersAsync();
    }

    Normal usage:


    public async void GetCustomers()
    {
    customerList = await GetCustomers();
    }

    I've tried using the following:


    Task task = GetCustomers();
    task.Wait()
    Task task = GetCustomers();
    task.RunSynchronously();
    Task task = GetCustomers();
    while(task.Status != TaskStatus.RanToCompletion)

    I also tried a suggestion from here, however it doesn't work when the dispatcher is in a suspended state.


    public static void WaitWithPumping(this Task task)
    {
    if (task == null) throw new ArgumentNullException(“task”);
    var nestedFrame = new DispatcherFrame();
    task.ContinueWith(_ => nestedFrame.Continue = false);
    Dispatcher.PushFrame(nestedFrame);
    task.Wait();
    }

    Here is the exception and stack trace from calling RunSynchronously:



    System.InvalidOperationException


    Message: RunSynchronously may not be called on a task unbound to a delegate.


    InnerException: null


    Source: mscorlib


    StackTrace:



              at System.Threading.Tasks.Task.InternalRunSynchronously(TaskScheduler scheduler)
    at System.Threading.Tasks.Task.RunSynchronously()
    at MyApplication.CustomControls.Controls.MyCustomControl.CreateAvailablePanelList() in C:\Documents and Settings\...\MyApplication.CustomControls\Controls\MyCustomControl.xaml.cs:line 638
    at MyApplication.CustomControls.Controls.MyCustomControl.get_AvailablePanels() in C:\Documents and Settings\...\MyApplication.CustomControls\Controls\MyCustomControl.xaml.cs:line 233
    at MyApplication.CustomControls.Controls.MyCustomControl.b__36(DesktopPanel panel) in C:\Documents and Settings\...\MyApplication.CustomControls\Controls\MyCustomControl.xaml.cs:line 597
    at System.Collections.Generic.List`1.ForEach(Action`1 action)
    at MyApplication.CustomControls.Controls.MyCustomControl.d__3b.MoveNext() in C:\Documents and Settings\...\MyApplication.CustomControls\Controls\MyCustomControl.xaml.cs:line 625
    at System.Runtime.CompilerServices.TaskAwaiter.<>c__DisplayClass7.b__1(Object state)
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
    at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
    at System.Windows.Threading.DispatcherOperation.InvokeImpl()
    at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
    at System.Threading.ExecutionContext.runTryCode(Object userData)
    at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Windows.Threading.DispatcherOperation.Invoke()
    at System.Windows.Threading.Dispatcher.ProcessQueue()
    at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
    at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
    at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
    at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
    at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
    at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
    at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
    at System.Windows.Threading.Dispatcher.Run()
    at System.Windows.Application.RunDispatcher(Object ignore)
    at System.Windows.Application.RunInternal(Window window)
    at System.Windows.Application.Run(Window window)
    at System.Windows.Application.Run()
    at MyApplication.App.Main() in C:\Documents and Settings\...\MyApplication\obj\Debug\App.g.cs:line 50
    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()

    Can you provide some examples of why it is hard to parse XML and HTML with a regex?




    One mistake I see people making over and over again is trying to parse XML or HTML with a regex. Here are a few of the reasons parsing XML and HTML is hard:



    People want to treat a file as a sequence of lines, but this is valid:



    attr="5"
    />


    People want to treat < or

    <img>


    People often want to match starting tags to ending tags, but XML and HTML allow tags to contain themselves (which traditional regexes cannot handle at all):



    foo 


    People often want to match against the content of a document (such as the famous "find all phone numbers on a given page" problem), but the data may be marked up (even if it appears to be normal when viewed):



    (703)
    348-3020



    Comments may contain poorly formatted or incomplete tags:



    foo

    bar


    What other gotchas are you aware of?


    Answer



    Here's some fun valid XML for you:



    b"> ]>


    b
    b
    d



    And this little bundle of joy is valid HTML:



        
    ">
    ]>
    x



    &

    < -->
    &e link




    Not to mention all the browser-specific parsing for invalid constructs.



    Good luck pitting regex against that!



    EDIT (Jörg W Mittag): Here is another nice piece of well-formed, valid HTML 4.01:



      "http://www.w3.org/TR/html4/strict.dtd"> 
    /<br/> <p/><br/></code></pre><br/> </div> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> - <meta content='https://stklowf.blogspot.com/2016/09/can-you-provide-some-examples-of-why-it.html' itemprop='url'/> <a class='timestamp-link' href='https://stklowf.blogspot.com/2016/09/can-you-provide-some-examples-of-why-it.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2016-09-29T13:27:00-07:00'>September 29, 2016</abbr></a> </span> <span class='post-comment-link'> <a class='comment-link' href='https://stklowf.blogspot.com/2016/09/can-you-provide-some-examples-of-why-it.html#comment-form' onclick=''> No comments: </a> </span> <span class='post-icons'> <span class='item-control blog-admin pid-1083048888'> <a href='https://www.blogger.com/post-edit.g?blogID=8010773932506618868&postID=6139975210327932969&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=6139975210327932969&target=email' target='_blank' title='Email This'><span class='share-button-link-text'>Email This</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=6139975210327932969&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=6139975210327932969&target=twitter' target='_blank' title='Share to Twitter'><span class='share-button-link-text'>Share to Twitter</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=6139975210327932969&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Share to Facebook'><span class='share-button-link-text'>Share to Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=6139975210327932969&target=pinterest' target='_blank' title='Share to Pinterest'><span class='share-button-link-text'>Share to Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> </div> <div class='post-outer'> <div class='post hentry uncustomized-post-template' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'> <meta content='8010773932506618868' itemprop='blogId'/> <meta content='5788666710101299942' itemprop='postId'/> <a name='5788666710101299942'></a> <h3 class='post-title entry-title' itemprop='name'> <a href='https://stklowf.blogspot.com/2016/09/how-to-get-get-query-string-variables.html'>How to get GET (query string) variables in Express.js on Node.js?</a> </h3> <div class='post-header'> <div class='post-header-line-1'></div> </div> <div class='post-body entry-content' id='post-body-5788666710101299942' itemprop='description articleBody'> <p>In Express, use <code>req.query</code>.</p><br/><p><code>req.params</code> only gets the route parameters, not the query string parameters. See the <a href="http://expressjs.com/4x/api.html#req.params" rel="noreferrer">express</a> or <a href="https://sailsjs.com/documentation/reference/request-req/req-param" rel="noreferrer">sails</a> documentation:</p><br/><blockquote readability="14"><br/> <p>(req.params) Checks route params, ex: /user/:id </p><br/> <p>(req.query) Checks query string params, ex: ?id=12 Checks urlencoded body params </p><br/> <p>(req.body), ex: id=12 To utilize urlencoded request bodies, req.body should be an object. This can be done by using the _express.bodyParser middleware.</p><br/></blockquote><br/><p>That said, most of the time, you want to get the value of a parameter irrespective of its source. In that case, use <code>req.param('foo')</code>.</p><br/><p>The value of the parameter will be returned whether the variable was in the route parameters, query string, or the encoded request body.</p><br/><p>Side note- if you're aiming to get the intersection of all three types of request parameters (similar to PHP's <code>$_REQUEST</code>), you just need to merge the parameters together-- here's how I <a href="https://github.com/balderdashy/sails/blob/v1.0.0-40/lib/hooks/request/param.js#L17-L28" rel="noreferrer">set it up in Sails</a>. Keep in mind that the path/route parameters object (<code>req.params</code>) has array properties, so order matters (although this <a href="https://github.com/visionmedia/express/pull/1835" rel="noreferrer">may change in Express 4</a>)</p> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> - <meta content='https://stklowf.blogspot.com/2016/09/how-to-get-get-query-string-variables.html' itemprop='url'/> <a class='timestamp-link' href='https://stklowf.blogspot.com/2016/09/how-to-get-get-query-string-variables.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2016-09-29T12:22:00-07:00'>September 29, 2016</abbr></a> </span> <span class='post-comment-link'> <a class='comment-link' href='https://stklowf.blogspot.com/2016/09/how-to-get-get-query-string-variables.html#comment-form' onclick=''> No comments: </a> </span> <span class='post-icons'> <span class='item-control blog-admin pid-1083048888'> <a href='https://www.blogger.com/post-edit.g?blogID=8010773932506618868&postID=5788666710101299942&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=5788666710101299942&target=email' target='_blank' title='Email This'><span class='share-button-link-text'>Email This</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=5788666710101299942&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=5788666710101299942&target=twitter' target='_blank' title='Share to Twitter'><span class='share-button-link-text'>Share to Twitter</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=5788666710101299942&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Share to Facebook'><span class='share-button-link-text'>Share to Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=5788666710101299942&target=pinterest' target='_blank' title='Share to Pinterest'><span class='share-button-link-text'>Share to Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> </div> <div class='post-outer'> <div class='post hentry uncustomized-post-template' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'> <meta content='8010773932506618868' itemprop='blogId'/> <meta content='8994899120228326337' itemprop='postId'/> <a name='8994899120228326337'></a> <h3 class='post-title entry-title' itemprop='name'> <a href='https://stklowf.blogspot.com/2016/09/java-onpostexecute-is-only-sometimes.html'>java - onPostExecute is only sometimes called in AsyncTask</a> </h3> <div class='post-header'> <div class='post-header-line-1'></div> </div> <div class='post-body entry-content' id='post-body-8994899120228326337' itemprop='description articleBody'> <div class="post-text" itemprop="text"><br/><br/><p>My AsyncTask is executed in my MainActivity, but it doesn't call onPostExecute. The method doInBackground is finished until the return statement (checked with System.out)!</p><br/><br/><br/><p>The Call:</p><br/><br/><pre><code>@Override<br/>protected void onStart() {<br/> super.onStart();<br/><br/> if (playIntent == null) {<br/> playIntent = new Intent(this, MusicService.class);<br/><br/><br/> if (CheckPermissions()) {<br/> Prepare();<br/> }<br/> }<br/>}<br/><br/>private void Prepare() {<br/> MusicStore musicStore = new MusicStore(getApplicationContext());<br/><br/> sSongs = musicStore.getSongs();<br/><br/><br/> StoreParcel storeParcel = new StoreParcel(StoreParcel.StoreAction.READ_PLAYLISTS, this);<br/><br/> musicStore.execute(storeParcel);<br/><br/> if (sSongs.length < 1) {<br/> fabPlayPause.hide();<br/><br/> snbInformation = Snackbar.make(recyclerView, getString(R.string.snb_Information) + "Music.", Snackbar.LENGTH_INDEFINITE);<br/> snbInformation.show();<br/><br/> }<br/> else {<br/> fabPlayPause.show();<br/> }<br/><br/> bindService(playIntent, musicServiceConn, BIND_AUTO_CREATE);<br/><br/> startService(playIntent);<br/>}<br/></code></pre><br/><br/><br/><p>The AsyncTask:</p><br/><br/><pre><code>public class MusicStore extends AsyncTask<storeParcel, Void, StoreParcel> {<br/> private Context mContext;<br/><br/> public MusicStore(Context context) {<br/> mContext = context;<br/> }<br/><br/><br/> //region AsyncTask<br/><br/> @Override<br/> protected StoreParcel doInBackground(StoreParcel... params) {<br/> StoreParcel parcel = params[0];<br/><br/> StoreParcel storeParcel = new StoreParcel(parcel.getAction(), parcel.getPlaylistInterface());<br/><br/> switch (parcel.getAction()) {<br/> case WRITE_PLAYLISTS:<br/><br/> WritePlaylists(parcel.getPlaylists());<br/> break;<br/> case READ_PLAYLISTS:<br/> storeParcel.setPlaylists(ReadPlaylists());<br/> break;<br/> }<br/><br/> return storeParcel;<br/> }<br/><br/><br/> @Override<br/> protected void onPostExecute(StoreParcel storeParcel) {<br/> if (storeParcel.getAction() == StoreParcel.StoreAction.READ_PLAYLISTS) {<br/> storeParcel.getPlaylistInterface().SyncPlaylists(storeParcel.getPlaylists());<br/> }<br/><br/> super.onPostExecute(storeParcel);<br/> }<br/><br/> //region Methods<br/><br/><br/> private void WritePlaylists(Playlist[] playlists) {<br/> File dir = new File(mContext.getFilesDir() + Preferences.dirPlaylists);<br/><br/> if (!dir.exists()) {<br/> dir.mkdirs();<br/> }<br/><br/> for (File f : dir.listFiles()) {<br/> f.delete();<br/><br/> }<br/><br/> if (playlists == null) return;<br/><br/> String sFilename;<br/> File file;<br/><br/> for (int i = 0; i < playlists.length; i++) {<br/> sFilename = playlists[i].getName();<br/><br/><br/> try {<br/> file = new File(dir, sFilename + ".json");<br/> file.createNewFile();<br/><br/> Writer writer = new OutputStreamWriter(new FileOutputStream(file));<br/><br/> Gson gson = new GsonBuilder().create();<br/> gson.toJson(playlists[i], writer);<br/><br/> writer.close();<br/><br/> }<br/> catch (IOException ioe) {<br/> ioe.printStackTrace();<br/> }<br/> }<br/> }<br/><br/> private Playlist[] ReadPlaylists() {<br/> Playlist[] playlists;<br/><br/><br/> File dir = new File(mContext.getFilesDir() + Preferences.dirPlaylists);<br/><br/> File[] files = dir.listFiles();<br/><br/> if (files == null) return null;<br/><br/> playlists = new Playlist[files.length];<br/><br/> Reader reader = null;<br/><br/><br/> try {<br/> for (int i = 0; i < files.length; i++) {<br/> reader = new InputStreamReader(new FileInputStream(files[i]));<br/><br/> Gson gson = new GsonBuilder().create();<br/> playlists[i] = gson.fromJson(reader, Playlist.class);<br/> }<br/><br/> if (reader != null) reader.close();<br/> }<br/><br/> catch (IOException ioe) {<br/> ioe.printStackTrace();<br/> }<br/><br/> return playlists;<br/> }<br/><br/> //endregion<br/><br/> //endregion<br/><br/>}<br/></code></pre><br/><br/><p>The StoreParcel is a class created by me! It only countains an Interface, and an Enum-Value!</p><br/> </div><div class="post-text" itemprop="text"> <div style="font-weight: bold;"><p class="normal">Answer</p> <br/></div><br/><p>I think you should run the task in onResume so you are the ui exists. You can do UI stuff in onStart and onPostExecute has to run on UI thread.</p><br/><br/><pre><code>@Override<br/>protected void onStart() {<br/> super.onStart();<br/><br/><br/> if (playIntent == null) {<br/> playIntent = new Intent(this, MusicService.class);<br/> }<br/>}<br/><br/>@Override<br/>protected void onStart() {<br/> super.onStart();<br/> if (CheckPermissions()) {<br/><br/> Prepare();<br/> }<br/>}<br/></code></pre><br/> </div> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> - <meta content='https://stklowf.blogspot.com/2016/09/java-onpostexecute-is-only-sometimes.html' itemprop='url'/> <a class='timestamp-link' href='https://stklowf.blogspot.com/2016/09/java-onpostexecute-is-only-sometimes.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2016-09-29T12:06:00-07:00'>September 29, 2016</abbr></a> </span> <span class='post-comment-link'> <a class='comment-link' href='https://stklowf.blogspot.com/2016/09/java-onpostexecute-is-only-sometimes.html#comment-form' onclick=''> No comments: </a> </span> <span class='post-icons'> <span class='item-control blog-admin pid-1083048888'> <a href='https://www.blogger.com/post-edit.g?blogID=8010773932506618868&postID=8994899120228326337&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=8994899120228326337&target=email' target='_blank' title='Email This'><span class='share-button-link-text'>Email This</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=8994899120228326337&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=8994899120228326337&target=twitter' target='_blank' title='Share to Twitter'><span class='share-button-link-text'>Share to Twitter</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=8994899120228326337&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Share to Facebook'><span class='share-button-link-text'>Share to Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=8994899120228326337&target=pinterest' target='_blank' title='Share to Pinterest'><span class='share-button-link-text'>Share to Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> </div> <div class='post-outer'> <div class='post hentry uncustomized-post-template' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'> <meta content='8010773932506618868' itemprop='blogId'/> <meta content='7734355691326674577' itemprop='postId'/> <a name='7734355691326674577'></a> <h3 class='post-title entry-title' itemprop='name'> <a href='https://stklowf.blogspot.com/2016/09/breaking-bad-why-is-walter-jr-being.html'>breaking bad - Why is Walter Jr. being called "Flynn"? - Movies & TV</a> </h3> <div class='post-header'> <div class='post-header-line-1'></div> </div> <div class='post-body entry-content' id='post-body-7734355691326674577' itemprop='description articleBody'> <div class="post-text" itemprop="text"><br/><br/><p>Why is "Junior" in <em>Breaking Bad</em> all of a sudden now called Flynn? I thought he was dubbed Junior as he is also Walter White (Jr.). Is Flynn a middle name or second given name?</p><br/> </div><div class="post-text" itemprop="text"> <div style="font-weight: bold;"><p class="normal">Answer</p> <br/></div><br/><p>Walter Jr. starts calling himself "Flynn" in the <a href="http://www.slantmagazine.com/house/2009/03/breaking-bad-mondays-season-2-ep-4-down/">Season 2 episode "Down"</a>. He does it to distance himself from his father.</p><br/><br/><p>From <a href="http://en.wikipedia.org/wiki/List_of_Breaking_Bad_characters#Walter_Hartwell_White_Jr.">Wikipedia:</a></p><br/><br/><blockquote><br/><br/> <p><strong>He grows apart from Walt due to his father's absences and bizarre behavior</strong>, being taught to drive by his friends and <strong>wanting to be called "Flynn</strong>."</p><br/></blockquote><br/><br/><p><br />From a 2009 <a href="http://blogs.amctv.com/breaking-bad/2009/05/rj-mitte-interview.php">interview with RJ Mitte (Walter Jr.)</a>:</p><br/><br/><blockquote><br/> <p><strong>Q:</strong> <em>Walter Jr. gives himself a nickname this season. Any idea where "Flynn" came from?</em>*</p><br/> <br/> <p><strong>A:</strong> <em>I know it was an old movie star -- Errol Flynn. It took me a while to figure out where it came from though. I asked Vince, "Flynn? Out of all the nicknames?" And he's like "Well, that's why I picked it."</em></p><br/></blockquote><br/><br/> </div> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> - <meta content='https://stklowf.blogspot.com/2016/09/breaking-bad-why-is-walter-jr-being.html' itemprop='url'/> <a class='timestamp-link' href='https://stklowf.blogspot.com/2016/09/breaking-bad-why-is-walter-jr-being.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2016-09-29T10:18:00-07:00'>September 29, 2016</abbr></a> </span> <span class='post-comment-link'> <a class='comment-link' href='https://stklowf.blogspot.com/2016/09/breaking-bad-why-is-walter-jr-being.html#comment-form' onclick=''> No comments: </a> </span> <span class='post-icons'> <span class='item-control blog-admin pid-1083048888'> <a href='https://www.blogger.com/post-edit.g?blogID=8010773932506618868&postID=7734355691326674577&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=7734355691326674577&target=email' target='_blank' title='Email This'><span class='share-button-link-text'>Email This</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=7734355691326674577&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=7734355691326674577&target=twitter' target='_blank' title='Share to Twitter'><span class='share-button-link-text'>Share to Twitter</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=7734355691326674577&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Share to Facebook'><span class='share-button-link-text'>Share to Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=7734355691326674577&target=pinterest' target='_blank' title='Share to Pinterest'><span class='share-button-link-text'>Share to Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> </div> <div class='post-outer'> <div class='post hentry uncustomized-post-template' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'> <meta content='8010773932506618868' itemprop='blogId'/> <meta content='4155422378550554233' itemprop='postId'/> <a name='4155422378550554233'></a> <h3 class='post-title entry-title' itemprop='name'> <a href='https://stklowf.blogspot.com/2016/09/python-unboundlocalerror-at-inversing.html'>python - UnboundLocalError at inversing a string</a> </h3> <div class='post-header'> <div class='post-header-line-1'></div> </div> <div class='post-body entry-content' id='post-body-4155422378550554233' itemprop='description articleBody'> <pre><code>def FirstReverse(str):<br/><br/><br/> chaine = str.split(' ');<br/><br/> for i in range(len(chaine), -1):<br/> inverse = chaine[i]<br/> return inverse ; <br/><br/><br/>print FirstReverse(raw_input())<br/></code></pre><br/><br/><p>i want to inverse a string but i have some difficulties , i got this error message </p><br/><br/><blockquote><br/> <p>UnboundLocalError: local variable 'inverser' referenced before assignment</p><br/></blockquote> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> - <meta content='https://stklowf.blogspot.com/2016/09/python-unboundlocalerror-at-inversing.html' itemprop='url'/> <a class='timestamp-link' href='https://stklowf.blogspot.com/2016/09/python-unboundlocalerror-at-inversing.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2016-09-29T09:57:00-07:00'>September 29, 2016</abbr></a> </span> <span class='post-comment-link'> <a class='comment-link' href='https://stklowf.blogspot.com/2016/09/python-unboundlocalerror-at-inversing.html#comment-form' onclick=''> No comments: </a> </span> <span class='post-icons'> <span class='item-control blog-admin pid-1083048888'> <a href='https://www.blogger.com/post-edit.g?blogID=8010773932506618868&postID=4155422378550554233&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=4155422378550554233&target=email' target='_blank' title='Email This'><span class='share-button-link-text'>Email This</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=4155422378550554233&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=4155422378550554233&target=twitter' target='_blank' title='Share to Twitter'><span class='share-button-link-text'>Share to Twitter</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=4155422378550554233&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Share to Facebook'><span class='share-button-link-text'>Share to Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=4155422378550554233&target=pinterest' target='_blank' title='Share to Pinterest'><span class='share-button-link-text'>Share to Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> </div> <div class='post-outer'> <div class='post hentry uncustomized-post-template' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'> <meta content='8010773932506618868' itemprop='blogId'/> <meta content='931635941823708060' itemprop='postId'/> <a name='931635941823708060'></a> <h3 class='post-title entry-title' itemprop='name'> <a href='https://stklowf.blogspot.com/2016/09/what-is-meant-by-ems-android-textview_29.html'>What is meant by Ems? (Android TextView)</a> </h3> <div class='post-header'> <div class='post-header-line-1'></div> </div> <div class='post-body entry-content' id='post-body-931635941823708060' itemprop='description articleBody'> <p>ems is a <strong>unit</strong> of measurement</p><br/><br/><p>The name em was originally a <em>reference to the width</em> of the <strong>capital M</strong>. It sets the width of a TextView/EditText to fit a text of n 'M' letters regardless of the actual text extension and text size.</p><br/><br/><p>Eg :</p><br/><br/><p><code>android:ems</code> Makes the EditText be exactly this many ems wide.</p><br/><br/><pre><code><editText<br/> android:ems="2"<br/><br/>/><br/></code></pre><br/><br/><p>denotes twice the width of letter M is created.</p> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> - <meta content='https://stklowf.blogspot.com/2016/09/what-is-meant-by-ems-android-textview_29.html' itemprop='url'/> <a class='timestamp-link' href='https://stklowf.blogspot.com/2016/09/what-is-meant-by-ems-android-textview_29.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2016-09-29T09:53:00-07:00'>September 29, 2016</abbr></a> </span> <span class='post-comment-link'> <a class='comment-link' href='https://stklowf.blogspot.com/2016/09/what-is-meant-by-ems-android-textview_29.html#comment-form' onclick=''> No comments: </a> </span> <span class='post-icons'> <span class='item-control blog-admin pid-1083048888'> <a href='https://www.blogger.com/post-edit.g?blogID=8010773932506618868&postID=931635941823708060&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=931635941823708060&target=email' target='_blank' title='Email This'><span class='share-button-link-text'>Email This</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=931635941823708060&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=931635941823708060&target=twitter' target='_blank' title='Share to Twitter'><span class='share-button-link-text'>Share to Twitter</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=931635941823708060&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Share to Facebook'><span class='share-button-link-text'>Share to Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=931635941823708060&target=pinterest' target='_blank' title='Share to Pinterest'><span class='share-button-link-text'>Share to Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> </div> <div class='post-outer'> <div class='post hentry uncustomized-post-template' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'> <meta content='8010773932506618868' itemprop='blogId'/> <meta content='1570822280567229380' itemprop='postId'/> <a name='1570822280567229380'></a> <h3 class='post-title entry-title' itemprop='name'> <a href='https://stklowf.blogspot.com/2016/09/interleave-lists-in-r.html'>Interleave lists in R</a> </h3> <div class='post-header'> <div class='post-header-line-1'></div> </div> <div class='post-body entry-content' id='post-body-1570822280567229380' itemprop='description articleBody'> <div class="post-text" itemprop="text"><br/><br/><p>Let's say that I have two lists in R, not necessarily of equal length, like:</p><br/><br/><pre><code> a <- list('a.1','a.2', 'a.3')<br/> b <- list('b.1','b.2', 'b.3', 'b.4')<br/></code></pre><br/><br/><p>What is the best way to construct a list of interleaved elements where, once the element of the shorter list had been added, the remaining elements of the longer list are append at the end?, like:</p><br/><br/><br/><pre><code>interleaved <- list('a.1','b.1','a.2', 'b.2', 'a.3', 'b.3','b.4')<br/></code></pre><br/><br/><p>without using a loop. I know that <em>mapply</em> works for the case where both lists have equal length.</p><br/> </div><div class="post-text" itemprop="text"> <div style="font-weight: bold;"><p class="normal">Answer</p> <br/></div><br/><p>Here's one way:</p><br/><br/><pre><code>idx <- order(c(seq_along(a), seq_along(b)))<br/>unlist(c(a,b))[idx]<br/><br/><br/># [1] "a.1" "b.1" "a.2" "b.2" "a.3" "b.3" "b.4"<br/></code></pre><br/><br/><p>As @James points out, since you need a list back, you should do:</p><br/><br/><pre><code>(c(a,b))[idx]<br/></code></pre><br/> </div> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> - <meta content='https://stklowf.blogspot.com/2016/09/interleave-lists-in-r.html' itemprop='url'/> <a class='timestamp-link' href='https://stklowf.blogspot.com/2016/09/interleave-lists-in-r.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2016-09-29T08:20:00-07:00'>September 29, 2016</abbr></a> </span> <span class='post-comment-link'> <a class='comment-link' href='https://stklowf.blogspot.com/2016/09/interleave-lists-in-r.html#comment-form' onclick=''> No comments: </a> </span> <span class='post-icons'> <span class='item-control blog-admin pid-1083048888'> <a href='https://www.blogger.com/post-edit.g?blogID=8010773932506618868&postID=1570822280567229380&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=1570822280567229380&target=email' target='_blank' title='Email This'><span class='share-button-link-text'>Email This</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=1570822280567229380&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=1570822280567229380&target=twitter' target='_blank' title='Share to Twitter'><span class='share-button-link-text'>Share to Twitter</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=1570822280567229380&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Share to Facebook'><span class='share-button-link-text'>Share to Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=1570822280567229380&target=pinterest' target='_blank' title='Share to Pinterest'><span class='share-button-link-text'>Share to Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> </div> <div class='post-outer'> <div class='post hentry uncustomized-post-template' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'> <meta content='8010773932506618868' itemprop='blogId'/> <meta content='6498968951199317906' itemprop='postId'/> <a name='6498968951199317906'></a> <h3 class='post-title entry-title' itemprop='name'> <a href='https://stklowf.blogspot.com/2016/09/php-moveuploadedfile-wont-move-file-to.html'>php move_uploaded_file wont move the file to the hosted server</a> </h3> <div class='post-header'> <div class='post-header-line-1'></div> </div> <div class='post-body entry-content' id='post-body-6498968951199317906' itemprop='description articleBody'> <p>I don't know how to fix this but the problem is that it won't upload to the server that I'm using to host the website it creates the folder just fine but won't move it. The coding for the moving is below.</p><br/><br/><br/><blockquote><br/> <p>This is the error I get <br/> <strong>Warning: move_uploaded_file(./userdata/profile_pics/iOy1pQXTZsLw7VA/) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/a4640336/public_html/account_settings.php on line 103</strong></p><br/></blockquote><br/><br/><p>and as well as this error code</p><br/><br/><blockquote><br/> <p><strong>Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpX1zVno' to './userdata/profile_pics/iOy1pQXTZsLw7VA/' in /home/a4640336/public_html/account_settings.php on line 103</strong></p><br/><br/></blockquote><br/><br/><pre><code> move_uploaded_file(@$_FILES["profilepic"]["tmp_name"],"./userdata/profile_pics/$rand_dir_name/".$FILES["profilepic"]["name"]);<br/> echo "Your profile pic has been updated!".@$_FILES ["profilepic"]["name"];<br/> //$profile_pic_name = @$_FILES["profilepic"] ["name"];<br/> //$profile_pic_query= mysql_query("UPDATE users SET profile_pic='$rand_dir_name/$profile_pic_name' WHERE username='$username'");<br/> //header("location: account_settings.php");<br/></code></pre><br/><br/><p>Overall I have tried to change where it is located to have it leading directly from the source but it doesn't change. If anyone can help please help me! </p><br/><br/><br/><p><strong>PS the commented out parts were done to be able to see the error</strong></p> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> - <meta content='https://stklowf.blogspot.com/2016/09/php-moveuploadedfile-wont-move-file-to.html' itemprop='url'/> <a class='timestamp-link' href='https://stklowf.blogspot.com/2016/09/php-moveuploadedfile-wont-move-file-to.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2016-09-29T06:38:00-07:00'>September 29, 2016</abbr></a> </span> <span class='post-comment-link'> <a class='comment-link' href='https://stklowf.blogspot.com/2016/09/php-moveuploadedfile-wont-move-file-to.html#comment-form' onclick=''> No comments: </a> </span> <span class='post-icons'> <span class='item-control blog-admin pid-1083048888'> <a href='https://www.blogger.com/post-edit.g?blogID=8010773932506618868&postID=6498968951199317906&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=6498968951199317906&target=email' target='_blank' title='Email This'><span class='share-button-link-text'>Email This</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=6498968951199317906&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=6498968951199317906&target=twitter' target='_blank' title='Share to Twitter'><span class='share-button-link-text'>Share to Twitter</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=6498968951199317906&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Share to Facebook'><span class='share-button-link-text'>Share to Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=6498968951199317906&target=pinterest' target='_blank' title='Share to Pinterest'><span class='share-button-link-text'>Share to Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> </div> <div class='post-outer'> <div class='post hentry uncustomized-post-template' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'> <meta content='8010773932506618868' itemprop='blogId'/> <meta content='8557218225744429344' itemprop='postId'/> <a name='8557218225744429344'></a> <h3 class='post-title entry-title' itemprop='name'> <a href='https://stklowf.blogspot.com/2016/09/php-using-user-supplied-database.html'>php - Using user-supplied database credentials across multiple pages</a> </h3> <div class='post-header'> <div class='post-header-line-1'></div> </div> <div class='post-body entry-content' id='post-body-8557218225744429344' itemprop='description articleBody'> <div class="post-text" itemprop="text"><br/><br/><p>I am learning to use MySQL with PHP and while practicing, I tried to create a simple web application using Core PHP and MySQL. It is summarized below:</p><br/><br/><p>-It has a pretty simple html page where username(uname) and password(pword) for MySQL are input in a form and are sent by POST method to a PHP script called PHP1.php</p><br/><br/><p>-PHP1 makes connection to MySQL. The code is(skipping PHP tags):</p><br/><br/><pre><code>//Get input username and password<br/>$username = $_POST['uname'];<br/>$password = $_POST['pword'];<br/>//Server information<br/>$server = "localhost";<br/>//Connect<br/>$conn = new mysqli($server, $username, $password);<br/>//Check success/failure<br/>if ($conn -> connect_error)<br/>{<br/> die("Connection failed".$conn->connect_error);<br/>}<br/></code></pre><br/><br/><p>After connecting, PHP1 retrieves information about the databases stored in the respective account and displays radio buttons to select the database and sends the name of the selected database by GET method to another script PHP2.php</p><br/><br/><p>-In PHP2.php I want to display the TABLES in the selected database.<br/>However, when control is transferred to PHP2.php, connection to MySQL is terminated. I first tried to include my PHP1.php file in PHP2.php and use the $conn variable but ofcourse it'll try to reconnect to MySQL due to the above mentioned code and at the same time, the first request containing uname and pword is lost resulting in an authentication error.</p><br/><br/><p>How can I overcome this problem?</p><br/><br/><p>EDIT:<br/>I have seen other questions here but all of them have fixed usernmae/passwords and so the connection script can be placed in a separate file easily. I require to take username and password from the user.</p><br/> </div><div class="post-text" itemprop="text"> <div style="font-weight: bold;"><p class="normal">Answer</p> <br/></div><br/><p>Use <a href="https://www.php.net/manual/en/book.session.php" rel="nofollow noreferrer">Sessions</a> which will persist the session variables across pages:</p><br/><br/><p><strong>PHP1</strong></p><br/><br/><pre><code>session_start();<br/>$_SESSION['username'] = $username = $_POST['uname'];<br/>$_SESSION['password'] = $password = $_POST['pword'];<br/><br/>$server = "localhost";<br/>$conn = new mysqli($server, $username, $password);<br/></code></pre><br/><br/><p><strong>PHP2</strong></p><br/><br/><pre><code>session_start();<br/>$username = $_SESSION['username'];<br/>$password = $_SESSION['password'];<br/><br/>$server = "localhost";<br/>$conn = new mysqli($server, $username, $password);<br/></code></pre><br/><br/><p>In PHP1 you're going to want to check that the <code>$_POST</code> values are set and in other pages you'll want to check that the <code>$_SESSION</code> variables are set. See <a href="https://www.php.net/manual/en/function.isset.php" rel="nofollow noreferrer">isset</a>.</p><br/> </div> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> - <meta content='https://stklowf.blogspot.com/2016/09/php-using-user-supplied-database.html' itemprop='url'/> <a class='timestamp-link' href='https://stklowf.blogspot.com/2016/09/php-using-user-supplied-database.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2016-09-29T04:33:00-07:00'>September 29, 2016</abbr></a> </span> <span class='post-comment-link'> <a class='comment-link' href='https://stklowf.blogspot.com/2016/09/php-using-user-supplied-database.html#comment-form' onclick=''> No comments: </a> </span> <span class='post-icons'> <span class='item-control blog-admin pid-1083048888'> <a href='https://www.blogger.com/post-edit.g?blogID=8010773932506618868&postID=8557218225744429344&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=8557218225744429344&target=email' target='_blank' title='Email This'><span class='share-button-link-text'>Email This</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=8557218225744429344&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=8557218225744429344&target=twitter' target='_blank' title='Share to Twitter'><span class='share-button-link-text'>Share to Twitter</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=8557218225744429344&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Share to Facebook'><span class='share-button-link-text'>Share to Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=8010773932506618868&postID=8557218225744429344&target=pinterest' target='_blank' title='Share to Pinterest'><span class='share-button-link-text'>Share to Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> </div> </div></div> </div> <div class='blog-pager' id='blog-pager'> <span id='blog-pager-newer-link'> <a class='blog-pager-newer-link' href='https://stklowf.blogspot.com/search?updated-max=2016-10-01T10:47:00-07:00&max-results=7&reverse-paginate=true' id='Blog1_blog-pager-newer-link' title='Newer Posts'>Newer Posts</a> </span> <span id='blog-pager-older-link'> <a class='blog-pager-older-link' href='https://stklowf.blogspot.com/search?updated-max=2016-09-29T04:33:00-07:00&max-results=7' id='Blog1_blog-pager-older-link' title='Older Posts'>Older Posts</a> </span> <a class='home-link' href='https://stklowf.blogspot.com/'>Home</a> </div> <div class='clear'></div> <div class='blog-feeds'> <div class='feed-links'> Subscribe to: <a class='feed-link' href='https://stklowf.blogspot.com/feeds/posts/default' target='_blank' type='application/atom+xml'>Posts (Atom)</a> </div> </div> </div><div class='widget FeaturedPost' data-version='1' id='FeaturedPost1'> <div class='post-summary'> <h3><a href='https://stklowf.blogspot.com/2017/06/c-does-curly-brackets-matter-for-empty_20.html'>c++ - Does curly brackets matter for empty constructor?</a></h3> <p> Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t... </p> </div> <style type='text/css'> .image { width: 100%; } </style> <div class='clear'></div> </div><div class='widget PopularPosts' data-version='1' id='PopularPosts1'> <div class='widget-content popular-posts'> <ul> <li> <div class='item-content'> <div class='item-title'><a href='https://stklowf.blogspot.com/2016/11/analysis-were-parts-of-dark-knight.html'>analysis - Were parts of The Dark Knight Rises a commentary on the Occupy movement? - Movies & TV</a></div> <div class='item-snippet'>A fair amount of the second act of The Dark Knight Rises has a class warfare plotline. This is foreshadowed in the trailers with Selina Ky...</div> </div> <div style='clear: both;'></div> </li> <li> <div class='item-content'> <div class='item-thumbnail'> <a href='https://stklowf.blogspot.com/2016/12/mysql-syntax-error-or-access-violation.html' target='_blank'> <img alt='' border='0' src='https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uaeqg25N_kWjCqEBIte_SOwZiJfFAf8VWqQcb-ap0vCikkf0dppcF289pXu7mhumf5SpGjZ3yOtqX9uadmxXUu5HJhhKGG=w72-h72-p-k-no-nu'/> </a> </div> <div class='item-title'><a href='https://stklowf.blogspot.com/2016/12/mysql-syntax-error-or-access-violation.html'>mysql - Syntax error or access violation php sql</a></div> <div class='item-snippet'>i have added this sql in my code , function devenir_client_dataforform() { $type = $_POST['clientType']; //$produit...</div> </div> <div style='clear: both;'></div> </li> <li> <div class='item-content'> <div class='item-title'><a href='https://stklowf.blogspot.com/2017/06/c-sequence-points-vs-operator-precedence.html'>c++ - Sequence Points vs Operator Precedence</a></div> <div class='item-snippet'> I'm still trying to wrap my head around how the following expression results in undefined behavior: a = a++; Upon searching SO...</div> </div> <div style='clear: both;'></div> </li> </ul> <div class='clear'></div> </div> </div></div> </div> </div> <div class='column-left-outer'> <div class='column-left-inner'> <aside> </aside> </div> </div> <div class='column-right-outer'> <div class='column-right-inner'> <aside> <div class='sidebar section' id='sidebar-right-1'><div class='widget BlogSearch' data-version='1' id='BlogSearch1'> <h2 class='title'>Search This Blog</h2> <div class='widget-content'> <div id='BlogSearch1_form'> <form action='https://stklowf.blogspot.com/search' class='gsc-search-box' target='_top'> <table cellpadding='0' cellspacing='0' class='gsc-search-box'> <tbody> <tr> <td class='gsc-input'> <input autocomplete='off' class='gsc-input' name='q' size='10' title='search' type='text' value=''/> </td> <td class='gsc-search-button'> <input class='gsc-search-button' title='search' type='submit' value='Search'/> </td> </tr> </tbody> </table> </form> </div> </div> <div class='clear'></div> </div><div class='widget BlogArchive' data-version='1' id='BlogArchive1'> <h2>Blog Archive</h2> <div class='widget-content'> <div id='ArchiveList'> <div id='BlogArchive1_ArchiveList'> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2017/'> 2017 </a> <span class='post-count' dir='ltr'>(2404)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2017/06/'> June 2017 </a> <span class='post-count' dir='ltr'>(276)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2017/05/'> May 2017 </a> <span class='post-count' dir='ltr'>(434)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2017/04/'> April 2017 </a> <span class='post-count' dir='ltr'>(433)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2017/03/'> March 2017 </a> <span class='post-count' dir='ltr'>(450)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2017/02/'> February 2017 </a> <span class='post-count' dir='ltr'>(379)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2017/01/'> January 2017 </a> <span class='post-count' dir='ltr'>(432)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate expanded'> <a class='toggle' href='javascript:void(0)'> <span class='zippy toggle-open'> ▼  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/'> 2016 </a> <span class='post-count' dir='ltr'>(3825)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/12/'> December 2016 </a> <span class='post-count' dir='ltr'>(446)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/11/'> November 2016 </a> <span class='post-count' dir='ltr'>(421)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/10/'> October 2016 </a> <span class='post-count' dir='ltr'>(458)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate expanded'> <a class='toggle' href='javascript:void(0)'> <span class='zippy toggle-open'> ▼  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/09/'> September 2016 </a> <span class='post-count' dir='ltr'>(374)</span> <ul class='posts'> <li><a href='https://stklowf.blogspot.com/2016/09/get-int-value-from-enum-in-c.html'>Get int value from enum in C#</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/r-faq-how-to-make-great-r-reproducible.html'>r faq - How to make a great R reproducible example</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/javascript-typeerror-is-not-function.html'>javascript - TypeError: "this..." is not a function</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/iterating-javascript-object-properties.html'>Iterating a JavaScript object's properties using j...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-how-to-start-programming-from-scratch.html'>c# - How to start programming from scratch?</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/how-to-set-limits-for-axes-in-ggplot2-r.html'>How to set limits for axes in ggplot2 R plots?</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/assembly-how-does-division-by-constant.html'>assembly - How does division by constant work in a...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-where-and-why-do-i-have-to-put-and.html'>c++ - Where and why do I have to put the "template...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/security-best-practices-salting.html'>security - Best Practices: Salting & peppering pas...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/how-to-get-today-date-in-java-in.html'>How to get today's Date in java in the following p...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/android-how-to-change-font-on-textview.html'>android - How to change the font on the TextView?</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/function-what-is-scope-of-variables-in.html'>function - What is the scope of variables in JavaS...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/unit-testing-what-is-mocking.html'>unit testing - What is Mocking?</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/plot-explanation-why-did-grandfather.html'>plot explanation - Why did Grandfather insist on A...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/a-quick-and-easy-way-to-join-array.html'>A quick and easy way to join array elements with a...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/angular-what-is-difference-between.html'>angular - What is the difference between Promises ...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/please-explain-use-of-javascript.html'>Please explain the use of JavaScript closures in l...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-fatal-error-allowed-memory-size-of.html'>php - Fatal Error: Allowed Memory Size of 13421772...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/vba-deleting-duplicate-copy-of-chart.html'>VBA deleting a duplicate copy of chart object fail...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/floating-point-general-way-of-comparing.html'>floating point - General way of comparing numerics...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-parse-error-syntax-error-unexpected.html'>php - Parse error: syntax error, unexpected 'endif...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/excel-select-multiple-ranges-with-vba.html'>excel - Select multiple ranges with VBA</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-how-would-i-run-async-task-method.html'>c# - How would I run an async Task method synchron...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/can-you-provide-some-examples-of-why-it.html'>Can you provide some examples of why it is hard to...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/how-to-get-get-query-string-variables.html'>How to get GET (query string) variables in Express...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/java-onpostexecute-is-only-sometimes.html'>java - onPostExecute is only sometimes called in A...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/breaking-bad-why-is-walter-jr-being.html'>breaking bad - Why is Walter Jr. being called "Fly...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/python-unboundlocalerror-at-inversing.html'>python - UnboundLocalError at inversing a string</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/what-is-meant-by-ems-android-textview_29.html'>What is meant by Ems? (Android TextView)</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/interleave-lists-in-r.html'>Interleave lists in R</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-moveuploadedfile-wont-move-file-to.html'>php move_uploaded_file wont move the file to the h...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-using-user-supplied-database.html'>php - Using user-supplied database credentials acr...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/javascript-is-text-considered-node-too.html'>javascript - Is text considered a node too in the ...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/using-sql-server-2008-r2-express-with-c.html'>Using SQL Server 2008 R2 Express with C# Express 2010</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-uncaught-error-call-to-undefined.html'>php - Uncaught Error: Call to undefined function m...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/passing-2d-array-to-c-function.html'>Passing a 2D array to a C++ function</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/convert-associative-array-to-simple.html'>Convert an associative array to a simple array of ...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-why-do-i-get-sql-error-when.html'>php - Why do I get a SQL error when preparing a st...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/redirect-from-html-page.html'>Redirect from an HTML page</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/android-how-to-get-device-uuid-without.html'>android - How to get device UUID without permission</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/what-is-meant-by-ems-android-textview.html'>What is meant by Ems? (Android TextView)</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-instantiate-new-object-from-variable.html'>php - Instantiate new object from variable</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/javascript-securityexception-1000-even.html'>javascript - SecurityException 1000, even though u...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/how-do-i-declare-namespace-in-javascript_28.html'>How do I declare a namespace in JavaScript?</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/java-what-is-this-date-format-2011-08.html'>java - What is this date format? 2011-08-12T20:17:...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/css-selectors-difference-between-and.html'>CSS Selectors - difference between and when to use...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/css-transitions-with-jquery-not-working.html'>CSS Transitions with jquery not working</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/best-way-to-find-if-item-is-in.html'>Best way to find if an item is in a JavaScript array?</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/javascript-html5-local-storage-fallback.html'>javascript - HTML5 Local Storage fallback solutions</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-how-do-i-use-wmain-entry-point-in.html'>c++ - How do I use the wmain() entry point in Code...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/shell-how-do-i-split-string-on.html'>shell - How do I split a string on a delimiter in ...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/debugging-how-can-i-get-useful-error.html'>debugging - How can I get useful error messages in...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/regex-regular-expression-for-remove.html'>regex - Regular expression for remove html links</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/performance-when-to-use-couchdb-over.html'>performance - When to use CouchDB over MongoDB and...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-want-to-get-all-values-of-checked.html'>php - Want to get all values of checked checkbox u...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-sql-injection-that-gets-around.html'>php - SQL injection that gets around mysql_real_es...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/html-list-tag-not-working-in-android.html'>Html List tag not working in android textview. wha...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-mysql-get-hack-prevention.html'>PHP MySQL $_GET Hack prevention</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/r-how-to-achieve-hand-drawn-pencil-fill.html'>r - how to achieve a hand-drawn pencil fill in ggp...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-how-to-send-html-in-attachment.html'>c# - How to send html in attachment?</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-phpass-producing-warning-isreadable.html'>php - PHPass producing warning: is_readable() [fun...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/can-this-c-vector-initialization-cause.html'>Can this c++ vector initialization cause memory leak?</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-what-way-is-best-way-to-hash.html'>php - What way is the best way to hash a password?</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/how-to-can-apply-multithreading-for-for.html'>How to can apply multithreading for a for loop in ...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-good-cryptographic-hash-functions.html'>php - Good cryptographic hash functions</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/is-there-any-advantage-of-using.html'>Is there any advantage of using references instead...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/how-to-deal-with-floating-point-number.html'>How to deal with floating point number precision i...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/wordpress-how-to-echo-taxonomy-tags-in.html'>wordpress - How to echo taxonomy tags in the wp_dr...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/generate-random-number-between-2.html'>generate random number between 2 variables jquery</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-how-does-free-know-size-of-memory-to.html'>c - how does free know the size of memory to be fr...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/stdstring-vs-string-in-c.html'>std::string vs string in c++</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/javascript-sorting-array-of-objects-by.html'>javascript sorting array of objects by string prop...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/javascript-implement-promises-pattern.html'>javascript - Implement promises pattern</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/javascript-how-to-check-if-jquery.html'>javascript - How to check if jQuery object exist i...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/javascript-strange-with-nodejsjs-in.html'>javascript - Strange with nodejs/js in using "this...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/how-does-python-super-work-with.html'>How does Python's super() work with multiple inher...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-phpspec-catching-typeerror-in-php7.html'>php - PHPSpec Catching TypeError in PHP7</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-file-name-or-path-doesn-exist-or-used.html'>c# - The file name or path doesn't exist or used b...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/java-jframe-class-not-working-in-main.html'>java - JFrame class not working in Main</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-flood-of-unresolved-external-symbol.html'>c++ - flood of unresolved external symbol errors</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-while-loop-doesn-seem-to-finish-after.html'>c - While loop doesn't seem to finish after EOF</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-undefined-reference-to-classfunction.html'>c++ - undefined reference to CLASS::function()</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/jquery-cannot-read-property-of.html'>jquery - "TypeError: Cannot read property 'setStat...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/how-to-generate-random-five-digit.html'>How to generate a random five digit number Java</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/plot-explanation-in-kane-does-bernstein.html'>plot explanation - In "Citizen Kane" does Bernstei...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-structure-initialization.html'>C++ Structure Initialization</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/java-is-there-any-performance.html'>java - Is there any performance difference between...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-mysqlfetcharraymysqlfetchassocmysql.html'>php - mysql_fetch_array()/mysql_fetch_assoc()/mysq...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-actionscript-does-not-see-changes.html'>php - actionscript does not see changes to the tex...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/zend-framework-requireonce-gives-php.html'>zend framework - Require_Once gives PHP Division B...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/css-how-to-style-placeholder-attribute.html'>css - How to style placeholder attribute across al...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/java-pass-by-value-reference-variables.html'>Java, pass-by-value, reference variables</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/javascript-division-giving-wrong-answer.html'>javascript division giving wrong answer?</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-pass-by-pointer-pass-by-reference.html'>c++ - Pass by pointer & Pass by reference</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/sql-how-to-lowercase-whole-string.html'>sql - How to lowercase the whole string keeping th...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/javascript-js-round-to-2-decimal-places.html'>javascript - JS round to 2 decimal places</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/c-error-lnk2019-unresolved-external.html'>c++ - error LNK2019: unresolved external symbol er...</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/php-mysql-chinese-pinyin-encoding-issue.html'>php - MySQL Chinese pinyin encoding issue</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/cant-connect-my-database-with-php.html'>Cant connect my database with php</a></li> <li><a href='https://stklowf.blogspot.com/2016/09/java-how-do-i-get-object-from-hashmap.html'>java - How do I get object from HashMap respectively?</a></li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/08/'> August 2016 </a> <span class='post-count' dir='ltr'>(369)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/07/'> July 2016 </a> <span class='post-count' dir='ltr'>(355)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/06/'> June 2016 </a> <span class='post-count' dir='ltr'>(306)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/05/'> May 2016 </a> <span class='post-count' dir='ltr'>(305)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/04/'> April 2016 </a> <span class='post-count' dir='ltr'>(311)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/03/'> March 2016 </a> <span class='post-count' dir='ltr'>(269)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/02/'> February 2016 </a> <span class='post-count' dir='ltr'>(145)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2016/01/'> January 2016 </a> <span class='post-count' dir='ltr'>(66)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2015/'> 2015 </a> <span class='post-count' dir='ltr'>(11)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://stklowf.blogspot.com/2015/12/'> December 2015 </a> <span class='post-count' dir='ltr'>(11)</span> </li> </ul> </li> </ul> </div> </div> <div class='clear'></div> </div> </div></div> <table border='0' cellpadding='0' cellspacing='0' class='section-columns columns-2'> <tbody> <tr> <td class='first columns-cell'> <div class='sidebar no-items section' id='sidebar-right-2-1'></div> </td> <td class='columns-cell'> <div class='sidebar no-items section' id='sidebar-right-2-2'></div> </td> </tr> </tbody> </table> <div class='sidebar no-items section' id='sidebar-right-3'></div> </aside> </div> </div> </div> <div style='clear: both'></div> <!-- columns --> </div> <!-- main --> </div> </div> <div class='main-cap-bottom cap-bottom'> <div class='cap-left'></div> <div class='cap-right'></div> </div> </div> <footer> <div class='footer-outer'> <div class='footer-cap-top cap-top'> <div class='cap-left'></div> <div class='cap-right'></div> </div> <div class='fauxborder-left footer-fauxborder-left'> <div class='fauxborder-right footer-fauxborder-right'></div> <div class='region-inner footer-inner'> <div class='foot no-items section' id='footer-1'></div> <table border='0' cellpadding='0' cellspacing='0' class='section-columns columns-2'> <tbody> <tr> <td class='first columns-cell'> <div class='foot no-items section' id='footer-2-1'></div> </td> <td class='columns-cell'> <div class='foot no-items section' id='footer-2-2'></div> </td> </tr> </tbody> </table> <!-- outside of the include in order to lock Attribution widget --> <div class='foot section' id='footer-3' name='Footer'><div class='widget Attribution' data-version='1' id='Attribution1'> <div class='widget-content' style='text-align: center;'> Theme images by <a href='http://www.istockphoto.com/file_closeup.php?id=9505737&platform=blogger' target='_blank'>Ollustrator</a>. Powered by <a href='https://www.blogger.com' target='_blank'>Blogger</a>. </div> <div class='clear'></div> </div></div> </div> </div> <div class='footer-cap-bottom cap-bottom'> <div class='cap-left'></div> <div class='cap-right'></div> </div> </div> </footer> <!-- content --> </div> </div> <div class='content-cap-bottom cap-bottom'> <div class='cap-left'></div> <div class='cap-right'></div> </div> </div> </div> <script type='text/javascript'> window.setTimeout(function() { document.body.className = document.body.className.replace('loading', ''); }, 10); </script> <script type="text/javascript" src="https://www.blogger.com/static/v1/widgets/4140855455-widgets.js"></script> <script type='text/javascript'> window['__wavt'] = 'AOuZoY4JIdCzOUoYOXRUt8vSV5Yk1EQ6oA:1726537977051';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\x3d8010773932506618868','//stklowf.blogspot.com/2016/09/','8010773932506618868'); _WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '8010773932506618868', 'title': 'Blog', 'url': 'https://stklowf.blogspot.com/2016/09/', 'canonicalUrl': 'https://stklowf.blogspot.com/2016/09/', 'homepageUrl': 'https://stklowf.blogspot.com/', 'searchUrl': 'https://stklowf.blogspot.com/search', 'canonicalHomepageUrl': 'https://stklowf.blogspot.com/', 'blogspotFaviconUrl': 'https://stklowf.blogspot.com/favicon.ico', 'bloggerUrl': 'https://www.blogger.com', 'hasCustomDomain': false, 'httpsEnabled': true, 'enabledCommentProfileImages': true, 'gPlusViewType': 'FILTERED_POSTMOD', 'adultContent': false, 'analyticsAccountNumber': '', 'encoding': 'UTF-8', 'locale': 'en-GB', 'localeUnderscoreDelimited': 'en_gb', 'languageDirection': 'ltr', 'isPrivate': false, 'isMobile': false, 'isMobileRequest': false, 'mobileClass': '', 'isPrivateBlog': false, 'isDynamicViewsAvailable': true, 'feedLinks': '\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Blog - Atom\x22 href\x3d\x22https://stklowf.blogspot.com/feeds/posts/default\x22 /\x3e\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/rss+xml\x22 title\x3d\x22Blog - RSS\x22 href\x3d\x22https://stklowf.blogspot.com/feeds/posts/default?alt\x3drss\x22 /\x3e\n\x3clink rel\x3d\x22service.post\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Blog - Atom\x22 href\x3d\x22https://www.blogger.com/feeds/8010773932506618868/posts/default\x22 /\x3e\n', 'meTag': '', 'adsenseHostId': 'ca-host-pub-1556223355139109', 'adsenseHasAds': true, 'adsenseAutoAds': false, 'boqCommentIframeForm': true, 'loginRedirectParam': '', 'view': '', 'dynamicViewsCommentsSrc': '//www.blogblog.com/dynamicviews/4224c15c4e7c9321/js/comments.js', 'dynamicViewsScriptSrc': '//www.blogblog.com/dynamicviews/5702e3d62c3de6e9', 'plusOneApiSrc': 'https://apis.google.com/js/platform.js', 'disableGComments': true, 'interstitialAccepted': false, 'sharing': {'platforms': [{'name': 'Get link', 'key': 'link', 'shareMessage': 'Get link', 'target': ''}, {'name': 'Facebook', 'key': 'facebook', 'shareMessage': 'Share to Facebook', 'target': 'facebook'}, {'name': 'BlogThis!', 'key': 'blogThis', 'shareMessage': 'BlogThis!', 'target': 'blog'}, {'name': 'Twitter', 'key': 'twitter', 'shareMessage': 'Share to Twitter', 'target': 'twitter'}, {'name': 'Pinterest', 'key': 'pinterest', 'shareMessage': 'Share to Pinterest', 'target': 'pinterest'}, {'name': 'Email', 'key': 'email', 'shareMessage': 'Email', 'target': 'email'}], 'disableGooglePlus': true, 'googlePlusShareButtonWidth': 0, 'googlePlusBootstrap': '\x3cscript type\x3d\x22text/javascript\x22\x3ewindow.___gcfg \x3d {\x27lang\x27: \x27en_GB\x27};\x3c/script\x3e'}, 'hasCustomJumpLinkMessage': false, 'jumpLinkMessage': 'Read more', 'pageType': 'archive', 'pageName': 'September 2016', 'pageTitle': 'Blog: September 2016'}}, {'name': 'features', 'data': {}}, {'name': 'messages', 'data': {'edit': 'Edit', 'linkCopiedToClipboard': 'Link copied to clipboard', 'ok': 'Ok', 'postLink': 'Post link'}}, {'name': 'template', 'data': {'name': 'custom', 'localizedName': 'Custom', 'isResponsive': false, 'isAlternateRendering': false, 'isCustom': true}}, {'name': 'view', 'data': {'classic': {'name': 'classic', 'url': '?view\x3dclassic'}, 'flipcard': {'name': 'flipcard', 'url': '?view\x3dflipcard'}, 'magazine': {'name': 'magazine', 'url': '?view\x3dmagazine'}, 'mosaic': {'name': 'mosaic', 'url': '?view\x3dmosaic'}, 'sidebar': {'name': 'sidebar', 'url': '?view\x3dsidebar'}, 'snapshot': {'name': 'snapshot', 'url': '?view\x3dsnapshot'}, 'timeslide': {'name': 'timeslide', 'url': '?view\x3dtimeslide'}, 'isMobile': false, 'title': 'Blog', 'description': '', 'url': 'https://stklowf.blogspot.com/2016/09/', 'type': 'feed', 'isSingleItem': false, 'isMultipleItems': true, 'isError': false, 'isPage': false, 'isPost': false, 'isHomepage': false, 'isArchive': true, 'isLabelSearch': false, 'archive': {'year': 2016, 'month': 9, 'rangeMessage': 'Showing posts from September, 2016'}}}]); _WidgetManager._RegisterWidget('_HeaderView', new _WidgetInfo('Header1', 'header', document.getElementById('Header1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'lightboxEnabled': true, 'lightboxModuleUrl': 'https://www.blogger.com/static/v1/jsbin/392203275-lbx__en_gb.js', 'lightboxCssUrl': 'https://www.blogger.com/static/v1/v-css/13464135-lightbox_bundle.css'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_FeaturedPostView', new _WidgetInfo('FeaturedPost1', 'main', document.getElementById('FeaturedPost1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_PopularPostsView', new _WidgetInfo('PopularPosts1', 'main', document.getElementById('PopularPosts1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogSearchView', new _WidgetInfo('BlogSearch1', 'sidebar-right-1', document.getElementById('BlogSearch1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogArchiveView', new _WidgetInfo('BlogArchive1', 'sidebar-right-1', document.getElementById('BlogArchive1'), {'languageDirection': 'ltr', 'loadingMessage': 'Loading\x26hellip;'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_AttributionView', new _WidgetInfo('Attribution1', 'footer-3', document.getElementById('Attribution1'), {}, 'displayModeFull')); </script> </body> </html>