Some Of The Best Answers From Latest Asked Questions

8

answers

Are HTTP headers case-sensitive?

In a blog post I use the following PHP to set the content-type of a response: header('content-type: application/json; charset=utf-8'); I just got a comment on that post saying that content-type nee..

10

answers

How to include the reference of DocumentFormat.OpenXml.dll on Mono2.10?

I am using C#.net Windows Desktop Application.I want to run these application with other platform also. So, i am using Mono 2.10 as a cross compiler.While running,unexpectedly my Application is termin..

5

answers

How to make an executable JAR file?

I have a program which consists of two simple Java Swing files. How do I make an executable JAR file for my program?..

4

answers

How to install mod_ssl for Apache httpd?

Ok So I installed Apache httpd a while ago and have recently come back to it to try setup SSL and get it serving several different tomcat servers. At the moment I have two completely separate Tomcat..

13

answers

how to use DEXtoJar

I find the solution to decompile a file dex to jar from this link http://code.google.com/p/dex2jar/downloads/list but i don't understand how to use it...

7

answers

Convert xlsx file to csv using batch

How do you convert multiple xlsx files to csv files with a batch script?..

12

answers

What are file descriptors, explained in simple terms?

What would be a more simplified description of file descriptors compared to Wikipedia's? Why are they required? Say, take shell processes as an example and how does it apply for it? Does a process ta..

8

answers

A Space between Inline-Block List Items

Possible Duplicate: Unwanted margin in inline-block list items How to remove “Invisible space” from HTML Why do the inline-block list items have a space in them? No matter how I make ..

9

answers

What is the benefit of zerofill in MySQL?

I just want to know what is the benefit/usage of defining ZEROFILL for INT DataType in MySQL? `id` INT UNSIGNED ZEROFILL NOT NULL ..

3

answers

C/C++ macro string concatenation

#define STR1 "s" #define STR2 "1" #define STR3 STR1 ## STR2 Is it possible to concatenate STR1 and STR2, to "s1"? You can do this by passing args to anoth..

10

answers

How to clear Facebook Sharer cache?

We used the link: http://www.facebook.com/sharer.php?u=[shared URL] ...to share a particular page. However, Facebook Sharer uses the cached version of the images and the title. Is there a way to q..

5

answers

Android and setting width and height programmatically in dp units

I'm doing: button.setLayoutParams(new GridView.LayoutParams(65, 65)); According to the docs the units for the width and height (both 65 in the above) are "pixels". How do you force this to be device..

6

answers

Difference between map and collect in Ruby?

I have Googled this and got patchy / contradictory opinions - is there actually any difference between doing a map and doing a collect on an array in Ruby/Rails? The docs don't seem to suggest any, ..

8

answers

Add string in a certain position in Python

Is there any function in Python that I can use to insert a value in a certain position of a string? Something like this: "3655879ACB6" then in position 4 add "-" to become "3655-879ACB6"..

4

answers

PHP: Update multiple MySQL fields in single query

