text:
Q: Open 25+ tabs with javascript at once I'm using javascript to open all links to images on a website. But the script stops after opening about ~25 tabs, this probably caused by Chrome. I have tried Firefox but it freezes (and so I wouldn't even dare to try it in IE). I have tried to make the script wait for 500 milliseconds between each tab, but that changed nothing besides making the script slower.
Any suggestions on how to solve this? Isn't there maybe some way to only open the next tab when the previous one is fully loaded?
function in_array(needle, haystack) {
    var key = '';
    for (key in haystack) {
        if (haystack[key] == needle) {
            return true
        }
    }
    return false
}
function sleep(milliseconds) {
  var start = new Date().getTime();
  for (var i = 0; i < 1e7; i++) {
    if ((new Date().getTime() - start) > milliseconds){
      break;
    }
  }
}
var allLinks = document.links;
var allHrefs = [];
var openedWindows = [];
var x = 0;
var y = 0;
for (var i = 0; i < allLinks.length; i++) {
    if (allLinks[i].href.match(/\.(jpg|png|jpeg|gif|bmp)$/i)) {
        allHrefs[x] = allLinks[i].href;
        x++
    }
}
for (var i = 0; i < allHrefs.length; i++) {
    if (!in_array(allHrefs[i], openedWindows)) {
        openedWindows[y] = allHrefs[i];
        y++;
        sleep(500);
        window.open(allHrefs[i])
    }
}

A: Since it seems like the obvious script breaker, replace your sleep() function and just setInterval or setTimeout your link opening functions. You could change your last loop to something like this
    for (var i = 0; i < allHrefs.length; i++) {
        if (!in_array(allHrefs[i], openedWindows)) {
            openedWindows[y] = allHrefs[i];
            y++;
            setTimeout(window.open(allHrefs[i]), 500);
        }
    }


text:
Q: Unable to bind ng-model from select option I am trying to pass a value from the select option that would in order render a chart.Below is the code which I am trying to use. I am getting all the options in the dropdown but when I select it doesnt seem to pass.

test

        <select class="field col-xs-4" id="dropdown[arrKey]">
          <option ng-repeat="chartsTypeValue in charts.data.chartsType[arrKey]" ng-model="charts.type[chartsTypeValue]">{{chartsTypeValue}} </option>

        </select>

    <bars-chart ng-if="arrValue" chart-data="arrValue"></bars-chart>

    <donut-Chart ng-if="arrValue" chart-data="arrValue"></donut-chart>

    <line-Chart ng-if="arrValue" chart-data="arrValue"></line-chart>

redpajama_set_name: RedPajamaStackExchange


