Some Of The Best Answers From Latest Asked Questions

7

answers

Enable 'xp_cmdshell' SQL Server

I want to execute EXEC master..xp_cmdshell @bcpquery But I am getting the following error: SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this compon..

2

answers

How to use org.apache.commons package?

On various web examples I see imports such as: import org.apache.commons.net.ftp.FTPClient; I don't understand how to use these, and the apache website is fairly unclear. How to I use these classes..

17

answers

How can I copy the output of a command directly into my clipboard?

How can I pipe the output of a command into my clipboard and paste it back when using a terminal? For instance: cat file | clipboard ..

6

answers

Running multiple commands in one line in shell

Say I have a file /templates/apple and I want to put it in two different places and then remove the original. So, /templates/apple will be copied to /templates/used AND /templates/inuse and then a..

9

answers

Rails - How to use a Helper Inside a Controller

While I realize you are supposed to use a helper inside a view, I need a helper in my controller as I'm building a JSON object to return. It goes a little like this: def xxxxx @comments = Array.ne..

16

answers

Convert JS date time to MySQL datetime

Does anyone know how to convert JS dateTime to MySQL datetime? Also is there a way to add a specific number of minutes to JS datetime and then pass it to MySQL datetime?..

9

answers

How to link a folder with an existing Heroku app

I have an existing Rails app on GitHub and deployed on Heroku. I'm trying to set up a new development machine and have cloned the project from my GitHub repository. However, I'm confused as to how to ..

7

answers

How to cast or convert an unsigned int to int in C?

My apologies if the question seems weird. I'm debugging my code and this seems to be the problem, but I'm not sure. Thanks!..

10

answers

How to edit .csproj file

When I am compiling my .csproj file using .NET Framework 4.0 MSBUILD.EXE file, I am getting an error: "lable01" not found in the current context of "website01.csproj". Actually, I ..

9

answers

ImportError: No module named _ssl

Ubuntu Maverick w/Python 2.7: I can't figure out what to do to resolve the following import error: >>> import ssl Traceback (most recent call last): File "<stdin>", line 1, in <m..

9

answers

How to convert a String to JsonObject using gson library

Please advice how to convert a String to JsonObject using gson library. What I unsuccesfully do: String string = "abcde"; Gson gson = new Gson(); JsonObject json = new JsonObject(); json = gson.to..

9

answers

How to center canvas in html5

I've been searching for a solution for a while now, but haven't found anything. Maybe it's just my search terms. Well, I'm trying to make the canvas center according to the size of the browser window...

24

answers

Where does PHP store the error log? (php5, apache, fastcgi, cpanel)

I am on shared hosting and have Cpanel, Apache, PHP is run by fastcgi. Where does PHP store the error log? Is there any other way I can find the error log on shared hosting environment instead of ha..

4

answers

How to convert these strange characters? (ë, Ã, ì, ù, Ã)

My page often shows things like ë, Ã, ì, ù, à in place of normal characters. I use utf8 for header page and MySQL encode. How does this happen?..

3

answers

executing a function in sql plus

I created a function in oracle that inserts records in specific tables and return an output according to what occurs within the function. e.g (ins_rec return number) How do I call this function and s..

3

answers

How to implement a confirmation (yes/no) DialogPreference?

How can I implement a Preference that displays a simple yes/no confirmation dialog? For an example, see Browser->Setting->Clear Cache...

3

answers

Mapping many-to-many association table with extra column(s)

My database contains 3 tables: User and Service entities have many-to-many relationship and are joined with the SERVICE_USER table as follows: USERS - SERVICE_USER - SERVICES SERVICE_USER table cont..

7

answers

XOR operation with two strings in java

How to do bitwise XOR operation to two strings in java...

11

answers

C++ - unable to start correctly (0xc0150002)

I'm trying to run an OpenCV application through Microsoft Visual C++ 2010 Express, and get the following message: How can I solve this issue?..

10

answers

What exactly is an instance in Java?

What is the difference between an object, instance, and reference? They say that they have to create an instance to their application? What does that mean?..

8

