Formatting a number with leading zeros in PHP

Formatting a number with leading zeros in PHP

I have a variable which contains the value 1234567.I would like it to contain exactly 8 digits, i.e. 01234567.Is there a PHP function for that? 1:Use sprintf :sprintf('%08d', 1234567);Alternatively you can also use str_pad:str_pad($value

Parse query string in JavaScript [duplicate]

Parse query string in JavaScript [duplicate]

Possible Duplicate: How can I get query string values? I need to parse the query string www.mysite.com/default.aspx?dest=aboutus.aspx.How do I get the dest variable in JavaScript? 1:Here is a fast and easy way of parsing query strings

How to send HTTP request in java? [duplicate]

How to send HTTP request in java? [duplicate]

This question already has an answer here: How to use java.net.URLConnection to fire and handle HTTP requests 12 answers In Java, How to compose a HTTP

Capturing stdout when calling Runtime.exec

Capturing stdout when calling Runtime.exec

When experiencing networking problems on client machines, I'd like to be able to run a few command lines and email the results of them to myself.I've found Runtime.exec will allow me to execute arbitrary commands, but Collecting the results

CHECK constraint in MySQL is not working

CHECK constraint in MySQL is not working

First I created a table likeCREATE TABLE Customer ( SD integer CHECK (SD > 0), Last_Name varchar (30), First_Name varchar(30));and then inserted values in that tableINSERT INTO Customer values ('-2','abc','zz');MySQL doesn't show an erro

Return row only if value doesn't exist

Return row only if value doesn't exist

I have 2 tables - reservation: id | some_other_column ----+------------------ 1 | value 2 | value 3 | valueAnd second table - reservation_log: id | reservation_id | change_type ----+----------------+------------- 1

In JavaScript can I make a “click” event fire programmatically for a file input element?

In JavaScript can I make a “click” event fire programmatically for a file input element?

I'd like to make a click event fire on an tag programmatically.Just calling click() doesn't seem to do anything or at least it doesn't pop up a file selection dialog.I've been experimenting with capturing events using li

Converting JSON data to Java object

Converting JSON data to Java object

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string can look like:{ 'title': 'Computinga

Serializing to JSON in jQuery [duplicate]

Serializing to JSON in jQuery [duplicate]

This question already has an answer here: Serializing an object to JSON 3 answers I need to serialize an object to JSON. I'm using jQuery. Is there a "

How to 'insert if not exists' in MySQL?

How to 'insert if not exists' in MySQL?

I started by googling, and found this article which talks about mutex tables.I have a table with ~14 million records. If I want to add more data in the same format, is there a way to ensure the record I want to insert does not already exist

'innerText' works in IE, but not in Firefox

'innerText' works in IE, but not in Firefox

I have some JavaScript code that works in IE containing the following:myElement.innerText = "foo";However, it seems that the 'innerText' property does not work in Firefox. Is there some Firefox equivalent? Or is there a more generic, cros

How to load an ImageView by URL in Android? [closed]

How to load an ImageView by URL in Android? [closed]

How do you use an image referenced by URL in an ImageView? 1:From Android developer:// show The Image in a ImageViewnew DownloadImageTask((ImageView) findViewById(R.id.imageView1)) .execute("http://java.sogeti.nl/JavaBlog/wp-c

Convert string representation of list to list

Convert string representation of list to list

I was wondering what the simplest way is to convert a string list like the following to a list:x = u'[ "A","B","C" , " D"]'Even in case user puts spaces in between the commas, and spaces inside of the quotes. I need to handle that as well t

ORA-00979 not a group by expression

ORA-00979 not a group by expression

I am getting ORA-00979 with the following query:SELECT cr.review_sk, cr.cs_sk, cr.full_name,tolist(to_char(cf.fact_date, 'mm/dd/yyyy')) "appt",cs.cs_id, cr.tracking_numberfrom review cr, cs, fact cfwhere cr.cs_sk = cs.cs_skand UPPER(cs.cs_i

What is JSONP all about? [duplicate]

What is JSONP all about? [duplicate]

This question already has an answer here: Can anyone explain what JSONP is, in layman terms? 4 answers I understand JSON, but not JSONP. Wikipedia's do

Which wizard control can I use in a WinForms application?

Which wizard control can I use in a WinForms application?

I was looking for scenario-like wizard (with Next/Back buttons) that I can use in a Windows application under .NET 3.5. Is there any wizard control provided by Microsoft in .NET Framework 3.5? 1:No, Microsoft does not provide a ready-mad

SSRS date default with formula disables parameter

SSRS date default with formula disables parameter

When I set a default value formula for a date parameter in SSRS, such as:=CDate(”01/” & Month(Now) & “/” & Year(Now))or even:=Nowthe date parameter control becomes disabled with nothing in it. Does anyone know what simple thing (I am sure)

Generate random numbers replicating arbitrary distribution

Generate random numbers replicating arbitrary distribution

I have data wherein I have a variable z that contains around 4000 values (from 0.0 to 1.0) for which the histogram looks like this. Now I need to generate a random variable, call it random_z which should replicate the above distribution. Wh

Log-log lmplot with seaborn

Log-log lmplot with seaborn

Can the function lmplot from Seaborn plot on a log-log scale?This is lmplot on a normal scaleimport numpy as npimport pandas as pdimport seaborn as snsx = 10**arange(1, 10)y = 10** arange(1,10)*2df1 = pd.DataFrame( data=y, index=x )df2 = p

Using SQLite in a Python program

Using SQLite in a Python program

I have created a Python module that creates and populates several SQLite tables. Now, I want to use it in a program but I don't really know how to call it properly. All the tutorials I've found are essentially "inline", i.e. they walk throu

Wait for n seconds, then next line of code without freezing form

Wait for n seconds, then next line of code without freezing form

Hi I am trying to find a method of waiting a number of milliseconds before moving to the next line of code,I have looked into Thread.Sleep but this will freeze the main form, I would like this to remain active.I tried timers and stopwatches

How to get Selenium to wait for a transition page to redirect before running an assertion

How to get Selenium to wait for a transition page to redirect before running an assertion

I have a fairly standard situation: Click a button, it loads a transition page with a progress bar or something, and then that page redirects to the next page, which takes a while to load.I want to run assertions on the final page, not the

How to Use -confirm in PowerShell

How to Use -confirm in PowerShell

I'm trying to take user input and before proceeding I would like get a message on screen and than a confirmation, whether user wants to proceed or not. I'm using the following code but its not working:write-host "Are you Sure You Want To Pr

I want to get number of weeks in a particular month

I want to get number of weeks in a particular month

i want to get number of weeks in current month.That including the previous month's days in the last week and the first week days in the next month.Something like this:Simple Isnt it? http://i50.tinypic.com/5ml2de.pngI want to use this in a

idioms for returning multiple values in shell scripting

idioms for returning multiple values in shell scripting

Are there any idioms for returning multiple values from a bash function within a script?http://tldp.org/LDP/abs/html/assortedtips.html describes how to echo multiple values and process the results (e.g., example 35-17), but that gets tricky