text:
Q: Access to the .co Zone File? Not sure if SuperUser is the right place to ask this, feel free to move accordingly.
I've been looking for how/where to get access to the complete .co zone file, but so far I only found a couple of old forum postings where a few users try to sell some outdated and reverse-engineered (What does that mean anyway... Did someone brute-force all the ≃ 3763 possible combinations?) zone file for a substantial amount of money ($1,000) with no access to updates whatsoever.
Where (if at all available) can I get access to this zone file? Googling revealed fruitless so far.
I also contacted go.co support a week or so ago asking this question but I'm still waiting for a reply...

A: The registrar information for the Colombia domain gives ".CO Internet S.A.S."
as the sponsoring organization with http://www.go.co/ as their website.
The best way to get their zone file is to contact this company and ask.
You will need of course to furnish a valid reason and might be charged (or not) for this service.
Another address might be the DatCat collection : Passive DNS Zone Files,
a project run by the Indiana University. You will need to contact the project administrator, (if the project is still running), and of course give a valid reason.
Passive listening to DNS requests will only give you the domains that are actively in use.

A: I came across this knowledge base answer:

Does .CO Internet provide access to the .CO Zone File?
Last Updated: Oct 07, 2013 03:30PM COT
No.  Currently, access to the .CO Zone File is not available to the general public.  .CO Accredited
  Registrars and Affiliate Partners may apply and be granted access to
  the .CO Zone File based upon signing a Zone File Sharing Agreement and
  paying a one-time fee.  Access is granted on a case-by-case basis.
  Interested parties should contact Partners@go.co for more information.

A: I think I know a place where you can get co. zone file. I once needed an ar. and used a database I bought from these guys https://alldomainsdb.com/. I think you can buy the whole database with all kinds of zone files or a specific one, you have to make a request. Price is high and you must first contact the guys, so it takes some time and money, but the list was big so I guess it's worth the try


text:
Q: Pandas multi-index best way to slice for ranges of subordinate levels I have two questions concerning pandas dataframe multi-indices.
Assume I have a data-frame df as follows:
                                   data
    port                           bm  pf
    sector instrument date
    1      A          2013-01-14    0   0
                      2013-01-15    5   5
                      2013-01-16   10  10
                      2013-01-17   15  15
                      2013-01-18   20  20

Which can be generated with the following code:
import pandas as pd
date = pd.bdate_range('2013-01-14','2013-01-20').repeat(5)
sector = [1,1,1,2,2] * 5
df = pd.DataFrame(dict(port=['pf']*25,sector=sector,instrument=list('ABCDE')*5,date=date,data=xrange(25)))
df = pd.concat([df,pd.DataFrame(dict(port=['bm']*25,sector=sector,instrument=list('ABCDE')*5,date=date,data=xrange(25)))],axis=0)
df = df.set_index(['port','sector','instrument','date'])
df = df.unstack('port')

I want to get two sets of results: all the values on 2013-01-17 and all the values from 2013-01-17 to the end of the series.
For the first I know I can use one of the following approaches:
idx = pd.IndexSlice
targetdate = pd.Timestamp('2013-01-17')
slicer = (slice(None),slice(None),targetdate)

1) df.loc[slicer,:]
2) df.xs(pd.Timestamp('2013-01-17'),level=2)
3) df.xs(slicer,)
4) df[idx[:,:,targetdate],:]
all of which seem quite clunky. Is there a more obvious way I'm missing? What other ways are there to acheive this. I guess I'm hoping there is something like df.loc(level=2)[targetdate] (which doesn't work of course).
For the second I've only come up with one solution
query = df.index.get_level_values(2) >= pd.Timestamp('2013-01-17')
df[query]

Again is there a more efficient way to do this?
Final bonus question: what does df.index.get_loc_level() do? I feel like it should help with this but I have no idea how to use it.
Thanks

A: I think this masking, like you're doing, is going to be pretty good here:
query = df.index.get_level_values(2) >= pd.Timestamp('2013-01-17')
df[query]

if you have lots of repetition in dates you may improve performance with something lower-level:
query = (df.index.levels[2] >= pd.Timestamp("2013-01-17"))[df.index.labels[2]]
df[query]

I'll probably get shouted out for that...! But it will be significantly faster in some cases.

get_loc_level is the similar of loc, i.e. label based rather than by position:

Get integer location slice for requested label or tuple

In [21]: df.index.get_loc_level(2)
Out[21]:
(slice(15, 25, None),
 MultiIndex(levels=[[u'A', u'B', u'C', u'D', u'E'], [2013-01-14 00:00:00, 2013-01-15 00:00:00, 2013-01-16 00:00:00, 2013-01-17 00:00:00, 2013-01-18 00:00:00]],
            labels=[[3, 3, 3, 3, 3, 4, 4, 4, 4, 4], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]],
            names=[u'instrument', u'date']))

by default it takes the first index, but you can pass in more...
In [21]: df.index.get_loc_level((1, "A"))
Out[21]:
(slice(0, 5, None), <class 'pandas.tseries.index.DatetimeIndex'>
 [2013-01-14, ..., 2013-01-18]
 Length: 5, Freq: None, Timezone: None)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Execution order of select and group by in Mysql SELECT salary * months AS earnings, COUNT(*)
FROM Employee
GROUP BY earnings
ORDER BY earnings DESC
LIMIT 1;

I have a doubt here, As per the order select is executed at last right, But here select is executed before group by, please provide some insight on this
Complete details refer this link
https://www.hackerrank.com/challenges/earnings-of-employees/problem

A: You are misunderstanding what SQL is.  A SQL SELECT statement describes the result set being produced.  It does not specify the steps for executing it.
That is, SQL is a descriptive language, not a procedural language.
The SELECT statement is compiled, typically into a directed acyclic graph (DAG) of operations, which do get executed.  This has no obvious relation to the original SELECT.  For instance, there typically are not DAG operators called SELECT, FROM, or WHERE.  But the results are guaranteed to be the same.
You might be confused with scoping rules in the SELECT statement itself.  That is, table and column aliases are defined in the FROM and can be used throughout the query.  However, that is the scoping of the identifiers in the query, not any sort of "execution" order.


text:
Q: How to compare two Lists in an efficient way? I have two List of objects. I am going to remove those objects from List1 that are in the List2 too. List 2 can have its own objects that List1 does not contain them. I am going to compare the objects inside the lists based on their IDs. I cannot use remove() or removeAll() methods and I am not going to create any set. What would be the efficient way?

A: You must overwrite the equals() and hashcode() methods in your element classes, in order to be able to use removeAll() based on object equality. See the Java documentation for a discussion on how to implement these methods.


text:
Q: Should React Context be used instead of props drilling for non global data? I have found myself in a situation where the child components odf my app take some props with the only purpose of passing them down to their own child components, props drilling. It is clear that Context is a good alternative for data that is mean to be globally accessed in the application. However, is it a good practice to create sub-contexts for subsections of the application?  In this case, the data stored in a section´s context is only going to be used for that particular section. My worry is that context may be intended to be used globally only.
//This context provider wrapps the whole application. The data stored there will be //accessible down to the last child of App.js.
<AppContextProvider>
 <App/>
<AppContextProvider/>

Now inside App.js
const App ()=>{
return (

      <subcompoenet1/>
       <subcomponent2/>

)

Now subcmpoenet2 is a complex section of the app. The data flowing in this section will only be accessible to its children. So is it a good practice to create a context for this section? Just like so:
const subcomponent2 ()=>{
  return (
    <AsectionContextProvider>
       <child1/>
       <chile2/>
       <chile3/>
    <AsectionContextProvider/>
)
}

<AppContextProvider>


text:
Q: iOS Display Alert Dependent On Country User In In my app, I need to check the user's country, and then display an alert based on that.  In the AppDelegate file, I have in didFinishLaunchingWithOptions:
self.locationManager = [[CLLocationManager alloc] init];
    self.locationManager.delegate = self;
    //Here you set the Distance Filter that you need
    self.locationManager.distanceFilter = kCLDistanceFilterNone;
    // Here you set the Accuracy
    self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
    [self.locationManager startUpdatingLocation];

Then for the delegate I have this.  It works, but the alert is constantly re-appearing.  How do I only have it run this once?
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
    NSLog(@"Running");
    CLLocation *newLocation = [locations lastObject];

    CLGeocoder *reverseGeocoder = [[CLGeocoder alloc] init];

    [reverseGeocoder reverseGeocodeLocation:newLocation completionHandler:^(NSArray *placemarks, NSError *error)
     {

         CLPlacemark *myPlacemark = [placemarks objectAtIndex:0];
         NSString *countryCode = myPlacemark.ISOcountryCode;
         NSString *countryName = myPlacemark.country;
         NSLog(@"My country code: %@ and countryName: %@", countryCode, countryName);
         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
         if ([countryName isEqualToString:@"Thailand"]) {
             [defaults setBool:NO forKey:@"TestMode"];
             [defaults synchronize];
         }
         else {
             [defaults setBool:YES forKey:@"TestMode"];
             [defaults synchronize];
             UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test Mode" message:@"Currently, live distribution is limited to the country of Thailand.  You may still use the app in 'Test Mode' to store distribution data on your machine.  When your country is added, you will have the option to upload it to our server." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
             [alert show];
         }

     }];

}

A: Instead of using...
[self.locationManager startUpdatingLocation];

...which tells the location manager to send updates about locations every time it gets a location update, why don't you use:
[self.locationManager requestLocation];

Which will only send you the first location the location manager gets.

A: Take a bool value. It should be false for the first time. Then replace your code with this.
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
    NSLog(@"Running");
    CLLocation *newLocation = [locations lastObject];
     [manager stopUpdatingLocation];

    CLGeocoder *reverseGeocoder = [[CLGeocoder alloc] init];
    [reverseGeocoder reverseGeocodeLocation:newLocation completionHandler:^(NSArray *placemarks, NSError *error)
     {

         CLPlacemark *myPlacemark = [placemarks objectAtIndex:0];
         NSString *countryCode = myPlacemark.ISOcountryCode;
         NSString *countryName = myPlacemark.country;
         NSLog(@"My country code: %@ and countryName: %@", countryCode, countryName);
         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
         if ([countryName isEqualToString:@"Thailand"]) {
             [defaults setBool:NO forKey:@"TestMode"];
             [defaults synchronize];
         }
         else {
             [defaults setBool:YES forKey:@"TestMode"];
             [defaults synchronize];

              if(boolvar == false){
              boolvar = true

             UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test Mode" message:@"Currently, live distribution is limited to the country of Thailand.  You may still use the app in 'Test Mode' to store distribution data on your machine.  When your country is added, you will have the option to upload it to our server." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
             [alert show];
         }
}
     }];

}


