Some Of The Best Answers From Latest Asked Questions

7

answers

How to add url parameter to the current url?

Currently I'm at http://example.com/topic.php?id=14 and I want to make a link to http://example.com/topic.php?id=14&like=like by not defining the current url. Like <a href="&like=..

37

answers

Hide separator line on one UITableViewCell

I'm customizing a UITableView. I want to hide the line separating on the last cell ... can i do this? I know I can do tableView.separatorStyle = UITableViewCellStyle.None but that would affect all th..

7

answers

make: Nothing to be done for `all'

I am going through an eg pgm to create a make file. http://mrbook.org/tutorials/make/ My folder eg_make_creation contains the following files, desktop:~/eg_make_creation$ ls factorial.c functions...

9

answers

android - save image into gallery

i have an app with a gallery of images and i want that the user can save it into his own gallery. I've created an option menu with a single voice "save" to allow that but the problem is...how can i sa..

5

answers

How to use readline() method in Java?

I am beginner in Java, and I was reading the topic of giving values to variables through the readLine() method from the keyboard. The program for that is given in the book is as follows: import java...

11

answers

Different names of JSON property during serialization and deserialization

Is it possible: to have one field in class, but different names for it during serialization/deserialization in Jackson library? For example, I have class "Coordiantes". class Coordinates{ int red;..

2

answers

Silent installation of a MSI package

I have a MSI package that I need to install if the package is not already installed. Also I need to install it silently. The package prompts user for: Installation location (C:\Program Files\Foobar)..

7

answers

How can I get date in application run by node.js?

Do I have to manually run date command using child_process and fetch the result from it to get the date? Is there any other way using node?..

19

answers

Create an Array of Arraylists

I am wanting to create an array of arraylist like below: ArrayList<Individual>[] group = new ArrayList<Individual>()[4] But it's not compiling. How can I do this?..

3

answers

How to get the current time in milliseconds in C Programming

Possible Duplicate: How to measure time in milliseconds using ANSI C? How can I get the Windows system time with millisecond resolution? We want to calculate the time which a player have ..

3

answers

How to return multiple values?

Is it possible to return two or more values from a method to main in Java? If so, how it is possible and if not how can we do? ..

15

answers

MySQL 'Order By' - sorting alphanumeric correctly

I want to sort the following data items in the order they are presented below (numbers 1-12): 1 2 3 4 5 6 7 8 9 10 11 12 However, my query - using order by xxxxx asc sorts by the first digit above ..

11

answers

Making a button invisible by clicking another button in HTML

How can I make a button invisible by clicking another button in HTML? I have written like below, but it doesn't work. <input type="button" onclick="demoShow();" value="edit" /> <script type=..

2

answers

Is there a way to use two CSS3 box shadows on one element?

I'm trying to replicate a button style in a Photoshop mock-up that has two shadows on it. The first shadow is an inner lighter box shadow (2px), and the second is a drop shadow outside the button (5px..

12

answers

Is there a wikipedia API just for retrieve content summary?

I need just to retrieve first paragraph of a Wikipedia page. Content must be html formated, ready to be displayed on my website (so NO BBCODE, or WIKIPEDIA special CODE!)..

10

answers

Rounding SQL DateTime to midnight

I am having a small problem with my SQL query. I'm using the GETDATE function, however, let's say I execute the script at 5PM, it will pull up records between 12/12/2011 5PM to 12/18/2011 5PM. How can..

5

answers

Set LIMIT with doctrine 2?

I trying to write a query (with subquery) but i don't know how set a limit in my subquery. My query: $query_ids = $this->getEntityManager() ->createQuery( "SELECT e_.id FR..

9

answers

What is a clearfix?

Recently I was looking through some website's code, and saw that every <div> had a class clearfix. After a quick Google search, I learned that it is for IE6 sometimes, but what actually is a c..

28

answers

how to release localhost from Error: listen EADDRINUSE

i am testing a server written in nodejs on windows 7 and when i try to run the tester in the command line i get the following error Error: listen EADDRINUSE at errnoException (net.js:614:11) at Array..

7

answers

System.drawing namespace not found under console application

I selected console application as my C# project. But the imports that seemed to work under windows form project doesnt seem to work here. It says that the drawing namespace does not exist. using Syst..

2

answers

How to use && in EL boolean expressions in Facelets?

I am having a little trouble figuring out how to do and's on EL expressions in Facelets. So basically I have: <h:outputText id="Prompt" value="Fobar" rendered="#{beanA.prompt == true &..

10

answers

Adding 1 hour to time variable

I have a time to which I want to add an hour: $time = '10:09'; I've tried: $time = strtotime('+1 hour'); strtotime('+1 hour', $time); $time = date('H:i', strtotime('+1 hour')); But none of the abo..

4

answers

MySQL: Insert datetime into other datetime field

I have a table with a DATETIME column. I would like to SELECT this datetime value and INSERT it into another column. I did this (note: '2011-12-18 13:17:17' is the value the former SELECT gave me fro..

3

answers

How to connect with Java into Active Directory

I am using Weblogic, Ejb3.0. Java 1.6 I need to access Active Directory via Java code. I read about several ways (Kerberos, LDAP) Anyone could advice me on comfortable way of doing so? where could I..

16

answers

How do I run Python code from Sublime Text 2?

I want to set up a complete Python IDE in Sublime Text 2. I want to know how to run the Python code from within the editor. Is it done using build system? How do I do it ?..

13

answers

Call to undefined function mysql_connect

I just installed PHP and Apache on my home PC. When I try to call function mysql_connect I get: fatal error: call to undefined function mysql_connect. I have loaded php.ini where I have uncommented..

3

answers

Dictionary of dictionaries in Python?

From another function, I have tuples like this ('falseName', 'realName', positionOfMistake), eg. ('Milter', 'Miller', 4). I need to write a function that make a dictionary like this: D={realName:{fal..

8

answers

Where to change the value of lower_case_table_names=2 on windows xampp

I am using windows 7 and xampp i am trying to export my database and while in the process the table names are converted to lower case. I have searched a lot, i know i have to change the value of lower..

6

answers

struct in class

I have struct in class and not know how to call variables from struct, please help ;) #include <iostream> using namespace std; class E { public: struct X { int v; }; }; ..

8

answers

How Do I Replace/Change The Heading Text Inside <h3></h3>, Using jquery?

How do I change/replace the <h3> text: "Featured Offers" using javascript to say "Public Offers" instead? </div> <!-- FEATURED OFFERS --> <div class="panel"> <div class..

4

answers

Access VBA | How to replace parts of a string with another string

I am trying to create a piece of code that replaces one word with another. Example: Replace Avenue with Ave and North with N. I am using MS Access, I could use SQL REPLACE Function but I want to do th..

9

answers

Sum of values in an array using jQuery

I have an array containing some values and I want to get their sum. Here is the example: var somearray = ["20","40","80","400"]; I want to sum these values using jQuery. In this example the result..

12

answers

What is the difference between DAO and Repository patterns?

What is the difference between Data Access Objects (DAO) and Repository patterns? I am developing an application using Enterprise Java Beans (EJB3), Hibernate ORM as infrastructure, and Domain-Driven ..

8

answers

Can scrapy be used to scrape dynamic content from websites that are using AJAX?

I have recently been learning Python and am dipping my hand into building a web-scraper. It's nothing fancy at all; its only purpose is to get the data off of a betting website and have this data put..

5

answers

Java - How do I make a String array with values?

I know how to make an empty array, but how do I make a String array with values from the start?..

5

answers

What is the difference between "screen" and "only screen" in media queries?

What is the difference between screen and only screen in media queries? <link media="screen and (max-device-width: 480px)" rel="stylesheet" href="m.css" /> <link media="only screen and (max-..

4

answers

How to handle an IF STATEMENT in a Mustache template?

I'm using mustache. I'm generating a list of notifications. A notification JSON object looks like: [{"id":1364,"read":true,"author_id":30,"author_name":"Mr A","author_photo":"image.jpg","story":"want..

9

answers

Why does "pip install" inside Python raise a SyntaxError?

I'm trying to use pip to install a package. I try to run pip install from the Python shell, but I get a SyntaxError. Why do I get this error? How do I use pip to install the package? >>> ..

10

answers

Why are elementwise additions much faster in separate loops than in a combined loop?

Suppose a1, b1, c1, and d1 point to heap memory, and my numerical code has the following core loop. const int n = 100000; for (int j = 0; j < n; j++) { a1[j] += b1[j]; c1[j] += d1[j]; } T..

4

answers

matrix multiplication algorithm time complexity

I came up with this algorithm for matrix multiplication. I read somewhere that matrix multiplication has a time complexity of o(n^2). But I think my this algorithm will give o(n^3). I don't know how..

25

answers

Find the most popular element in int[] array

int[] a = new int[10]{1,2,3,4,5,6,7,7,7,7}; how can I write a method and return 7? I want to keep it native without the help of lists, maps or other helpers. Only arrays[]...

13

answers

Limit number of characters allowed in form input text field

How do I limit or restrict the user to only enter a maximum of five characters in the textbox? Below is the input field as part of my form: <input type="text" id="sessionNo" name="sessionNum" /&g..

2

answers

How to write data with FileOutputStream without losing old data?

If you work with FileOutputStream methods, each time you write your file through this methods you've been lost your old data. Is it possible to write file without losing your old data via FileOutputSt..

6

answers

Select records from NOW() -1 Day

Is there a way in a MySQL statement to order records (through a date stamp) by >= NOW() -1 so all records from the day before today to the future are selected?..

9

answers

CSS vertical alignment text inside li

I am displaying number of boxes in a row with fix height and width, generated from <li> tags. now I need to align the text in the vertical center. The CSS vertical-align has no impact, maybe I..

9

answers

How to use the TextWatcher class in Android?

Can anyone tell me how to mask the substring in EditText or how to change EditText substring input to password type or replace by another character like this 123xxxxxxxxx3455 String contents = et1.g..

7

answers

Why use 'virtual' for class properties in Entity Framework model definitions?

In the following blog: http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx The blog contains the following code sample: public class Dinner { pub..

14

answers

Store JSON object in data attribute in HTML jQuery

I am storing data using the data- approach in a HTML tag like so: <td><"button class='delete' data-imagename='"+results[i].name+"'>Delete"</button></td> I am then retrieving..

9

answers

C++11 reverse range-based for-loop

Is there a container adapter that would reverse the direction of iterators so I can iterate over a container in reverse with range-based for-loop? With explicit iterators I would convert this: for (..

2

answers

Object does not support item assignment error

In my views.py I assign values before saving the form. I used to do it the following way: projectForm.lat = session_results['lat'] projectForm.lng = session_results['lng'] Now, since the list of va..

5

answers

Codeigniter $this->db->get(), how do I return values for a specific row?

Say I have a database table with three columns: ID, Name, and Age. I need to find the user with a specific (unique) ID, and then return the age. Currently, I am using the following code $this->db-..

14

answers

Apache redirect to another port

I've struggled with this for some time and am definitely doing something wrong. I have apache server and a JBoss server on the same machine. I'd like to redirect traffic for mydomain.com to JBoss ..

14

answers

CSS: Set a background color which is 50% of the width of the window

Trying to achieve a background on a page that is "split in two"; two colors on opposite sides (seemingly done by setting a default background-color on the body tag, then applying another onto a div th..

6

answers

How to start and stop/pause setInterval?

I'm trying to pause and then play a setInterval loop. After I have stopped the loop, the "start" button in my attempt doesn't seem to work : _x000D_ _x000D_ input = document.getElementById("input");..

6

answers

Does MySQL foreign_key_checks affect the entire database?

When I execute this command in MySQL: SET FOREIGN_KEY_CHECKS=0; Does it affect the whole engine or it is only my current transaction?..

6

answers

What's the idiomatic syntax for prepending to a short python list?

list.append() is the obvious choice for adding to the end of a list. Here's a reasonable explanation for the missing list.prepend(). Assuming my list is short and performance concerns are negligible..

8

answers

'Access denied for user 'root'@'localhost' (using password: NO)'

I'm trying to set the password of the user root but I'm gettin the error below, any idea? +------------------------------------------------------------------------------------------------------------..

3

answers

How to force a view refresh without having it trigger automatically from an observable?

Note: this is mostly for debugging and understanding KnockoutJS. Is there a way to explicitly request Knockout to refresh the view from (already bound) view model? I am looking for something like: ..

8

answers

How to list all methods for an object in Ruby?

How do I list all the methods that a particular object has access to? I have a @current_user object, defined in the application controller: def current_user @current_user ||= User.find(session[:us..

15

answers

Jersey Exception : SEVERE: A message body reader for Java class

I have a Jersey based Rest WS which outputs JSON. I am implementing a Jersey Client to invoke the WS and consume the JSON response. The client code I have is below WebResource r = restClient.resourc..

6

answers

Convert `List<string>` to comma-separated string

Is there a fast way to convert List<string> to a comma-separated string in C#? I do it like this but Maybe there is a faster or more efficient way? List<string> ls = new List<string&g..

5

answers

VBA Count cells in column containing specified value

I need to write a macro that searches a specified column and counts all the cells that contain a specified string, such as "19/12/11" or "Green" then associate this number with a variable, Does anyon..

3

answers

Combine Points with lines with ggplot2

I would like to plot a time series that look like this: what I plot with: qplot(Jahr, Wert, data=tu, group = Geschlecht, color = Altersgr) + facet_grid(Geschlecht ~ Land) My data looks like this..

6

answers

RegEx: How can I match all numbers greater than 49?

I'm somewhat new to regular expressions and am writing validation for a quantity field where regular expressions need to be used. How can I match all numbers greater than or equal to 50? I tried [..

4

answers

How to create a oracle sql script spool file

I have a question about spooling the the results of my program. My sample sql script looks like this. whenever sqlerror exit failure rollback set heading off set arraysize 1 set newpage 0 s..

7

answers

Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Holo.Widget.ActionBar.Title'

I am implementing ActionBar to set the color for text using this style script in xml but getting error when I run my application time does anybody have idea what I have missing this is my style.xml f..

2

answers

How to check for file existence

Is there a Ruby class/method where I could pass "a full path", home/me/a_file.txt, to identify whether it is a valid file path?..

5

answers

Parsing Query String in node.js

In this "Hello World" example: // Load the http module to create an http server. var http = require('http'); // Configure our HTTP server to respond with Hello World to all requests. var server = ht..

6

answers

Difference between F5, Ctrl + F5 and click on refresh button?

I have often experienced while developing my web applications that pressing F5 or refresh doesn't produce or refresh the proper result. But when we hit Ctrl + F5 it generates the correct result. What ..

27

answers

How to determine MIME type of file in android?

Suppose I have a full path of file like:(/sdcard/tlogo.png). I want to know its mime type. I created a function for it public static String getMimeType(File file, Context context) { Uri ur..

18

answers

How do I avoid the specification of the username and password at every git push?

I git push my work to a remote Git repository. Every push will prompt me to input username and password. I would like to avoid it for every push, but how to configure to avoid it?..

6

answers

Android Fastboot devices not returning device

At the moment I would like to reinstall Android on my device(custom hardware device). I got the image files after building. But when I enter fastboot devices nothing returns. adb devices is working...

19

answers

How to define an enum with string value?

I am trying to define an Enum and add valid common separators which used in CSV or similar files. Then I am going to bind it to a ComboBox as a data source so whenever I add or remove from the Enum de..

2

answers

What is the difference between SOAP 1.1, SOAP 1.2, HTTP GET & HTTP POST methods for Android?

I am working on a code for SOAP Web services, I would like to know the variations in SOAP 1.1, SOAP 1.2, HTTP GET & HTTP POST methods for Android, and which is the preferred one among them. Please..

4

answers

How to roundup a number to the closest ten?

Probably the title is not very suggestive. Let me explain you with an example. I have: 12345.6 2345.1 12345.00000001 I want those numbers to be roundup to 12350. How can I do this? If possible,..

5

answers

Going to a specific line number using Less in Unix

I have a file that has around million lines. I need to go to line number 320123 to check the data. How do I do that?..

4

answers

Python regex for integer?

I'm learning regex and I would like to use a regular expression in Python to define only integers - whole numbers but not decimals. I could make one that only allows numbers by using \d, but it also ..

6

answers

How to remove all elements in String array in java?

I would like to remove all the elements in the String array for instance: String example[]={"Apple","Orange","Mango","Grape","Cherry"}; Is there any simple to do it,any snippet on it will be helpf..

3

answers

Split comma separated column data into additional columns

I have comma separated data in a column: Column ------- a,b,c,d I want to split the comma separated data into multiple columns to get this output: Column1 Column2 Column3 Column4 ------- ---..

20

answers

Get the closest number out of an array

I have a number from minus 1000 to plus 1000 and I have an array with numbers in it. Like this: [2, 42, 82, 122, 162, 202, 242, 282, 322, 362] I want that the number I've got changes to the nearest..

3

answers

How to check if a line has one of the strings in a list?

Possible Duplicate: Check if multiple strings exist in another string I am trying to find out if there is a nice and clean way to test for 3 different strings. Basically I am looping troug..

9

answers

Key Shortcut for Eclipse Imports

It's been a while since I last used Eclipse. I used to love this handy key shortcut that added all the imports to the top of the source file, but I've forgotten it. Does anyone know what this shortc..

15

answers

Padding is invalid and cannot be removed?

I have looked online for what this exception means in relation to my program but can't seem to find a solution or the reason why it's happening to my specific program. I have been using the example..

9

answers

Why do Python's math.ceil() and math.floor() operations return floats instead of integers?

Can someone explain this (straight from the docs- emphasis mine): math.ceil(x) Return the ceiling of x as a float, the smallest integer value greater than or equal to x. math.floor(x) Return ..

4

answers

Converting a vector<int> to string

In C++, what is the simplest way to convert a vector of ints (i.e. vector<int>) to a string ?..

9

answers

How can I give the Intellij compiler more heap space?

When I make an Intellij project, I keep getting the following out of memory error. I already increased my heap size in idea.vmoptions: -Xms128m -Xmx2048m -XX:MaxPermSize=1024m -XX:ReservedCodeCache..

11

answers

How to access a mobile's camera from a web app?

In my web app (not native app) for mobiles, I want to take a photo and upload it, but I don't want to use Adobe Flash. Is there any way to do this?..

5

answers

Enable vertical scrolling on textarea

I have a textarea that I want to enable vertical scrolling. When I exceed the height of the textarea, it increases in size. The scroll bar does not appear. I want that a vertical scroll bar appears an..

6

answers

How to run php files on my computer

Could anyone please tell me how to run a php file locally on my system. Currently I am using a server to run files. I know both php & Apache to be installed. I need to see out put of this program,..

7

answers

How to convert milliseconds into a readable date?

The following: new Date(1324339200000).toUTCString() Outputs: "Tue, 20 Dec 2011 00:00:00 GMT" I need it to return Dec 20. Is there a better method I can use besides toUTCString()? I am looking f..

6

answers

How do I declare an array with a custom class?

I'm trying to declare an array with a custom class. When I added a constructor to the class, my compiler complains that there's "No matching constructor for initialization of name[3]". Here's my pro..

15

answers

What's the difference between Thread start() and Runnable run()

Say we have these two Runnables: class R1 implements Runnable { public void run() { … } … } class R2 implements Runnable { public void run() { … } … } Then what's the diffe..

14

answers

How to scroll up or down the page to an anchor using jQuery?

I'm looking for a way to include a slide effect for when you click a link to a local anchor either up or down the page. I'd like something where you have a link like so: <a href="#nameofdivetc"&g..

16

answers

How do I move files in node.js?

How can I move files (like mv command shell) on node.js? Is there any method for that or should I read a file, write to a new file and remove older file?..

7

answers

Select parent element of known element in Selenium

I have a certain element that I can select with Selenium 1. Unfortunately I need to click the parent element to get the desired behaviour. The element I can easily locate has attribute unselectable, ..

6

answers

javax.el.PropertyNotFoundException: Property 'foo' not found on type com.example.Bean

I have results from Query query = session.createQuery("From Pool as p left join fetch p.poolQuestion as s"); query and I would like to display it on JSP. I have loop: <c:forEach items="${pools..

13

answers

Programmatically trigger "select file" dialog box

I have a hidden file input element. Is it possible to trigger its select file dialog box from a button's click event?..

10

answers

How to use php serialize() and unserialize()

My problem is very basic. I did not find any example to meet my needs as to what exactly serialize() and unserialize() mean in php? They just give an example - serialize an array and show an output i..

19

answers

How to set UITextField height?

I am using a UITextField. I want to increase its height but I have not found any property to do this. How can I achieve this?..

12

answers

How do I center list items inside a UL element?

How do I center list items inside a ul without using extra divs or elements. I have the following. I thought text-align:center would do the trick. I can't seem to figure it out. <style> ul { ..