text: Q: iOS and SpriteKit camera background I am developing a game for iOS using Scenekit and maybe GamePlayKit. What I want is for the background of the main game play to be set to a live camera feed. That should be simple enough. A little googling brought me to this`question. My question however, is will a technique like the one in the linked question work well with SpriteKit? The question deals with setting the background with UIKit. Can I use this option with SceneKit too or do I have to use some sort of SceneKit specific way to set the background like so?


text:
Q: Data extention - Trailhead - Clarification on DATA RETENTION I came with a question, where in one the answer regarding the DATA RETENTION is as below [as per trailhead!!!]
You cannot remove the configured data retention settings once you configure them!
But, I am pretty much confident this is NOT correct, as I am able to,
- Turn off/on again
- Change the date of Data deletion
- Even change the option from "All records and data extensions" TO "Individual Records"
Correct me if I am wrong and does the above highlighted statement as per trailhead is correct?
FYI: Trailhead module link [https://trailhead.salesforce.com/content/learn/modules/marketing-cloud-contact-management/manage-contact-data?trail_id=develop-for-marketing-cloud]

A: The Trailhead is outdated, which is why it is stating incorrect info. There was a recent update (a couple months I think?) to data retention capabilities that now let's you change it after it being set in UI. They likely just didn't update it yet on Trailhead, but I am sure it will be handled at some point.


text:
Q: VB program guidance I am trying to create a program that will have a form to add users with multiple information (first/last name,tel,vat,email etc.) and store them in a database.
Then I want to have a standard form and will choose from the database the user each time I want to print the form. This way when the user is chosen all fields will be filled with the info from the database.
I have no clue with VB at all so all I ask here is for some guidance.
Can someone point me in the right direction?

A: Sounds like you need to learn .NET first, so head over the Microsoft Virtual Academy and wade through VB Fundamentals for Absolute Beginners.
If you are interested in making a user website, then this Microsoft tutorial is a good place to start. It shows how to create a Movie database with maintenance screens. You should be able to adapt it to "users".
You can also search the MSDN Developer Code Samples.
Happy coding.
P.S. Stack Overflow is for specific technical questions, not general inquiries. That's why your question is getting down-voted.


text:
Q: Blank page after running build on create-react-app Trying to deploy create-react-app on netlify, however my build is blank page. I'm using .env file for loading firebase api key is that a problem for build?
Even when I tried to open it locally on my computer its blank page and it outputs an error in console: "Loading failed for the  with source "file:///event-app/static/js/main.108757a0.js""
package.json:
https://gist.github.com/Verthon/f82371ad2bb636b2e95c5b7697aa0bb5
➜  event-app git:(master) ✗ npm run build

> event-app@0.1.0 build /home/jurr/Projects/event-app
> node scripts/build.js

Creating an optimized production build...
Compiled with warnings.

./src/components/Router.js
  Line 12:  'withFirebase' is defined but never used  no-unused-vars

./src/components/Firebase.js
  Line 21:  'Firebase' is defined but never used  no-unused-vars

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.

File sizes after gzip:

  282.86 KB  build/static/js/main.108757a0.js
  3.1 KB     build/static/css/main.8e671453.css

A: If you're using react-router and trying to open index.html directly in the browser (or using electron, which essentially does that), in addition to setting homepage as others have suggested, replace your BrowserRouter with a HashRouter.

I was trying to build an electron app using create-react-app.  When running in development everything was fine, but when I built the CRA and then pointed the electron app to the index.html file, I got the blank page.
I found that that was exactly the same as opening the index.html file directly in the browser.  Everyone says "set homepage in package.json", but I already had that.  So what now!?
I eventually figured out that the problem was react-router.  I was using a BrowserRouter.  Switching to a HashRouter solved the problem for me.

A: Add
"homepage": ".",

in your package.json then build again.

A: Just as @Verthon said putting the "homepage": ".", in your package.json file, in the top level like this:
{
     "name": "myApp",
     "homepage": ".",
     // all other package.json stuff...
}

A: Oooor as I just found out that I had done again and again: You published the public folder instead of the build folder.

A: I solved the problem by setting
"homepage": "."

in package.json according to this doc

A: I had a comment inside my return method and this caused the problem for me.
If the error message in the browser console is

Minified React error #152;

Then removing any comment inside the return method might solve your problem as it did mine.

A: If it's in the root folder you can use homepage
  "homepage":"."

in package.json
if it's in any other folder like https://example.com/admin you can use
  "homepage":"https://example.com/admin"

A: For me the issue was the inline runtime script was not being run as I was getting the error:

Refused to execute inline script because it violates the following
Content Security Policy directive: "script-src 'self'". Either the
'unsafe-inline' keyword, a hash ('sha256-5='), or a nonce
('nonce-...') is required to enable inline execution.

This was fixed by adding the INLINE_RUNTIME_CHUNK=false variable to the build script.
"build": "INLINE_RUNTIME_CHUNK=false react-scripts build",

This is because of the Content Security Policy of browsers: "A CSP compatible browser will then only execute scripts loaded in source files received from those allowlisted domains, ignoring all other script (including inline scripts and event-handling HTML attributes)."

A: I faced similar issue. But if you follow React-Deployment, correctly, you will realise that there is a  "homepage":"." // User "." if you are deploying on your local machine, but on a server hosted     somewhere you can use your domain or ip address the homepage field.

{
  "homepage":"https://example.com"
}

A: i had the same problem and it was because i was importing useContext wrong

A: I solved it. It happened to me after deploying to GitHub page.
It is working to local but after deployment it is opening the blank page.
Problem is we changed the homepage path. So We need to update paths which are in our code.
If I give an example with my case, I added homepage into the "package.json" file something like:
"homepage": "https://[YourGitHubAccountName].github.io/[YourProjectName]"

So after adding this, app doesn't work because The paths which are inside of my code need to be change.
For example:
'/' paths should become '/[YourProjectName]' or
'/test' should become '/[YourProjectName]/test'

A: I had a black screen when i was trying to map an undefined property
importing_file.js
<MediaImage  />

imported_file.js
export const MediaImage = props => {
    console.log("areas", props.areas)
    return (

        <map name={'element'props.id}>
 {props.areas.map(m=>{} )}

        </map>

)

}**

A: Working solution for React with typescript is to add "homepage": "." in package.json
  {
  "name": "todo-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
  },
  "scripts": {
  },
  "eslintConfig": {
  },
  "browserslist": {
  },
  "homepage": "."
}

now build the Application with npm run build and open the production html file.

A: *

*Run npm run eject

*Edit file webpack.config in the config folder

*Find path with "static/" or "static/js/" or "static/css/" in the file and delete such path

*Build your project again
This work for me. hope this works for you, too.

A: I was trying to open the application after build with double-clicking the index.html and didn't work either, I got the blank page  but if the built files are run in a server environment works.  https://create-react-app.dev/docs/deployment/

A: So the problem is with the caching of your app in the browser.
I have solved this problem with serviceWorker() in create-react-app.
Here is the solution: Just add this in you index.js file and remove service worker register
import { unregister } from './registerServiceWorker';
unregister();

A: simply change the private property value in your package.json to false


text:
Q: Meteor call Email send from server returns fiber error I am trying to do something which i thought would have been very trivial, but apparently is not.
I need to do something very simple, I need to run a setInterval so to check whether "today" is a new day, and if it is a new day, get some data and send an email.
Everytime i try, it returns me the usual issue
 Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
The code is running on Meteor server in a Meteor startup function.
All help will be greatly appreciated, i tried to solve it with async, fibers and future and i am either doing it wrong or i haven't found the answer yet.
Thank you,
Alessio
setInterval(function(){
    var now = moment().format('L');
    var date1 = new Date(now);
    var date2 = new Date(yesterday);
    var timeDiff = Math.abs(date2.getTime() - date1.getTime());
    var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
    if(diffDays>0){

        yesterday=now;

        //this is the part giving me problems
         Email.send({
        to: 'alexbonti83@hotmail.com',
        from: 'alexbonti83@hotmail.com',
        subject: 'test',
        text: 'test'
        });

    }else{
       // console.log('is the same day');
    }

},delay);

A: If I may make a suggestion, you are better off running code like this through a backend cron job then through a setInterval. If your server is disrupted or restarts for any reason, the interval will be lost from memory and you are not going to get the expected behavior sending emails.
The package I use and like for this purpose is percolate studio's synced-cron: https://atmospherejs.com/percolate/synced-cron
The answer to why setInterval is not working in your case is addressed in the Meteor documentation:

Timers
Meteor uses global environment variables to keep track of things like
  the current request's user. To make sure these variables have the
  right values, you need to use Meteor.setTimeout instead of setTimeout
  and Meteor.setInterval instead of setInterval.
These functions work just like their native JavaScript equivalents. If
  you call the native function, you'll get an error stating that Meteor
  code must always run within a Fiber, and advising to use
  Meteor.bindEnvironment.


text:
Q: how to check whether a place is present in between a route using google maps api hi i am developing a project on carpooling(users can offer lift and take lift to/from people) the problem can be better understood by an example
example:
suppose a person A is travelling from a place startA to endA and is ready to offer some seats in his car.then a person B is such that,his start position startB is between startA to endA and his endB may or may not be in between startA to endA.
then how to check whether startB is in between startA to endA using google maps api
I am doing my project in PHP.

A: This sounds like the "search along route" problem, to which the Google Maps APIs have no exact match, but there is an approach that may work well enough for your purpose.
Let me assume you can delegate the calculations to the browser's JavaScript engine. Then you can request directions from startA to endA and use RouteBoxer with a threshold T1 of how far is person A willing to deviate from the original route in order to pick person B.
With that threshold, you can build a set of bounding boxes to search along the route from startA to startB within distance T1 and check whether startB is contained by one of those boxes.
There is also the threshold T2 of how far from endB is person B willing to be dropped, but that one you can calculate easily by requesting (in different requests) driving and/or walking directions from endA to endB. If the above (startB is within T1 from the route) is true but the distance from endA to endB is greater than T2, then you could either warn person B or drop the route altogether.
This project sounds like a lot of fun, but let me warn you about one thing: you don't want to send requests to the Google Maps APIs (specially the Directions API) from your own server, using PHP. Not when the inputs are provided by users in real time. Instead, you should let each user's browser do the requests, using JavaScript. Otherwise, when your site grows popular it will run out of daily allowance for the service. Read the Geocoding Strategies for more.


text:
Q: NSDictionary dictionaryWithContentsOfFile doesnt load the data in order I am trying to load some data from a plist into an array
NSDictionary* mydictionary = [ NSDictionary dictionaryWithContentsOfFile:[ [ [ NSBundle      mainBundle] bundlePath ] stringByAppendingPathComponent:@"MyLevels.plist" ] ];

NSMutableArray *panelNames1;
panelNames1 = [[NSMutableArray alloc] init];

for (id theKey in mydictionary) {
    [panelNames1 addObject:[mydictionary objectForKey:theKey]];
}

But it does not seem to output in the same order as the MyLevels.plist into the array.
MyLevels.plist looks likes this:
[Key:1 Value: One]
[Key:2 Value: Two]
[Key:3 Value: Three]
[Key:4 Value: Four]
[Key:5 Value: Five]
But it reads it in this order: Three, One, Four, Two, Five
Any idea why??
Or even another way of doing the for loop maybe so it is in the correct order.
Thanks

A: NSDictionary objects do not preserve ordering. You should not expect to have keys enumerated in the same order in which they were read.

A: If order is important, you should create an array in your plist, and access it from one of the dictionary keys.

A:
Any idea why?

Yes. NSDictionary is unordered.


text:
Q: How do I mathematically  halve Orange Juice with my brother! I need to calculate the height of a glass(frustum) where the volume is half of total volume. Obviously, at h/2, volume will not be v/2. So my question is, at what height from the bottom of the glass is volume equal to half of full volume.
Where am I struck is the fact that 'R (bigger radius)' increases as the height.
Thanks,

A: Let the radius of the top of the glass be $R$, and let the bottom radius be $r$, where $0<r<R$. Let the height of the glass be $h$. The glass can be extended to a cone.  We will be working with several cones, all similar to each other. Since I do not remember the formula for the volume of a cone, we use scaling arguments.
Imagine a cone similar to our cones, but with top radius $1$.  Choose units of volume so that this top radius $1$ cone has volume $1$. (That's OK, the unit of volume need not be simply related to the unit of length. There exists a country where distances are measured in feet but volumes in gallons.)
If we extend our glass to a complete cone, the volume of that complete cone is, by scaling, $R^3$. Similarly, the part of that cone which is beyond the glass has volume $r^3$. So the glass itself has volume $R^3-r^3$. Half of this is $(R^3-r^3)/2$.  Add back the missing $r^3$ which lies beyond the glass. We conclude that the cone made up of the bottom half of the orange juice plus the stuff beyond the glass has volume
$$\frac{R^3-r^3}{2}+r^3\quad\text{or more simply}\quad \frac{R^3+r^3}{2}.$$
It follows that when exactly half of the orange juice is removed from the glass, the top of the orange juice is a circle of radius
$$\sqrt[3]{\frac{R^3+r^3}{2}}.$$
Pouring out juice until radius is just right sounds awkward. So let's work with heights. A similar triangle argument shows that the height of the "missing" cone is
$$\frac{hr}{R-r}.$$
By scaling it follows that the height of the half-full of juice cone is
$$\frac{h}{R-r}\sqrt[3]{\frac{R^3+r^3}{2}}.$$
To get the actual orange juice height when the glass is half-full, subtract the height of the missing cone. We get
$$\frac{h}{R-r}\left(\sqrt[3]{\frac{R^3+r^3}{2}}-r\right).$$
Remark: Scaling arguments are somewhat underused in elementary mathematics. Physicists use them much more routinely.

A: A different approach. Your glass is a section of a cone, and the volume of a cone is $\frac \pi 3 r^2h$.
You also have a linear relationship $h=ar$ between the height and the radius (which comes fro the geometry of the situation).
The volume of your glass is the difference in volume between two cones, one with radius say $r_1$ (the smaller) and the other $r_2$ (larger). Putting this together the glass has volume
$$V =\frac {\pi a} 3 (r_2^3 - r_1^3)$$
You now need to find the volume for an arbitrary $r$ - which is of the same form as this, and find the value of $r$ which gives a volume $\frac V 2$. Then there is a little work to get the heights instead of the radii, and to measure the height from the base of the glass, not the apex of the cone.

A: You can calculate the volume of any portion of your glass using integration.
Let $A(t)$ be the area of the section at height $t$. Let $y_0$ be the height of the orange juice in the glass.
You need to solve the following equation in $y$:
$$2\int_0^y A(t) dt = \int_0^{y_0} A(t) dt \,.$$
For the glass, the crosssection is a disk, so all you need is figure what is the radius as function in $t$ and integrate....


text:
Q: Template Literal not working with Bootstrap 4 Collapsible item? I've built out a template literal in js, and passing it to a collapsible item. Only some of the collapsibles are working. Any idea why this might be?

//Generates a random number for div id
function uuidv4() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
    var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
}

//Exhibitors
const qaList = [
  {
    faqId: uuidv4(),
    question: "Item 1",
    answer: "Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch."
  },
  {
    faqId: uuidv4(),
    question: "Item 2",
    answer: "Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch."
  },
  {
    faqId: uuidv4(),
    question: "Item 3",
    answer: "Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch."
  },
  {
    faqId: uuidv4(),
    question: "Item 4",
    answer: "Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch."
  },
  {
    faqId: uuidv4(),
    question: "Item 5",
    answer: "Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch."
  },
  {
    faqId: uuidv4(),
    question: "Item 6",
    answer: "Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch."
  }
];

function qaTemplate(faq) {
  return `

          ${faq.question}

        ${faq.answer}

  `
}

document.getElementById("accordionEx").innerHTML = `${qaList.map(qaTemplate).join(' ')};`
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css">

A: You have 2 issues.

*

*Your aria-labelledby were all pointing to the same id (multiple objects with headingOne1) Changed it to a dynamic id using the uuid heading-$(uuid}.

*Your uuid generator was making id's that start with numbers.  This is not a valid html id.  I prefixed the ids with i-.

Please see below for a working example

//Generates a random number for div id
function uuidv4() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
    var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
}

//Exhibitors
const qaList = [
  {
    faqId: uuidv4(),
    question: "Item 1",
    answer: "Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch."
  },
  {
    faqId: uuidv4(),
    question: "Item 2",
    answer: "Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch."
  },
  {
    faqId: uuidv4(),
    question: "Item 3",
    answer: "Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch."
  },
  {
    faqId: uuidv4(),
    question: "Item 4",
    answer: "Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch."
  },
  {
    faqId: uuidv4(),
    question: "Item 5",
    answer: "Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch."
  },
  {
    faqId: uuidv4(),
    question: "Item 6",
    answer: "Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch."
  }
];

function qaTemplate(faq) {
  return `

          ${faq.question}

        ${faq.answer}

  `
}

document.getElementById("accordionEx").innerHTML = `${qaList.map(qaTemplate).join(' ')}`;
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css">


text:
Q: Swift 3 - Reduce an array to a dictionary with a count of unique elements I'm currently migrating a current project to Swift3 (from 2.3) and am having some issues with an extension I have for my Sequence type.
The extension is designed to return a dictionary of unique values from the source array.
i.e. var myArray = ["Apple","Apple","Orange","Banana","Banana"]
the ".freq" extension returns a dictionary in the following format.
["Apple":2,"Orange":1,"Banana":2]

Here is the current Swift 2.3 syntax, which works:
extension Sequence where Self.Iterator.Element: Hashable {

    func freq() -> [Self.Iterator.Element: Int] {
        return reduce([:]) { ( accu: [Self.Iterator.Element: Int], element) in
            accu[element] = (accu[element]? + 1) ?? 1
            return accu
        }
    }
}

The issue is the the line accu[element] = (accu[element]? + 1) ?? 1 will not work in Swift 3, due to syntax changes:

cannot assign through subscript: accu is a let constant

I'm sure its probably an easy fix, but cannot seem to find a relevant example of how to do this in swift3.

A: Try this:
extension Sequence where Self.Iterator.Element: Hashable {

func freq() -> [Self.Iterator.Element: Int] {
    return reduce([:]) {
            ( accu: [Self.Iterator.Element: Int], element) in
            var accu2 = accu
            accu2[element] = (accu2[element] ?? 0) + 1
            return accu2
        }
    }
}


text:
Q: Checkboxes in ASP.NET I am trying to use a checkbox that is dynamically declared in an .vb file that I am trying to write into my .aspx page.  I am able to write a normal checkbox of <input type='checkbox /> from the .vb Class using Response.write, but it comes up blank when using <asp:Checkbox runat='server' />I need to pass whether or not the box is checked back to the server, because I am having to either approve something if one is checked, reject something if the other is checked or do nothing if neither are checked.  I have figured out how to make them mutually exclusive either way so that is not the problem. Does anyone have any recommendations?

A: Your problem lies in the order that the pages are compiled in: When you place an asp control like the asp:checkbox, it is compiled into a regular checkbox with some javascript attached when it is sent over to the client.
When you write the string "<input type='checkbox />" to the page from the code-behind it is writing that string directly to the page, after the aspx page has compiled its controls, but since that is valid html the browser renders the control.  When you write the asp:checkbox, the browser doesn't know what to do with it, because it is not valid html. In addition, the page has already been compiled, so there is no chance of .net creating the correct control for you.
You need to programmatic add the control to the webpage by creating a new control through the code behind
This site does a great job explaining it
And @toodles seems spot on. Writing static html and asp.net are two totally different ball games. I would spend a bit of time (like hours/days) reading/watching learning material to help you get on your feet.

A: The technical answers you are getting are all good. However, your question indicates that you really need to start by learning how asp.net server controls work. I suggest spending a couple hours watching the videos at http://asp.net and particularly http://www.asp.net/general/videos/intro-to-aspnet-controls
Then focus on understanding the page lifecycle and you'll have enough of the basics to be much more effective at asp.net. Have fun!

A: You can't use response.write to create server controls.
See this site for an example of the right way to do it:
http://msdn.microsoft.com/en-us/library/kyt0fzt1.aspx


text:
Q: Card flip jquery flipping both cards at the same time? This is my first time attempting card flip coding. I got it to work, but now I have two things I'd like to do that I can't get:

*

*I want each card to flip separately when the respective card is clicked.

*I'd like for the image card to be mobile responsive.

function flip() {
  $('.card').toggleClass('flipped');
}
.cardContainer {
  width: 100%;
  height: 484px;
  position: relative;
  border: 1px solid #ccc;
  -webkit-perspective: 400px;
  -moz-perspective: 400px;
  -o-perspective: 400px;
  perspective: 400px;
  margin-bottom: 50px;
}

.card {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-transition: -webkit-transform 1s;
  -moz-transition: -moz-transform 1s;
  -o-transition: -o-transform 1s;
  transition: transform 1s;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  -o-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-transform-origin: 50% 50%;
}

.card div {
  display: block;
  height: 100%;
  width: 100%;
  line-height: 260px;
  color: white;
  text-align: center;
  font-weight: bold;
  font-size: 140px;
  position: absolute;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -o-backface-visibility: hidden;
  backface-visibility: hidden;
}

.card .front {
  background: red;
}

.card .back {
  background: blue;
  -webkit-transform: rotateY( 180deg);
  -moz-transform: rotateY( 180deg);
  -o-transform: rotateY( 180deg);
  transform: rotateY( 180deg);
}

.card.flipped {
  -webkit-transform: rotateY( 180deg);
  -moz-transform: rotateY( 180deg);
  -o-transform: rotateY( 180deg);
  transform: rotateY( 180deg);
}

2

2

See jsFiddle
Website where it's being used
I am not a web designer/developer so my coding experience is pretty limited.  This is the last piece of the puzzle to get this page finished. I appreciate the help.

A: You can manage your click events in your main script and, when click is fired, apply the toggle on the closest .card of the event target.

$('document').ready(function() {
  $('.card').on('click', function(e) {
    $(e.target).closest('.card').toggleClass('flipped');
  });
});
.cardContainer {
  width: 100%;
  height: 484px;
  position: relative;
  border: 1px solid #ccc;
  -webkit-perspective: 400px;
  -moz-perspective: 400px;
  -o-perspective: 400px;
  perspective: 400px;
  margin-bottom: 50px;
}

.card {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-transition: -webkit-transform 1s;
  -moz-transition: -moz-transform 1s;
  -o-transition: -o-transform 1s;
  transition: transform 1s;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  -o-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-transform-origin: 50% 50%;
}

.card div {
  display: block;
  height: 100%;
  width: 100%;
  line-height: 260px;
  color: white;
  text-align: center;
  font-weight: bold;
  font-size: 140px;
  position: absolute;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -o-backface-visibility: hidden;
  backface-visibility: hidden;
}

.card .front {
  background: red;
}

.card .back {
  background: blue;
  -webkit-transform: rotateY( 180deg);
  -moz-transform: rotateY( 180deg);
  -o-transform: rotateY( 180deg);
  transform: rotateY( 180deg);
}

.card.flipped {
  -webkit-transform: rotateY( 180deg);
  -moz-transform: rotateY( 180deg);
  -o-transform: rotateY( 180deg);
  transform: rotateY( 180deg);
}

2

2

For the responsive part, I suggest you use a grid system like 960 Grid System, or Bootstrap grid system.


text:
Q: How to attach a resource file to an existing executable file? I have a resource file(.RES) and i want to add it into an existing executable file without recompiling and using the IDE! is it possible?
Edit
And how to extract the resource file?

A: You can use Colin Wilson's excellent Resource Utilities.
I'm using this simple console application to add a resource to an executable using his tools:
program AddResource;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Classes,
  unitNtModule,
  unitResFile,
  unitResourceRCData;

  procedure AddRes(exeName, resName: string);
  var
    exeModule: TNTModule;
    resFile  : TResModule;
  begin
    if ExtractFileExt(exeName) = '' then
      exeName := ChangeFileExt(exeName, '.exe');
    exeModule := TNTModule.Create;
    try
      exeModule.LoadFromFile(exeName);
      resFile := TResModule.Create;
      resFile.LoadFromFile(resName);
      exeModule.AddResource(resFile.ResourceDetails[0]);
      exeModule.SaveToFile(exeName);
    finally FreeAndNil(exeModule); end;
  end; { AddRes }

begin
  if ParamCount <> 2 then
    Writeln('Usage: AddResource <exe file> <resource file>')
  else
    AddRes(ParamStr(1), ParamStr(2));
end.

A: This is my answer : (Thank you PRUZ)
Uses Classes, Windows, SysUtils, Dialogs;

Type
  TBuffer = Array[0..0] of Byte;
  PBuffer = ^TBuffer;

Var
  FS             : TFileStream;
  ResourceHandle : THandle;
  DataLength     : DWord;
  Data           : PBuffer;
  Ok             : Boolean;

Begin
   ResourceHandle := BeginUpdateResource(pChar('d:\someexefile.exe'), False);
   IF (ResourceHandle <> 0) Then
   Begin
      FS := TFileStream.Create('d:\somebitmap.bmp', fmOpenRead);
      FS.Seek(0, soFromBeginning);
      DataLength := FS.Size;
      GetMem(Data, DataLength);
      FS.Read(Data^, DataLength);
      FS.Free;

      Ok := True;
      IF (not UpdateResource(ResourceHandle, RT_RCDATA, pChar('MyNewResource'), LANG_SYSTEM_DEFAULT{MakeLangID(LANG_NEUTRAL, SUBLANG_NEUTRAL)}, Data, DataLength)) Then Ok := False;

      IF (not EndUpdateResource(ResourceHandle, False)) Then Ok := False;

      IF (Ok) Then ShowMessage('Update of resources successful!')
         Else ShowMessage('Update of resources failed!');

      FreeMem(Data);
   End;
End.

Reference : http://www.delphi3000.com

A: If your question is, if you can add a resource to a existing exe  file, yes it is possible. To do this you must use the UpdateResource function which can add, delete, or replace a resource in a portable executable (PE) file.
update
Here you have a sample code
{$APPTYPE CONSOLE}

uses
  Classes,
  Windows,
  SysUtils;

procedure UpdateExeResource(Const Source,Dest:string);
var
  Stream     : TFileStream;
  hDestRes   : THANDLE;
  lpData     : Pointer;
  cbData     : DWORD;
begin
  Stream := TFileStream.Create(Source,fmOpenRead or fmShareDenyNone);
  try
    Stream.Seek(0, soFromBeginning);
    cbData:=Stream.Size;
    if cbData>0 then
    begin
      GetMem(lpData,cbData);
      try
        Stream.Read(lpData^, cbData);
        hDestRes:= BeginUpdateResource(PChar(Dest), False);
        if hDestRes <> 0 then
          if UpdateResource(hDestRes, RT_RCDATA,'DATA',0,lpData,cbData) then
          begin
            if not EndUpdateResource(hDestRes,FALSE) then RaiseLastOSError
          end
          else
          RaiseLastOSError
        else
        RaiseLastOSError;
      finally
        FreeMem(lpData);
      end;
    end;
  finally
    Stream.Free;
  end;
end;

begin
  try
    UpdateExeResource('C:\Users\Dexter\Documents\RAD Studio\Projects\Debug\Win32\Data.txt','C:\Users\Dexter\Documents\RAD Studio\Projects\Debug\Win32\project86.exe');
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


text:
Q: Horizontally align divs in separate columns One of our forms has two columns set up approximately as it is below (edited a number of input fields out since it's a rather large form). The user needs to be able to tab from the top of the left column all the way to the bottom, then back up to the top of the right column and again down to the bottom.
I have the form set up using two divs, one for each column (left/right). However, this has the effect of throwing the fieldsets out of whack horiztonally like so:

Keeping in mind the requirement that the user must be able to tab from top to bottom in each column, how would I adjust the CSS/general set up so that the fieldsets align horiztonally.
For example, in this fiddle Producer Info and Address Info are aligned properly, however I'd like Basic Info to horizontally align with Territory Info.
HTML

        <fieldset style="width: 400px;" >
            <legend>Produer Info</legend>

                Producer Type

                <input type="text"/>

        </fieldset>
        <fieldset style="width: 400px;" >
            <legend>Basic Info</legend>

                First Name

                <input type="text"/>

                 LastName

                <input type="text"/>

        </fieldset>

          <fieldset style="width: 400px;" >
            <legend>Address Info</legend>

                Home

                <input type="text"/>

                 Business

                <input type="text"/>

        </fieldset>
         <fieldset style="width: 400px;" >
            <legend>Territory Info</legend>

                Territory Type

                <input type="text"/>

        </fieldset>

CSS
.M-editor-label
{
    clear: both;
}

.M-editor-label
{
    float: left;
    margin: 1em 0 0 0;
}

.M-editor-field
{
    float: right;
    margin: 0.5em 0 0 0;
    color: Black;
}
.M-editor-field-xtraspace
{
    float: right;
    margin:  0.5em 0 20 0;
    color: Black;
}

A: As Basic Info and Territory Info are within two different div, their alignment can't be dependent on each other. Their alignment is affected only by their sibling like Producer info for Basic info and Address info for Territory info.
So, you need to manually give margin-top to the Basic Info so that it is at proper height from top matching that of Territory info.
Here's its fiddle: http://jsfiddle.net/mb2x8e68/

    <fieldset style="width: 400px;" >
        <legend>Produer Info</legend>

            Producer Type

            <input type="text"/>

    </fieldset>
    <fieldset style="margin-top:35px;width: 400px;" >
        <legend>Basic Info</legend>

            First Name

            <input type="text"/>

             LastName

            <input type="text"/>

    </fieldset>

      <fieldset style="width: 400px;" >
        <legend>Address Info</legend>

            Home

            <input type="text"/>

             Business

            <input type="text"/>

    </fieldset>
     <fieldset style="width: 400px;" >
        <legend>Territory Info</legend>

            Territory Type

            <input type="text"/>

    </fieldset>

A: I don't believe that you can achieve what you want without setting a fixed height to your elements. Adding the following to your CSS will ensure that all your fieldsets are aligned properly. Keep in mind that you will have to account for the largest sized box.
 fieldset{ height:100px;}


text:
Q: how to show items are loading in Recycler view at run time, like Messaging app I want to have this functionality in my app.
before fetching data from server or database. show a raw view like the picture and after data are present change items view by real data.
what is the best way to do it. does recyclerview supports it internally ?
i need combination of two images.

A: Use shimmer view:
https://github.com/facebook/shimmer-android
https://medium.com/mindorks/android-design-shimmer-effect-fa7f74c68a93
Create a layout design with it and show/hide based on API call.

A: As far as I know, RecyclerView does not have a native support for this. Overlap two views in a layout (for instance, frame layout) and then show the loading view, load the data, then switch to RecyclerView by setting it visible, and then setting the other views as gone.
Edit: Okay yeah, your question was indeed not good, but I'm gonna try to explain the logic you need to follow, to replicate this exact behavior. You can adjust the requirements as you need.
Think about how a RecyclerView works. It requires an adapter with certain elements in it, right? So, let's say, your network has 100 entries, but you cannot access all of them at once, hence you need to fill your list with "wait" items instead.
I already assume you have a layout with 2 text views side to side, what you need is to have a class with two strings, for example (this is Java btw):
public class MyListItem {
    public String item1 = "";
    public String item2 = "";

    public MyListItem(String item1, String item2) {
        this.item1 = item1;
        this.item2 = item2;
    }
}

A list of this class:
public List<MyListItem> items = new ArrayList<>();
And, items that are filled with "wait" in them.
for (int i = 0; i < 100; i++)
    items.add(new MyListItem("wait", "wait"));

Now that you have your list, create your adapter and attach this list into it, and start fetching the values 5 by 5, then, in your list, update these values like:
for (int i = lastPosition; i < lastPosition + 5; i++) {

    // This code might throw an IndexOutOfBoundsException,
    // i am not entirely sure but you get the idea.
    items.get(i).item1 = result.get(i - lastPosition).item1;
    items.get(i).item2 = result.get(i - lastPosition).item2;
}

and in your adapter call
myAdapter.notifyItemRangeChanged(positionStart, 5);
where positionStart was how many items you already fetched before. The animation from "wait" to "myListItem" will appear once you call the adapter code.
This is the core logic you need to follow, fit it as your requirements and you'll be good to go.

A: It's called a shimmer effect.
You should implement the below dependency and use it.

implementation 'com.facebook.shimmer:shimmer:0.4.0'

You can refer to the best example to load yours in recycler view data.
Link: https://medium.com/mindorks/android-design-shimmer-effect-fa7f74c68a93
GitHub shimmer effect link: https://github.com/facebook/shimmer-android


text:
Q: unable to edit nginx.conf file from K8 cluster I want to edit my Nginx.conf file present inside Nginx controller pod in AKS, but the edit command is not working using the exec command, is there any way else I could edit my nginx.conf.
the command which I tried:
kubectl exec -it nginx-nginx-ingress-controller -n nginx --  cat /etc/nginx/nginx.conf

A: yh, seems this is also working. tried an alternative way:
Edit/add the properties to change in ingress.yaml and redeploy it. the changes will then reflect in nginx.conf

A: As mentioned by CrowDev, it's not good practice to update the config of Nginx controller like that.
Nginx controller is the backend of the ingress you can use the config map to update the configuration of the Nginx controller and redeploy the pod of the controller.
Some of the Nginx controller config could be also overwritten using the ingress config and annotation inside it.
You can read more about annotation here : https://docs.nginx.com/nginx-ingress-controller/configuration/ingress-resources/advanced-configuration-with-annotations/
Update :
You can separate out different ingress by their name. if you want to manage different configs or headers you need to separate out ingress for managing different configs.
Example :
ingress : 1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-one
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
spec:
  rules:
  - http:
      paths:
      - path: /one
        pathType: Prefix
        backend:
          service:
            name: one
            port:
              number: 80

ingress : 2
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-two
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /two
        pathType: Prefix
        backend:
          service:
            name: two
            port:
              number: 80

now nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" will get apply to only one ingress or service.

A: Generally, it is a bad idea to exec into a pod to do changes. It violates the principle of infrastructure as code. You should extract the nginx.conf file to a ConfigMap and then mount it into the pod.
An example can be found here.
You can then edit the ConfigMap when needing to update the nginx config. Remember to redeploy the Pod to make the config apply.

A: I read from the official you are able to configure or modify the nginx.conf through annotation or configmap.
what you need is to modify your ingress file. first, check your ingress by
kubectl get ingress -A

you will see your ingress there, how did you create the ingress? of course, you execute the ingress file which is the YAML file. now you need to edit the file and add some annotation annotation or confgimap


text:
Q: Angular : How to Get @ViewChild reference in unit test fixture or mock it Under my component , i ve this variable which take reference for the html widget element (which i got from a 3rd library):
<dx-data-grid id="myWidget" #myWidget>
   ...
</dx-data-grid>

So in my ts file i call it this way :
  @ViewChild('myWidget') datatableWidget: DxDataGridComponent;

And in some method , i using it this way
myMethod(){
  this.datatableWidget.instance.myWidgetMethod();
}

Now in my test file , i want to test my method :  myMethod()
and as i m calling some private methode of my widget component , i got
 Cannot read property 'myWidgetMethod' of undefined

How may i get reference of @ViewChild from my fixture , or how may i mock it or event spyOn It ??
Suggestions ?


text:
Q: Azure AKS data ingestion optimization in log analytics I am using azure AKS for Mechine learning model deployment and it automatiaclly deploys models weekly
Now AKS produces more costs for log analytics data ingestion
We are working to optimize the data ingestion to the log analytics
i have two nodes in AKS
Somehow we can reduce some data ingestion. but when i see the data ingestion today for past 24 hour it again increases and when i try to see the nodes which produces billable data ingestion it shows one more filed which shows as 'deprecate field: see http://aka'
below i mentioned query and the query result for reference
query
find where TimeGenerated > ago(24h) project _BilledSize, Computer
| extend computerName = tolower(tostring(split(Computer, '.')[0]))
| where computerName != ""
| summarize TotalVolumeBytes=sum(_BilledSize) by computerName

query result
ComputerName                        TotalVolumeBytes

aks-agentpool-28198374-vmss000007   232,567,315

aks-agentpool-28198374-vmss000001   617,340,843

deprecated field: see http://aka    129,052

computerName
deprecated field: see http://aka

TotalVolumeBytes
129052

Here aks-agentpool-28198374-vmss000007 and aks-agentpool-28198374-vmss000001 are my nodes
But i dont have any idea about  'deprecated field: see http://aka'
I am not handling ML model deployment(i dont know obviuosly) and i asked ML team and they also dont know how this came into this
I analyzed many documents and query but i could not get the answer about what it is and how to get rid of this.
Can anyone guide me on this what is this in my node list and how can i stop this?

A: The value you are getting http://aka is probably part of a link to some microsoft documentation. You are truncating it though when you do tolower(tostring(split(Computer, '.')[0])).
Try add Computer to your summarize clause so that you can get the full link:
find where TimeGenerated > ago(24h) project _BilledSize, Computer
| extend computerName = tolower(tostring(split(Computer, '.')[0]))
| where computerName != ""
| summarize TotalVolumeBytes=sum(_BilledSize) by computerName, Computer

Once you do this you discover that the value of the field Computer is Deprecated field: see http://aka.ms/LA-Usage
Visiting that link tells you that the Usage table contains "Hourly usage data for each table in the workspace." And in the column reference table you can see that there are a number of columns that are deprecated, for example "Computer".
I.e The computer field is being deprecated and will later be removed from the usage table. It is still there, but the value of the field will always be Deprecated field: see http://aka.ms/LA-Usage , until it is removed indefinitely.
This just means that the Computer field in the Usage table should no longer be used and will be removed. The Usage table alone can no longer be used to determine which Computer incurred which cost.
You can query the usage table with the following query and see that the Computer field always conatains the deprecation message.
Usage
| summarize sum(_BilledSize) by Computer, SourceSystem, DataType, Type

EDIT:
If you are concerned with finding which resource contributes more to the cost of your workspace rather than which resource generates the most logs (which do not necessarily need to be the same since some data is ingested for free in log analytics), please add _IsBillable as a filter to your query to exclude entries that are not billed:
find where TimeGenerated > ago(24h) project _BilledSize, Computer, _IsBillable
| extend computerName = tolower(tostring(split(Computer, '.')[0]))
| where computerName != "" and _IsBillable == true
| summarize TotalVolumeBytes=sum(_BilledSize) by computerName

Since the entries in the usage table where the field  Computer is a deprecated field is not billable it will not show up.


text:
Q: video.js: good for buffer preloading and responsive fullscreen renderings? I now this question is subjective. Hope it won't get closed because frankly, I cannot find any other source for this informations (including video.js docs). So I try...
I want to use video.js, I need a simple background video. I know there are simple css ways for this, but I also need to ensure the better playback possible, and I was wondering: does video.js help on this? Does it ensures some kind of optimised playback, don't know, by checking initial buffering or the like?
And if yes, does it have any problem with css ways of getting it fullscreen?

A: VideoJs is widely using and most popular open source platform for videos. It is very difficult so summarize its advantages and pro's over other video libraries here. But to address your specific questions

It has a option to preload which you can specify and load frames, media or any metadata

videojs('my-player', {
  controls: true,
  autoplay: false,
  preload: 'auto'
});

CSS is highly customizable with very less efforts. See following example.

https://codepen.io/heff/pen/wtrHL
Hope this will help.


text:
Q: How to detect which program is playing sound on windows 7? I'm trying to write a little background program that stops music playing Winamp when another program plays sounds. The part about the accessing Winamp through Java is already solved now I need a way to detect which program plays the currently played sound (probably I want to allow some programs to play their sound without stopping my music). Although I'm doing this in Java (+ the winapi) everything in any language would help.
[edit] as I just got the first downvote on my first question here is some more detail: I already figured out how to use the winapi (but I don't know it) and capture things like volume levels and stuff. What still makes trouble is the mentioned detection of the origin of a sound that is played and aslo which program plays sounds. Is there anything in the winapi that could help me to do this?[/edit]

A: As Deanna mentioned, you can enumerate audio playback sessions just like Volume Mixer application (started from system tray icon) does and obtain per-session meters indicating session status.
You can find a C++ application that does it in this answer: Peak meters for individual programs on Windows 7. The meters are per-session and an audio-enabled application might have one or more sessions in it, but eventually as long as you enumerate them, you can figure out if there is any active playback there.

A: I believe the Windows Core Audio API in Vista+ allows you to get the VU levels for each application (After all, the mixer shows it). This should allow you to turn down one application when another is playing, etc.


text:
Q: Sqoop create-hive-table SQL Server NON-DEFAULT schema HDP-2.4.2.0-258 installed using Ambari 2.2.2.0
In SQL Server :
TABLE_CATALOG   TABLE_SCHEMA        TABLE_NAME
Management  Administration      SettingAttribute
Management  Administration      SettingAttributeGroup
Management  Administration      SettingAttributeValue
Management  Administration      SettingValue
Management  ape                 DatabaseScriptLog
Management  ape                 DatabaseLog
Management  Common              Language
Management  Common              ThirdPartyType
Management  Common              Country
Management  Company             DistributorCow
Management  Company             CustomerSetting
Management  Company             CustomerSettingAttributeValue

I can list the databases and the tables in a schema :
-bash-4.2$ sqoop list-databases --connect 'jdbc:sqlserver://<IP>;database=FleetManagement' --username --password
find: failed to restore initial working directory: Permission denied
16/08/11 11:25:39 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.4.2.0-258
16/08/11 11:25:39 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
16/08/11 11:25:39 INFO manager.SqlManager: Using default fetchSize of 1000
master
tempdb
model
msdb
Auth
FeatureToggle
FleetManagementCoach
LatestRuntime
FleetManagementThirdParty
VehicleDriverServicesFollowUp
FleetManagementCustomer
FleetManagementMessaging
FleetManagementSubscription
FleetManagementSupport
FleetManagementFollowUp
FleetManagementDatawarehouse
FleetManagement
FleetManagementPositioning

-bash-4.2$ sqoop list-tables --connect 'jdbc:sqlserver://<IP>;database=FleetManagement' --username --password  -- --schema Administration
find: failed to restore initial working directory: Permission denied
16/08/11 11:25:12 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.4.2.0-258
16/08/11 11:25:12 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
16/08/11 11:25:12 INFO manager.SqlManager: Using default fetchSize of 1000
16/08/11 11:25:12 INFO manager.SQLServerManager: We will use schema Administration
SettingAttribute
SettingAttributeGroup
SettingAttributeValue
SettingValue

Now, while using create-hive-table, Sqoop is unable to create SettingAttribute table
I tried the following commands in vain :
sqoop create-hive-table --driver 'com.microsoft.sqlserver.jdbc.SQLServerDriver' --connection-manager org.apache.sqoop.manager.SQLServerManager --connect 'jdbc:sqlserver://<IP>;database=FleetManagement' --username  --password  --table 'Administration.SettingAttribute'

The output :
16/08/10 16:40:32 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.4.2.0-258
16/08/10 16:40:32 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
16/08/10 16:40:32 INFO tool.BaseSqoopTool: Using Hive-specific delimiters for output. You can override
16/08/10 16:40:32 INFO tool.BaseSqoopTool: delimiters with --fields-terminated-by, etc.
16/08/10 16:40:32 INFO manager.SqlManager: Using default fetchSize of 1000
16/08/10 16:40:33 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM [Administration.SettingAttribute] AS t WHERE 1=0
16/08/10 16:40:33 ERROR manager.SqlManager: Error executing statement: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'Administration.SettingAttribute'.
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'Administration.SettingAttribute'.
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1655)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:440)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:385)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2444)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:191)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:166)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:297)
        at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:758)
        at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:767)
        at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:270)
        at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:241)
        at org.apache.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:227)
        at org.apache.sqoop.hive.TableDefWriter.getCreateTableStmt(TableDefWriter.java:126)
        at org.apache.sqoop.hive.HiveImport.importTable(HiveImport.java:188)
        at org.apache.sqoop.tool.CreateHiveTableTool.run(CreateHiveTableTool.java:58)
        at org.apache.sqoop.Sqoop.run(Sqoop.java:148)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
        at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:184)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:226)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:235)
        at org.apache.sqoop.Sqoop.main(Sqoop.java:244)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.2.0-258/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.2.0-258/zookeeper/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.2.0-258/accumulo/lib/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
16/08/10 16:40:34 INFO hive.HiveImport: Loading uploaded data into Hive
16/08/10 16:40:34 WARN conf.HiveConf: HiveConf of name hive.server2.enable.impersonation does not exist
Logging initialized using configuration in jar:file:/usr/hdp/2.4.2.0-258/hive/lib/hive-common-1.2.1000.2.4.2.0-258.jar!/hive-log4j.properties
NoViableAltException(307@[])
        at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.identifier(HiveParser_IdentifiersParser.java:11578)
        at org.apache.hadoop.hive.ql.parse.HiveParser.identifier(HiveParser.java:45881)
        at org.apache.hadoop.hive.ql.parse.HiveParser.columnNameType(HiveParser.java:38052)
        at org.apache.hadoop.hive.ql.parse.HiveParser.columnNameTypeList(HiveParser.java:36183)
        at org.apache.hadoop.hive.ql.parse.HiveParser.createTableStatement(HiveParser.java:5222)
        at org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2648)
        at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1658)
        at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1117)
        at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:202)
        at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:431)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:316)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1189)
        at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1237)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1126)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1116)
        at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:216)
        at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:168)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:379)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:314)
        at org.apache.hadoop.hive.cli.CliDriver.processReader(CliDriver.java:412)
        at org.apache.hadoop.hive.cli.CliDriver.processFile(CliDriver.java:428)
        at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:717)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:684)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:624)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.sqoop.hive.HiveImport.executeScript(HiveImport.java:338)
        at org.apache.sqoop.hive.HiveImport.importTable(HiveImport.java:245)
        at org.apache.sqoop.tool.CreateHiveTableTool.run(CreateHiveTableTool.java:58)
        at org.apache.sqoop.Sqoop.run(Sqoop.java:148)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
        at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:184)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:226)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:235)
        at org.apache.sqoop.Sqoop.main(Sqoop.java:244)
FAILED: ParseException line 1:63 cannot recognize input near ')' 'COMMENT' ''Imported by sqoop on 2016/08/10 16:40:33'' in column specification

Even this one failed :
sqoop create-hive-table --driver 'com.microsoft.sqlserver.jdbc.SQLServerDriver' --connection-manager org.apache.sqoop.manager.SQLServerManager --connect 'jdbc:sqlserver://<IP>;database=FleetManagement' -- --schema Administration --table 'SettingAttribute' --username  --password

The output :
16/08/10 16:42:37 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.4.2.0-258
16/08/10 16:42:37 ERROR tool.BaseSqoopTool: Error parsing arguments for create-hive-table:
16/08/10 16:42:37 ERROR tool.BaseSqoopTool: Unrecognized argument: --
16/08/10 16:42:37 ERROR tool.BaseSqoopTool: Unrecognized argument: --schema
16/08/10 16:42:37 ERROR tool.BaseSqoopTool: Unrecognized argument: Administration
16/08/10 16:42:37 ERROR tool.BaseSqoopTool: Unrecognized argument: --table
16/08/10 16:42:37 ERROR tool.BaseSqoopTool: Unrecognized argument: SettingAttribute
16/08/10 16:42:37 ERROR tool.BaseSqoopTool: Unrecognized argument: --username

Doesn't the create-hive-table support --schema option(nothing mentioned in the documentation)

A: use.. "-- --schema" at the end of the statement.
sqoop create-hive-table --driver 'com.microsoft.sqlserver.jdbc.SQLServerDriver' --connection-manager org.apache.sqoop.manager.SQLServerManager --connect 'jdbc:sqlserver://;database=FleetManagement' --table 'SettingAttribute' --username  --password  -- --schema Administration


text:
Q: How to reverse an array using the Reverse method. C# For some reason when I apply the reverse method, nothing changes.
public static string ReverseString(string word)
    {
        char[] myArray = word.ToCharArray();
        myArray.Reverse();

        string ans = string.Join("", myArray);

        return ans;
    }

A: Perhaps you're confusing the method you're using with the static Array.Reverse, which is indeed a void method?
Array.Reverse Method (Array)

The one you're using is a LINQ extension method of IEnumerable, whose reference you can find here:
Enumerable.Reverse Method (IEnumerable)

For your specific case though, I'd use this oneliner:
return new string(word.Reverse().ToArray());

A: The issue is that myArray.Reverse() does not modify myArray. This method returns a IEnumerable of char with the reverse of myArray.
Try this:
var reversed = myArray.Reverse();

And then work with reversed.

A: You need to store the return value in a variable:
var reversed = myArray.Reverse();

This is the signature for Reverse() method you are using, by the way, this is an extension method in the Enumerable class:
public static IEnumerable<TSource> Reverse<TSource>(this IEnumerable<TSource> source);

See the return type is an IEnumerable so you will need to store that and then work with that.
You can just do this:
public static string ReverseString(string word)
{
    return string.IsNullOrWhiteSpace(word) ? string.Empty
        :  string.Concat(word.Reverse());
}

A: Try Array.Reverse(myArray) instead of myArray.Reverse().
You are confusing Enumerable.Reverse and Array.Reverse methods.
IEnumerable<char>.Reverse: Returns a new reversed array without changing the old array
myArray = myArray.Reverse();

Array.Reverse: A Void method that will reverse the input array
Array.Reverse(myArray);

A: The method Reverse is a method that returns a new array (or collection) based on the original items.
public static string ReverseString(string word)
{
    char[] myArray = word.ToCharArray();
    myArray = myArray.Reverse().ToArray(); //<-- Call ToArray() method to convert back to the array and execute the deffered action.

    string ans = string.Join("", myArray);

    return ans;
}

This method is implemented by using deferred execution. The immediate
  return value is an object that stores all the information that is
  required to perform the action. The query represented by this method
  is not executed until the object is enumerated either by calling its
  GetEnumerator method directly or by using foreach in Visual C# or For
  Each in Visual Basic.
Unlike OrderBy, this sorting method does not consider the actual
  values themselves in determining the order. Rather, it just returns
  the elements in the reverse order from which they are produced by the
  underlying source.

A: You should do Array.Reverse(myArray)


text:
Q: How to fix strange behavior of Auth::loginUsingId() when I set remember me argument to true in laravel in AuthController, in order to login the user by id, I tried Auth::loginUsingId($id, $remember) with both true and false values for $remember. in both cases, login is successful, but the problem is when I set $remember = true, it will redirect back and the codes after that will be ignored:
set to false
Auth::loginUsingId($id, false);
dd('test'); // this line or anything else will execute after logging the user in

set to true
Auth::loginUsingId($id, true);
dd('test'); // this line or anything else will ignored and redirect back immediately
// after loggin the user in

I totally confused why this happens. I appreciate any help.

A: if you are sure that the login system works fine and the only problem is with remember me option, it could be because of missing remember_me column or some changes that you've made on remember_me column that you shouldn't do in your users migration.
make sure you have the following line in your users migration, if you are using version 8 of laravel as you have used it's tag:
$table->rememberToken();

and if you are using older version of laravel, you should have the following line:
$table->string('remember_me', 100)->nullable();


text:
Q: plpythonu function to execute python script on localhost does not work I am trying to create a function as shown below:
    CREATE OR REPLACE FUNCTION test_run(usename text)
    RETURNS void
    AS $$
    import subprocess
    from subprocess import call
    subprocess.call('/test/tty/sessions.py' + usename , shell=True)
   $$
   LANGUAGE plpythonu;

and the function suppose to execute the /test/tty/sessions.py script which is locally available on the server plus it has to take 1 argument in this case usename. I have tried so many different options but does not seem to work. Any ideas/suggestions please.. thanks..

A: You are trying to run the script test/tty/sessions.py<username> where <username> is the contents of the username variable. Change the + to a ,


text:
Q: Why am I getting different results? string s = "this is a test";
var result = s.ToCharArray().Reverse();
result.ToString();
Console.Write(result.ToArray()); //output = test a si sith
but with code : Console.WriteLine(result.ToString().ToArray());

and with code:
result.ToString();
result.ToArray();
Console.Write(result);

The output is :
System.Linq.Enumerable+ReverseIterator`1[System.Char]

