Generate random string/characters in JavaScript

Generate random string/characters in JavaScript

I want a 5 character string composed of characters picked randomly from the set [a-zA-Z0-9].What's the best way to do this with JavaScript? 1:I think this will work for you:function makeid() { var text = ""; var possible = "ABCDEFGHIJK

How to flush output of Python print?

How to flush output of Python print?

How do I force Python's print function to output to the screen?This is not a duplicate of Disable output buffering - the linked question is attempting unbuffered output, while this is more general. The top answers in that question are too p

Can I use a :before or :after pseudo-element on an input field?

Can I use a :before or :after pseudo-element on an input field?

I am trying to use the :after CSS pseudo-element on an input field, but it does not work. If I use it with a span, it works OK. This works (puts th

SharedPreferences Clear/Save

SharedPreferences Clear/Save

Iam trying to make a checker and I want to save a value into SharedPreferences. But i'am not sure if it worksThis what I do to save the value is : * SharedPreferences prefs = getSharedPreferences("PREFERENCE", MODE_PRIVATE); boolean f

Call a Javascript Function after UpdatePanel Postback Issue

Call a Javascript Function after UpdatePanel Postback Issue

I basically have in my UpdatePanel a literal that generates a javascript array based on a method in my codebehind.I don't have an issue when it comes to loading my content on page load. But if I try and carry out a search to update my javas

Deterministically creating and tagging EC2 instances

Deterministically creating and tagging EC2 instances

I am creating 3 EC2 instances, and subsequently iterating and tagging each of them.Sometimes the tag request fails, although the instance later appears to be running.Could this be a timing issue? Should I wait a few seconds after creating t

SQL Server 2005 Query History

SQL Server 2005 Query History

I can easily see a list of recently run queries using the following SQL:SELECT deqs.last_execution_time AS [Time], dest.TEXT AS [Query]FROM sys.dm_exec_query_stats AS deqsCROSS APPLY sys.dm_exec_sql_text(deqs.sql_hand

Arity-generic programming in Agda

Arity-generic programming in Agda

How to write arity-generic functions in Agda? Is it possible to write fully dependent and universe polymorphic arity-generic functions? 1:I'll take an n-ary composition function as an example.The simplest versionopen import Data.Vec.N-ar

Connect “computer-database-jpa” Play 2.1 sample application with MySQL

Connect “computer-database-jpa” Play 2.1 sample application with MySQL

I'm playing with computer-database-jpa (Java) Play Framework 2.1 sample application. Everything works fine when I'm using H2 in memory database but I had problems when I want to connect the application with MySQL.Some one had the same probl

Automatically try AJAX request again on Fail

Automatically try AJAX request again on Fail

I have seen that you can specify what to do generally if an ajax request fails, is it possible to have it try again in some sort of a loop so that it tries at least x amount of times before it stops? I have used this code before:$.ajaxSetup

android - listview filter count

android - listview filter count

So after I set the filter on my listview://Log adapter count before filterlistView.getFilter().filter(searchStr)//Log adapter count after filterWhat I'm trying to achieve is to get the count of the result of that filtering. Like if before

Is a Java static block equivalent to a C# static constructor?

Is a Java static block equivalent to a C# static constructor?

What is the real difference between a C# static constructor and a Java static block?They both must be parameterless.They are both called only once, when the related class is first used.Am I missing something, or are they the same thing, jus

How to increase memory and cache size for application pool in IIS 7 efficiently

How to increase memory and cache size for application pool in IIS 7 efficiently

I have searched the internet for how to increase memory and cache size for application pools in IIS 7 but all topics are diffused and I don't know the effect of combining those settings together.Can somebody describe how I can increase memo

Android Studio missing external dependencies

Android Studio missing external dependencies

I have a library project. I want to use Android's new build system. Currently I'm encountering a quite annoying scenario. I have my dependencies defined on gradle.build but they never appear under External Libraries in Android Studio. Hence

Progress bar primefaces on backend processing

Progress bar primefaces on backend processing

I would appreciate it if someone can give me some hints about progress bar and ajax back-end processing.To clarify what I need following are details:I have a command button to do some processing at the back-end.I would like to show a progre

SQL: how to get all the distinct characters in a column, across all rows

SQL: how to get all the distinct characters in a column, across all rows

Is there an elegant way in SQL Server to find all the distinct characters in a single varchar(50) column, across all rows?Bonus points if it can be done without cursors :)For example, say my data contains 3 rows:productname-----------produc

AngularJS v1.2.5 script error with textarea and placeholder attribute using IE11

AngularJS v1.2.5 script error with textarea and placeholder attribute using IE11

I have an Angular JS v1.2.5 form that won't work in IE11. It works fine in Firefox, Chrome, Safari. My form uses a textarea with interpolation inside the placeholder attribute. Hello {{ name }}! If the placeholder attribute is spe

SQL query to return only 1 record per group ID

SQL query to return only 1 record per group ID

I'm looking for a way to handle the following scenario. I have a database table that I need to return only one record for each "group id" that is contained within the table, furthermore the record that is selected within each group should b

CSS for hover that includes all child elements

CSS for hover that includes all child elements

I have a draggable div element with a hover style. This works fine, but the div contains some form elements (label, input). The problem is that when the mouse is over these child elements the hover is disabled. Name .app_setting:hover {

Could not find a method onClick_Foo(View) - first time running on Android Lollipop

Could not find a method onClick_Foo(View) - first time running on Android Lollipop

I have an app that is about a year old, is on the Play store in beta, has gone through dozens of revisions. All of a sudden I'm getting an error: Could not find a method onClick_Foo(View) in the activity class android.view.ContextThemeW

AngularUI-Bootstrap's Typeahead Can't Read `length` Property of `undefined`

AngularUI-Bootstrap's Typeahead Can't Read `length` Property of `undefined`

I am getting the following error when I attempt to get a typeahead values from AngularUI-Bootstrap, using a promise.TypeError: Cannot read property 'length' of undefined at http://localhost:8000/static/js/ui-bootstrap-tpls-0.6.0.min.js:1:3

Return max of zero or value for a pandas DataFrame column

Return max of zero or value for a pandas DataFrame column

I want to replace negative values in a pandas DataFrame column with zero.Is there a more concise way to construct this expression?df['value'][df['value'] 1:Here is the canonical way of doing it, while not necessarily more concise, is mo

Declaring jQuery Validate plugin rules — attribute vs. class vs. code

Declaring jQuery Validate plugin rules — attribute vs. class vs. code

In the examples for the jQuery Validate plugin, I see three different approaches to declaring validation rules:CSS Classes -- e.g. Attributes -- e.g. JS code -- e.g. $("#myForm").validate({ rules: { whatever: "required", ... } });But I don'

Bulk insert of hundreds of millions of records

Bulk insert of hundreds of millions of records

What is the fastest way to insert 237 million records into a table that has rules (for distributing data across child tables)?I have tried or considered:Insert statements.Transactional inserts (BEGIN and COMMIT).The COPY FROM command.http:/

Maps V2 with viewPager

Maps V2 with viewPager

I'm currently developing for Android 4.3.Background: I'm using pageViewer to scroll between three different fragments.My second fragment (tab 2) has XML with SupportMapFragment and other content. as shown below : My problem http://imageupl