text:
Q: How to display from UILabel html content, images, video in Swift 4 How to display from UILabel HTML content from API such as images and video, expect text which I have already done it. Is there a way to fetch from UILabel without using textview or WebKit all the content.
My code is kinda working from the images but the images are huge/cut and also doesn't embed videos from YT or FB
https://imgur.com/a/zdaMCHv
do {
        if let htmlMessageData = post?.content.data(using:
String.Encoding.utf16) {
            let layoutMessage = try NSMutableAttributedString(data:
htmlMessageData, options:
[NSAttributedString.DocumentReadingOptionKey.documentType:
NSAttributedString.DocumentType.html], documentAttributes: nil)
            let paragraphStyle = NSMutableParagraphStyle()
            paragraphStyle.alignment = .justified

layoutMessage.addAttribute(NSAttributedString.Key.paragraphStyle,
value: paragraphStyle, range: NSRange(location: 0, length:
layoutMessage.string.count))
            self.contentLabel.attributedText = layoutMessage
        }
    }
    catch {}


text:
Q: AS3: is-not keyword? I can't seem to actually find a reference to 'is' in the AS3 documentation for type comparison other than in examples. Perhaps this can't be done, but it seems like there should be something for this scenario...
Right now I have:
if ( event.target is Class )
{
}
else
{
    // What I really want to do!
}

This seems silly because what I really want to say is...
if ( event.target isNot Class )
{
    // Sure would be cleaner!
}

Can I do that?

A: Why not just do:
if ( !(event.target is Class) )
{
}

A: To get the class of an object:
var targetClass:Class = Object(event.target).constructor;

To test if target is not a textfield for example
if(Object(event.target).constructor != TextField){
   //not a textfield
}


text:
Q: Why not just study the consequences of Hausdorff axiom? What do statements like, "The arbitrary union of open sets is open," gain us? Define that a pair $(X,\tau)$ where $\tau \subseteq \mathcal{P}(X)$, is a Hausdorff space if for all distinct $a,b \in X$ there exist $A,B \in \tau$ such that $$a \in A, \;b \in B, \;A \cap B = \emptyset.$$
Note that a Hausdorff space, according to this definition, needn't be a topological space, and vice versa.
Call the elements of $\tau$ "open sets", whether or not $\tau$ is a topology.
Then many of the definitions of topological spaces apply equally well to Hausdorff spaces. In particular, the notion of a convergent sequence can be defined as per usual.
In particular, define that a sequence $x : \mathbb{N} \rightarrow X$ converges iff there exists $a \in X$ such that for all open $A$ such that $a \in A$, there exists $N$ such that for all $n \geq N$ it holds that $x_n \in A$.
Then we can write this proof to show that every convergent sequence in $X$ has a unique limit. (i.e. $a$ is unique).
Presumably, the more general result that every net has a unique limit can also be proven.
So why not study limits in arbitrary Hausdorff spaces? What goes wrong when we neglect to assume statements like, "The arbitrary union of open sets is open"?
Edit: So to clarify, my interest lies in the interaction between the topological space axioms and the Hausdorff axiom. What is it about a Hausdorff topological space that is so magical? There must be some sort of synergy going on, or they would have been studied independently of one another.
Note that we can define continuity of functions between topological spaces in terms of preimages of open sets. Lets call this "pre-images continuous." And we can define continuity of functions between Hausdorff spaces in terms of limits of nets. Lets call this "limit-continuous." Perhaps these notions coincide precisely in the case of Hausdorff topological spaces?
Note also that the topology generated by a Hausdorff space is necessarily Hausdorff. So for any Hausdorff space $X$, lets $X'$ denote the (necessarily Hausdorff) topological space generated by $X$. Perhaps a function $f : X \rightarrow Y$ between Hausdorff spaces is limit-continuous if and only if $f : X' \rightarrow Y'$ is (open-preimages)-continuous.

A: I see two main answers for questions of the form

Why aren't we studying <more general case of something> ?

and often both apply:

*

*The more general case isn't as nice.

*It has not yet come up naturally in work on theories / problems that we currently study.
Perhaps a more blunt phrasing of the second answer would be
  2'.  It has not yet come up in a situation where anyone would care.
There is also sometimes a third answer, which is
  3.  People do study that, it's just not mainstream.

