Some Of The Best Answers From Latest Asked Questions

8

answers

Convert string to ASCII value python

How would you convert a string to ASCII values? For example, "hi" would return 104105. I can individually do ord('h') and ord('i'), but it's going to be troublesome when there are a lot of letters...

12

answers

CSS Inset Borders

I need to create a solid color inset border. This is the bit of CSS I'm using: border: 10px inset rgba(51,153,0,0.65); Unfortunately that creates a 3D ridged border (ignore the squares and dark descr..

5

answers

java howto ArrayList push, pop, shift, and unshift

I've determined that a Java ArrayList.add is similar to a JavaScript Array.push I'm stuck on finding ArrayList functions similar to the following Array.pop Array.shift Array.unshift I'm leaning tow..

7

answers

Is the 'as' keyword required in Oracle to define an alias?

Is the 'AS' keyword required in Oracle to define an alias name for a column in a SELECT statement? I noticed that SELECT column_name AS "alias" is the same as SELECT column_name "alias" I am ..

4

answers

How to uninstall / completely remove Oracle 11g (client)?

How to uninstall / completely remove Oracle 11g (client)? deinstall.bat doesn't work. Edit: Further discussion related to why this question was closed and deleted: https://meta.stackexchange.com/q..

11

answers

Execute a PHP script from another PHP script

How would I make my server run a php script by triggering it manually using php? Basically I have a pretty big cronjob file that is ran every 2 hours, but I want to be able to trigger the file manuall..

7

answers

How to print a string at a fixed width?