answers

How to run a shell script in OS X by double-clicking?

I have a shell script that has user execution permission on OS X, but when I double click on it, it opens in a text editor. How can I get it to run by double-clicking it?..

9

answers

How to disassemble a binary executable in Linux to get the assembly code?

I was told to use a disassembler. Does gcc have anything built in? What is the easiest way to do this?..

8

answers

enable/disable zoom in Android WebView

There are some methods in WebSettings related to zoom: WebSettings.setSupportZoom WebSettings.setBuiltInZoomControls I noticed they work differently on some devices. For example, on my Galaxy S pi..

12

answers

Why doesn't list have safe "get" method like dictionary?

Why doesn't list have a safe "get" method like dictionary? >>> d = {'a':'b'} >>> d['a'] 'b' >>> d['c'] KeyError: 'c' >>> d.get('c', 'fail') 'fail' >>> l ..

19

answers

How to select date without time in SQL

When I select date in SQL it is returned as 2011-02-25 21:17:33.933. But I need only the Date part, that is 2011-02-25. How can I do this?..

7

answers

PHP: Split string

How do I split a string by . delimiter in PHP? For example, if I have the string "a.b", how do I get "a"? ..

5

answers

mysql query result in php variable

Is there any way to store mysql result in php variable? thanks $query = "SELECT username,userid FROM user WHERE username = 'admin' "; $result=$conn->query($query); then I want to print selected ..

7

answers

Collection that allows only unique items in .NET?

Is there a collection in C# that will not let you add duplicate items to it? For example, with the silly class of public class Customer { public string FirstName { get; set; } public string L..

4

answers

src absolute path problem

I have an image in C:\wamp\www\site\img and i try to display it in a page with this: <img src="C:\wamp\www\site\img\mypicture.jpg"/> but it's not working.The file is actually there and if I t..

19

answers

How do I use brew installed Python as the default Python?

I try to switch to Homebrew (after using fink and macport) on Mac OS X 10.6.2. I have installed python 2.7 with brew install python The problem is that, contrary to Macport, it seems that there i..

7

answers

Show Youtube video source into HTML5 video tag?

I'm trying to put a YouTube video source into the HTML5 <video> tag, but it doesn't seem to work. After some Googling, I found out that HTML5 doesn't support YouTube video URLs as a source. Ca..

4

answers

C - reading command line parameters

I have made little program for computing pi (p) as an integral. Now I am facing a question how to extend it to compute an integral, which will be given as an extra parameter when starting an applicati..

13

answers

How to set breakpoints in inline Javascript in Google Chrome?

When I open Developer Tools in Google Chrome, I see all kinds of features like Profiles, Timelines, and Audits, but basic functionality like being able to set breakpoints both in js files and within h..

5

answers

Closing a file after File.Create

I check to see if a file exists with if(!File.Exists(myPath)) { File.Create(myPath); } However, when I go to create a StreamReader with this newly created file, I get an error saying that ..

9

answers

sorting a List of Map<String, String>

I have a list variable created like this: List<Map<String, String>> list = new ArrayList<Map<String, String>>(); In my Android application, this list gets populated. just a..

11

answers

Sending a mail from a linux shell script

I want to send an email from a Linux Shell script. What is the standard command to do this and do I need to set up any special server names?..

3

answers

Regex for 1 or 2 digits, optional non-alphanumeric, 2 known alphas

I've been bashing my head against the wall trying to do what should be a simple regex - I need to match, eg 12po where the 12 part could be one or two digits, then an optional non-alphanumeric like a ..

5

answers

Django - what is the difference between render(), render_to_response() and direct_to_template()?

Whats the difference (in language a python/django noob can understand) in a view between render(), render_to_response() and direct_to_template()? e.g. from Nathan Borror's basic apps examples def co..

44

answers

How do I solve the INSTALL_FAILED_DEXOPT error?

I am developing an Android application using Android 2.2, my application APK size is 22.5 MB, and I would like to create a new build for a Samsung tablet. I got the following error: INSTALL_FAILED..

3

answers