A: In your case,
var result = s.ToCharArray().Reverse(); //Here type of result is IEnumerable<char>
result.ToString();//Calls default implementation of `.ToString()` method

When You call ToString(), it returns resultant string from overridden ToString() function. If it is not implemented in the given class then it returns its base implementation where it returns the fully qualified name of the variable.
In your case, .ToString() function is not overridden in Enumerable class, so it returns system.linq.Enumerable+ReverseIterator1[System.Char] as it is fully qualified name of result variable.
If you want to print elements of result, then try with string.Join(), like
var result = s.ToCharArray().Reverse();
Console.WriteLine(string.Join("", result));  //Instead of result.ToString()

MSDN Documentation: Object.ToString Method

Object.ToString is the major formatting method in the .NET Framework.
It converts an object to its string representation so that it is
suitable for display. (For information about formatting support in the
.NET Framework, see Formatting Types.) Default implementations of
the Object.ToString method return the fully qualified name of the
object's type.

A: There is a difference because the line:
result.ToString();

does not contribute to what is eventually printed at all. Calling ToString like that creates the string
"System.Linq.Enumerable+ReverseIterator`1[System.Char]"

And discards it. Note that this does not somehow reassigns that string to result, as you might think.
So you are essentially comparing:
Console.Write(result.ToArray());