For your particular question, about spaces only assumed to satisfy the Hausdorff separation axiom:
I haven't really put much effort in figuring out whether answer 1 applies, but I think it's quite likely that answer 2 does. Maybe it's true that an intricate theory of these Hausdorff-only-spaces could be developed; but as far as I'm aware, currently, there is no reason anyone would care. I could just as easily ask about the theory of "droops", which are (let's say) sets equipped with a ternary operation $\oslash$ satisfying the identity
$$\oslash(a,\oslash(a,b,c),\oslash(c,b,a))=\oslash(b,a,c).$$
Unless, and until, someone demonstrates that such a thing occurs naturally in the mathematics we're already doing, I find it very hard to be interested; and indeed, the theory of these things themselves would suffer, due to a lack of intuition and interconnection with the rest of mathematics. Once the world realizes that the set of complex structures on a manifold, or the rational points on an elliptic curve, naturally forms a droop, then you'll start getting people interested in droops, and moreover, this connection will give you things to think about, things to ask, things to investigate, and the theory of droops will begin to flourish. Without such a connection, any mathematician who was polite and listened to someone explain the definition of a droop most likely wouldn't be able to say anything about them because they lack any previous experience or intuition for such an object.
Okay, I'm exaggerating a bit with droops; Hausdorff-only-spaces are somewhat closer to everyday mathematical experience than a droop. And I don't mean to sound angry or discouraging; it's great to ask questions about why we do things one way and not the other, especially when answer 1 applies and the ways in which the general case are worse have been thoroughly investigated, and you'll gain some real mathematical experience from learning about why we're doing things the way we are. But the overall point is hopefully clear.


text:
Q: What does "assume by contradiction that a<=-2" mean? I want to prove the following statement.

If a+2>0, then a>-2.

What does "assume by contradiction that a<=-2" mean?

A: A proof by contradiction depends on the law of the excluded middle. The law of the excluded middle, in this situation, claims that either a > -2 is true OR else a <= -2 is true.
Thus, an "assumption by contradiction" is technically a theorem in propositional logic that is not susceptible of proof or disproof.


text:
Q: Create view that shows how much a student a spent I need to create a view like this:
STUDENT JANUARY FEBRUARY MARCH ........ DECEMBER
miki     10.23   23.23    0               0
Goku     10        0       0               0

I have a table studentMovement(id_studentmovement,id_student,month,year,cost,date) that represents every sigle cost for the student in this month and year. it contains the real cost that some students had done.
Another table is Month(id_month), that has all month id (January==1 February==2 etc).
Table Students(id_student,name)
Another view is Years(id_year), it contains some year.
I want to get for a year, for all students in the table student(also the student that don't have outputs) and for all month(if there is an output in this month the value is 0) , I want get the sum all cost. SO my view is this
CREATE
    ALGORITHM = UNDEFINED DEFINER = "***" @"%" SQL SECURITY DEFINER VIEW "schema"."v_student_table" AS select
        "s"."id_student" AS "id_student",
        "s"."name" AS "name",
        "m"."id_month" AS "id_month",
        coalesce(sum("sm"."amount"),0) AS "amount",
        coalesce(month("sm"."date"),"month"."id_month") AS "month",
        coalesce(year("sm"."date"),"year"."id_year") AS "anno"
    from
        ((("schema"."studentMovement" "sm"
    left join "schema"."students" "s" on "s"."id_student"="sm"."id_student")
    left join "schema"."month" "m" on "m"."id_month"="sm".id_month")
    inner join "schema"."years" "y" on "y"."id_year"="sm".id_year")

    group by
        coalesce(year("sm"."date"),"year"."id_year"),
         coalesce(month("sm"."date"),"month"."id_month"),
    "s"."id_student",
        "s"."name",
        "m"."id_month"

The problem is if there isn't a cost for a month in a year, I need to put 0 like value but with this query it doesn't do this.
the problem is the studentMovement has the real outputs. in the example above Goku has only one cost that is in jenuary but the student goku is not present for FEBRUARY etc, Anyone can help me?

A: You seem to want something like this:
select year(sm.date) as year, s.id_student, s.name,
       sum(amount) as year_amount,
       sum(case when month(sm.date) = 1 then amount else 0 end) as january,
       sum(case when month(sm.date) = 2 then amount else 0 end) as february,
       . . .
       sum(case when month(sm.date) = 12 then amount else 0 end) as december,
        "m"."id_month" AS "id_month",
        coalesce(sum("sm"."amount"),0) AS "amount",
from schema.students s join
     schema.studentMovement sm
     on s.d_student = sm.id_student
group by year(sm.date) as year, s.id_student, s.name;

The . . . is the logic for the remaining months.


text:
Q: releasePublishArtifactsAction doesnt seem to catch I am trying to publish a multi project to sonatype using sbt-release, sbt-pgp and sbt-sonatype plugins.
while running: sbt publishLocalSigned I see the .asc file published.
but when running sbt release to sonatype I can only see the .md5 and sha1 files.
here is my release.sbt:

    import ReleaseTransformations._

    // publishing
    publishMavenStyle in ThisBuild := true

    credentials in ThisBuild += Credentials(Path.userHome / ".ivy2" / ".credentials_sonatype")

    publishTo in ThisBuild := {
      val nexus = "https://oss.sonatype.org/"
      if (version.value.trim.endsWith("SNAPSHOT"))
        Some("snapshots" at nexus + "content/repositories/snapshots")
      else
        Some("releases" at nexus + "service/local/staging/deploy/maven2")
    }

    publishArtifact in Test := false

    pomIncludeRepository in ThisBuild := { _ => false }

    pomExtra in ThisBuild := {
        <url>my.url</url>
        <licenses>
          <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
          </license>
        </licenses>
        <scm>
          <connection>scm:git:git@github.com:url.git</connection>
          <developerConnection>scm:git:git@github.com:url.git</developerConnection>
          <url>url</url>
        </scm>
        <developers>
          <developer>
            <id>dev</id>
            <name>dev</name>
            <email>dev@gmail.com</email>
          </developer>
        </developers>
    }

    // use maven style tag name
    releaseTagName in ThisBuild := s"${name.value}-${(version in ThisBuild).value}"

    // sign artifacts

    releasePublishArtifactsAction in ThisBuild := PgpKeys.publishSigned.value

    // don't push changes (so they can be verified first)
    releaseProcess in ThisBuild := Seq(
      checkSnapshotDependencies,
      inquireVersions,
      runTest,
      setReleaseVersion,
      commitReleaseVersion,
      tagRelease,
      publishArtifacts,
      setNextVersion,
      commitNextVersion,
      pushChanges,
      releaseStepCommand("sonatypeRelease")
    )

my plugin.sbt:
    addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")

    addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")

    addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")

    addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")

    addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.11")

I am sure my gpg keys are properly set, otherwise I wont be able to run the publishLocalSigned but it seems like I miss something to my sbt-gpg plugin to kick in on release.
sbt version is 1.2.8 and I tried to downgrade to 0.13.17 and got the same behaviour.
I have to mention I was mainly following the jackson-module-scala approach:
https://github.com/FasterXML/jackson-module-scala/blob/master/release.sbt


text:
Q: How to display on x-axis as percentages and how to display values (percent)? To Sri Harsha Chilakapati and Efrem: here is the link,  how should look like graph - http://ulozto.cz/xcTuwHEG/graph-jpeg
I wanted to insert a graph directly and immediately, but it did not work.
Jirka
84
113
9
5
9
168
4
10

mollusca<-as.matrix(read.table("clipboard",head=F,row.names=1))

color<-c('chartreuse4', 'darkolivegreen2', 'darkkhaki', 'ghostwhite', 'Gold1',
            'darkgoldenrod4', 'cadetblue1', 'blue')

b<-barplot(mollusca,beside=F,horiz=T,main=NULL,sub=NULL,width=c(35),col=color,ylim=c(0,max(mollusca+20)),ylab=NULL,xlab="Cumulative percentage",border=NULL)

legend("top", c("přísně lesní druhy","lesní druhy vyskytující se i mimo les","silně vlhkomilné lesní druhy","silvifóbní druhy otevřených stanovišť","termofilní a xerotolerantní druhy","druhy se středními nároky","vlhkomilné druhy,nevázané přímo na mokřady","vodní druhy")
       , cex=0.8, fill=color,ncol=2,bty="n")


text:
Q: Include  in xcode 5? I'm trying to port some Android JNI code to iOS and I'm getting the error
'string' file not found when I try to compile the code in XCode 5.1.1
Does anyone know how to fix this?  Source is inlined, the __cplusplus ifndef is something I just added after reading some other answers (it didn't help).
/*
 * saveload.h
 * --------------------------
 * Declares functions relating to saving and loading from files.
 * This file is around for backwards compatibility, as we now use
 * proto saving and loading instead.
 */

#ifndef SAVELOAD_H_INCLUDED
#define SAVELOAD_H_INCLUDED

#ifndef __cplusplus
#include <string>
#endif

A: I think it should be:
#ifdef __cplusplus
#include <string>
#endif

See the makefile log. It must be have C++ headers in its include path.

A: The problem ended up being that my C++ files were .cc and not .mm files.


text:
Q: Why are you forced to have an empty method to use a method with input parameters? I'm calling an apex controller class method from my visual force page using an actionFunction like so:
<apex:form >
        <apex:actionFunction name="FunctionName" action="{!MyControllerFunction}">
            <apex:param name="Src" value="MySrc"/>
        </apex:actionfunction>
 </apex:form>

Initially, this controller method had no input parameters, but I had to add one during development. When I tried to do so on the controller class, I was notified that other pages were using the previous method with no parameters, and to change those first.
public PageReference MyControllerFunction(String Src)
{
    //Some stuff
    return pr;
}

Sure, so I added the parameter as shown above in my actionFunction definition. But, when I try to save this, I'm given yet another error:
Error: Unknown method 'MyController.MyControllerFunction()'
Quick Fix   Create Apex method 'MyController.MyControllerFunction'

Does this mean I'll have to go back and create a blank method of:
public PageReference MyControllerFunction()
    {
        //Some stuff
        return pr;
    }

whenever I need to add parameters to any function? Or am I missing something here?

Update:
<apex:form >
        <apex:actionFunction name="GetPageRef" action="{!MyControllerFunction}">
            <apex:param name="Src" value="MySrc" assignTo="{!SrcVal}"/>
        </apex:actionfunction>
    </apex:form>

Apex:
public transient String SrcVal{ get; set; }
public PageReference MyControllerFunction()
    {
        //Some stuff
        //Use SrcVal
        return pr;
    }

When it tries to use SrcVal in the controller function, it is coming up blank.
From your updated answer, it appears that in order to use the transient property for my global variable, I need to also apply the rerender attribute on the actionfunction call. I'm having difficulty finding the keywords allowed for this, should it just be "variables" similar to how you are rerendering "messages" in your example?

A: I find it far simpler to use the assignTo attribute to set my parameters:
public class MyController {
    public transient String src { get; set; }
    public PageReference MyControllerFunction() {
        // src will be set here
        return pr;
    }
}

Then, you can change your action function to:
<apex:form >
    <apex:actionFunction name="FunctionName" action="{!MyControllerFunction}">
        <apex:param name="Src" value="MySrc" assignTo="{!src}" />
    </apex:actionfunction>
</apex:form>

You can't remove a function from a class until all of the pages/components that use it no longer reference it. That means more edits in the long run. Using transient variables and assigning values to it allows you to preserve a zero-parameter function, and your transient variables get bound only to the pages/components that need it.

Functional Example:
Controller
public class Echo {
    public String value { get; set; }
    public void echoValue() {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Value sent was: '+value));
    }
}

Page
<apex:page controller="Echo">
    <apex:form>
        <script>
        function handle(event) {
            if(event.which === 13) {
                event.preventDefault();
                echo(event.target.value);
            }
        }
        </script>
        <p>
            Type something here, then press Enter to see it echoed back.
        </p>
        <input type="text" onkeypress="handle(event)" />
        <apex:actionStatus id="status" startText="Working..." />
        <apex:actionFunction name="echo" action="{!echoValue}" reRender="messages" status="status">
            <apex:param name="value" value="" assignTo="{!value}" />
        </apex:actionFunction>
        <apex:pageMessages id="messages" />
    </apex:form>
</apex:page>

A: Methods which are called from VF are required to take no parameters. To get the result you're looking for, the standard practice is to use apex:params, but you're missing a small detail. Here's a blog post from Bob Buzzard which explains in some detail, but basically you need to declare some transient class variables and bind them to the assignTo attribute of the apex:param


text:
Q: How can I parse XML with sencha touch? I obtain response from ajax request in xml format, but how can I parse them using sencha touch?
For example :
 Ext.Ajax.request(
    {
        url: "",
        xmlData: "",
        method: "POST",
        callback: function(options, success, response)
         {
           //response.responseText is equal to value
           if (success) {
             //Parsing response.responseText ...
           }
         }
});

A: All modern browsers have a built in XML Parser
XML Parsing (w3 Schools)
If you are trying to load a store with models and your service result is XML then you can use the xml reader:
var store = new Ext.data.Store({
  model: 'User',
  autoLoad:true,
  proxy: {
   type: 'ajax',
   url : 'ajax/user.xml',
   reader: {
    type : 'xml',
    model: 'User',
    record: 'user'
   }
  }
});


text:
Q: Link to products with the same image title (woocommerce) I have products with a generic image. The image title is for example abc.png.
I would like to generate a link to all products with that image title.
Any help would be appreciated.
Thank you.


text:
Q: Does Leibniz's rule hold for improper integrals? Does this hold in general?
$$
\frac{\mathrm{d}}{\mathrm{d}t}\int_{-\infty}^{\infty} f(x,t) \mathrm{d}x = \int_{-\infty}^{\infty}\frac{\partial}{\partial t}f(x,t) \mathrm{d}x.
$$
I know it is true if the bounds on the integral are finite but can the result be extended to improper integrals? Also if it is true in special cases, what are those cases?
Thanks a lot!

A:
No, the equality does not hold in general.

EXAMPLE $1$
For a first example, the integral $I(x)$ as given by
$$I(x)=\int_{-\infty}^\infty\frac{\sin(xt)}{t}\,dt$$
converges uniformly for all $|x|\ge \delta>0$.  But the integral of the derivative with respect to $x$, $\int_{-\infty}^\infty \cos(xt)\,dt$ diverges for all $x$.

EXAMPLE $2$
As another example, let $J(x)$ be the integral given by
$$J(x)=\int_0^\infty x^3e^{-x^2t}\,dt$$
Obviously, $J(x)=x$ for all $x$ and hence $J'(x)=1$.  However,
$$\int_0^\infty (3x^2-2x^4t)e^{-x^2t}\,dt=\begin{cases}1&,x\ne 0\\\\0&,x=0\end{cases}$$
Thus, formal differentiation under the integral sign leads to an incorrect result for $x=0$ even though all integrals involved are absolutely convergent.

Sufficient Conditions for Differentiating Under the Integral

If $f(x,t)$ and $\frac{\partial f(x,t)}{\partial x}$ are continuous for all $x\in [a,b]$ and $t\in \mathbb{R}$, and if $\int_{-\infty}^\infty f(x,t)\,dt$ converges for some $x_0\in[a,b]$ and $\int_{-\infty}^\infty \frac{\partial f(x,t)}{\partial x}\,dt$ converges uniformly for all $x\in [a,b]$, then
$$\frac{d}{dx}\int_{-\infty}^\infty f(x,t)\,dt=\int_{-\infty}^\infty \frac{\partial f(x,t)}{\partial x}\,dt$$


text:
Q: Correct "cannot open shared object file" error, but incorrect file reported in Cygwin? In Cygwin, I have an executable linked to shared libraries, for the sake of the question cygA.dll and cygB.dll (and more, but not relevant here). To my knowledge one should use PATH for shared library paths in Cygwin, which is where I had cygA.dll on already. I then tried to run the executable, expecting an error that cygB.dll could not be found. To my surprise, I got error while loading shared libraries: cygA.dll: cannot open shared object file: No such file or directory
Inspecting with ldd showed no entry of either .dll, but cygcheck correctly reported cygcheck: track_down: could not find cygB.dll
I also have a different executable with the same shared link to cygA.dll, which ran without issue.
Upon putting the path to cygA.dll on the PATH, my new executable also runs without issue. So Cygwin could not find cygB.dll but incorrectly reported cygA.dll as the missing one. This could be painful for a large project ... is this expected behavior, or a bug? In the latter case, a bug of what? Should I report it to Cygwin itself?

A: If a secondary level DLL is missing cygwin see only the failure of loading the first level DLL. Windows does not pass the info
you can have the corrent info using strace
EG:
$ cygcheck gm.exe
Found: D:\cygwin64\bin\gm.exe
D:\cygwin64\bin\gm.exe
  D:\cygwin64\bin\cygwin1.dll
    C:\WINDOWS\system32\KERNEL32.dll
      C:\WINDOWS\system32\ntdll.dll
      C:\WINDOWS\system32\KERNELBASE.dll
  D:\cygwin64\bin\cygGraphicsMagick-3.dll
    D:\cygwin64\bin\cygbz2-1.dll
...

$ mv cygbz2-1.dll cygbz2-1.dll-bk

 $ strace -o /tmp/gm.strace /usr/bin/gm.exe --help
D:/cygwin64/bin/strace.exe: error while loading shared libraries: ?: cannot open
 shared object file: No such file or directory

But windows correctly provides a popup info:


text:
Q: EmberJS router and external library I have currently difficulties in using the EmberJS router and an external library.
Using the EmberJS router, the routing functionality works perfectly.
Also the inclusion of the external library within a component works as expected.
BUT the combination of both is not working.
In detail: the library (pdf.js) is manipulating the DOM and inserting anchor tags while scrolling through the document. These anchor tags work fine. But if I try to "catch" the event and use the EmberJS routing functionality, it is not working!
I cannot create an eventlistener in the DidRender() function and use preventDefault, because the elements are not present during the time of execution of DidRender.
Did anyone face the same issue or maybe has a solution for this problem?
Cheers,
Franz

A: I am assuming you are using a component,
Init 3-rd party lib inside didInsertElement hook instead of DidRender.
The DOM is ready inside that hook and you can assess the component HTML element using this.$().
What does this mean?

But if I try to "catch" the event and use the EmberJS routing functionality, it is not working!

DOM manipulation operations are all sync operations. Bind the your own even handler inside the didInsertElement hook too, but pay close attention to your this context.


text:
Q: What is the role of continuity in definition of distributions? Why one can not say simply that a distribution is a linear functional on space $\mathcal D$? What is the purpose or application of topology here?

A: If we remove continuity, the space $\mathcal{D}'$ of distributions certainly would not be the same:

The existence of linear functionals which are discontinuous on $\mathcal{D}$ may be demonstrated mathematically using the axiom of choice. However, no explicit example of these can be cited and there is very little chance of ever meeting one in practice. (Source)

In general, smaller the topology on $\mathcal{D}$, bigger the dual $\mathcal{D'}$. The topology Schwartz put in $\mathcal{D}$ is precisely the one that yields the dual with no more elements than those needed to ensure that each continuous function is infinitely differentiable:

ainsi nous avons introduit le moins possible d'êtres mathématiques nouveaux pour que toute fonction continue devienne indéfiniment dérivable. (Source)

I think this can be seen as a kind of "role" of continuity (it produces an "ideal amount" of distributions).


text:
Q: Vs Code debugging Blazor WASM standalone I am trying to debug blazor wasm application using Visual Studio Code, and tried this method from documentation Debug ASP.NET Core Blazor WebAssembly
So I checked got nuget DevServer Package and VS Code Extensions that are needed that is C# for Visual Studio Code Extension and Microsoft.AspNetCore.Razor.VSCode.BlazorWasmDebuggingExtension.
Also I have my launchSettings.json:
{
  "profiles": {
    "Blazor.Wasm": {
      "commandName": "Project",
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

and VsCode launch.json:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Debug Blazor Web Assembly in Chrome",
            "type": "blazorwasm",
            "request": "launch",
            "url": "https://localhost:5001",
            "webRoot": "${workspaceFolder}"
        }
    ]
}

And in result I have an error message like bellow.

But I see webpage has been started, i can go to https://localhost:5001 and it works, but when i put a breakpoint it is marked as unload, like debugger is not loaded or working at all.
What can be the problem of this?

A: the fix has not been published yet.
https://github.com/dotnet/aspnetcore/issues/45257
https://github.com/dotnet/aspnetcore/issues/45257#issuecomment-1357128650

This problem does not happen in VS2022.

In VS Code the way to debug is with chrome devtools as follows:
Launch the Blazor site from console

dotnet run

"chrome-path\chrome.exe" --remote-debugging-port=9222 --user-data-dir="user-data-root-path\AppData\Local\Temp\blazor-chrome-debug" schema:// localhost:port/

And now in chrome: shift+alt+D.
Then debug blazor in chrome devtools at source tab and search your code in file://.
Then add a breakpoint and inspect in devtools of chrome.

Update on 2023-02-02
blazorwasm-companion.launchDebugProxy v1.1.3 has been released today (2023-02-02) and resolves the issue.


text:
Q: Adding Liebert UPS (Uninterrupted power supply) psi Range I have an Liebert PowerSure PSI Line-Interactive UPS, 1000VA and using Ubuntu 12.04 LTS.
I've used it on windows and it came up as and Notebooks battery. Is there support for these type of devices?
I've tried the Multi link software on the emerson site and found ML_36_004_Linux_x86.bin Which would be the software when using the 2.4.18+ Kernel. is it possible to use this file?

A: Here is a little method to see if you can. Run uname -a in a terminal(Can't paste it, you must type it), and you will see a string in the form of:
Linux ubuntu X.X.X-XX-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 YYYYYY GNU/Linux

If you want to use this package, the X.X.X-XX part must be greater than 2.4.18- [nnn], where [nnn] is any number.(You are running 12.4, it should be around 3.0.0.12 or something a bit higher). Also, the YYYYY part of the scring (See above example) must be x86, not x86_64 if you want to use this package. If you get x86_64, look for a package with the name ML_36_04_Linux_X86_64, or something like that meant for 64-bit systems.

A: You can also install Network UPS tools:
apt-get install nut
then configure NUT to report when your UPS sends events and act accordingly.


text:
Q: Rotating an image around another? I am currently developing a game for iphone in which there is a spinning asteroid(which is circular) and an object spinning around the circumference of that asteroid. I have made calculations for the object to spin around the circumference of the asteroid using x = center.x + radius*cosf(degrees in radians) and y = center.y + radius*sinf(degrees in radians.) The only question I have is this: How much should I change the value of 'degrees' per frame in the object spinning around the circle to keep the image rotating so it appears to be moving around the circle but without rotating too much and how do I calculate something like that? Any help is appreciated.

A: Decide how many revolutions per minute you want then replace "degrees in radians" from your example with "revolutions/minute * minutes * 2pi". You can replace "minutes" with any time measurement.


text:
Q: How to send the ESC signal to vim when my esc key doesn't work? I'm having a problem with the Esc key when I want to return to the interactive mode from the insert mode. Is there exist another key used to release the insert mode.

A: Existing solutions notwithstanding, the conventional solution in Vim is to remap keys in your .vimrc configuration. In fact, many Vim users have an easier reachable key remapped to Esc. Popular choices are Ctrl+Enter, or jj, etc.
To enable this, just put something like the following into your .vimrc and reload it/restart Vim:
" Shift-Enter
inoremap <S-CR> <Esc>
" Double-j
inoremap jj <Esc>

More information and alternatives

A: Ctrl-[ sends the same character to the terminal as the physical Esc key.  The latter is simply a shortcut for the former, generally.

A: You could try Ctrl-C, that works for me and is in my opinion easier than ESC. However I am not sure if it is enabled by default.

A: If you want to be able to use a single key, as a pure *nix solution (without Vim mappings) you could define another key as Esc.  Just like Emacs users remap CapsLock to Ctrl some Vim users (me included) remap CapsLock to Esc.  This works for any *nix using X11.
Use xev -event keyboard (and then press CapsLock) to get the keycode for the CapsLock key (for me it is keycode 66).  Then you can use xmodmap to remap the key:
xmodmap -e 'remove Lock = Caps_Lock' -e 'keycode 66 = Escape'

To get this at login you can add the xmodmap expressions to ~/.Xmodmap as follows:
remove Lock = Caps_Lock
keycode 66 = Escape

Although for the second part YMMV, since not all display managers run ~/.Xmodmap.  You may need to add xmodmap .Xmodmap to .xinitrc on some of them.

A: Terminal emulators send an ESC code also when you press:

*

*Ctrl+[

*Ctrl+3 I like this one as you can use one hand only to press it.

*Alt followed by any other key. For example Alt+h,j,k,l will exit insert mode and move the cursor at the same time.

A: Ctrl + F2
Is enabled by default. No need to configure any settings.
You will move to normal mode, where you can do :q! or :wq.


text:
Q: Select rows with non matching column I am trying to retrieve rows with same Volume value or with only 1 Volume, but could not come up with a SQL logic.
Data:

ID
Volume

A
100

A
100

B
101

B
102

B
103

B
104

C
400

Required Output:

ID
Volume

A
100

A
100

C
400

A: This one is achievable using a subquery.
select * from test where col1 in (
  select t.col1
  from(
    select col1, col2,
        dense_rank() over (partition by col1 order by col2) as dr
    from test) t
  group by  t.col1
  having sum(case when t.dr = 1 then 0 else t.dr end) = 0)

Try this dbfiddle.

A: This can be done on a more easy way:
select t1.id,
       t1.volume
from tbl t1
inner join (select id
            from tbl
            group by id
            having count(distinct volume) = 1
            ) as t2 on t1.id=t2.id;

https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=92bc234e631a1106b0e322bc4954d696
having count(distinct volume) = 1 will return only the id that have the same volume , including the id with just one volume.

A: I'd naturally be inclined towards Ergest Basha's pattern.
It can also be expressed using NOT EXISTS()
SELECT
  t.*
FROM
  tbl AS t
WHERE
  NOT EXISTS (
    SELECT *
      FROM tbl
     WHERE id = t.id
       AND volume <> t.volume
  )

https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=243c42008f527391514d1ad124730587


text:
Q: Create a filtered copy of JavaScript object with arrays I'm new to JavaScript/jQuery and there's probably an easy way to do this, but I'm unable to find the function or syntax I need. Basically, I have a set of objects like this:
{
  "Object1": [
    {
      "Value": "ABC",
      "IsEnabled": true
    },
    {
      "Value": "DEF",
      "IsEnabled": false
    }
  ],
  "Object2": [
    {
      "Value": "GHI",
      "IsEnabled": false
    }
  ]
}

And I want to turn it into a new set of objects based on the "IsEnabled" value equals true.
{
  "Object1": [
    {
      "Value": "ABC",
      "IsEnabled": true
    }
  ]
}

If it's simpler, I would also be OK with not a new object, but the existing object with the "IsEnabled"=false objects removed. Any help is appreciated, thanks.

A: Loop over the properties in the outer object. For each of them, call filter() to get just the enabled objects in the array. If the resulting array is not empty, add it to the result.

const input = {
  "Object1": [
    {
      "Value": "ABC",
      "IsEnabled": true
    },
    {
      "Value": "DEF",
      "IsEnabled": false
    }
  ],
  "Object2": [
    {
      "Value": "GHI",
      "IsEnabled": false
    }
  ]
};

const output = {};

Object.entries(input).forEach(([key, array]) => {
  const new_array = array.filter(el => el.IsEnabled);
  if (new_array.length > 0) {
    output[key] = new_array;
  }
});

console.log(output);

A: If you are in for a functional programming pattern, you can for instance use Object.entries, then map and filter on that array of pairs, and finally Object.fromEntries:

let obj = {"Object1": [{"Value": "ABC","IsEnabled": true},{"Value": "DEF","IsEnabled": false}],"Object2": [{"Value": "GHI","IsEnabled": false}]};

let result = Object.fromEntries(
    Object.entries(obj)
          .map(([k, arr]) => [k, arr.filter(o => o.IsEnabled)])
          .filter(([, arr]) => arr.length)
);

console.log(result);


text:
Q: Making final class variables static in GWT In Java when a final field is assigned a constant value compile-time, it usually makes sense declaring it static. It saves overhead according to the relevant PMD rule.
Does it make any sense or difference doing it in GWT regarding the generated Javascript code?

A: If the variable is assigned when it is declared final, then yes, static makes a certain amount of sense, but there are cases where it should not be static:
public MyClassWithFinal {
    private final String finalVar;
    public MyClassWithFinal(String name) {
         this.finalVar = name;
    }
}

Another case: If the instance var is not a string or number constant, but requires running a constructor, that constructor may have side effects each time it is invoked, so running it only once is different than running it multiple times.
That said, GWT will inline/intern constant string values, so if you have multiple String fields all assigned to the same value, GWT will probably detect that and promote them all to static.
public final String constant = "Some Constant that really ought to be static";

GWT will notice that this is never assigned except when declared, and may even remove the field itself.
The best rule is to start with the best (i.e. most readable, most maintainable, most efficient) Java code, and to only break from that in cases where GWT requires something specific. This is not one of those cases: the compiler should perform the same basic optimizations no matter how you write this.

A: A field marked as final doesn't mean that it is immutable, only that its reference won't point to any other memory chunk. Therefore, it can only make sense to make a field static if it is really immutable, or if it is a primitive.
For instance, it's common to declare lists as final if you want to make sure that they will never point to a different list object, but the list itself can still be filled with data, cleared, filled again, etc. And of course, each object declaring such list does not mandatory want to share it among every instances.
private final List<...> list = new ArrayList<...>();

Final keyword is there to prevent you from doing mistakes, like setting to null a reference that should never change.


text:
Q: How to switch xml layout from spinner selection I'm developing a simple BMI calculator for android. I have input fields for lbs, feet, and inches. I want to give users the ability to switch from imperial units to metric, so I added a spinner widget with imperial and metric as options. If the user changes the spinner to metric, I want to be able to change the XML layout so that the input fields are kg and cm. What is the best way to change the XML layout when the user switches between metric and imperial?
I tried creating a new activity that loads the metric layout XML when the user switches to it, but it seems like a poor design to create a new activity just to switch units. I also tried simply using setContentLayout to set the layout to metric.xml if spinner has metric selected and imperial.xml if imperial is selected. This sort of works but the ads and spinner widgets are no longer configured after switching between the layouts. I am still new to android development so I am wondering what the best approach to this would be? I am simply trying to make a slight layout change when the user switches between the different unit options. Any tips appreciated.

A: Normally, I would put everything inside activity layout xml file and toggle based on the condition like this
<TextView
      android:id="@+id/feet"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:visibility="gone"/>

<TextView
      android:id="@+id/inch"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:visibility="gone"/>

And in your spinner adapter selection listener, you can toggle the view you want to show:
feet.setVisibility(View.VISIBLE)

A: You can use FrameLayout. It allow you to make to different layouts on each other (different views can be located on another views). For example:
<FrameLayout

    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:background="#FFFFFF">

    <RelativeLayout
        android:id="@+id/digital_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:layout_marginLeft="294dp"
        android:layout_marginTop="64dp">

        <Spinner
            android:id="@+id/spinner101"
            android:layout_width="135dp"
            android:layout_height="wrap_content"
            android:layout_below="@+id/checkBox100"
            android:layout_toEndOf="@+id/textView100"
            android:visibility="visible"/>

        <TextView
            android:id="@+id/textView102"
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"
            android:layout_below="@+id/spinner101"
            android:text="Value pulse"
            android:textSize="20dp"
            android:visibility="visible"/>

        <TextView
            android:id="@+id/textView107"
            android:layout_width="wrap_content"
            android:layout_height="22dp"
            android:layout_alignStart="@+id/textView106"
            android:layout_below="@+id/textView103"
            android:gravity="center"
            android:text="11%"
            android:visibility="visible"/>

    </RelativeLayout>

<RelativeLayout

    android:id="@+id/analog_layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <EditText
        android:id="@+id/editText3"
        android:layout_width="136dp"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/spinner2"
        android:layout_below="@+id/checkBox3"
        android:ems="10"
        android:hint="Constant"
        android:inputType="textPersonName"
        android:textSize="15dp"
        android:visibility="invisible" />

    <Button
        android:id="@+id/button6"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/checkBox9"
        android:layout_marginLeft="20dp"
        android:onClick="onResetClick"
        android:text="Reset" />

    <View
        android:id="@+id/delitel1"
        android:layout_width="234dp"
        android:layout_height="2dp"
        android:layout_alignStart="@+id/textView7"
        android:layout_below="@+id/button6"
        android:layout_marginTop="10dp"
        android:background="#004f9b" />

    <TextView
        android:id="@+id/textView14"
        android:layout_width="135dp"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignTop="@+id/delitel1"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp"
        android:text="Language:"
        android:textSize="20dp"
        android:visibility="invisible" />

</RelativeLayout>

So, you need to give different id to each RelativeLayouts. Here there are android:id="@+id/digital_layout" and android:id="@+id/analog_layout".
And in code need to write handler for your spinner:
@Override
    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
        switch (position) {
            case 0:
                digital_layout.setVisibility(View.INVISIBLE);
                analog_layout.setVisibility(View.VISIBLE);
            break;
            case 1:
                digital_layout.setVisibility(View.VISIBLE);
                analog_layout.setVisibility(View.INVISIBLE);
            break;
            etc.
        }
    }


text:
Q: Custom Slider (Toggle Slider) not working using jquery Working on Jquery (Toggle Slider).

*

*On load, the left button should be disabled (currently not working).

*After first click, the right button then left button should be enabled.

*When we get to the last slide, the right button should be disabled.
(Currently not working)

*When the slide goes to first position the slide shouldn't move again

*the same for last slide also

Here is my jQuery code for reference.

$(".leftBtn").click(function(e) {
  goRight();
});
$(".rightBtn").click(function(e) {
  goLeft();
});

function goRight() { // inner stuff slides left
  var initalLeftMargin = $(".innerLiner").css('margin-left').replace("px", "") * 1;
  var newLeftMargin = (initalLeftMargin - 204); // extra 2 for border
  $(".innerLiner").animate({
    marginLeft: newLeftMargin
  }, 500);
}

function goLeft() { // inner stuff slides right
  var initalLeftMargin = $(".innerLiner").css('margin-left').replace("px", "") * 1;
  var newLeftMargin = (initalLeftMargin + 204); // extra 2 for border
  if (newLeftMargin >= 0){
            $(".leftBtn").css("display", "none");
         } else {
             $(".leftBtn").css("display", "block");
         }
  $(".innerLiner").animate({
    marginLeft: newLeftMargin
  }, 500);
}
* {
  Box-sizing: Border-box
}

.mycontainer {
  white-space: nowrap;
  overflow-x: hidden;
  width: 204px;
}

.box {
  display: inline-block;
  border: 2px black solid;
  padding: 20px;
  width: 200px;
  height: 100px;
  vertical-align: top;
  background-color: pink;
}

.box2 {
  background-color: yellow;
}

<input class="rightBtn" type="button" value="Left">

      This is box1

      This is box2

      This is box3

<input class="leftBtn" type="button" value="Right">

A: You are moving to the correct direction.  Here are some tips to fix the code:

*

*Move the button update code to a function to make it easy to update and call.

*Show both buttons by default, and hide the correct one depending on new margin.

*Call the function with initial margin to disable the correct initial button, before user click anything.

In short,
function updateButtons( newLeftMargin ) {
  $(".leftBtn,.rightBtn").show(); // Show both buttons by default
  if ( newLeftMargin >= 0 )
    $(".rightBtn").hide();
  if ( newLeftMargin <= -408 )
    $(".leftBtn").hide();
}
updateButtons(0)

Below is a complete snippet.  Note that I took the liability to lightly optimise your other code.

function goRight() { // inner stuff slides left
  var initalLeftMargin = parseInt( $(".innerLiner").css('margin-left') );
  var newLeftMargin = (initalLeftMargin - 204); // extra 2 for border
  updateButtons( newLeftMargin );
  $(".innerLiner").animate({
    marginLeft: newLeftMargin
  }, 500);
}

function goLeft() { // inner stuff slides right
  var initalLeftMargin = parseInt( $(".innerLiner").css('margin-left') );
  var newLeftMargin = (initalLeftMargin + 204); // extra 2 for border
  updateButtons( newLeftMargin );
  $(".innerLiner").animate({
    marginLeft: newLeftMargin
  }, 500);
}

function updateButtons( newLeftMargin ) {
  $(".leftBtn,.rightBtn").show(); // Show both buttons by default
  if ( newLeftMargin >= 0 )
    $(".rightBtn").hide();
  if ( newLeftMargin <= -408 )
    $(".leftBtn").hide();
}
updateButtons(0)

$(".leftBtn").click( goRight );
$(".rightBtn").click( goLeft );
* {
  Box-sizing: Border-box
}

.mycontainer {
  white-space: nowrap;
  overflow-x: hidden;
  width: 204px;
}

.box {
  display: inline-block;
  border: 2px black solid;
  padding: 20px;
  width: 200px;
  height: 100px;
  vertical-align: top;
  background-color: pink;
}

.box2 {
  background-color: yellow;
}

<input class="rightBtn" type="button" value="Left">

      This is box1

      This is box2

      This is box3

<input class="leftBtn" type="button" value="Right">


text:
Q: Slow video performance with 4 monitors. What's the cause? I recently installed another video card and added two more monitors to my work setup. Opening RDP windows and expanding the start menu cause the box to slow, mouse to jump and is a real productivity killer. Am I lacking the power necessary to drive the cards? Is there just increased processor load that is slowing me down?

*

*Dell Optiplex 755

*265W Power supply

*Core 2 6600 (2.40 GHZ)

*8GB RAM

*ATI Radeon HD 2400 Pro

*Nvidia GeForce 8400 GS

*Windows 7 x64


text:
Q: On Direct integral decomposition of von Neumann algebras I have a question. We know by theory that any von Neumann algebra is direct integral of factors. Then how to get the decomposition in practical situation. Basically what is the decomposition examples for abelian vN algebras, Group vN algebras such that group is not i.c.c, and  $\mathbb{B}(\mathcal{H})\otimes L^{\infty}(X,\mu)$. Thanks in advance!

A: There is no "practical situation", my opinion (with a small caveat mentioned at the end). Any von Neumann algebra that is expressed to you in a somewhat concrete way, is more amenable to manipulation than a direct integral. People (very) seldom use direct integrals to prove some general fact, not to understand their algebras.
For example, an abelian von Neumann algebra is $L^\infty(X,\mu)$ for some measure space. Suppose $X$ is $\mathbb R^n$, or $\mathbb C^n$, or one of many many other nontrivial measure spaces. Writing your algebra as a direct integral of uncountable many copies of $\mathbb C$ gives you nothing. Similarly, on $B(H)\otimes L^\infty(X,\mu)$ you can see the centre directly (it's $I\otimes L^\infty(X,\mu)$) and do stuff; writing the algebra as a direct integral of uncountably many copies of $B(H)$ gives you nothing of value.
In the case of group von Neumann algebras I don't have much to say. Mostly because I don't really remember if one can characterize the centre explicitly: the only case where the direct integral decomposition can be useful is the case where you have minimal central projections, because in that case you can write the decomposition rather explicitly. That said, I don't think  it is usual to be able to write projections in a group von Neumann algebras explicitly (I might be wrong, I haven't played with group algebras in a very long time).
The only case where the direct integral decomposition is meaningful is in the case of finite-dimensional algebras. A finite-dimensional von Neumann algebra is of the form $\bigoplus_{k=1}^m M_{m_k}(\mathbb C)$. That's precisely the direct integral decomposition (over a finite measure space, that's why it's tractable).


text:
Q: SQL Server for XML mix Element and dynamic Attribute Not able to to get the desired XML output, when I execute the code below I dont want the tag amount, I need the amount as a value from vCod tag.
Can I get that ouput with FOR XML? what am I doing wrong ?
This code sql code :
declare @t table (vKey int,  vCod varchar(4) , amount decimal(16,2) )

insert @t values ( 1 , 'v110' , 12.34 )
insert @t values ( 1 , 'v115' , 18.40 )
insert @t values ( 1 , 'v120' , 2.55 )
insert @t values ( 2 , 'v110' , 22.33 )
insert @t values ( 2 , 'v120' , 8.05 )
insert @t values ( 3 , 'v120' , 13.23 )
insert @t values ( 3 , 'v125' , 28.05 )
insert @t values ( 3 , 'v130' , 44.00 )

select vkey as '@key', vCod as '@vCod' , amount as '@amount' from @t for xml
path('Root')`

Produces:
<Root key="1" vCod="v110" amount="12.34" />
<Root key="1" vCod="v115" amount="18.40" />
<Root key="1" vCod="v120" amount="2.55" />
<Root key="2" vCod="v110" amount="22.33" />
<Root key="2" vCod="v120" amount="8.05" />
<Root key="3" vCod="v120" amount="13.23" />
<Root key="3" vCod="v125" amount="28.05" />
<Root key="3" vCod="v130" amount="44.00" />

I need this:
<Root>
    <Group key="1">
        <vCod v110="12.24"
              v115="18.40"
              v120="2.55"/>
    </Group>
    <Group key="2">
        <vCod v110="22.33"
              v120="8.05"/>
    </Group>
    <Group key="3">
        <vCod v120="13.23"
              v125="28.05"
              v130="44.00"/>
    </Group>
</Root>

A: You'll need to PIVOT the amount values around vCod so that you can use those vCod values as attribute names, e.g.:
declare @t table (vKey int,  vCod varchar(4) , amount decimal(16,2) )

insert @t values ( 1 , 'v110' , 12.34 )
insert @t values ( 1 , 'v115' , 18.40 )
insert @t values ( 1 , 'v120' , 2.55 )
insert @t values ( 2 , 'v110' , 22.33 )
insert @t values ( 2 , 'v120' , 8.05 )
insert @t values ( 3 , 'v120' , 13.23 )
insert @t values ( 3 , 'v125' , 28.05 )
insert @t values ( 3 , 'v130' , 44.00 )

select
  vkey as [@key],
  v110 as [vCod/@v110],
  v115 as [vCod/@v115],
  v120 as [vCod/@v120],
  v125 as [vCod/@v125],
  v130 as [vCod/@v130]
from (
  select vKey, vCod, amount from @t
) Src
pivot (max(amount) for vCod in ([v110], [v115], [v120], [v125], [v130])) p
for xml path('Group'), root('Root');

Which produces:
<Root>
    <Group key="1">
        <vCod v110="12.34" v115="18.40" v120="2.55"/>
    </Group>
    <Group key="2">
        <vCod v110="22.33" v120="8.05"/>
    </Group>
    <Group key="3">
        <vCod v120="13.23" v125="28.05" v130="44.00"/>
    </Group>
</Root>


text:
Q: How to sort the value in an output CSV file with XSLT using one of the columns I have an XML that I am trying to transform using XSLT. I want the output CSV file to be sorted using the TRANNUM Column in ascending order. See a snippet from the XSLT file I want to modify below. The TRANNUM column has 3 possible values which are 10,11 and 12. I want the rows where the TRANNUM value equals 10 to come first followed by 11 and then 12 in the CSV output file. Below XSLT is working but not sorting the values using the TRANNUM values in ascending order but using the values of  tns:Company/tns:Code ('RETGP', 'RTLPM', 'RETRT') to sort the output instead of 10, 11, 12
Below is the extract from my XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:math="http://www.w3.org"
    xmlns:wd="http://"
    xmlns:tns="http://"
    xmlns:xtt="urn:"
    exclude-result-prefixes="xs math wd tns xtt" version="3.0">

    <xsl:param name="p.source"></xsl:param>

    <xsl:output method="text" indent="yes"/>
    <xsl:strip-space elements="*"/>
    <xsl:template match="tns:OutboundFile">
        <header1>FinJournals
TRANNUM,DATE,PROPERTY,ACCOUNT,POSTMONTH,BOOKNUM,AMOUNT,REMARK,REF,DESC,SEGMENT2,DISPLAYTYPE,ReverseNextMonth</header1>
        <JournalEntry>
            <xsl:for-each-group select="tns:Journal_Entry/tns:Journal_Line[tns:Ledger_Account != '888888']"
                group-by="string-join((tns:Company/tns:Code,tns:Ledger_Account,description),'+')">
            <xsl:sort select="tns:Company/tns:Code" data-type="text" order="ascending"/>
                <xsl:if test="format-number(sum(current-group()/tns:Ledger_Debit_Amount) - sum(current-group()/tns:Ledger_Credit_Amount),'#0.00') != '0.00'">
                    <JournalLine>
                        <xsl:text>
</xsl:text>
                        <TRANNUM>
                            <xsl:choose>
                                <xsl:when test="tns:Company/tns:Code = 'RETGP'">10</xsl:when>
                                <xsl:when test="tns:Company/tns:Code = 'RTLPM'">11</xsl:when>
                                <xsl:when test="tns:Company/tns:Code = 'RETRT'">12</xsl:when>
                            </xsl:choose>
                        </TRANNUM><xsl:text>,</xsl:text>
                        <DATE><xsl:value-of select="format-date(current-date(),'[M01]/[D01]/[Y0001]')"/></DATE><xsl:text>,</xsl:text>
                        <PROPERTY>
                            <xsl:choose>
                                <xsl:when test="tns:Company/tns:Code = 'RETGP'">22000</xsl:when>
                                <xsl:when test="tns:Company/tns:Code = 'RTLPM'">26000</xsl:when>
                                <xsl:when test="tns:Company/tns:Code = 'RETRT'">23000</xsl:when>
                            </xsl:choose>
                        </PROPERTY><xsl:text>,</xsl:text>

Sample Current Output
TRANNUM,DATE,PROPERTY,ACCOUNT,POSTMONTH
10,01/11/2023,22000,720010,01/13/2023,1
10,01/11/2023,22000,720025,01/13/2023,1
10,01/11/2023,22000,211070,01/13/2023,1
10,01/11/2023,22000,720005,01/13/2023,1
10,01/11/2023,22000,211070,01/13/2023,1
12,01/11/2023,23000,720025,01/13/2023,1
12,01/11/2023,23000,211070,01/13/2023,1
11,01/11/2023,26000,211070,01/13/2023,1
11,01/11/2023,26000,211010,01/13/2023,1
11,01/11/2023,26000,211065,01/13/2023,1
11,01/11/2023,26000,211010,01/13/2023,1
11,01/11/2023,26000,211070,01/13/2023,1
11,01/11/2023,26000,211015,01/13/2023,1
Sample Expected Output
TRANNUM,DATE,PROPERTY,ACCOUNT,POSTMONTH
10,01/11/2023,22000,211070,01/13/2023,1
10,01/11/2023,22000,720025,01/13/2023,1
10,01/11/2023,22000,211070,01/13/2023,1
10,01/11/2023,22000,720010,01/13/2023,1
10,01/11/2023,22000,720025,01/13/2023,1
11,01/11/2023,26000,211070,01/13/2023,1
11,01/11/2023,26000,211010,01/13/2023,1
11,01/11/2023,26000,211065,01/13/2023,1
11,01/11/2023,26000,211010,01/13/2023,1
11,01/11/2023,26000,211015,01/13/2023,1
11,01/11/2023,26000,211070,01/13/2023,1
12,01/11/2023,23000,720005,01/13/2023,1
12,01/11/2023,23000,211070,01/13/2023,1

A: Perhaps add e.g.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:math="http://www.w3.org"
    xmlns:wd="http://"
    xmlns:tns="http://"
    xmlns:xtt="urn:"
    exclude-result-prefixes="xs math wd tns xtt" version="3.0">

    <xsl:param name="p.source"></xsl:param>

    <xsl:output method="text" indent="yes"/>
    <xsl:strip-space elements="*"/>
    <xsl:template match="tns:OutboundFile">

    <xsl:param name="code-map" as="map(xs:string, xs:integer)"
      select="map { 'RETGP' : 10, 'RTLPM' : 11, 'RETRT' : 12 }"/>
        <header1>FinJournals
TRANNUM,DATE,PROPERTY,ACCOUNT,POSTMONTH,BOOKNUM,AMOUNT,REMARK,REF,DESC,SEGMENT2,DISPLAYTYPE,ReverseNextMonth</header1>
        <JournalEntry>
            <xsl:for-each-group select="tns:Journal_Entry/tns:Journal_Line[tns:Ledger_Account != '888888']"
                group-by="string-join((tns:Company/tns:Code,tns:Ledger_Account,description),'+')">
                <xsl:sort select="$code-map(tns:Company/tns:Code)"/>
                <xsl:if test="format-number(sum(current-group()/tns:Ledger_Debit_Amount) - sum(current-group()/tns:Ledger_Credit_Amount),'#0.00') != '0.00'">
                    <JournalLine>
                        <xsl:text>
</xsl:text>
                        <TRANNUM>
                            <xsl:choose>
                                <xsl:when test="tns:Company/tns:Code = 'RETGP'">10</xsl:when>
                                <xsl:when test="tns:Company/tns:Code = 'RTLPM'">11</xsl:when>
                                <xsl:when test="tns:Company/tns:Code = 'RETRT'">12</xsl:when>
                            </xsl:choose>
                        </TRANNUM>

Untested as no input sample was provided.


text:
Q: URL - FileNotFoundException for image file in Android I'm trying to get a image from particular URL but it throwsFileNotFoundException. If I try to open the url from my browser, i can see the images. Please help. Below is my code. Thanks.
String fileURL = "http://sposter.smartag.my/images/KFC_Voucher.jpg";
String FILENAME = "caldophilus.jpg";
URL u = new URL(fileURL);
HttpURLConnection c = (HttpURLConnection) u.openConnection();
c.setRequestMethod("GET");
c.setDoOutput(true);
c.connect();
File root = Environment.getExternalStorageDirectory();
FileOutputStream f = new FileOutputStream(new File(root, FILENAME));
InputStream x=c.getInputStream();
int size=x.available();
byte b[]= new byte[size];
x.read(b);
f.write(b);
f.flush();
f.close();

A: i try this and its work fine. Thanks.
URL url = new URL(fileURL);
URLConnection conexion = url.openConnection();
conexion.connect();
int lenghtOfFile = conexion.getContentLength();
Log.d("ANDRO_ASYNC", "Lenght of file: " + lenghtOfFile);
InputStream input = new BufferedInputStream(url.openStream());
OutputStream output = new FileOutputStream("/sdcard/caldophilus.jpg");
byte data[] = new byte[1024];
long total = 0;
while ((count = input.read(data)) != -1) {
total += count;
output.write(data, 0, count);
}
output.flush();
output.close();
input.close();

A: Try this:
  BufferedInputStream inputStream = null;
  OutputStream out = null;

  String fileName = null;
  String path = null;
  File savedFile = null;

  try
  {
      // Replace your URL here.
      URL fileURL = new URL("http://enter.your.url.here");
      URLConnection connection = fileURL.openConnection();
      connection.connect();

      inputStream = new java.io.BufferedInputStream(connection.getInputStream());

      // Replace your save path here.
      File fileDir = new File("path/to/save");
      fileDir.mkdirs();
      savedFile = new File("path/to/save", fileName);
      out = new FileOutputStream(savedFile);

      byte buf[] = new byte[1024];
      int len;

      long total = 0;

      while ((len = inputStream.read(buf)) != -1)
      {
        total += len;
        out.write(buf, 0, len);
      }

      out.close();
      inputStream.close();
  }
  catch (Exception)
  {

  }

A: Try the below code. It should work!
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;

public class DownloadManager {

    public static void downLoadImage(String imageURL, String destinationFileName) throws IOException {
        URL url = new URL(imageURL);
        InputStream inputStream = url.openStream();
        OutputStream outputStream = new FileOutputStream(destinationFileName);
        byte[] byteData = new byte[2048];
        int length;
        while((length=inputStream.read(byteData))!=-1) {
            outputStream.write(byteData, 0, length);
        }
        inputStream.close();
        outputStream.close();
    }

    public static void main(String[] args) throws IOException {
        String imageURL = "http://sposter.smartag.my/images/KFC_Voucher.jpg";
        String destinationFileName = "C:/Users/sarath_sivan/Desktop/caldophilus.jpg";
        downLoadImage(imageURL, destinationFileName);
    }
}

A: Try this at once -
try {
            url = paths[0];
            HttpURLConnection connection = (HttpURLConnection) url
                    .openConnection();
            int length = connection.getContentLength();
            InputStream is = (InputStream) url.getContent();
            byte[] imageData = new byte[length];
            int buffersize = (int) Math.ceil(length / (double) 100);
            int downloaded = 0;
            int read;
            while (downloaded < length) {
                if (length < buffersize) {
                    read = is.read(imageData, downloaded, length);
                } else if ((length - downloaded) <= buffersize) {
                    read = is.read(imageData, downloaded, length
                            - downloaded);
                } else {
                    read = is.read(imageData, downloaded, buffersize);
                }
                downloaded += read;
                publishProgress((downloaded * 100) / length);
            }
            Bitmap bitmap = BitmapFactory.decodeByteArray(imageData, 0,
                    length);
            if (bitmap != null) {
                Log.i(TAG, "Bitmap created");
            } else {
                Log.i(TAG, "Bitmap not created");
            }
            is.close();
            return bitmap;
        } catch (MalformedURLException e) {
            Log.e(TAG, "Malformed exception: " + e.toString());
        } catch (IOException e) {
            Log.e(TAG, "IOException: " + e.toString());
        } catch (Exception e) {
            Log.e(TAG, "Exception: " + e.toString());
        }

And, just take a look at here

A: In ...
FileOutputStream f = new FileOutputStream(new File(root, FILENAME));

Try replacing FILENAME with fileURL.
Also, at which line is the exception thrown? That would help.

A: String fileURL = "http://sposter.smartag.my/images/KFC_Voucher.jpg";

String FILENAME = "caldophilus.jpg";

URL u = new URL(fileURL);

HttpURLConnection c = (HttpURLConnection) u.openConnection();

c.setRequestMethod("GET");

//c.setDoOutput(true); =========== remove this;

c.connect();


text:
Q: Interactive Process Communication in Haskell I am trying to write a Haskell program that executes an interactive program (also written in Haskell), sending and receiving lines of text. The interactive program reads from stdIn and writes to stdOut using the standard Haskell library.
However, this proved to be more complicated than I anticipated, probably due to Haskell lazyness or some other misterious thing happening on the background. The program apparently goes into deadlock, and does not receive back the line of text it was expected to receive. It does receive the text fine if the interactive program terminates as a result of sending the line of text, but I need the program to keep running and receive more data (it's called interactive for a reason). Sometimes it prints the expected output only after I kill the program receiving the message. The code looks like this:
main = do
    (hin,hout,herr,pl) <- (runInteractiveCommand "./PlayerMain")
    hSetBinaryMode hin False
    hSetBinaryMode hout False
    hSetBuffering hin LineBuffering
    hSetBuffering hout NoBuffering
    hPutStr hin "start\n"
    out <- hGetLine hout
    putStrLn out

I already tried replacing lazy strings with strict Data.Text, but the behaviour was the same. Any light?

A: Maybe the reason is that the output of ./PlayerMain is being buffered. ./PlayerMain writes something that doesn't get flushed right away, and then hangs because it keeps expecting more input.
That would explain why you do get the message when the program terminates.
So maybe it will work if you modify ./PlayerMain and set its stdout to NoBuffering.


text:
Q: Solve $2^x + 3^{2x + 2} = 5$ Out of curiosity, how would you approach the following exponential equation:
$$2^x + 3^{2x + 2} = 5$$
This resulted from a work on a system of logarithmic equations and I know for a fact that it has a single solution, $x \approx -0.345464$, which I obtained with the help of Wolfram Alpha. Anyhow, I simply can't figure out a way to solve for $x$ in an enclosed form.
My main question would be: is the solution generally expressable as a real number in a closed form? Or is this equation a dead end and maybe I should reconsider my approach to the system of equations?
That also brought me to the following thought. The equation can be rewritten as:
$$2^x + 9\cdot 9^x - 5 = 0$$
which is a general composition of exponential functions. I couldn't find any general approaches to such general exponential equations, but my intuition is that there's not much 'general' stuff to do with them and all depends on the current case.
I hope you could understand me, my terminology is perhaps not very precise and I'm a bit self learned in mathematics, so any clarification is welcome! Thanks in advance!

A: I don't think one can solve this "nicely". However, the following graph may help! Even if you can't solve it by hand, you can always get an idea of what range of values should the solution fall within.
If you really want to solve it numerically, the Newton-Raphson method is just one of the many methods you could try out to obtain the root of $f(x) = 2^x + 3^{2x+2} - 5$. Note that $f'(x)>0$ so there's only one solution.

A: As you expect, you cannot get a closed form solution.
Consider that ou are looking for the zero of function
$$f(x)=2^x + 3^{2x + 2}-5$$ By inspection, you know that the solution is somewhere between $-1$ and $0$.
Try Taylor expansion
$$f(x)=5+x (\log (2)+18 \log (3))+x^2 \left(\frac{\log ^2(2)}{2}+18 \log ^2(3)\right)+O\left(x^3\right)$$
Using the first term only, you have, as an estimate
$$x=-\frac{5}{\log (2)+18 \log (3)}\approx -0.244282$$ Now, use more terms and use series reversion to get
$$x=t-\frac{ \left(\log ^2(2)+36 \log ^2(3)\right)}{2 (\log (2)+18 \log (3))}t^2 +O\left(t^3\right)\quad \text{with} \quad t=\frac{f(x)-5}{\log (2)+18 \log (3)}$$ Making $f(x)=0$ as we desire, then another estimate
$$x=-\frac{5 \left(7 \log ^2(2)+828 \log ^2(3)+72 \log (2) \log (3)\right)}{2 (\log   (2)+18 \log (3))^3}\approx -0.30832$$
Now, let us polish the root using the so simple Newton method and, since I am lazy, I shall start with the first estimate I wrote. The successive iterates are
$$\left(
\begin{array}{cc}
 0 & -0.2442817505 \\
 1 & -0.3353427850 \\
 2 & -0.3453567313 \\
 3 & -0.3454642504 \\
 4 & -0.3454642627
\end{array}
\right)$$ and we could get as many decimal figures as required. For the fun of it, the solution
$$-0.345464262655186305826853008027166943006071510\cdots$$


text: Q: Explicit Chebotarev in function fields Let $K/\mathbb F_q(T)$ be a finite Galoisian extension of degree $d$ and $n\in\mathbb N$. Does one have a completely explicit bound on the number of irreducible $P\in\mathbb F_q[T]$ of degree $\le n$ that split totally in $K$ ($n\to+\infty$)? (I would like to have the two main terms of the asymptotic estimate)


text:
Q: Python: Trying to run script in terminal but get an error IntegrityError: NOT NULL constraint failed So I'm trying to run a script from the command line that parses information from an xml file stored locally. Whenever I run the script I get this error.
Traceback (most recent call last):
  File "updatedb.py", line 54, in <module>
    populate()
  File "updatedb.py", line 37, in populate
    diameter=diameter, streetNumber=streetNumber, street=street)
  File "updatedb.py", line 41, in add_tree
    tree = Tree.objects.get_or_create(treeId=treeId)[0]
  File "/usr/lib/python2.7/site-packages/django/db/models/manager.py", line 92, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 424, in get_or_create
    return self._create_object_from_params(lookup, params)
  File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 465, in _create_object_from_params
    six.reraise(*exc_info)
  File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 457, in _create_object_from_params
    obj.save(force_insert=True, using=self.db)
  File "/cygdrive/c/users/user/workspace/hug/timetravellingtrout/hug_project/hug/models.py", line 30, in save
    super(Tree, self).save(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 589, in save
    force_update=force_update, update_fields=update_fields)
  File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 617, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 698, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 731, in _do_insert
    using=using, raw=raw)
  File "/usr/lib/python2.7/site-packages/django/db/models/manager.py", line 92, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 921, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 921, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/utils.py", line 81, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 485, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: NOT NULL constraint failed: hug_tree.streetNumber

I have no clue what's causing it and I've tried all the possible solutions I've found about this error. I've tried using null=True, blank=True, migrating the stuff, but nothing is working.
My other files look like this:
models.py
class Tree(models.Model):

    treeId = models.IntegerField(primary_key=True)
    neighbourhood = models.CharField(max_length=128)
    commonName = models.CharField(max_length=128)
    diameter = models.FloatField(null=True, blank=True)
    streetNumber = models.PositiveSmallIntegerField()
    street = models.CharField(max_length=128)

    def save(self, *args, **kwargs):
                self.slug = slugify(self.treeId)
                super(Tree, self).save(*args, **kwargs)

    def __unicode__(self):
        return str(self.treeId)

script
def populate():
    parsedfiles = minidom.parse('C:\Users\User\Downloads\New folder\StreetTrees_ArbutusRidge.xml')
    treelist = parsedfiles.getElementsByTagName('StreetTree')
    for alltrees in treelist:
        treeId = alltrees.getAttribute('TreeID')
        neighbourhood = alltrees.getElementsByTagName('NeighbourhoodName')
        commonName = alltrees.getElementsByTagName('CommonName')
        diameter = alltrees.getElementsByTagName('Diameter')
        streetNumber = alltrees.getElementsByTagName('CivicNumber')
        street = alltrees.getElementsByTagName('StdStreet')
        add_tree(treeId=treeId, neighbourhood=neighbourhood, commonName=commonName,
                 diameter=diameter, streetNumber=streetNumber, street=street)

def add_tree(treeId, neighbourhood, commonName, diameter, streetNumber, street):
    tree = Tree.objects.get_or_create(treeId=treeId)[0]
    tree.neighbourhood = neighbourhood
    tree.commonName = commonName
    tree.diameter = diameter
    tree.streetNumber = streetNumber
    tree.street = street
    tree.save()
    return tree

# Start execution here!
if __name__ == '__main__':
    print "Starting update script..."
    populate()

A: getElementsByTagName() returns a list of elements. Your field only accepts a positive small integer (not a list). You should change the following line to target a single element:
streetNumber = alltrees.getElementsByTagName('CivicNumber')[0]

You will likely have to do this for your other fields as well...


text:
Q: Constructor with output-parameter today I saw a snipped that looked really horrible to me, but unfortunetly I cannot simply change it, so I wonder if I can bypass this somehow. I have a class with a constructor that has an output-parameter for success. But that looks really ugly to me. And now when deriving from this class I have to take this param with me- if I want to or not.
class ClassA {
    ClassA(out bool success) {...}
}

class B: ClassA {
    // call the constructor from ClassA but without the out-param
}

So I´d know if its good practise or if not how I can avoid declaring the out-param from ClassB.

A: While passing ref or out parameters to a constructor is ugly, there are some types where attempts to create a usable instance will have side-effects, and might fail after some of those side-effects have already occurred.  If it is not possible to construct a valid object, the only ways via which the constructor can pass information to the caller are by storing it in a threadstatic field, encapsulating it within the thrown exception, storing or feeding it to a passed-in object or delegate, or writing it to a ref/out parameter.  Of those, only the ref/out parameter makes obvious the existence of information with which the client code should be doing something.
The existence of ref or out parameters is often an indication that a constructor should be protected, and that outside code should go through a factory methods which ensure that if an exception is thrown the passed-out object will get used suitably.  For a class to reasonably support inheritance, however, it must offer at least one constructor which is visible outside it.  Having that constructor use an out or ref parameter may be the least evil way for a class to let a caller know what things will need cleaning up if construction fails.

A: You can do something like this:
class ClassA
{
    protected ClassA(out bool success)
    {
        success = true;
    }
}

class B : ClassA
{
    [ThreadStatic]
    static bool success; // static to use in base(out success) call

    public bool Success
    {
        get;
        private set;
    }

    public B()
        : base(out success)
    {
        Success = success;
        success = false; // reset value
    }
}

It's ugly, but at least you get rid of the out parameter if so you want.

A: Well, the design of that class is broken anyway, so let's break it a bit more (NOTE! I do not recommend this approach!):
void Main()
{

}

public class ClassA
{
    public ClassA(out bool success)
    {
        success = true;
    }
}

public class B: ClassA
{
    private static bool success;

    // call the constructor from ClassA but without the out-param
    public B()
        : base(out success)
    {
    }
}

Other than that, the closest you can get is making a factory method:
public class B : ClassA
{
    public static B Create()
    {
        bool success;
        var result = new B(out success);
        if (success)
            return result;
        // TODO: Dispose result?
        throw new StupidProgrammerException();
    }
}

A: If you really don't care about the value of the out parameter, in newer versions of C# you can declare an out variable inline and you can choose to do nothing with it:
class B : ClassA
{
    B() : base(out bool ignore) { }
}

You can go further and use the special discard name _ to let the compiler know you won't use the variable. This way you don't even need to declare its type:
class B : ClassA
{
    B() : base(out _) { }
}


text:
Q: How can I get my mouse pointer back without losing my session? My mouse pointer has vanished (though the mouse is usable) and I have a multi-day calculation in progress on my Ubuntu 15.04 computer. So, how could I try to get my pointer back without losing my current session?
I have tried the following command but nothing changed:
gsettings set org.gnome.settings-daemon.plugins.cursor active false

A: The following procedure appears to work in Ubuntu 15.04. The X Server communicates with programs via the network socket localhost:0. The environment variable DISPLAY can be set to this socket, then, on resetting Unity, this socket can be picked up for communications again. So, on encountering an interface problem such as a missing mouse pointer or a frozen display, something like the following procedure could be attempted:

*

*Access tty1: Ctrl+Alt+F1

*Set the environment variable DISPLAY: DISPLAY=:0

*Export the environment variable DISPLAY: export DISPLAY

*Reset Unity: sudo unity --replace


text:
Q: vqmod advanced search by searching twice I am faced with a problem where I need to search for a line of code which is too common.
Say I have this code and need to convert it into an array_merge:
$this['data'][] = array(
    'firstname'      => $query->row['firstname'],
    'lastname'       => $query->row['lastname'],
    'company'        => $query->row['company'],
    'company_id'     => $query->row['company_id']
);

vqmod
<operation>
    <search position="replace"><![CDATA[
    $this['data'][] = array( ]]></search>
    <add><![CDATA[
    $this['data'][] = array_merge($data, array( ]]></add>
</operation>
<operation>
    <search position="replace"><![CDATA[
    ); ]]></search>
    <add><![CDATA[
    )); ]]></add>
</operation>

Problem with this is that it's trying to search for code which is too common.
I could use offset to replace the whole thing because we use other extensions modifying this same array. Also can't rely that company_id is always last.
So instead I was thinking if there was a way to search twice or something similar to this concept:

*

*Search for: $this['data'][] = array( find the line number of this.

*Then start the next search from this line number, finding the next occurrence of: );
This same idea could then be applied to a method where I wanted to add some logic before the returned data.
<operation>
    <search position="before"><![CDATA[
    private static function _cacheName ]]></search>
    <search2><![CDATA[
    return ]]></search2>
    <add><![CDATA[
    // custom code ]]></add>
</operation>

A: You can use index. As stated in the vqmod's Scripting manual, you can specify which results you'd like to use. So the code below would find the 2nd occurrence of the text and replace it with the specified part:
<operation>
  <search position="replace" index="2"><![CDATA[
  $this['data'][] = array( ]]></search>
  <add><![CDATA[
  $this['data'][] = array_merge($data, array(]]></add>
</operation>

You can apply the same thing to the closing );. Alternatively, you could try to figure out how many lines are within that array, and you could use an offset with replace:
<operation>
  <search position="replace" index="2" offset="4"><![CDATA[
  $this['data'][] = array( ]]></search>
  <add><![CDATA[
  ));]]></add>
</operation>

A good starting point would be to check the file which is modified, in the vqcache folder, so you would have an idea on how many lines shall you offset.
It's important to note, that vqmod can only search for a single line or a part of a single line.


text:
Q: Implementation of a global search for chats in telegram tdlib I'm trying to replicate the global chat search as in telegram.

I'm using getChats method for searching, but the problem is that the method only returns a list of ids.
In addition to the id, I would also like to get the name and avatar of the chat.

Therefore, I have to go through the chatids in the forEach and for each id call the getChat method that returns the data I need. This, in turn, causes severe problems with the query execution time. (14 seconds). In a telegram, the search takes ~2 seconds. I don't know how they did it, I re-read all the documentation and did not find a method that would allow me to pass the name of the chat and get, in addition to identifiers, also a title and an image. Has anyone already encountered a similar problem?
import BaseAction from "./BaseAction";
import airgram from "../airgram/airgram";
import { ChatsUnion, ChatUnion } from 'airgram';

class SearchChatsAction implements BaseAction
{
    async run(name: string): Promise<any>
    {
        const output = await airgram.api.searchPublicChats({
            query: name
        });

        const promises: Array<any> = [];
        const result: Array<any> = [];
        for (const chatId of (output.response as ChatsUnion).chatIds)
        {
            promises.push(
                airgram.api.getChat({
                    chatId: chatId
                }).then(output => {
                    result.push({
                        id: (output.response as ChatUnion).id,
                        title: (output.response as ChatUnion).title
                    });
                })
            );
        }

        await Promise.all(promises);
        return result;
    }
}

export default SearchChatsAction;

A: I think the issue you're facing is because of API. You should try using different API. If you check these two documentations:

*

*searchPublicChat

*searchPublicChats
The API you're using returns just chatIds but searchPublicChat will contain all the information of searched chat.


text:
Q: How do I make react native icon sizes flexible? I'm building a ReactNative iOS/Android app using Expo, and I want to use vector icons for some of my artwork.  The issue is the artwork in question needs to scale with the view, I don't want it too small on some devices or too large on another.
With an image, in theory, I could use style = { { width:'100%', aspectRatio: 1 } } to force things to behave.  (In theory I say, because it doesn't work consistently)
Is there anything similar for vector icons?  Right now I'm just picking a size number that more-or-less works, but I don't want it to stop working on a given size, and it just seems that I'm repeating the mistake of using fixed widths that broke some other screens until I fixed it.

A: You can use 'Dimensions':
Import Dimensions From react native and then use it to set the size of your image
import {Dimensions} from 'react-native'
const SCREEN_WIDTH = Dimensions.get("window").width;
const logo = require("logo.png");

in render:

then you set the image style:
const styles = StyleSheet.create({
  logo: {
    height: SCREEN_WIDTH * 0.65,
    width: SCREEN_WIDTH * 0.65,
    marginLeft: SCREEN_WIDTH * 0.2
  }
})


text:
Q: passing value to html input tag with javascript Hey guys I've got a bit of an issue passing values to a form input box.
It works fine with VBScript on IE, but not on Mozilla or Chrome, which means it won't work on any android devices.
Here is my code:
<script language="vbscript">
    dim TheForm
    set TheForm = document.forms("form1")
    TheForm.Text2.value="hai"
</script>

As far as I know Chrome and Firefox only accept JavaScript for this sorta thing.

A: You can use Javascript:
<script>
document.getElementById('myField').value = "hai";
</script>

Where:
<input type="text" id="myField" value="" />

A: As you figured out, unfortunately the only standard (cross browser) scripting language in HTML pages is JavaScript.
See also What language types are allowed in the HTML script tag?
That is why you can even use just <script> tag, without specifying the language (should have been type BTW) attribute, and every browser will default to JavaScript (as recommended by HTML5 spec).
Now IE may accept other language(s), this is vendor-specific.

A: If you want the same thing in javascript then you can do like following :
<script language="javascript">
    var TheForm;
    var TheForm = document.form1;
    TheForm.Text2.value="hai";
</script>