How can I compare two strings in java and define which of them is smaller than the other alphabetically?

I want to use the binary search algorithm to search the string which has been entered by the user in a very big sorted file. I can not compare the string which has been entered by the user with the st..

18

answers

Import SQL file into mysql

I have a database called nitm. I haven't created any tables there. But I have a SQL file which contains all the necessary data for the database. The file is nitm.sql which is in C:\ drive. This file h..

11

answers

Calling one Activity from another in Android

How can I call another activity from one (the current) activity? And for the same I want to call an activity which contains a dialog message box from my current activity...

16

answers

How to use \n new line in VB msgbox() ...?

What is the alternative to \n (for new line) in a VB.NET MsgBox()?..

9

answers

Android Left to Right slide animation

I have three activities whose launch modes are single instance. Using onfling(), I swing them left and right. The problem is when I swipe right to left the slide transition is okay but when I swipe ..

4

answers

WCF change endpoint address at runtime

I have my first WCF example working. I have the host on a website which have many bindings. Because of this, I have added this to my web.config. <serviceHostingEnvironment multipleSiteBindingsEnab..

8

answers

How to save a plot into a PDF file without a large margin around

If I print a plot in EPS format, the content of the EPS file is fully occupied with the plot. But if I print a plot in PDF format, then there are big margins above and below the plot in the PDF file. ..

5

answers

align divs to the bottom of their container

I figured this would be simple, I need to align both of the inside divs (green and blue) to the bottom of their container (red). I'm hoping to not use absolute positioning and i need it to be ie6,7,8 ..

14

answers

Onchange open URL via select - jQuery

What would be the best way to attach an event so on change of a select option a URL. Store the href in an attr and grab it on change?..

12

answers

Difference between float and decimal data type

What difference does it make when I use float and decimal data types in MySQL?. When should I use which?..

13

answers

Uploading images using Node.js, Express, and Mongoose

Please consider newer answers that have more up-to-date information as things have changed over the years! Since many new Node.js libraries are quickly being rendered obsolete and there are relativel..

3

answers

How to display with n decimal places in Matlab

I was wondering how to use command to set up displaying with n decimal places in Matlab? Must n be restricted to some predetermined numbers? Or one can just specify any for n? Thanks and regards!..

4

answers

jquery $('.class').each() how many items?

When looping over a group of items using jquery selectors is there a way to find out how many items there are on the collection?..

6

answers

How do I check if PHP is connected to a database already?

Basically in pseudo code I'm looking for something like if (connected_to_any_database()) { // do nothing } else { mysql_connect(...) } How do I implement connected_to_any_database() ..

8

answers

jQuery $.ajax request of dataType json will not retrieve data from PHP script

I've been looking all over for the solution but I cannot find anything that works. I am trying to get a bunch of data from the database and then via AJAX autocomplete input fields in a form. To do thi..

1

answers

How to put individual tags for a scatter plot

I am trying to do a scatter plot in matplotlib and I couldn't find a way to add tags to the points. For example: scatter1=plt.scatter(data1["x"], data1["y"], marker="o", c="blue"..

13

answers

Count number of records returned by group by

How do I count the number of records returned by a group by query, For eg: select count(*) from temptable group by column_1, column_2, column_3, column_4 Gives me, 1 1 2 I need to count the a..

5

answers

An Iframe I need to refresh every 30 seconds (but not the whole page)

I have this bit of code <iframe marginwidth="0" marginheight="0" width="240" height="80" scrolling="no" frameborder=0 src="irc_online.php"..

11

answers

Querying data by joining two tables in two database on different servers

There are two tables in two different databases on different servers, I need to join them so as to make few queries. What options do I have? What should I do?..

5

answers

Two Radio Buttons ASP.NET C#

I have two radio buttons for metric and US measurements. I load the page so the metric radio button is clicked. How do I set the two buttons so when US is clicked metric unclicks and vise versa?..

11

answers

How to add a footer to the UITableView?

I'me using this code to add a footer to the TableView. It has 20 sections, and each section a few rows. There's a titleForHeaderInSection, and sectionForSectionIndexTitle methods. CGRect footerRect =..

