Some Of The Best Answers From Latest Asked Questions

3

answers

How to Auto resize HTML table cell to fit the text size

I have a table with 2 rows and variable columns. I tried width = 100% for the column. So the first content in the view will fit. But suppose if i am changing the contents dynamically then it is not dy..

2

answers

Could not connect to SMTP host: localhost, port: 25; nested exception is: java.net.ConnectException: Connection refused: connect

I'm doing application for send email from localhost in jsp & i found error like Could not connect to SMTP host: localhost, port: 25; nested exception is: java.net.ConnectException: Connection refu..

3

answers

Fatal error: Call to undefined function mysql_connect() in C:\Apache\htdocs\test.php on line 2

Fatal error: Call to undefined function mysql_connect() in C:\Apache\htdocs\test.php on line 2 I've spent 11 hours today trying to get past this ONE problem. I have installed: MySQL 5.1 Apache 2.2.1..

10

answers

"A lambda expression with a statement body cannot be converted to an expression tree"

In using the EntityFramework, I get the error "A lambda expression with a statement body cannot be converted to an expression tree" when trying to compile the following code: Obj[] myArray = objects...

15

answers

How to change the Eclipse default workspace?

Where can I change the default workspace in Eclipse?..

8

answers

MySQL Insert into multiple tables? (Database normalization?)

I tried searching a way to insert information in multiple tables in the same query, but found out it's impossible? So I want to insert it by simply using multiple queries i.e; INSERT INTO users (user..

28

answers

libxml install error using pip

This is my error: (mysite)[email protected]:~/zjm_test/mysite$ pip install lxml Downloading/unpacking lxml Running setup.py egg_info for package lxml Building lxml version 2.3. Build..

10

answers

How to rename a class and its corresponding file in Eclipse?

Cannot find any menu item to do this. Is it doable?..

6

answers

Folder structure for a Node.js project

I notice that Node.js projects often include folders like these: /libs, /vendor, /support, /spec, /tests What exactly do these mean? What's the different between them, and where should I include..

23

answers

pip install mysql-python fails with EnvironmentError: mysql_config not found

This is the error I get (mysite)[email protected]:~/zjm_test/mysite$ pip install mysql-python Downloading/unpacking mysql-python Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded..

9

answers

How to place object files in separate subdirectory

I'm having trouble with trying to use make to place object files in a separate subdirectory, probably a very basic technique. I have tried to use the information in this page: http://www.gnu.org/softw..

3

answers

"Error 404 Not Found" in Magento Admin Login Page

I just transfered my magento installation from one local machine server to another. Now, I cannot login to admin panel. When I go to the admin login url, I get the following error message:- "Error: 4..

11

answers

List of installed gems?

Is there a Ruby method I can call to get the list of installed gems? I want to parse the output of gem list. Is there a different way to do this?..

4

answers

Select the values of one property on all objects of an array in PowerShell

Let's say we have an array of objects $objects. Let's say these objects have a "Name" property. This is what I want to do $results = @() $objects | %{ $results += $_.Name } This works, but can ..

9

answers

jQuery $("#radioButton").change(...) not firing during de-selection

About a month ago Mitt’s question went unanswered. Sadly, I’m running into the same situation now. http://api.jquery.com/change/#comment-133939395 Here’s the situation: I’m using jQuery to c..

11

answers

Uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)

When I want to create a Ruby on Rails project, I get the message below. /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::De..

6

answers

Drawable image on a canvas

How can I get an image to the canvas in order to draw on that image?..

8

answers

XCOPY switch to create specified directory if it doesn't exist?

I am using XCOPY in a post-build event to copy compiled DLLs from their output folders to the main app's output folder. The DLLs are being copied to a "Modules" subfolder in the main app output folder..

28

answers

How to get the current date/time in Java

What's the best way to get the current date/time in Java?..

4

answers

Showing all session data at once?

I have tried the following but it is giving me errors: print_r($this->session->userdata()); How can I show all session data in CodeIgniter?..

3

answers

Trying to get property of non-object - CodeIgniter