and
Console.WriteLine(result.ToString().ToArray());

Note that result is an IEnumerable<char> containing the sequence of characters in the string s, but reversed. result.ToString().ToArray() means "call ToString on result, then call ToArray on the return value of ToString".
Calling ToString on the IEnumerable<char> that is result doesn't give you the characters that are in the sequence, but instead just the type name (this is the default ToString implementation):
System.Linq.Enumerable+ReverseIterator`1[System.Char]

Then you call ToArray on that string to convert it to a char[], and there is an overload of Console.WriteLine that prints the characters in a char[].
Console.Write(result.ToArray()); is similar, except you don't convert the IEnumerable<char> to a not-very-useful string, and directly convert the sequence of chars to a char[], so that char[] actually has the characters of s in reverse order.
Write also has an overload that prints the contents of a char[], which you then call.


text:
Q: Scipy SLSQP constrained optimization doesn't always work I am trying to minimize a function with scipy.optimize.minimize with SLSQP method. But sometimes it fails with the error message 'Iteration limit exceeded' or 'Positive directional derivative for linesearch', for the exact same input.
Example that just happened: I have it running on a Flask server, so I initalized it and send a request, it failed (iteration limit). I sent a lot of  the same request without shutting the Flask down, it failed with every single one of them. Then, I restarted the Flask. Suddenly ALL the requests were optimized succesfully, I kept sending them and they never failed. But if I restart the Flask again, it might stop working, or not, it seems random, but if it worked one time, it will work forever until the server is restarted.
But even when it is one of the server instance that the optimizer is failing, it still works for less complex inputs.
Problem Context: What I am trying to optimize is a stock market portfolio, respecting constraints such as volatility. It usually fails when it is more than $500,000.
con = {"type": "eq", "fun": self.sum}
con2 = {"type": "ineq", "fun": self.volatility_ceiling}
con3 = {"type": "ineq", "fun": self.volatility_floor}
cons = (con, con2, con3)

#allocation_list is a list of percentages for each stock in the portfolio

optimized_result = minimize(self.gain, allocation_list, constraints=cons, bounds=self.bounds, method="SLSQP", options={"maxiter": 400})

def gain(self, allocation_list):
    gain_list = [get_gain(id) for id in self.id_list]
    gain_avg = np.average(gain_list, weights=allocation_list)
    return (gain_avg) * (-1)

def sum(self, allocation_list):
    return np.sum(allocation_list) - 1

def volatility_ceiling(self, allocation_list):
    standard_dev = self.vol_portfolio(lista_aloc)
    if self.current_risk_profile == "PROFILE_1":
        return (standard_dev * (-1)) + 0.009
    elif self.current_risk_profile == "PROFILE_2":
        return (standard_dev * (-1)) + 0.011
    elif self.current_risk_profile == "PROFILE_3":
        return (standard_dev * (-1)) + 0.015
    elif self.current_risk_profile == "PROFILE_4":
        return (standard_dev * (-1)) + 0.024
    #The function continues until PROFILE_10

def volatility_ceiling(self, allocation_list):
    standard_dev = self.vol_portfolio(allocation_list)
    if self.current_risk_profile == "PROFILE_1":
        return standard_dev - 0.0
    elif self.current_risk_profile == "PROFILE_2":
        return standard_dev - 0.009
    elif self.current_risk_profile == "PROFILE_3":
        return standard_dev - 0.011
    elif self.current_risk_profile == "PROFILE_4":
        return standard_dev - 0.015
    #The function continues until PROFILE_10

A: I would recommend modifying the 'units' of dollars in your model. For example, instead of 'dollars' switch to 'thousands of dollars' when representing the budget. To that end, use '500' instead of '500,000', and interpret the results accordingly. For example, if an allocation of '3.5' units is made to an asset from the available budget, this would correspond to $3,500 and so on...
As a general model principle, if the numerical values of the numbers span a wide range, the model would be poorly scaled and it is an invitation to numerical problems. Most commercial optimizers would throw warnings alerting you to take actions to improve scaling. If the model had been linear (with or without integer variables), the optimizer would normally attempt to improve scaling itself. For example,
https://www.lindo.com/doc/online_help/lingo15_0/205_themodelispoorlyscaled_.htm
For black-box type nonlinear models, such features may not be available.


text:
Q: Get authentication token.id from OpenAm within Saml response I have implemented SSO with paspport-saml and OpenAM. I can get certain user attributes such as id,givenName etc.
But now I want to get authentication token id with Saml response for further authentication of web services.
How I can get authentication token id with Saml response?

A: You can get SAML assertion Id from saml response or you can use nameID based on ID provider setting it will contain either userName or principle object.
String ID = credential.getAuthenticationAssertion().getID();

or

String userName = credential.getNameID().getValue();


text:
Q: java BufferedImage to int[] issue I have a BufferedImage (Type.TYPE_INT_ARGB) that I want to convert to a int[]. I do this by using the following method:
((DataBufferInt)src.getRaster().getDataBuffer()).getData();. But when I do this with an image, it gives me the wrong array size. For a 320 x 240 Image it makes a 57,600 size int[] when it should give me a 78,600 size array. Do you know what I am doing wrong?

A: What's wrong with
src.getRGB(0,0,image.getWidth(),image.getHeight(),null,0,1);


text:
Q: when i open a link in android webview in app browser how can i put close button on top left Please Refer this example http://www.mkyong.com/android/android-webview-example/
In the above link example when we clink on button it redirects to google home page. Google page opening in webview. On the top i want to put close button. So when i click close button it has to go to previous back page. Please see below image for example.

public class MainActivity extends Activity {
    private WebView webView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ActionBar bar = getActionBar();
        bar.hide();
        webView = (WebView) findViewById(R.id.webView1);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.loadUrl("http://www.google.com");
        webView.setWebViewClient(new WebViewClient() {
            public boolean shouldOverrideUrlLoading(WebView viewx, String urlx) {
                viewx.loadUrl(urlx);
                return false;
            }
        });

    }
}

A: Remove these lines from your code:
 ActionBar bar = getActionBar();
 bar.hide();

Now replace your home button on action bar with an 'X' icon and override its action like this:
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
    switch (menuItem.getItemId()) {
        case android.R.id.home:
          finish();
    }
    return (super.onOptionsItemSelected(menuItem));
}


text:
Q: Ldap ssl with dynamic truststore I am trying to connect to a ldap over ssl. I have generated a .jks file with the certificate entry. I do not want to import this to cacerts rather want to access it dynamically when i initialize the ldap connection.
if (sslAuth) {
        ldapHost = "ldaps://" + ldapHost;
    } else {
        ldapHost = "ldap://" + ldapHost;
    }
    Hashtable<Object, Object> env = new Hashtable<Object, Object>();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
            "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, ldapHost);
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    env.put(Context.SECURITY_PRINCIPAL, "userName");
    env.put(Context.SECURITY_CREDENTIALS, "password");
    if (sslAuth) {
        System.setProperty("javax.net.ssl.trustStore", "C:\\temp\\AD-Cert-TrustStore.jks");
        System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
        env.put(DirContext.SECURITY_PROTOCOL, "ssl");
    }
    LdapContext ctx = new InitialLdapContext(env, null);
    return ctx;

But i am getting the below exception
 javax.naming.CommunicationException: simple bind failed: ldaphost:636 [Root exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]

A: If all the necessary javax.net....-properties are correctly spelled and have correct values, there must be premature initialization of some ssl-aware objects. For example, if in your app SslRMIClientSocketFactory or SslRMIServerSocketFactory are created before setting those properties, then subsequent attempts to start ssl-connection even with new factories will behave as if the properties were not set.


text:
Q: Does Data.Map work in a pass-by-value or pass-by-reference way? (Better explanation inside) I have a recursive function working within the scope of strictly defined interface, so I can't change the function signatures.
The code compiles fine, and even runs fines without error. My problem is that it's a large result set, so it's very hard to test if there is a semantic error.
My primary question is: In a sequence of function calls A to B to A to B to breaking condition, considering the same original Map is passed to all functions until breaking condition, and that some functions only return an Integer, would an insert on a Map in a function that only returns an Integer still be reflected once control is returned to the first function?
primaryFunc :: SuperType -> MyMap -> (Integer, MyMap)
primaryFunc (SubType1 a) mapInstance = do
    let returnInt = func1 a mapInstance
    (returnInt, mapInstance)
primaryFunc (SubType2 c) mapInstance = do
    let returnInt = primaryFunc_nonprefix_SuperType c mapInstance
    let returnSuperType = (Const returnInt)
    let returnTable = H.insert c returnSuperType mapInstance
    (returnInt, returnTable)
primaryFunc (ConstSubType d) mapInstance = do
    let returnInt = d
    (returnInt, mapInstance)

func1 :: SubType1 -> MyMap -> Integer
func1 oe vt = do
    --do stuff with input and map data to get return int
    returnInt = primaryFunc
    returnInt

func2 :: SubType2 -> MyMap -> Integer
func2 pe vt = do
    --do stuff with input and map data to get return int
    returnInt = primaryFunc
    returnInt

A: Your question is almost impossibly dense and ambiguous, but it should be possible to answer what you term your "primary" question from the simplest first principles of Haskell:

*

*No Haskell function updates a value (e.g. a map).  At most it can return a modified copy of its input.

*Outside of the IO monad, no function can have side effects.  No function can affect the value of any variable assigned before it was called; all it can do is return a value.

So if you pass a map as a parameter to a function, nothing the function does can alter your existing reference to that value.  If you want an updated value, you can only get that from the output of a function to which you have passed the original value as input.  New value, new reference.
Because of this, you should have absolute clarity at any depth within your web of functions about which value you are working with.  Knowing this, you should be able to answer your own question.  Frankly, this is such a fundamental characteristic of Haskell that I am perplexed that you even need to ask.
If a function only returns an integer, then any operations you perform on any values made available to the function can only affect the output - that is, the integer value returned.  Nothing done within the function can affect anything else (short of causing the whole program to crash).
So if function A has a reference to a map and it passes this value to function B which returns an int, nothing function B does can affect A's copy of the map.  If function B were allowed to secretly alter A's copy of the map, that would be a side effect.  Side effects are not allowed.
You need to understand that Haskell does not have variables as you understand them.  It has immutable values, references to immutable values and functions (which take inputs and return new outputs).  Functions do not have variables which are in scope for other functions which might alter those variables on the fly.  That cannot happen.
As an aside, not only does the code you posted show that you do not understand the basics of Haskell syntax, the question you asked shows that you haven't understood the primary characteristics of Haskell as a language.  Not only are these fundamentals things which can be understood before having learned any syntax, they are things you need to know to make sense of the syntax.
If you have a deadline, meet it using a tool you do understand.  Then go learn Haskell properly.

A: In addition, you will find that

an insert on a Map in a function that only returns an Integer

is nearly impossible to express. Yes, you can technically do it like in
 insert k v map `seq` 42        -- force an insert and throw away the result

but if you think that, for example:
 let done = insert k v map in 42

does anything with the map, you're probably wrong.
In no case, however, is the original map altered.


text:
Q: Almost subgroups of $\mathbb S^1$ Suppose $X\subset \mathbb S^1$ is a finite subset of the group $\mathbb S^1$ such that $|X+X|<(1+c )|X|$ for a sufficiently small $c\in(0,1)$. I believe that in such case there exists a subgroup $G=\mathbb Z/n\mathbb Z\subset \mathbb S^1$ such that $n$ is "close" to $|X|$ and the size of the symmetric difference $|X\Delta G|$ is small comparatively to $|X|$. I.e.  informally, $X$ is almost a subgroup of $\mathbb S^1$.
I believe that this should be a classical statement, but don't know how to find it in the literature. Do you know a reference or a short proof? How small is $|X\Delta G|$ comparatively to $|X|$?


text:
Q: Size DataGridviewRows to fill DataGridView
How can I adjust the columns horizontally so that the data fills the entire DataGridView and leaves no blank spaces to the left or right of the data?
So far I have used WindowState = Maximized and this doesn't work.

A: try this :
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill


text:
Q: Webpack - how to do simple css minification and concatenation Webpack is powerful, sure, but it's confusing and complicated for beginners (like I am). Doesn't help that recently they moved to 2.2 so a lot of documentation I see is for the older version which adds to this difficulty.
All I want to do is this:
I have an app.css and a main.css which I want to minify and bundle into one (say app.min.css) and copy to my output directory - what's the easiest way?
I am manually linking it in my html file so I don't need webpack to write out a URL for me or anything. I may do a lot more fancy stuff around modularization latter, but for now I'd like to get my basic setup up and running. I do have my webpack.config.js running on my entry index.js file and that all seems fine.
What's the simplest way to do it? What am I missing? I'm getting lost in this loader and that loader (css-loader, raw-loader, style-loader...) and errors that are cryptic and take time to figure out. It surprises me that for a tool so powerful you'd imagine there are simpler ways to do basic things like this...
Thank you for the help

A: This is actually very simple, and the docs do a good job of explaining it.
First you need to make sure you have a css loader configured so Webpack knows what to do with css files.  Then by using the ExtractTextPlugin you basically bundle what you specify into a separate file.
The entry block can take multiple files, so you could modify it like so.  OR you could require/import them at the top of index.js.
entry: {
  bundle: "./index.js",
  main: "./main.css",
  app: "./app.css"
}


text:
Q: Add extension to List of enums I have an array of enums and would like a convenient method to access the enum string representation directly.
As an example. I have the following enum
from enum import Enum

class Countries(Enum):
    CH = "Switzerland"
    DE = "Germany"
    FR = "France"

sel_countries = [Countries.CH, Countries.FR]

And now, I would like to have a method like [Countries.CH, Countries.FR].toString() that returns ['Switzerland', 'France'].
I know, I could get the desired results using [e.value for e in sel_countries].
But how could I add such a method to a list object?

A: To add methods to builtins, the easiest way is to create a new subclass. When subclassing containers such as list and dict it's best to use UserList and UserDict instead.
from enum import Enum
from collections import UserList

class Countries(Enum):
    CH = "Switzerland"
    DE = "Germany"
    FR = "France"

class EnumList(UserList):
    def to_string(self):
        return EnumList([item.value for item in self])

sel_countries = EnumList([Countries.CH, Countries.FR])

print(sel_countries.to_string())


text:
Q: 404 error when adding a Facebook Page Tab using a Squarespace URL I'm getting a 404 error when trying to add a Facebook Page Tab using a URL from a Squarespace hosted (using a custom domain) site.
I've followed these instructions - https://developers.facebook.com/docs/pages/tabs - and everything went fine, except when I click on the Page Tab it shows a 404 error page instead of the URL entered.
I tried the URL with and without the trailing slash, but it made no difference.
I also tried an alternative URL from a non Squarespace hosted site and that worked fine.
Are there additional steps I need to take because I'm using Squarespace?

A: For future readers...
Using Facebook Page Tabs isn't possible unless the URL is HTTPS and supports POST requests.
In the case of Squarespace, they have their own method of implementing Facebook Page Tabs, which is documented here - https://support.squarespace.com/hc/en-us/articles/206543737-Adding-Squarespace-tabs-to-Facebook


text:
Q: jqWidgets: Data and grid are not displayed I am using jqWidgets to create a grid using jqxGrid in Angular.
I have followed this demo
here
To get a table grid
However all I see within the browser is the column name and no outlines around the columns and rows.  Also there is no data displayed even though I am linking to the xml where all the data is set, but nothing is displayed.
import { Component } from '@angular/core';
import { jqxGridComponent } from 'jqwidgets-framework/jqwidgets-ts/angular_jqxgrid';

@Component({
templateUrl: 'buttons.component.html',
selector: 'my-app',

})
export class ButtonsComponent {

constructor() { }

source: any =
 {
    datatype: "xml",
    datafields: [
        { name: 'EmployeeNum', type: 'int' },
        { name: 'FullName', type: 'string' },
        { name: 'MarketCenter', type: 'string' },
        { name: 'FunctionTitle', type: 'string' },
        { name: 'HireDate', type: 'date' },
        { name: 'TermDate', type: 'date' }
    ],
    root: "Employees",
    record: "Employ",
    id: 'EmployeeID',

    url: "demos/sampledata/products.xml"
 };

dataAdapter: any = new $.jqx.dataAdapter(this.source);

unitsInStockRenderer: any = (row, columnfield, value, defaulthtml, columnproperties, rowdata) =>
{
    if (value < 20)
    {
        return '' + value + '';
    }
    else
    {
        return '' + value + '';
    }
};

columns: any[] =
[
    {
        text: 'Employee #', columngroup: 'ProductDetails',
        datafield: 'EmployeeNum', width: 330
    },
    {
        text: 'Name', columngroup: 'ProductDetails',
        datafield: 'FullName', width: 330
    },
    {
        text: 'M/C', columngroup: 'ProductDetails',
        datafield: 'MarketCenter', width: 330
    },
    {
        text: 'Function', columngroup: 'ProductDetails',
        datafield: 'FunctionTitle', width: 330
    },
    {
        text: 'Hire Date', columngroup: 'ProductDetails',
        datafeild: 'HireDate', width: 330
    },
    {
        text: 'Term Date', columngroup: 'ProductDetails',
        datafeild: 'TermDate', width: 330
    }
];

}

Here is the products.xml file that contains the table data.  Here is one row as an example
<Employees>

<Employ EmployeeID="1">
<EmployeeNum>2793</EmployeeNum>
<FullName>Brian Miller</FullName>
<MarketCenter>458-Salt Lake City</MarketCenter>
<FunctionTitle>Controller</FunctionTitle>
<HireDate>10/12/2008</HireDate>
<TermDate>10/12/2008</TermDate>
</Employ>

</Employees>

Any help on showing the data within the grid and why there are no outlines around the grid and columns as shown in the demo above I linked to.  Any help is appreciated.  Thanks

A: I had to just put the xml file within the assets folder and it works fine


text:
Q: World Clock Webservice? What is the most reliable World Clock Webservice that you use?

A: Unfortunately, you'll probably never get a really accurate atomic clock webservice due to latency issues with the transport of the messages/packets back and forth from your machine to the server.
Most atomic clocks that are accessible over the internet use a specific protocol called the Network Time Protocol that includes a jitter buffer which specifically accounts for and adjusts based upon the latency of the transport.  This provides a more accurate representation of the atomic clock's time than using a web-service over HTTP.
I think if you must use a webservice, the most accurate one will be the one hosted on a server that is physically and geographically closest to you and also has the least number of network hops to get from your own machine to the server, since this will reduce the latency of the packets.

A: Understood about latency.  With that in mind, I go to NIST's site for US times and World Time Server for the rest.  Don't know if either is the "best".

A: I think due to latency, there is no such thing as a reliable atomic clock webservice.

A: Here's a blog post which comes to the same conclusion.
Purists are quick to point to the accuracy problem. But I bet you could not even get perfectly accurate time even if your application was sitting on the same server as the atomic clock software itself.
I think there is a need for a clock Web Service. I can think of a few scenarios where it doesn't matter being off a few seconds.
Aside accuracy, another challenging area of serving up date and time is taking into account the daylight saving details of most country. That is something even the latest OSes struggle to get right. But that is definitely something that would make a clock Web Service valuable.

A: Since there are so few web services out there delivering time, http://www.timeapi.org/utc/now is only reliable web service that I know of (besides http://www.earthtools.org/timezone/0/0, which does not appear to be reliable). Therefore it's the most accurate one I can recommend, especially if you are just using it for determining the difference between local time and UTC time, which can be rounded to the nearest 15 minutes.  And if you want the time in a specific time zone, replace utc with the three-letter abbreviation for the time zone -- i.e., http://www.timeapi.org/est/now for the Eastern Standard Time.

A: A NTP webservice would be fine as long as the latency is predictable.  NTP is a wire protocol and very lightweight to remove any moving pieces that may cause additional variation in latency (aka jitter).  A SOAP stack would introduce more variability.


text:
Q: How to Display Android Native Alertdialog on App Load Without Showing Anything Else I am trying to display a native Alertdialog as soon as the app loads, but an ad is showing before that. I want to make sure this Alertdialog is showing as the first thing when the app loads, and when the Alertdialog is dismissed, the ads and everything else should load next.
Any ideas on how to do that inside Android application?
Here's what I have in code:

 public void checkForCookiePolicy()
  {
   final SharedPreferences settings =
           getSharedPreferences("localPreferences", MODE_PRIVATE);
       if (settings.getBoolean("isFirstRun", true)) {

        AlertDialog.Builder builder1 = new AlertDialog.Builder(getContext());
     builder1.setTitle("Cookie Policy");
     builder1.setMessage("We use device identifiers to personalise content and ads, to provide social media features and to analyse our traffic. We also share such identifiers and other information from your device with our social media, advertising and analytics partners.");
     builder1.setCancelable(true);

     builder1.setPositiveButton("See Details",
       new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {

         Intent intent = new Intent(AppActivity.this, CookiePolicy.class);
         startActivity(intent);
         settings.edit().putBoolean("isFirstRun", false).commit();

        }
       });
     builder1.setNegativeButton("Dismiss", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int id) {
       settings.edit().putBoolean("isFirstRun", false).commit();
       dialog.cancel();

      }
     });

     AlertDialog alert11 = builder1.create();
     alert11.show();
       }

  }

Here's the ad code. It's above the alert code:

  revmob = RevMob.start(this);
  revmob.createFullscreen(this, null);


text:
Q: Position of direct object of phrasal verb (bring up) Is it grammatically correct if I say:

His mother brought that little matter of his prison record up again.

Or should I better say:

His mother brought that little matter up of his prison record again.

I know it is the correct to say:

His mother brought up that little matter of his prison record again.

However, I am not sure about the other option.

A: The further the preposition is from the verb, the more difficult the understanding. While all sentences are technically correct, (You are allowed to separate 'brought' from 'up.') it's a good idea to keep them together. The exception would be when a pronoun is the direct object. Then, you want to put the object between the verb and the preposition: 'Why even bring it up?'


text:
Q: accessing "module scope" vars I'm currently learning Python, and I have to work on a Python 2.7 project.
Accessing "module scope" variables in functions of the module itself is a bit confusing for me, and I didn't succeed in finding a satisfying way.
My attempts so far:
Way 1:
my_module.py
my_global_var = None

def my_func():
    global my_global_var
    my_global_var = 'something_else'

Here I think that confusing local and "module scope" vars may be quite easy.
Way 2:
my_module.py
import my_module

my_global_var = None

def my_func():
    my_module.my_global_var = 'something_else'

Here, the name of "my_module" could not be as easily changed as "way 1" when necessary. Plus, importing a module into itself sounds quite weird.
What would you recommend? Or would you suggest something else? Thanks.

A: Way 1 is the correct way when you absolutely must rebind a global variable. However you should ask yourself why you are modifying a global and whether there is something better you can do (such as encapsulating the behaviour in a class).
Importing a module into itself should be avoided as it is error prone. If the module is also a script you would sometimes need to import __main__ instead, or if the module is part of a package maybe you should be importing foo.my_module. In short, don't do that.

A: Importing a module within itself can have unwanted side effects (like evaluating statements more than once.)  I would suggest using "Way 1" and a tool like pylint to help verify your code and enforce common practices.
PyLint can be found at: http://www.logilab.org/project/pylint

A: You probably want to read up on Python's namespaces. Way 1 is correct but generally unnecessary, never use 2. An easier approach is to just use a dict (or class or some other object):
my_globals = {'var': None}

def my_func():
    my_globals['var'] = 'something else'

Assignments always go into the innermost scope and the innermost scope is always searched first, thus the need for the global keyword. In this case you aren't assigning to a name, so it's unnecessary.

A: Avoid setting globals at all. You can create new namespaces with classes quite easily, so use class variables if you must.
For anything serious you need a proper design with classes anyways.