3

answers

Setting the classpath in java using Eclipse IDE

I have an Eclipse project with an external folder containing a lot of JAR files (legacy libraries) . instead of adding all the jars in Eclipse ("add external Jar"), I would prefer to add a ref to this..

4

answers

Test file upload using HTTP PUT method

I've written a service using HTTP PUT method for uploading a file. Web Browsers don't support PUT so I need a method for testing. It works great as a POST hitting it from a browser. update: This is wh..

3

answers

How do I check if a given Python string is a substring of another one?

I have two strings and I would like to check whether the first is a substring of the other. Does Python have such a built-in functionality?..

1

answers

Checking for #N/A in Excel cell from VBA code

I'm iterating through a range of cells which hold numbers with 2 decimal places. I need to check if the cell holds '#N/A', and if it does, I need to skip it. The problem is, when a cell holds a valid ..

5

answers

Export a graph to .eps file with R

How do I export a graph to an .eps format file? I typically export my graphs to a .pdf file (using the 'pdf' function), and it works quite well. However, now I have to export to .eps files...

7

answers

Populate a Drop down box from a mySQL table in PHP

I am trying to populate a Drop down box from results of a mySQL Query, in Php. I've looked up examples online and I've tried them on my webpage, but for some reason they just don't populate my drop do..

16

answers

Disable asp.net button after click to prevent double clicking

I have an ASP.NET button that I need to disable after the user clicks it to prevent double-clicking. Once the submit completes it has to be enabled again. Can anyone help me with this?..

36

answers

Squash my last X commits together using Git

How can I squash my last X commits together into one commit using Git?..

11

answers

Changing every value in a hash in Ruby

I want to change every value in a hash so as to add '%' before and after the value so { :a=>'a' , :b=>'b' } must be changed to { :a=>'%a%' , :b=>'%b%' } What's the best way to do thi..

2

answers

c++ bool question

in c++ , the bool , is that true == 1, false == 0?? thanks..

6

answers

How to show first commit by 'git log'?

I have a project which has long history. I want to show the first commit on git. How do I do this?..

6

answers

How to check a string for specific characters?

How can I check if a string has several specific characters in it using Python 2? For example, given the following string: The criminals stole $1,000,000 in jewels. How do I detect if it has do..

30

answers

How can I get a list of Git branches, ordered by most recent commit?

I want to get a list of all the branches in a Git repository with the "freshest" branches at the top, where the "freshest" branch is the one that's been committed to most recently (and is, therefore, ..

11

answers

How should I call 3 functions in order to execute them one after the other?

If I need call this functions one after other, $('#art1').animate({'width':'1000px'},1000); $('#art2').animate({'width':'1000px'},1000); $('#art3').animate({'width':'1000px'},1000); ..

8

answers

Imported a csv-dataset to R but the values becomes factors

I am very new to R and I am having trouble accessing a dataset I've imported. I'm using RStudio and used the Import Dataset function when importing my csv-file and pasted the line from the console-win..

7

answers

Python Replace \\ with \