I'm trying to make update form, that is going to retrieve the data for the specific ID selected, and fill in the form, so its going to be available for updating. When I click edit on the specific ent..

6

answers

Rails: Why "sudo" command is not recognized?

In my application directory (on Windows) I run: sudo pdfkit --install-wkhtmltopdf as explained here, but I got this error: 'sudo' is not recognized as an internal or external command, op..

7

answers

php - add + 7 days to date format mm dd, YYYY

I have date of this format March 3, 2011 in database and I need to extend it with 7 days. I mean $date = $date + 7. Is there any build in function to do that ?..

5

answers

JavaScript push to array

How do I push new values to the following array? json = {"cool":"34.33","alsocool":"45454"} I tried json.push("coolness":"34.33");, but it didn't work...

7

answers

How to navigate to a section of a page

I have a landing page with links. How can I direct user to a section of a different page? Main Page: <a href="/sample">Sushi</a> <a href="/sample">BBQ</a> Sample Page: <..

3

answers

How to concatenate string and int in C?

I need to form a string, inside each iteration of the loop, which contains the loop index i: for(i=0;i<100;i++) { // Shown in java-like code which I need working in c! String prefix = "pre_";..

13

answers

Find and replace in file and overwrite file doesn't work, it empties the file

I would like to run a find and replace on an HTML file through the command line. My command looks something like this: sed -e s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g index.html > index.html ..

8

answers

R memory management / cannot allocate vector of size n Mb

I am running into issues trying to use large objects in R. For example: > memory.limit(4000) > a = matrix(NA, 1500000, 60) > a = matrix(NA, 2500000, 60) > a = matrix(NA, 3500000, 60) Erro..

6

answers

.c vs .cc vs. .cpp vs .hpp vs .h vs .cxx

Possible Duplicates: *.h or *.hpp for your class definitions Correct C++ code file extension? .cc vs .cpp I used to think that it used to be that: .h files are header files for C and C++, and usua..

1

answers

Changing line colors with ggplot()

I don't use ggplot2 that much, but today I thought I'd give it a go on some graphs. But I can't figure out how to manually control colors in geom_line() I'm sure I'm overlooking something simple, but..

7

answers

Import pfx file into particular certificate store from command line

It's relatively easy to import a certificate into the user's personal store from a pfx file by using CertUtil: certutil –f –p [certificate_password] –importpfx C:\[certificate_path_and_name].pf..

12

answers

jquery animate background position

I can't seem to get this working. $('#product_family_options_dd').animate({ height: '300px', width: '900px', backgroundPosition: '-20px 0px', }, The height and width animate but not..

5

answers

UPDATE with CASE and IN - Oracle

I wrote a query that works like a charm in SQL Server. Unfortunately it needs to be run on an Oracle db. I have been searching the web inside out for a solution on how to convert it, without any succe..

11

answers

Unable to use Intellij with a generated sources folder

Related question How to configure IntelliJ IDEA and/or Maven to automatically add directories with Java source code generated using jaxb2-maven-plugin? I have a custom plugin that generates sources u..

11

answers

Autocompletion in Vim

I'm having trouble with autocompletion. How can I get a code suggestion while I'm typing? I usually develop in PHP, Ruby, HTML, C and CSS...

6

answers

__init__ and arguments in Python

I want to understand arguments of the constructor __init__ in Python. class Num: def __init__(self,num): self.n = num def getn(self): return self.n def getone(): r..

14

answers

JavaScript require() on client side

Is it possible to use require() (or something similar) on client side? Example var myClass = require('./js/myclass.js'); ..

10

answers

Does Java support structs?

Does Java have an analog of a C++ struct: struct Member { string FirstName; string LastName; int BirthYear; }; I need to use my own data type...

3

answers

Splitting a C++ std::string using tokens, e.g. ";"

Possible Duplicate: How to split a string in C++? Best way to split a string in C++? The string can be assumed to be composed of words separated by ; From our guide lines point of view C s..

9

answers

How to view UTF-8 Characters in VIM or Gvim

I work on webpages involving Non-English scripts from time to time, most of them uses utf-8 charset, VIM and Gvim does not display UTF-8 Characters correctly. Using VIM 7.3.46 on windows 7 64 bit, wi..

8

answers

Convert normal Java Array or ArrayList to Json Array in android

Is there any way to convert a normal Java array or ArrayList to a Json Array in Android to pass the JSON object to a webservice? ..

9

answers

Vertical align text in block element

I know vertical alignment is always asked about, but I don't seem to be able to find a solution for this particular example. I'd like the text centered within the element, not the element centered its..

4

answers

Inheritance and init method in Python

I'm begginer of python. I can't understand inheritance and __init__(). class Num: def __init__(self,num): self.n1 = num class Num2(Num): def show(self): print self.n1 mynumb..

5

answers

click or change event on radio using jquery

I have some radios in my page,and I want to do something when the checked radio changes,however the code does not work in IE: $('input:radio').change(...); And after googling,people suggest use the..

5

answers

How to use a table type in a SELECT FROM statement?

This question is more or less the same as this In the package header : Declared the following row type: TYPE exch_row IS RECORD( currency_cd VARCHAR2(9), exch_rt_eur NUMBER, exch_rt_us..

4

answers

How to set time to a date object in java

I created a Date object in Java. When I do so, it shows something like: date=Tue Aug 09 00:00:00 IST 2011. As a result, it appears that my Excel file is lesser by one day (27 feb becomes 26 feb and so..

3

answers

How can I use nohup to run process as a background process in linux?

I use this command to run my work. (time bash executeScript 1 input fileOutput $> scrOutput) &> timeUse.txt While, 1 is a number of process that I use to run this work. I have to change t..

16

answers

Fatal error: Maximum execution time of 30 seconds exceeded

I am downloading a JSON file from an online source and and when it runs through the loop I am getting this error: Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\temp\fet..

5

answers

Python: print a generator expression?

In the Python shell, if I enter a list comprehension such as: >>> [x for x in string.letters if x in [y for y in "BigMan on campus"]] I get a nicely printed result: ['a', 'c', 'g', 'i', '..

12

answers

json_decode to array

I am trying to decode a JSON string into an array but i get the following error. Fatal error: Cannot use object of type stdClass as array in C:\wamp\www\temp\asklaila.php on line 6 Here is..

11

answers

How do I get the last character of a string?

How do I get the last character of a string? public class Main { public static void main(String[] args) { String s = "test string"; //char lastChar = ??? } } ..

7

answers

Disable clipboard prompt in Excel VBA on workbook close

I have an Excel workbook, which using VBA code that opens another workbook, copies some data into the original, then closes the second workbook. When I close the second workbook (using Application.Cl..

4

answers

What are the special dollar sign shell variables?

In Bash, there appear to be several variables which hold special, consistently-meaning values. For instance, ./myprogram &; echo $! will return the PID of the process which backgrounded myprogr..

5

answers

How can I get a list of users from active directory?

How can I get a list of users from active directory? Is there a way to pull username, firstname, lastname? I saw a similar post where this was used: PrincipalContext ctx = new PrincipalContext(Con..

3

answers

git diff between cloned and original remote repository

I have cloned a github repository and made no changes locally. Github repository moved forward with commits on the same branch. How do I find a diff between my local repository and the original gith..

7

answers

'uint32_t' identifier not found error

I'm porting code from Linux C to Visual C++ for windows. Visual C++ doesn't know #include <stdint.h> so I commented it out. Later, I found a lot of those 'uint32_t': identifier not found error..

4

answers

linux execute command remotely

how do I execute command/script on a remote linux box? say I want to do service tomcat start on box b from box a...

30

answers

Android "Only the original thread that created a view hierarchy can touch its views."

I've built a simple music player in Android. The view for each song contains a SeekBar, implemented like this: public class Song extends Activity implements OnClickListener,Runnable { private Se..

3

answers

How do I specify different Layouts in the ASP.NET MVC 3 razor ViewStart file?

I would like to have 2 separate Layouts in my application. Let's say one is for the Public section of the website and the other is for the Member side. For simplicity, let's say all the logic for each..

9

answers

Reordering Chart Data Series

How does one reorder series used to create a chart in Excel? For example, I go to the chart, right click > Select Data. In the left column I see series 1, series 2, to series n. Say, I want to move..

9

answers

How to kill a child process after a given timeout in Bash?

I have a bash script that launches a child process that crashes (actually, hangs) from time to time and with no apparent reason (closed source, so there isn't much I can do about it). As a result, I w..

13

answers

Simple way to change the position of UIView?

I change the position of a UIView with following codes without changing size of the view. CGRect f = aView.frame; f.origin.x = 100; // new x f.origin.y = 200; // new y aView.frame = f; Is there mor..

8

answers

How to re-sign the ipa file?

How do I sign the .ipa file with a provisioning profile after I generate an IPA like the following with a different provision profile? I would like to sign the IPA with an ad-hoc provisioning profile ..

8

answers

How do I add a Fragment to an Activity with a programmatically created content view

I want to add a Fragment to an Activity that implements its layout programmatically. I looked over the Fragment documentation but there aren't many examples describing what I need. Here is the type of..

14

answers

How to check for a JSON response using RSpec?

I have the following code in my controller: format.json { render :json => { :flashcard => @flashcard, :lesson => @lesson, :success => true } In my RSpe..

8

answers

How do I define a method in Razor?

How do I define a method in Razor?..

7

answers

Create a git patch from the uncommitted changes in the current working directory

Say I have uncommitted changes in my working directory. How can I make a patch from those without having to create a commit?..

2

answers

How do I write a method to calculate total cost for all items in an array?

I'm stuck. This is what I have written so far, but I don't know how to set up for a method call to prompt for the total. I need the individual totals for all items in the array to be added to get a to..

5

answers

how to convert a string to date in mysql?

I have a string column which acts as a date and I want to select it as a date. Is it possible? My sample data format would be; month/day/year -> 12/31/2011..

12

answers

Query to count the number of tables I have in MySQL

I am growing the number of tables I have and I am sometimes curious just to do a quick command line query to count the number of tables in my database. Is that possible? If so, what is the query?..

22

answers

Printing prime numbers from 1 through 100

This c++ code prints out the following prime numbers: 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97. But I don't think that's the way my book wants it to be written. It menti..

3

answers

How to Select Min and Max date values in Linq Query

I am moving from SQL to Linq and I need some help. I am testing both Linq-to-SQL and Linq-to-Entities. I want to try both to decide which one suits me best. Your help is appreciated. Thanks What is t..

3

answers

How to set a cron job to run at a exact time?

I have a cron job that runs once a day. But I would like to make it run at midnight or other time exactly...

2

answers

Match line break with regular expression

<li><a href="#">Animal and Plant Health Inspection Service Permits Provides information on the various permits that the Animal and Plant Health Inspection Service issues as well as onl..

3

answers

Convert InputStream to BufferedReader

I'm trying to read a text file line by line using InputStream from the assets directory in Android. I want to convert the InputStream to a BufferedReader to be able to use the readLine(). I have the..

10

answers

How to sort an associative array by its values in Javascript?

I have the associative array: array["sub2"] = 1; array["sub0"] = -1; array["sub1"] = 0; array["sub3"] = 1; array["sub4"] = 0; What is the most elegan..

3

answers

Split varchar into separate columns in Oracle

I'm in a bit of a pickle: I've been asked to take in comments starting with a specific string from a database, and separate the result into separate columns. For example -- if a returned value is th..

29

answers

Android SDK manager won't open

So I installed the android sdk for Windows: http://developer.android.com/sdk/index.html (the installation link) And ran into the path variable problem. So I fixed that by changing "PATH" in envir..

17

answers

Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.`

EDIT: After I modified the web.config and I don't get error that's good.... then I add a new page (html) and write this small code to consume the service like this: $("#btn12").click(function (even..

2

answers

Function to return only alpha-numeric characters from string?

I'm looking for a php function that will take an input string and return a sanitized version of it by stripping away all special characters leaving only alpha-numeric. I need a second function that d..

9

answers

iPhone get SSID without private library

I have a commercial app that has a completely legitimate reason to see the SSID of the network it is connected to: If it is connected to a Adhoc network for a 3rd party hardware device it needs to be..

7

answers

CSS Float: Floating an image to the left of the text

For each post box, I want the thumbnail to float to the left and the text to float to the right. I do not want the thumb to wrap around the text. Here is my html code: <div class="post-container"..

2

answers

How to keep form values after post

I am trying to find what the easiest way to keep form values after post. I am really trying to have to keep from learning ajax right this second for the one form, Plus I am not sure how hard it would ..

2

answers

Calling a java method from c++ in Android

I'm trying to get a simple Java method call from C++ while Java calls native method. Here's the Java code: public class MainActivity extends Activity { private static String LIB_NAME = "name"; ..

14

answers

Add shadow to custom shape on Android

Is it possible to add a drop shadow to a custom shape in Android? After looking through the documentation, I only see a way to apply a text shadow. I've tried this with no luck: <?xml version="1...

3

answers

New self vs. new static

I am converting a PHP 5.3 library to work on PHP 5.2. The main thing standing in my way is the use of late static binding like return new static($options); , if I convert this to return new self($opti..

2

answers

Target elements with multiple classes, within one rule

I have some HTML that would have elements with multiple classes, and I need to assign them within one rule, so that the same classes could be different within different containers. Say I have this in ..

6

answers

SQL Query - Concatenating Results into One String

I have a sql function that includes this code: DECLARE @CodeNameString varchar(100) SELECT CodeName FROM AccountCodes ORDER BY Sort I need to concatenate all results from the select query into Cod..

3

answers

Deleting rows from parent and child tables

Assume two tables in Oracle 10G TableA (Parent) --> TableB (Child) Every row in TableA has several child rows related to it in TableB. I want to delete specific rows in TableA which means i ha..

6

answers

With form validation: why onsubmit="return functionname()" instead of onsubmit="functionname()"?

The question is pretty self-explanatory. I don't understand what the return is doing in the following code: <form onsubmit="return somefunction()"> ..

9

answers

How do you push a tag to a remote repository using Git?

I have cloned a remote Git repository to my laptop, then I wanted to add a tag so I ran git tag mytag master When I run git tag on my laptop the tag mytag is shown. I then want to push this to the ..

11

answers

Format Float to n decimal places

I need to format a float to "n"decimal places. was trying to BigDecimal, but the return value is not correct... public static float Redondear(float pNumero, int pCantidadDecimales) { // the func..

8

answers

2 column div layout: right column with fixed width, left fluid

My requirement is simple: 2 columns where the right one has a fixed size. Unfortunately I couldn't find a working solution, neither on stackoverflow nor in Google. Each solution described there fails ..

15

answers

Checking Bash exit status of several commands efficiently

Is there something similar to pipefail for multiple commands, like a 'try' statement but within bash. I would like to do something like this: echo "trying stuff" try { command1 command2 c..

6

answers

WebSockets vs. Server-Sent events/EventSource

Both WebSockets and Server-Sent Events are capable of pushing data to browsers. To me they seem to be competing technologies. What is the difference between them? When would you choose one over the ot..

9

answers

Remove an onclick listener

I have an object where the text cycles and displays status messages. When the messages change, I want the click event of the object to change to take you to the activity that the message is relating ..

12

answers

Set CSS property in Javascript?

I've created the following... var menu = document.createElement('select'); How would I now set CSS attributes e.g width: 100px?..

10

answers

What is the difference between a stored procedure and a view?

I am confused about a few points: What is the difference between a stored procedure and a view? When should I use stored procedures, and when should I use views, in SQL Server? Do views allow the cr..

13

answers

How to pass data between fragments

Im trying to pass data between two fragmens in my program. Its just a simple string that is stored in the List. The List is made public in fragments A, and when the user clicks on a list item, I need ..

12

answers

Better way to convert file sizes in Python

I am using a library that reads a file and returns its size in bytes. This file size is then displayed to the end user; to make it easier for them to understand it, I am explicitly converting the fil..