I am basically just trying to update multiple values in my table. What would be the best way to go about this? Here is the current code: $postsPerPage = $_POST['postsPerPage']; $style = $_POST['style..

6

answers

multi line comment vb.net in Visual studio 2010

Possible Duplicate: commenting VB code Lack of block comments in VB .NET? How to? Is there a way to comment out more than one line of code in vb.net using VS 2010?..

2

answers

Very Long If Statement in Python

I have a very long if statement in Python. What is the best way to break it up into several lines? By best I mean most readable/common. ..

5

answers

INSERT INTO...SELECT for all MySQL columns

I'm trying to move old data from: this_table >> this_table_archive copying all columns over. I've tried this, but it doesn't work: INSERT INTO this_table_archive (*) VALUES (SELECT * FROM t..

10

answers

Assign format of DateTime with data annotations?

I have this attribute in my view model: [DataType(DataType.DateTime)] public DateTime? StartDate { get; set; } If I want to display the date, or populate a textbox with the date, I have these: <..

8

answers

Getting a count of rows in a datatable that meet certain criteria

I have a datatable, dtFoo, and would like to get a count of the rows that meet a certain criteria. EDIT: This data is not stored in a database, so using SQL is not an option. In the past, I've used ..

4

answers

VBA Excel 2-Dimensional Arrays

I was trying to find out how to declare a 2-Dimensional array but all of the examples I have found so far are declared with set integers. I'm trying to create a program that will utilize two 2-Dimens..

15

answers

Redis command to get all available keys?

Is there a Redis command for fetching all keys in the database? I have seen some python-redis libraries fetching them. But was wondering if it is possible from redis-client...

8

answers

Spring MVC: how to create a default controller for index page?

I'm trying to do one of those standard spring mvc hello world applications but with the twist that I'd like to map the controller to the root. (for example: http://numberformat.wordpress.com/2009/09/0..

6

answers

How to succinctly write a formula with many variables from a data frame?

Suppose I have a response variable and a data containing three covariates (as a toy example): y = c(1,4,6) d = data.frame(x1 = c(4,-1,3), x2 = c(3,9,8), x3 = c(4,-4,-2)) I want to fit a linear regr..

14

answers

Where can I find the Java SDK in Linux after installing it?

I installed JDK using apt-get install but I don't know where my jdk folder is. I need to set the path for that. Does any one have a clue on the location?..

10

answers

What are the advantages and disadvantages of recursion?

With respect to using recursion over non-recursive methods in sorting algorithms or, for that matter, any algorithm what are its pros and cons?..

10

answers

How exactly does <script defer="defer"> work?

I have a few <script> elements, and the code in some of them depend on code in other <script> elements. I saw the defer attribute can come in handy here as it allows code blocks to be post..

6

answers

How to remove gem from Ruby on Rails application?

I have installed a gem on my Rails application (devise). After I installed the gem, I realized that I don't need it. I want to remove the gem, its dependencies and the files it created on my applicat..

22

answers

jQuery date formatting

How can I format the date using jQuery. I am using below code but getting error: $("#txtDate").val($.format.date(new Date(), 'dd M yy')); Please suggest a solution...

5

answers

How to use regex in file find

I was trying to find all files dated and all files 3 days or more ago. find /home/test -name 'test.log.\d{4}-d{2}-d{2}.zip' -mtime 3 It is not listing anything. What is wrong with it?..

5

answers

convert strtotime to date time format in php

i need to convert strtotime to date btime format (from 1307595105 to 06/08/2011 09:51:45 PM PDT) in php Could you please give me an answer..

7

answers

How to get MD5 sum of a string using python?

In the Flickr API docs, you need to find the MD5 sum of a string to generate the [api_sig] value. How does one go about generating an MD5 sum from a string? Flickr's example: string: 000005fab4534..

10

answers

How to hide a div from code (c#)

I have a div element on my page that I wish to show/hide based on a session value in my code-behind. How can I do this?..

10

answers

pdftk compression option

I use pdftk to compress a pdf using the following command line pdftk file1.pdf output file2.pdf compress It works as the weight of my file decreased. Are there [options] to change the compression..

4

answers

Is there an easy way to convert Android Application to IPad, IPhone

I have a nice application running in the Android Market. Several people have asked me to deliver an IPad/Phone version. What am I getting into here if I try to do this? Are there any reputable comp..

8

answers

Fastest way to check a string contain another substring in JavaScript?

I'm working with a performance issue on JavaScript. So I just want to ask: what is the fastest way to check whether a string contains another substring (I just need the boolean value)? Could you pleas..

8

answers

How to copy a huge table data into another table in SQL Server

I have a table with 3.4 million rows. I want to copy this whole data into another table. I am performing this task using the below query: select * into new_items from productDB.dbo.items I need ..

8

answers

How to scale down a range of numbers with a known min and max value

So I am trying to figure out how to take a range of numbers and scale the values down to fit a range. The reason for wanting to do this is that I am trying to draw ellipses in a java swing jpanel. I..

8

answers

Refresh a page using JavaScript or HTML

How can I refresh a page using JavaScript or HTML?..

3

answers

How to specify a port number in SQL Server connection string?

I use the following connection string in SQL Server Management Studio. It failed to connect: mycomputer.test.xxx.com:1234\myInstance1 But the following one is ok: mycomputer.test.xxx.com\myInstance..

6

answers

Writing image to local server

Update The accepted answer was good for last year but today I would use the package everyone else uses: https://github.com/mikeal/request Original I'm trying to grab google's logo and save it to ..

4

answers

How to use Greek symbols in ggplot2?

My categories need to be named with Greek letters. I am using ggplot2, and it works beautifully with the data. Unfortunately I cannot figure out how to put those greek symbols on the x axis (at the ..

4

answers

How do you represent a JSON array of strings?

This is all you need for valid JSON, right? ["somestring1", "somestring2"] ..

5

answers

CSS Pseudo-classes with inline styles

Is it possible to have pseudo-classes using inline styles? Example: <a href="http://www.google.com" style="hover:text-decoration:none;">Google</a> I know the above HTML won't work bu..

11

answers

Select records from today, this week, this month php mysql

I imagine this is pretty simple, but can't figure it out. I'm trying to make a few pages - one which will contain results selected from my mysql db's table for today, this week, and this month. The da..

7

answers

jQuery - how to check if an element exists?

I know that you can test for width() or height() but what if the element's display property is set to none? What other value is there to check to make sure the element exists?..

6

answers

Undefined Reference to

When I compile my code for a linked list, I get a bunch of undefined reference errors. The code is below. I have been compiling with both of these statements: g++ test.cpp as well as g++ Linea..

28

answers

PHP function to get the subdomain of a URL

Is there a function in PHP to get the name of the subdomain? In the following example I would like to get the "en" part of the URL: en.example.com ..

11

answers

Convert integer value to matching Java Enum

I've an enum like this: public enum PcapLinkType { DLT_NULL(0) DLT_EN10MB(1) DLT_EN3MB(2), DLT_AX25(3), /*snip, 200 more enums, not always consecutive.*/ DLT_UNKNOWN(-1); private fina..

12

answers

How to pass parameters to a Script tag?

I read the tutorial DIY widgets - How to embed your site on another site for XSS Widgets by Dr. Nic. I'm looking for a way to pass parameters to the script tag. For example, to make the following w..

5

answers

Is this very likely to create a memory leak in Tomcat?

I configured tomcat to work with a different external open source. However, after the tomcat is running for a few minutes I get: SEVERE: The web application [/MyProject] created a ThreadLocal wit..

8

answers

Is an anchor tag without the href attribute safe?

Is it okay to use an anchor tag without including the href attribute, and instead using a JavaScript click event handler? So I would omit the href completely, not even have it empty (href="")...

4

answers

How does tuple comparison work in Python?

I have been reading the Core Python programming book, and the author shows an example like: (4, 5) < (3, 5) # Equals false So, I'm wondering, how/why does it equal false? How does python compar..

7

answers

What is the main purpose of setTag() getTag() methods of View?

What is the main purpose of such methods as setTag() and getTag() of View type objects? Am I right in thinking that I can associate any number of objects with a single View?..

8

answers

Is there a Mutex in Java?

Is there a Mutex object in java or a way to create one? I am asking because a Semaphore object initialized with 1 permit does not help me. Think of this case: try { semaphore.acquire(); //do st..

3

answers

Remove and Replace Printed items

I was wondering if it was possible to remove items you have printed in Python - not from the Python GUI, but from the command prompt. e.g. a = 0 for x in range (0,3): a = a + 1 b = ("Lo..

12

answers

disable all form elements inside div

is there a way to disable all fields (textarea/textfield/option/input/checkbox/submit etc) in a form by telling only the parent div name in jquery/javascript?..

21

answers

How can I "reset" an Arduino board?

I've uploaded a sketch to an Arduino Uno whose loop is something like this: void loop(){ Serial.println("Hello, World!"); } So, now, I can't upload anything anymore, because the IDE says "port ..

8

answers

Getting Lat/Lng from Google marker

I made a Google Maps map with a draggable marker. When the user drags the marker, I need to know the new latitude and longitude, but I don't understand what is the best approach to doing that. How ca..

12

answers

How many bytes does one Unicode character take?

I am a bit confused about encodings. As far as I know old ASCII characters took one byte per character. How many bytes does a Unicode character require? I assume that one Unicode character can conta..

5

answers

How to convert a number to string and vice versa in C++

Since this question gets asked about every week, this FAQ might help a lot of users. How to convert an integer to a string in C++ how to convert a string into an integer in C++ how to convert a floa..

3

answers

SQlite - Android - Foreign key syntax

I've been trying to get foreign keys working within my Android SQLite database. I have tried the following syntax but it gives me a force close: private static final String TASK_TABLE_CREATE = "creat..

15

answers

Convert javascript array to string

I'm trying to iterate over a "value" list and convert it into a string. Here is the code: var blkstr = $.each(value, function(idx2,val2) { var str = idx2 + ":" + val2; ..

4

answers

JQuery: Change value of hidden input field

I'm having a hella time setting the value of a hidden input. I want to pass the HTML from between the option tags to the hidden field- end run it will the page title from wordpress' wp_list_dropdow..

5

answers

Casting variables in Java

I wonder if anyone could tell me how casting works? I understand when I should do it, but not really how it works. On primitive data types I understand partially but when it comes to casting objects I..

11

answers

Parse JSON from JQuery.ajax success data

I am having trouble getting the contents of JSON object from a JQery.ajax call. My call: $('#Search').click(function () { var query = $('#query').valueOf(); $.ajax({ url: '/Products/S..

4

answers

How to expand/collapse a diff sections in Vimdiff?

I've started using vimdiff today, and wanted to do some of the things that I've taken for granted on Windows based diff editors (like expand/collapse a diff section, have full file expansion/only diff..

11

answers

How to search JSON tree with jQuery

I have a question about searching the JSON for the specific information. For example, I have this JSON file: { "people": { "person": [ { "name": "Peter", ..

10

answers

How to monitor SQL Server table changes by using c#?

I have more than one application accessing the same DB and I need to get notified if one of these apps change anything (update, insert) in a certain table. Database and apps are not in the same serve..

5

answers

Put text at bottom of div

I have 4 DIV's right next to each other, and they're all centered in the middle of the screen. I have 2 words in each div, but I don't want them at the top, I want them to appear in the bottom right h..

8

answers

SQL Server insert if not exists best practice

I have a Competitions results table which holds team member's names and their ranking on one hand. On the other hand I need to maintain a table of unique competitors names: CREATE TABLE Competitors ..

5

answers

git replace local version with remote version

How can I tell git to ignore my local file and take the one from my remote branch without trying to merge and causing conflicts?..

5

answers

jquery find class and get the value

I am trying to get the value of an input text field. the HTML is: <div id="start"> <p> <input type="text" class="myClass" value="my value" name="mytext"/> </p>..

28

answers

How to get the user input in Java?

I attempted to create a calculator, but I can not get it to work because I don't know how to get user input. How can I get the user input in Java?..

5

answers

how to insert datetime into the SQL Database table?

How can I insert datetime into the SQL Database table ? Is there a way to insert this query through the insert command in C# / .NET?..

7

answers

Is it possible to decompile a compiled .pyc file into a .py file?

Is it possible to get some information out of the .pyc file that is generated from a .py file?..

7

answers

Is there a way to only install the mysql client (Linux)?

Are there are any Linux mysql command line tools that don't require the entire mysql db installation package to be installed? What I'm trying to do is from server #1 (app server), execute mysql com..

9

answers

How can I build for release/distribution on the Xcode 4?

Build for debug is just press on the PLAY symbol, but I don't know how to Build for distribution/release? ..

7

answers

How do I select a MySQL database through CLI?

I've managed to get into MySQL using the command line terminal, but when I tried to enter some SQL, it said 'no database selected' how do I select a database? my database name is: photogallery What..

4

answers

Wrapping text inside input type="text" element HTML/CSS

The HTML shown below, <input type="text"/> is displayed in a browser like so: When I add the following text, The quick brown fox jumped over the lazy dog. Using the HTML below, <..

5

answers

How to print variable addresses in C?

When i run this code. #include <stdio.h> void moo(int a, int *b); int main() { int x; int *y; x = 1; y = &x; printf("Address of x = %d, value of x = %d\n", &x, ..

4

answers

setting textColor in TextView in layout/main.xml main layout file not referencing colors.xml file. (It wants a #RRGGBB instead of @color/text_color)

I'm trying to set some general colors for a program I'm writing. I created a colors.xml file and am trying to directly reference the colors from the layout.xml file. I believe I'm am doing this correc..

18

answers

incompatible character encodings: ASCII-8BIT and UTF-8

I use Ruby 1.9.2 and Rails 3.0.5 I have the following error: incompatible character encodings: ASCII-8BIT and UTF-8 It has nothing to do with the database i think. The error is happinging on t..

5

answers

Correct way to delete cookies server-side

For my authentication process I create a unique token when a user logs in and put that into a cookie which is used for authentication. So I would send something like this from the server: Set-Cookie..

9

answers

How do I install Eclipse Marketplace in Eclipse Classic?

I'm running Eclipse 3.6.1 Classic, which does not come with the Eclipse Marketplace plugin by default. I've looked around the Eclipse website, but I don't see an available plugin for installing Eclips..

9

answers

MySQL SELECT only not null values

Is it possible to do a select statement that takes only NOT NULL values? Right now I am using this: SELECT * FROM table And then I have to filter out the null values with a php loop. Is there a w..

3

answers

MySQL Check if username and password matches in Database

I have a form which has a textbox with the name attribute username and another one with the name attribute password. I also have a database with columns called user and pass. When my users signed up i..

6

answers

Back to previous page with header( "Location: " ); in PHP

The title of this question kind of explains my question. How do I redirect the PHP page visitor back to their previous page with the header( "Location: URL of previous page" );..

11

answers

Implement division with bit-wise operator

How can I implement division using bit-wise operators (not just division by powers of 2)? Describe it in detail...

12

answers

How do I correctly detect orientation change using Phonegap on iOS?

I found this orientation test code below looking for JQTouch reference material. This works correctly in the iOS simulator on mobile Safari but doesn’t get handled correctly in Phonegap. My project ..

8

answers

jQuery Scroll to Div

I am making an FAQ page and have buttons across the top to jump to a category (it jumps to the p tag that I use as the category label, ex. <p id="general"> for my general category). Instead of j..

8

answers

What is Node.js' Connect, Express and "middleware"?

Despite knowing JavaScript quite well, I'm confused what exactly these three projects in Node.js ecosystem do. Is it something like Rails' Rack? Can someone please explain?..

37

answers

Validating IPv4 addresses with regexp

I've been trying to get an efficient regex for IPv4 validation, but without much luck. It seemed at one point I had had it with (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?(\.|$)){4}, but it produces some st..

5

answers

Plot smooth line with PyPlot

I've got the following simple script that plots a graph: import matplotlib.pyplot as plt import numpy as np T = np.array([6, 7, 8, 9, 10, 11, 12]) power = np.array([1.53E+03, 5.92E+02, 2.04E+02, 7.2..

13

answers

Convert array of strings into a string in Java

I want the Java code for converting an array of strings into an string...

24

answers

Intersection and union of ArrayLists in Java

Are there any methods to do so? I was looking but couldn't find any. Another question: I need these methods so I can filter files. Some are AND filters and some are OR filters (like in set theory), ..

19

answers

Reading CSV file and storing values into an array

I am trying to read a *.csv-file. The *.csv-file consist of two columns separated by semicolon (";"). I am able to read the *.csv-file using StreamReader and able to separate each line by using the..

7

answers

How can I bring my application window to the front?

How to bring my application window to front? For example whan my app needs attention. This is for my personal program. I need that functionality. This is what I got. But it's NOT working 100% times...

20

answers

PHP Warning: PHP Startup: Unable to load dynamic library

I run a PHP script and get this error: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin' - /usr/local/lib/php/extensi..

10

answers

How to include JavaScript file or library in Chrome console?

Is there a simpler (native perhaps?) way to include an external script file in the Google Chrome browser? Currently I’m doing it like this: document.head.innerHTML += '<script src="http://examp..