So I can't seem to figure this out... I have a string say, "a\\nb" and I want this to become "a\nb". I've tried all the following and none seem to work; >>> a 'a\\nb' >>> a.replace(..

6

answers

TextView bold via xml file?

Is there a way to bold the text in a TextView via XML? <TextView android:textSize="12dip" android:textAppearance="bold" -> ?? </TextView> Thanks..

4

answers

Stretch horizontal ul to fit width of div

For the main nav of my site, there is a 980px wide div with a ul for the main nav links. I am trying to make the nav links stretch to fit the width of the div evenly. <div style="width: 980px;"&g..

5

answers

Javascript Drag and drop for touch devices

I am looking for a drag & DROP plugin that works on touch devices. I would like similar functionality to the jQuery UI plugin which allows "droppable" elements. The jqtouch plugin supports dragg..

5

answers

Delete all lines starting with # or ; in Notepad++

Using Notepad++, how do I remove all lines starting with # or ;?..

6

answers

How can I create a blank/hardcoded column in a sql query?

I want have a query with a column that is a hardcoded value not from a table, can this be done? I need it basically as a placeholder that I am going to come back to later and fill in. example: SELE..

10

answers

html vertical align the text inside input type button

I'm trying to create a button with height of '22px' , and that the text inside the button will be vertically aligned in the center of the button. I tried everything , and can't find out how to do it. ..

5

answers

How to add rows dynamically into table layout

I have certain data in sqllite and it update every time whenever, I click on save button and I want to show the data into a table layout for adding more rows for updated data. I have certain code but..

12

answers

How do I update a Python package?

I'm running Ubuntu 9:10 and a package called M2Crypto is installed (version is 0.19.1). I need to download, build and install the latest version of the M2Crypto package (0.20.2). The 0.19.1 package ..

12

answers

Calendar Recurring/Repeating Events - Best Storage Method

I am building a custom events system, and if you have a repeating event that looks like this: Event A repeats every 4 days starting on March 3, 2011 or Event B repeats every 2 weeks on Tuesday sta..

6

answers

VBA test if cell is in a range

I want to test if a given cell is within a given range in Excel VBA. What is the best way to do this?..

5

answers

Setting graph figure size

All I want to do is make the width greater and the height smaller. I'm just doing raster plots but this question applies to any MATLAB figure. I can manually resize it using the figure directly when..

4

answers

append option to select menu?

Using Javascript how would I append an option to a HTML select menu? e.g to this: <select> <option value="volvo">Volvo</option> <option value="saab">Saab</option&g..

22

answers

WordPress is giving me 404 page not found for all pages except the homepage

All of a sudden I go to my WordPress website and all the pages give me a 404 page not found page. I'm assuming the problem lies with the permalink structure, which I could swear I did not touch. The p..

10

answers

Datetime equal or greater than today in MySQL

What's the best way to do following: SELECT * FROM users WHERE created >= today; Note: created is a datetime field...

2

answers

Replace X-axis with own values

I have a question regarding the command plot(). Is there a way to fully eliminate the x-axis and replace it with own values? I know that I can get rid of the axis by doing plot(x,y, xaxt = 'n') an..

6

answers

SQL Server default character encoding

By default - what is the character encoding set for a database in Microsoft SQL Server? How can I see the current character encoding in SQL Server?..

4

answers

How can I create a unique constraint on my column (SQL Server 2008 R2)?

I have SQL Server 2008 R2 and I want to set a unique column. There seems to be two ways to do this: "unique index" and "unique constraint". They are not much different from what I understand, alth..

10

answers

Git push existing repo to a new and different remote repo server?

Say I have a repository on git.fedorahosted.org and I want to clone this into my account at github to have my own playground aside from the more "official" repo on fedorahosted. What would be the step..

10

answers

Use of Application.DoEvents()

Can Application.DoEvents() be used in C#? Is this function a way to allow the GUI to catch up with the rest of the app, in much the same way that VB6's DoEvents does?..

22

answers

What is the point of "final class" in Java?

I am reading a book about Java and it says that you can declare the whole class as final. I cannot think of anything where I'd use this. I am just new to programming and I am wondering if programmer..

10

answers

How to find a value in an array of objects in JavaScript?

I have an array of objects: Object = { 1 : { name : bob , dinner : pizza }, 2 : { name : john , dinner : sushi }, 3 : { name : larry, dinner : hummus } } I want to be able to search the obje..

13

answers

How can I create a progress bar in Excel VBA?

I'm doing an Excel app that needs a lot data updating from a database, so it takes time. I want to make a progress bar in a userform and it pops up when the data is updating. The bar I want is just a ..

6

answers

Why is the minidlna database not being refreshed?

I am developing a MiniDLNA server to stream media over WiFi. Existing files are shown properly. However, when I add new files to media folders the changes are not updated across MiniDLNA clients. I h..

4

answers

Convert json data to a html table

Is there any jQuery or javascript library that generates a dynamic table given json data? I don't want to define the columns, the library should read the keys in the json hash and generate columns. O..