I have this code (printing the occurrence of the all permutations in a string) def splitter(str): for i in range(1, len(str)): start = str[0:i] end = str[i:] yield (start..

15

answers

Animation CSS3: display + opacity

I have got a problem with a CSS3 animation. .child { opacity: 0; display: none; -webkit-transition: opacity 0.5s ease-in-out; -moz-transition: opacity 0.5s ease-in-out; transit..

9

answers

Cross origin requests are only supported for HTTP but it's not cross-domain

I'm using this code to make an AJAX request: $("#userBarSignup").click(function(){ $.get("C:/xampp/htdocs/webname/resources/templates/signup.php", {/*params*/}, function(response)..

4

answers

How can I make a menubar fixed on the top while scrolling

I'd like to make a menubar, which is fixed on the top of the page while scrolling. Something like the top menu in Facebook. Also, I want a div holding the logo float at the left of menubar, and a na..

9

answers

How to see an HTML page on Github as a normal rendered HTML page to see preview in browser, without downloading?

On http://github.com developer keep the HTML, CSS, JavaScript and images files of the project. How can I see the HTML output in browser? For example this: https://github.com/necolas/css3-social-signi..

11

answers

Java way to check if a string is palindrome

I want to check if a string is a palindrome or not. I would like to learn an easy method to check the same using least possible string manipulations..

3

answers

Using an IF Statement in a MySQL SELECT query

I am trying to use an IF statement in a MySQL select query. I am getting an error after the AND statement where the first IF. SELECT J.JOB_ID,E.COMPANY_NAME,J.JOB_DESC,JT.JOBTYPE_NAME,J.COMPENSATI..

8

answers

How to use MySQL dump from a remote machine

How can I backup a mysql database which is running on a remote server, I need to store the back up file in the local pc...

9

answers

How to stop a setTimeout loop?

I'm trying to build a loading indicator with a image sprite and I came up with this function function setBgPosition() { var c = 0; var numbers = [0, -120, -240, -360, -480, -600, -720]; fu..

1

answers

How are SSL certificate server names resolved/Can I add alternative names using keytool?

These may be phrased as separate questions for clarity, but they are all related to the same issue. How are SSL certificate server names resolved? Why do browsers seem to use the CN field of the cer..

7

answers

Is there a way to have printf() properly print out an array (of floats, say)?

I believe I have carefully read the entire printf() documentation but could not find any way to have it print out, say, the elements of a 10-element array of float(s). E.g., if I have float[] foo = ..

21

answers

How to delete or add column in SQLITE?

I want to delete or add column in sqlite database I am using following query to delete column. ALTER TABLE TABLENAME DROP COLUMN COLUMNNAME But it gives error System.Data.SQLite.SQLiteException..

12

answers

How do I copy the contents of one ArrayList into another?

I have some data structures, and I would like to use one as a temporary, and another as not temporary. ArrayList<Object> myObject = new ArrayList<Object>(); ArrayList<Object> myTemp..

8

answers

warning: implicit declaration of function

My compiler (GCC) is giving me the warning: warning: implicit declaration of function Please help me understand why is it coming...

6

answers

Copy an entire worksheet to a new worksheet in Excel 2010

I have found similar questions that deal with copying an entire worksheet in one workbook and pasting it to another workbook, but I am interested in simply copying an entire worksheet and pasting it t..

15

answers

How to drop all tables in a SQL Server database?

I'm trying to write a script that will completely empty a SQL Server database. This is what I have so far: USE [dbname] GO EXEC sp_msforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT all' EXEC sp_msfore..

12

answers

Catching multiple exception types in one catch block

I'd like a cleaner way to obtain the following functionality, to catch AError and BError in one block: try { /* something */ } catch( AError, BError $e ) { handler1( $e ) } catch( Exception $..

8

answers

Better way to find index of item in ArrayList?

For an Android app, I have the following functionality private ArrayList<String> _categories; // eg ["horses","camels"[,etc]] private int getCategoryPos(String category) { for(int i = 0; i..

5

answers

Convert char* to string C++

I know the starting address of the string(e.g., char* buf) and the max length int l; of the string(i.e., total number of characters is less than or equal to l). What is the simplest way to get the va..

14

answers

IF... OR IF... in a windows batch file

Is there a way to write an IF OR IF conditional statement in a windows batch-file? For example: IF [%var%] == [1] OR IF [%var%] == [2] ECHO TRUE ..

12

answers

Wordpress - Images not showing up in the Media Library

I have a huge problem with my Wordpress. My uploaded images don't list in the Media Library. It is weird tho, it says I have 75 images, but display none. Take a look yourself. Even weirder, if I g..

6

answers

Difference between 3NF and BCNF in simple terms (must be able to explain to an 8-year old)

I have read the quote : data depends on the key [1NF], the whole key [2NF] and nothing but the key [3NF]. However, I am having trouble understanding 3.5NF or BCNF as it's called. Here is what I unde..

5

answers

JQuery - File attributes

Trying to access file attributes from an input field after a file is selected. Tried this but get the error 'file not defined' var file = $("#uploadedfile").prop("files")[0]; var fileName = file.file..

8

answers

Java - ignore exception and continue

For my Java application, I am creating an instance of a user information object and populating it with a service that I don't control the source for. The code looks like this: // username given as ..

9

answers

How to find a string inside a entire database?

I have one specific string, such as "123abcd" for example but I don't know the name of the table or even the name of the column inside the table on my SQL Server Database. I want to find it with a sel..

11

answers

Retrieve the commit log for a specific line in a file?

Is there any way to get git to give you a commit log for just commits that touched a particular line in a file? Like git blame, but git blame will show you the LAST commit that touched a particular l..

32

answers

mysql Foreign key constraint is incorrectly formed error

I have two tables, table1 is the parent table with a column ID and table2 with a column IDFromTable1 (not the actual name) when I put a FK on IDFromTable1 to ID in table1 I get the error Foreign key c..

6

answers

Embed an External Page Without an Iframe?

Is there any way to embed an external web page without using an iframe? I have access to both sites, I just want the page that the content is embedded on to resize based on the content that is embedde..

26

answers

WAMP/XAMPP is responding very slow over localhost

I don't know what the problem is. WAMP was very slow, so I reformatted my computer and installed WAMP. Still, accessing localhost is very, very slow, and sometimes it doesn't even load at all. I even ..

16

answers

How to sort a List<Object> alphabetically using Object name field

I have a List of Objects like List<Object> p.I want to sort this list alphabetically using Object name field. Object contains 10 field and name field is one of them. if (list.size() > 0) { ..

45

answers

Clicking the back button twice to exit an activity

I've noticed this pattern in a lot of Android apps and games recently: when clicking the back button to "exit" the application, a Toast comes up with a message similar to "Please click BACK again to e..

3

answers

get keys of json-object in JavaScript

I have a json-object in JavaScript and I want to get the used keys in it. My JavaScript-Code looks like this: var jsonData = [{"person":"me","age":"30"},{"person":"you","age":"25"}]; And I want a l..

3

answers

How to style the <option> with only CSS?

Note: This question is not about making a custom dropdown. It's only about possibilities of styling <option> elements within the select element in CSS How can I style <option>s of a <s..

4

answers

View's SELECT contains a subquery in the FROM clause

I have two tables and I need to create a view. The tables are: credit_orders(id, client_id, number_of_credits, payment_status) credit_usage(id, client_id, credits_used, date) I use the following qu..

4

answers

Show Current Location and Nearby Places and Route between two places using Google Maps API in Android

I need to develop an application using Google Maps in Android to locate my current location and need to find nearest location. (For example: Nearby police station from my current location.) It shoul..

8

answers

How to put a jpg or png image into a button in HTML

I want a button with an image in it. I am using this: <input type="submit" name="submit" src="images/stack.png" /> But it does not show the image. I want the whole button to be the image...

25

answers

__FILE__ macro shows full path

The standard predefined macro __FILE__ available in C shows the full path to the file. Is there any way to short the path? I mean instead of /full/path/to/file.c I see to/file.c or file.c ..

17

answers

How to add an extra column to a NumPy array

Let’s say I have a NumPy array, a: a = np.array([ [1, 2, 3], [2, 3, 4] ]) And I would like to add a column of zeros to get an array, b: b = np.array([ [1, 2, 3, 0], [2, 3..

6

answers

JQUERY ajax passing value from MVC View to Controller

What I want is to pass the value of txtComments from View (using jquery/ajax) to Controller. The problem is the ajax/jquery doesn't accept script tags as string. Meaning, when I input any script/htm..

2

answers

How do I parse a URL query parameters, in Javascript?

Possible Duplicate: Use the get paramater of the url in javascript How can I get query string values in JavaScript? In Javascript, how can I get the parameters of a URL string (not the cu..

8

answers

What does "@" mean in Windows batch scripts

I saw @ is used in such contexts: @echo off @echo start eclipse.exe What does @ mean here?..

7

answers

Force file download with php using header()

I want the user to be able to download some files I have on my server, but when I try to use any of the many examples of this around the internet nothing seems to work for me. I've tried code like thi..

4

answers

How to convert String to DOM Document object in java?

I have a case like getting an XML and convert the XML elements to document object and getting the element values and attributes which i have been created already Here is the piece of code i have trie..

13

answers

Access denied for user 'root'@'localhost' while attempting to grant privileges. How do I grant privileges?

I've looked at a number of similar questions and so I'm demonstrating that I've checked the basics. Though of course, that doesn't mean I haven't missed something totally obvious. :-) My question is:..

7

answers

Java Does Not Equal (!=) Not Working?

Here is my code snippet: public void joinRoom(String room) throws MulticasterJoinException { String statusCheck = this.transmit("room", "join", room + "," + this.groupMax + "," + this.uniqueID); ..

6

answers

Check div is hidden using jquery

This is my div <div id="car2" style="display:none;"></div> Then I have a Show button that will show the div when you click: $("show").click(function() { $("$car2").show(); }); ..

5

answers

How to create the branch from specific commit in different branch

I have made several commits in the master branch and then merged them to dev branch. I want to create a branch from a specific commit in dev branch, which was first committed in master branch. I use..

3

answers

PHP preg_replace special characters

I am wanting to replace all non letter and number characters i.e. /&%#$ etc with an underscore (_) and replace all ' (single quotes) with ""blank (so no underscore). So "There wouldn't be any" (i..

8

answers

Run CSS3 animation only once (at page loading)

I'm making a simple landing page driven by CSS3. To make it look awesome there's an <a> plopping up: @keyframes splash { from { opacity: 0; transform: scale(0, 0); } ..

3

answers

Putting text in top left corner of matplotlib plot

How can I put text in the top left (or top right) corner of a matplotlib figure, e.g. where a top left legend would be, or on top of the plot but in the top left corner? E.g. if it's a plt.scatter(),..

9

answers

MySQL Cannot drop index needed in a foreign key constraint

I need to ALTER my existing database to add a column. Consequently I also want to update the UNIQUE field to encompass that new column. I'm trying to remove the current index but keep getting the erro..

2

answers

How do I hide the bullets on my list for the sidebar?

This is a WordPress site, the classes/ID's are generated, I can't just go in and add a class. Yes, I have firebug... but I'm so twisted around and confused as to whether this is coming from BuddyPres..

17

answers

Is there a JSON equivalent of XQuery/XPath?

When searching for items in complex JSON arrays and hashes, like: [ { "id": 1, "name": "One", "objects": [ { "id": 1, "name": "Response 1", "objects": [ // etc. }] ..

5

answers

How to throw a C++ exception

I have a very poor understanding of exception handling(i.e., how to customize throw, try, catch statements for my own purposes). For example, I have defined a function as follows: int compare(int a, ..

11

answers

Remove spacing between table cells and rows

I'm designing an HTML email template, which forces me to use tables. In the code below, I'm having trouble (1) removing the spacing below the placeholder image and (2) removing the space between the i..

5

answers

How do I find Waldo with Mathematica?

This was bugging me over the weekend: What is a good way to solve those Where's Waldo? ['Wally' outside of North America] puzzles, using Mathematica (image-processing and other functionality)? Here ..

11

answers

What is an attribute in Java?

I read that to get length of an array, I use the length attribute, like arrayName.length. What is an attribute? Is it a class?..

5

answers

How can I generate UUID in C#

I am creating an .idl file programmatically. How do I create UUIDs for the interfaces and Methods Programmatically. Can I generate the UUID programmatically?..

31

answers

Highest Salary in each department

I have a table EmpDetails: DeptID EmpName Salary Engg Sam 1000 Engg Smith 2000 HR Denis 1500 HR Danny 3000 IT David 2000 IT ..

5

answers

How can I find out what version of git I'm running?

I'm trying to follow some tutorials to learn how to use Git but some of the instructions are for specific versions. Is there a command that I can use find out what version I have installed?..

5

answers

How to specify in crontab by what user to run script?

I have few crontab jobs that run under root, but that gives me some problems. For example all folders created in process of that cron job are under user root and group root. How can i make it to run ..

3

answers

How do I write to a Python subprocess' stdin?

I'm trying to write a Python script that starts a subprocess, and writes to the subprocess stdin. I'd also like to be able to determine an action to be taken if the subprocess crashes. The process I'..

4

answers

How to get the android Path string to a file on Assets folder?

I need to know the string path to a file on assets folder, because I'm using a map API that needs to receive a string path, and my maps must be stored on assets folder This is the code i'm trying: ..

1

answers

Pythonic way to add datetime.date and datetime.time objects

I have two objects that represent the same event instance --- one holds the date, the other the time of this event, and I want to create a datetime object. Since one can't simply add date and time o..

7

answers

Redis - Connect to Remote Server

I've just install Redis succesfully using the instructions on the Quick Start guide on http://redis.io/topics/quickstart on my Ubuntu 10.10 server. I'm running the service as dameon (so it can be run..

10

answers

CAST DECIMAL to INT

I'm trying to do this: SELECT CAST(columnName AS INT), moreColumns, etc FROM myTable WHERE ... I've looked at the help FAQs here: http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html , it say..

10

answers

How to add a line to a multiline TextBox?

How can i add a line of text to a multi-line TextBox? e.g. pseudocode; textBox1.Clear(); textBox1.Lines.Add("1000+"); textBox1.Lines.Add("750-999"); textBox1.Lines.Add("400-749"); ...snip... textBox..

4

answers

onclick on a image to navigate to another page using Javascript

I am getting warmed up with Javascript so I am trying something on my own. I am searching for a onclick function, where I have thumbnail images in my index.html page, and whenever a user clicks the im..

9

answers

How can I use tabs for indentation in IntelliJ IDEA?

How can I use tabs instead of multiple spaces for indentation in IntelliJ IDEA 11.0? I have "Use tab character" checked under "Code Style" > "General" > "Default Indent Options". And also tried to ha..

4

answers

Find first element in a sequence that matches a predicate

I want an idiomatic way to find the first element in a list that matches a predicate. The current code is quite ugly: [x for x in seq if predicate(x)][0] I've thought about changing it to: from i..

16

answers

How to represent empty char in Java Character class

I want to represent an empty character in Java as "" in String... Like that char ch = an empty character; Actually I want to replace a character without leaving space. I think it might be suffici..

3

answers

multiprocessing.Pool: When to use apply, apply_async or map?

I have not seen clear examples with use-cases for Pool.apply, Pool.apply_async and Pool.map. I am mainly using Pool.map; what are the advantages of others?..

3

answers

List files in local git repo?

I'm using Sparkleshare, which uses Git to sync files between my laptop and my backup server. Now I want to be able to browse in the files and dirs that I've uploaded to my server, but I do not know h..

16

answers

How do you run JavaScript script through the Terminal?

For instance, if you were to run a Python script you would type python filename.py or if you wanted to run a C program make filename then ./ filename. How do you do this with .js files?..

2

answers

How to get the fragment instance from the FragmentActivity?

I set the content view in the FragmentActivity, and the activity will create the fragment instance for me according to the class name specified in the layout file. But how can I get that fragment inst..

5

answers

Python dictionary : TypeError: unhashable type: 'list'

I'm having troubles in populating a python dictionary starting from another dictionary. Let's assume that the "source" dictionary has string as keys and has a list of custom objects per value. I'm c..

4

answers

How to conditionally take action if FINDSTR fails to find a string

I have a batch file as follows; CD C:\MyFolder findstr /c:"stringToCheck" fileToCheck.bat IF NOT XCOPY "C:\OtherFolder\fileToCheck.bat" "C:\MyFolder" /s /y I am getting an error ("C:\OtherFolder\fi..

4

answers

What is a void pointer in C++?

Possible Duplicate: What is a void pointer and what is a null pointer? I often see code which resembles something like the following: void * foo(int bar); What does this mean? Does it mea..

31

answers

How do I convert a string to a number in PHP?

I want to convert these types of values, '3', '2.34', '0.234343', etc. to a number. In JavaScript we can use Number(), but is there any similar method available in PHP? Input Output '2' ..

30

answers

Which terminal command to get just IP address and nothing else?

I'm trying to use just the IP address (inet) as a parameter in a script I wrote. Is there an easy way in a unix terminal to get just the IP address, rather than looking through ifconfig? ..

6

answers

Using Page_Load and Page_PreRender in ASP.Net

I see some people are using Page_Load and Page_PreRender in same aspx page. Can I exactly know why do we need to invoke both the methods in same asp.net page? Please see the code below, protect..

8

answers

List of zeros in python

How can I create a list which contains only zeros? I want to be able to create a zeros list for each int in range(10) For example, if the int in the range was 4 I will get: [0,0,0,0] and for 7: [..

10

answers

How do I ignore files in a directory in Git?

What is the proper syntax for the .gitignore file to ignore files in a directory? Would it be config/databases.yml cache/* log/* data/sql/* lib/filter/base/* lib/form/base/* lib/model/map/* lib/mode..

1

answers

Can there be an apostrophe in an email address?

Possible Duplicate: What characters are allowed in email address? I have an email address with an apostrophe in it and am wondering if that is valid?..

7

answers

Commenting multiple lines in DOS batch file

I have written huge MS DOS Batch file. To test this batch file I need to execute some lines only and want to hide/comment out remaining. I have some existing comment lines starting with :: hence I can..

10

answers

How to put a new line into a wpf TextBlock control?

I'm fetching text from an XML file, and I'd like to insert some new lines that are interpreted by the textblock render as new lines. I've tried: <data>Foo bar baz \n baz bar</data> But..

3

answers

JSON.parse unexpected character error

I get this error: JSON.parse: unexpected character when I run this statement in firebug: JSON.parse({"balance":0,"count":0,"time":1323973673061,"firstname":"howard","userId":5383,"localid":1,"f..

6

answers

how to sort an ArrayList in ascending order using Collections and Comparator

How to sort an ArrayList in ascending order using Comparator? I know how to sort it in descending order using: Comparator mycomparator = Collections.reverseOrder(); then Collections.sort(myarrayL..

10

answers

How do I "break" out of an if statement?

I have a if statement that I want to "break" out of. I understand that break is only really for loops. Can anyone help? For those that require an example of what I'm trying to do: if( color == red..

7

answers

Get most recent row for given ID

In the table below, how do I get just the most recent row with id=1 based on the signin column, and not all 3 rows? +----+---------------------+---------+ | id | signin | signout | +----+..

8

answers

Make a number a percentage

What's the best way to strip the "0."XXX% off a number and make it a percentage? What happens if the number happens to be an int? var number1 = 4.954848; var number2 = 5.9797; $(document).ready(fun..

3

answers

What is the difference between =Empty and IsEmpty() in VBA (Excel)?

I have used the following VBA code: Do While .Cell(i,1) <> Empty ' doing things i = i+1 Loop to iterate through columns (with Double/Integer values) in Excel. Then I found a case where th..

4

answers

Properties order in Margin

If I have such string in XAML: Storyboard.TargetProperty="Margin" From="1,2,3,4" To="0,0,0,0" What is Top Bottom Right and Left? 1- right 2- top 3- left 4 - bottom Is that right?..

4

answers

Where do I get servlet-api.jar from?

In order to write servlets code I need servlet-api.jar. Where do i get servlet-api.jar from ?..