Some Of The Best Answers From Latest Asked Questions

7

answers

How can I get the UUID of my Android phone in an application?

I'm looking for help to get the UUID of my Android phone. I have searched the net and found one potential solution but it is not working in the emulator. Here is the code: Class<?> c; try { ..

4

answers

How to retrieve form values from HTTPPOST, dictionary or?

I have an MVC controller that has this Action Method: [HttpPost] public ActionResult SubmitAction() { // Get Post Params Here ... return something ... } The form is a non-trivial form with a ..

14

answers

How Should I Set Default Python Version In Windows?

I installed Python 2.6 and Python 3.1 on Windows 7 and set environment variable: path = d:\python2.6. When I run python in cmd, it displays the python version 2.6, which is what I want! But, when I w..

5

answers

How to rotate the background image in the container?

I want to rotate the image which is placed in the button of scrollbar in Chrome. Now I have a CSS with this content: ::-webkit-scrollbar-button:vertical:decrement { background-image:url(images/ar..

3

answers

How can I get an int from stdio in C?

I have significant trouble with this... printf("> "); int x = getchar(); printf("got the number: %d", scanf("%d", &x)); Output > 1234 got the number: 1 ..

10

answers

Google Authenticator available as a public service?

Is there public API for using the Google Authenticator (two factor authentication) on self-running (e.g. LAMP stack) web apps?..

14

answers

Java switch statement multiple cases

Just trying to figure out how to use many multiple cases for a Java switch statement. Here's an example of what I'm trying to do: switch (variable) { case 5..100: doSomething(); break..

8

answers

How to check if array is not empty?

How to check if the array is not empty? I did this: if not self.table[5] is None: Is this the right way?..

11

answers

disable a hyperlink using jQuery

<a href="gohere.aspx" class="my-link">Click me</a> I did $('.my-link').attr('disabled', true); but it didn't work Is there an easy way to disable the hyperlink using jquery? Remove ..

15

answers

What is the "hasClass" function with plain JavaScript?

How do you do jQuery’s hasClass with plain ol’ JavaScript? For example, <body class="foo thatClass bar"> What’s the JavaScript way to ask if <body> has thatClass?..

9

answers

How to set the opacity/alpha of a UIImage?

I know you can do this with a UIImageView, but can it be done to a UIImage? I want to have the animation images array property of a UIImageView to be an array of the same image but with different opa..

6

answers

Send Message in C#

I'm creating an application that uses a main project that is connected to several different DLLs. From one DLL window I need to be able to open a window in another but the DLL's can't reference each o..

9

answers

git pull while not in a git directory

Let's say I have a directory, /X/Y, which is a git repository. Is it possible to somehow call a command like git pull from inside /X, but targeting the /X/Y directory? EDIT: I guess I was wondering s..

13

answers

iOS - Calling App Delegate method from ViewController

What I am trying to do is click a button (that was created in code) and have it call up a different view controller then have it run a function in the new view controller. I know it could be done rel..

8

answers

Same font except its weight seems different on different browsers

The text is correctly displayed in Chrome. I want it to display this way in all browsers. How can I do this? I was able to fix this in Safari with -webkit-font-smoothing: antialiased; Chrome: Fire..

7

answers

Get and Set Screen Resolution

How can I collect and change screen resolution using Visual C#?..

16

answers

String formatting: % vs. .format vs. string literal

Python 2.6 introduced the str.format() method with a slightly different syntax from the existing % operator. Which is better and for what situations? Python 3.6 has now introduced another string forma..

10

answers

Base64 encoding in SQL Server 2005 T-SQL

I'd like to write a T-SQL query where I encode a string as a Base64 string. Surprisingly, I can't find any native T-SQL functions for doing Base64 encoding. Does a native function exist? If not, wh..

16

answers

check if "it's a number" function in Oracle

I'm trying to check if a value from a column in an oracle (10g) query is a number in order to compare it. Something like: select case when ( is_number(myTable.id) and (myTable.id >0) ) ..

5

answers

Add event handler for body.onload by javascript within <body> part

We want to include a maps from Google Maps API in our document. The documentation tells to initialize the map with a function called by the onload() event of the body. The ordinary way to call: <..

3

answers

ctypes - Beginner

I have the task of "wrapping" a c library into a python class. The docs are incredibly vague on this matter. It seems they expect only advanced python users would implement ctypes. Well i'm a begin..

1

answers

.htaccess, order allow, deny, deny from all: confused?

In my .htaccess, I have the following: <Limit GET POST> order deny,allow deny from all allow from all </Limit> <Limit PUT DELETE> order deny,allow deny from all </Limit> <F..

10

answers

Where is the correct location to put Log4j.properties in an Eclipse project?

Where in my Eclipse project should I add the log4j.properties file so that it will work as intended?..

8

answers

How to extract string following a pattern with grep, regex or perl

I have a file that looks something like this: <table name="content_analyzer" primary-key="id"> <type="global" /> </table> <table name="content_analyzer2" primar..

10

answers

MySQL "between" clause not inclusive?

If I run a query with a between clause, it seems to exclude the ending value. For example: select * from person where dob between '2011-01-01' and '2011-01-31' This gets all results with dob from '..

9

answers

How can I style even and odd elements?

Is it possible to use CSS pseudo-classes to select even and odd instances of list items? I'd expect the following to produce a list of alternating colors, but instead I get a list of blue items: <..

10

answers

HashSet vs LinkedHashSet

What is the difference between them? I know that A LinkedHashSet is an ordered version of HashSet that maintains a doubly-linked List across all elements. Use this class instead of HashSet wh..

5

answers

"Debug only" code that should run only when "turned on"

I would like to add some C# "debug only" code that only runs if the person debugging requests it. In C++, I used to do something similar to the following: void foo() { // ... #ifdef DEBUG s..

3

answers

CSS to prevent child element from inheriting parent styles

Possible Duplicate: How do I prevent CSS inheritance? Is there a way to declare the CSS property of an element such that it will not affect any of its children or is there a way to declare CSS of a..

22

answers

What is the most efficient way to concatenate N arrays?

What is the most efficient way to concatenate N arrays of objects in JavaScript? The arrays are mutable, and the result can be stored in one of the input arrays...

3

answers

CakePHP find method with JOIN

Hi, I need to do the following query using the CakePHP find method: SELECT * FROM `messages` INNER JOIN users ON messages.from = users.id WHERE messages.to = 4 ORDER BY messages.datetime DESC Basi..

20

answers

How do I find a stored procedure containing <text>?

I need to search a SQL server 2008 for stored procedures containing where maybe the name of a database field or variable name. ..

10

answers

How to pass boolean values to a PowerShell script from a command prompt

I have to invoke a PowerShell script from a batch file. One of the arguments to the script is a boolean value: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -File .\RunScript.p..

7

answers

Isn't the size of character in Java 2 bytes?

I used RandomAccessFile to read a byte from a text file. public static void readFile(RandomAccessFile fr) { byte[] cbuff = new byte[1]; fr.read(cbuff,0,1); System.out.println(new String(c..

41

answers

How do I remove the space between inline/inline-block elements?

Given this HTML and CSS: _x000D_ _x000D_ span {_x000D_ display:inline-block;_x000D_ width:100px;_x000D_ background-color:palevioletred;_x000D_ }_x000D_ <p>_x000D_ <span> F..

12

answers

How can I make an image transparent on Android?

I am using a linear layout and frame layout. In the linear layout I keep an image as background and in the frame layout I keep an imageView. In that imageView I give an image. Now I want to make the ..

9

answers

Generate a random number in a certain range in MATLAB

How can I generate a random number in MATLAB between 13 and 20?..

4

answers

how to modify an existing check constraint?

Is there any way to modify an existing check constraint on a table other than dropping and re-creating it? create table t ( n number); ora10g> Tabelle wurde erstellt. ora10g> alter table t ad..

4

answers

Reading e-mails from Outlook with Python through MAPI

I'm trying to write a short program that will read in the contents of e-mails within a folder on my exchange/Outlook profile so I can manipulate the data. However I'm having a problem finding much inf..

35

answers

What is the difference between null and undefined in JavaScript?

I want to know what the difference is between null and undefined in JavaScript...

4

answers

What is float in Java?

I wrote this code: float b = 3.6; and I get this: Error:Unresolved compilation problem: Type mismatch: cannot convert from double to float Why? Whats the definition of float?..

3

answers

JavaScript replace \n with <br />

var messagetoSend = $.trim(document.getElementById("msgText").value); messagetoSend = messagetoSend.replace("\n", "<br />"); alert(messagetoSend); Given input: Line 1 Line 2 Line 3 Th..

3

answers

How to export MySQL database with triggers and procedures?

How to create a MySQL database dump (.sql file) with all its triggers and procedures?..

8

answers

How to fit Windows Form to any screen resolution?

I work on VS 2008 with C#. This below code does not work for me. My form was designed in 1024 x 768 resolution. Our clients laptop is in 1366 x 768 resolution. To solve this problem, I set below cod..

14

answers

How to remove the last character from a bash grep output

COMPANY_NAME=`cat file.txt | grep "company_name" | cut -d '=' -f 2` outputs something like this "Abc Inc"; What I want to do is I want to remove the trailing ";" as well. How can i do that? I am..

18

answers

Retrieving parameters from a URL

Given a URL like the following, how can I parse the value of the query parameters? For example, in this case I want the value of def. /abc?def='ghi' I am using Django in my environment; is there a ..

4

answers

Chrome & Safari Error::Not allowed to load local resource: file:///D:/CSS/Style.css

When I access my aspx page in chrome or safari it shows this error in console Not allowed to load local resource: file:///D:/CSS/Style.css Everything works fine in IE and FF. I use an external ..

7

answers

Where is SQLite database stored on disk?

Where is the SQLite database stored i.e. directory path on windows 7 when created ?..

11

answers

Python unexpected EOF while parsing

Here's my python code. Could someone show me what's wrong with it. while 1: date=input("Example: March 21 | What is the date? ") if date=="June 21": sd="23.5° North Latitude" if date=="March 21"..

10

answers

How to get MAC address of client using PHP?

How can I get MAC Address using PHP or javascript.....

21

answers

Maven error "Failure to transfer..."

I am trying to set up a project using Maven (m2eclipse), but I get this error in Eclipse: Description Resource Path Location Type Could not calculate build plan: Failure to transfer ..

2

answers

What is the use of rt.jar file in java?

Possible Duplicate: Why do we use rt.jar in a java project? I am very confused to knowing about rt.jar file. What is the role of rt.jar file or use of rt.jar file in java?? Tha..

30

answers

How to get all groups that a user is a member of?

PowerShell's Get-ADGroupMember cmdlet returns members of a specific group. Is there a cmdlet or property to get all the groups that a particular user is a member of? I fixed my mistake: Get-Member..

5

answers

How to return a 200 HTTP Status Code from ASP.NET MVC 3 controller

I am writing an application that is accepting POST data from a third party service. When this data is POSTed I must return a 200 HTTP Status Code. How can I do this from my controller?..

11

answers

How to "git show" a merge commit with combined diff output even when every changed file agrees with one of the parents?

After doing a "simple" merge (one without conflicts), git show usually only shows something like commit 0e1329e551a5700614a2a34d8101e92fd9f2cad6 (HEAD, master) Merge: fc17405 ee2de56 Author: Tilman V..

10

answers

CSS3 equivalent to jQuery slideUp and slideDown?

My application is performing poorly with jQuery's slideDown and slideUp. I'm looking to use a CSS3 equivalent in browsers which support it. Is it possible, using CSS3 transitions, to change an elemen..

16

answers

JavaScript: filter() for Objects

ECMAScript 5 has the filter() prototype for Array types, but not Object types, if I understand correctly. How would I implement a filter() for Objects in JavaScript? Let's say I have this object: ..

10

answers

Polygon Drawing and Getting Coordinates with Google Map API v3

I'm trying to develop an application by using Google Maps API v3. What I'm trying to do is; first let the user draw a polygon on a Google Map and get his/her polygon's coordinates and save them into a..

17

answers

How do I use regex in a SQLite query?

I'd like to use a regular expression in sqlite, but I don't know how. My table has got a column with strings like this: "3,12,13,14,19,28,32" Now if I type "where x LIKE '3'" I also get the rows whic..

7

answers

Java - Convert integer to string

Given a number: int number = 1234; Which would be the "best" way to convert this to a string: String stringNumber = "1234"; I have tried searching (googling) for an answer but no many seemed ..

13

answers

Java, List only subdirectories from a directory, not files

In Java, How do I list only subdirectories from a directory? I'd like to use the java.io.File functionality, what is the best method in Java for doing this? ..

4

answers

For loop example in MySQL

In MySQL, I have this stored procedure with a LOOP: DELIMITER $$ CREATE PROCEDURE ABC() BEGIN DECLARE a INT Default 0 ; simple_loop: LOOP SET a=a+1; select a; ..

22

answers

SQL query to select dates between two dates

I have a start_date and end_date. I want to get the list of dates in between these two dates. Can anyone help me pointing the mistake in my query. select Date,TotalAllowance from Calculation where ..

9

answers

convert nan value to zero

I have a 2D numpy array. Some of the values in this array are NaN. I want to perform certain operations using this array. For example consider the array: [[ 0. 43. 67. 0. 38.] [ 100. 86..

8

answers

Fastest way to get the first object from a queryset in django?

Often I find myself wanting to get the first object from a queryset in Django, or return None if there aren't any. There are lots of ways to do this which all work. But I'm wondering which is the mo..

7

answers

How to split a single column values to multiple column values?

I have a problem splitting single column values to multiple column values. For Example: Name ------------ abcd efgh ijk lmn opq asd j. asdjja asb (asdfas) asd asd and I need the output something l..

15

answers

Upload folder with subfolders using S3 and the AWS console

When I try to upload a folder with subfolders to S3 through the AWS console, only the files are uploaded not the subfolders. You also can't select a folder. It always requires opening the folder fir..

15

answers

Java associative-array

How can I create and fetch associative arrays in Java like I can in PHP? For example: $arr[0]['name'] = 'demo'; $arr[0]['fname'] = 'fdemo'; $arr[1]['name'] = 'test'; $arr[1]['fname'] = 'fname'; ..

3

answers

How to sort with a lambda?

sort(mMyClassVector.begin(), mMyClassVector.end(), [](const MyClass & a, const MyClass & b) { return a.mProperty > b.mProperty; }); I'd like to use a lambda function to sort cu..

23

answers

Uppercase first letter of variable

I have searched over the web can can't find anything to help me. I want to make the first letter of each word upper case within a variable. So far i have tried: toUpperCase(); And had no luck, as ..

4

answers

warning: assignment makes integer from pointer without a cast

When I declare a char * to a fixed string and reuse the pointer to point to another string /* initial declaration */ char *src = "abcdefghijklmnop"; ..... /* I get the "warning: assignment makes i..

6

answers

Is there a date format to display the day of the week in java?

I know of date formats such as "yyyy-mm-dd" -which displays date in format 2011-02-26 "yyyy-MMM-dd"-which displays date in format 2011-FEB-26 to be used in eg: SimpleDateFormat formatter = new Simp..

11

answers

Monitor network activity in Android Phones

I would like to monitor network traffic of my Android Phone. I was thinking using tcpdump for Android, but I'm not sure if I have to cross-compile for the phone. Another question is the following, If..

4

answers

How to programmatically set SelectedValue of Dropdownlist when it is bound to XmlDataSource

I'm using XmlDataSource as the datasource for a dropdownlist. Now I want to set the SelectedValue of the drop down when the page initially loads. I have tried the OnDataBound event of the drop down i..

30

answers

PHP code is not being executed, instead code shows on the page

I'm trying to execute some PHP code on a project (using Dreamweaver) but the code isn't being run. When I check the source code, the PHP code appears as HTML tags (I can see it in the source code). A..

9

answers

DataGrid get selected rows' column values

I'm trying to get the values of each column of a selected row in a DataGrid. This is what I have: private void dataGrid1_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { DataGri..

4

answers

Can we import XML file into another XML file?

Can we import an XML file into another XML file? I mean is there any import tag in XML that takes XML path as parameter and imports XML (for which path is provided)...

4

answers

Fatal error: Call to a member function fetch_assoc() on a non-object

I'm trying to execute a few queries to get a page of information about some images. I've written a function function get_recent_highs($view_deleted_images=false) { $lower = $this->database->..

3

answers

How do I store the select column in a variable?

How do I store the select column in a variable? I tried this, but it throws me an error "Incorrect syntax": declare @EmpId int SELECT dbo.Employee.Id as @EmpId FROM dbo.Employee ..

11

answers

How to implement the factory method pattern in C++ correctly

There's this one thing in C++ which has been making me feel uncomfortable for quite a long time, because I honestly don't know how to do it, even though it sounds simple: How do I implement Factory M..

4

answers

Wrapping long text without white space inside of a div

I am having issues with wrapping text. I am generating some hexencoding encryption and the output is too long like: 827938828ey823876te37257e5t328er6367r5erd663275e65r532r6s3624e5645376er563rdr753..

11

answers

Is it possible to cherry-pick a commit from another git repository?

I'm working with a git repository that needs a commit from another git repository that knows nothing of the first. Typically I would cherry-pick using the [email protected]{x} in the reflog, but because this .gi..

12

answers

find -exec with multiple commands

I am trying to use find -exec with multiple commands without any success. Does anybody know if commands such as the following are possible? find *.txt -exec echo "$(tail -1 '{}'),$(ls '{}')" \; Ba..

12

answers

what's the easiest way to put space between 2 side-by-side buttons in asp.net

I have 2 buttons side by side, and I would like to have some inbetween them. Following code will have 2 buttons right next to each other. I have tried margin for the div, and just couldn't get some n..

3

answers

'True' and 'False' in Python

I tried running this piece of code: path = '/bla/bla/bla' if path is True: print "True" else: print "False" And it prints False. I thought Python treats anything with value as True. Why is..

2

answers

XPath to get all child nodes (elements, comments, and text) without parent

I need an XPath to fetch all ChildNodes ( including Text Element, Comment Element & Child Elements ) without Parent Element. Any help Sample Example: <DOC> <PRESENTEDIN> <X>..

15

answers

How can I get a web site's favicon?

Simple enough question: I've created a small app that is basically just a favourites that sits in my system tray so that I can open often-used sites/folders/files from the same place. Getting the defa..

6

answers

ASP.NET MVC Global Variables

How do you declare global variables in ASP.NET MVC?..

8

answers

Configuring RollingFileAppender in log4j

I'm working on a set of web services and we'd like to have a daily rotated log. I'm trying to get org.apache.log4j.rolling.RollingFileAppender from the log4j extras companion working, since the docum..

8

answers

How to load images dynamically (or lazily) when users scrolls them into view

I've noticed this in numerous "modern" websites (e.g. facebook and google image search) where the images below the fold load only when user scrolls down the page enough to bring them inside the visibl..

7

answers

C# find biggest number

It's the first time I am using c# so I am not very familiar with it. I would like to create a simple program to find the biggest number if I have the user entering 3 numbers. I just need to know what ..

17

answers

Use dynamic variable names in JavaScript

In PHP you can do amazing/horrendous things like this: $a = 1; $b = 2; $c = 3; $name = 'a'; echo $$name; // prints 1 Is there any way of doing something like this with Javascript? E.g. if I have a..

9

answers

How can I get onclick event on webview in android?

I want to know when the user clicks on webview but not on a hyperlink. On that click I want to show/hide a view of my activity that holds a webview. Any suggestion?..

10

answers

Linux: command to open URL in default browser

What command we have to execute (from Java, but that should not matter) on Linux (different common distributions) to open a given URL in the default browser?..

5

answers

require_once :failed to open stream: no such file or directory

I have this testing code in "PAGE A": <?php require_once('../mysite/php/classes/eventManager.php'); $x=new EventManager(); $y=$x->loadNumbers(); ?> "eventManager.php" has inside a require_..

2

answers

How to select an element with 2 classes

Possible Duplicate: CSS Selector that applies to elements with two classes i have this elements <div class="a b"></div> <div class="b"></div> <div class="a">&..

2

answers

Core dump file analysis

What are all the things I will need to check while analyzing a core dump file? Please tell me from scratch...

13

answers

How can I add a box-shadow on one side of an element?

I need to create a box-shadow on some block element, but only (for example) on its right side. The way I do it is to wrap the inner element with box-shadow into an outer one with padding-right and ove..

7

answers

Shorter syntax for casting from a List<X> to a List<Y>?

I know its possible to cast a list of items from one type to another (given that your object has a public static explicit operator method to do the casting) one at a time as follows: List<Y> Li..

7

answers

How to construct a std::string from a std::vector<char>?

Short of (the obvious) building a C style string first then using that to create a std::string, is there a quicker/alternative/"better" way to initialize a string from a vector of chars?..