Some Of The Best Answers From Latest Asked Questions

9

answers

Use RSA private key to generate public key?

I don't really understand this one: according to: http://www.madboa.com/geek/openssl/#key-rsa , You can generate a public key from a private key. openssl genrsa -out mykey.pem 1024 openssl rsa -in m..

19

answers

WCF Service Client: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding

I've got a WCF Service running on my local IIS server. I've added it as a service reference to a C# Website Project and it adds fine and generates the proxy classes automatically. However, when I try..

3

answers

Page vs Window in WPF?

What is the difference between a Page and a Window in WPF when you are adding a new file in the Solution Explorer?..

10

answers

Difference between getAttribute() and getParameter()

What is the difference between getAttribute() and getParameter() methods within HttpServletRequest class?..

4

answers

displayname attribute vs display attribute

What is difference between DisplayName attribute and Display attribute in ASP.NET MVC?..

12

answers

Python SQL query string formatting

I'm trying to find the best way to format an sql query string. When I'm debugging my application I'd like to log to file all the sql query strings, and it is important that the string is properly for..

8

answers

How to trigger a build only if changes happen on particular set of files

How do I tell Jenkins/Hudson to trigger a build only for changes on a particular project in my Git tree?..

9

answers

Android Text over image

I have an imageView with an image, over that image I want to place a text. How can I achieve that?..

13

answers

Converting int to string in C

I am using the itoa() function to convert an int into string, but it is giving an error: undefined reference to `itoa' collect2: ld returned 1 exit status What is the reason? Is there some other wa..

6

answers

How to find the files that are created in the last hour in unix

How to find the files that are created in the last hour in unix..

21

answers

What is the facade design pattern?

Is facade a class which contains a lot of other classes? What makes it a design pattern? To me, it is like a normal class. Can you explain to me this Facade pattern?..

4

answers

what does this mean ? image/png;base64?

I don't know what we call this. but i found a image at google 404 url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKsAAADVCAMAAAAfHvCaAAAAGFBMVEVYn%2BH%2F%2F%2F%2Bex%2B3U5vd7s%2Bfq8%2Fs0itq72PMLUP..

5

answers

How do I use the JAVA_OPTS environment variable?

How do I use the JAVA_OPTS variable to configure a web server (a linux server)? How can I set -Djava.awt.headless=true using JAVA_OPTS?..

11

answers

How to add items to a spinner in Android?

How to add items to a spinner?..

5

answers

Find and copy files

Why does the following does not copy the files to the destination folder? # find /home/shantanu/processed/ -name '*2011*.xml' -exec cp /home/shantanu/tosend {} \; cp: omitting directory `/home/shant..

4

answers

How to set the background image of a html 5 canvas to .png image

I would like to know how it is possible to set the background image of a canvas to a .png file. I do not want to add the image in the back of the canvas and make the canvas transparent. I want the u..

8

answers

jQuery Call to WebService returns "No Transport" error

I have the following web service; [WebMethod] public string HelloWorld() { return "Hello World"; } It's stock standard with no alterations to the class decorators. I have t..

40

answers

The entitlements specified...profile. (0xE8008016). Error iOS 4.2

I am getting the 'dreaded' error The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile. (0xE8008016). when trying ..

18

answers

CSS: Truncate table cells, but fit as much as possible

Meet Fred. He's a table: <table border="1" style="width: 100%;"> <tr> <td>This cells has more content</td> <td>Less content here</td> <..

14

answers

Check if String contains only letters

The idea is to have a String read and to verify that it does not contain any numeric characters. So something like "smith23" would not be acceptable. ..

4

answers

Nginx location priority

What order do location directives fire in?..

4

answers

How is a non-breaking space represented in a JavaScript string?

This apparently is not working: X = $td.text(); if (X == '&nbsp;') { X = ''; } Is there something about a non-breaking space or the ampersand that JavaScript doesn't like?..

4

answers

Extract every nth element of a vector

I would like to create a vector in which each element is the i+6th element of another vector. For example, in a vector of length 120 I want to create another vector of length 20 in which each element..

7

answers

How do I execute external program within C code in linux with arguments?

I want to execute another program within C code. For example, I want to execute a command ./foo 1 2 3 foo is the program which exists in the same folder, and 1 2 3 are arguments. foo program create..

14

answers

Is it possible to get element from HashMap by its position?

How to retrieve an element from HashMap by its position, is it possible at all?..

9

answers

Adding items to end of linked list

I'm studying for an exam, and this is a problem from an old test: We have a singly linked list with a list head with the following declaration: class Node { Object data; Node next; Node(..

11

answers

Get GMT Time in Java

In Java, I want to get the current time in GMT. I tried various options like this: Date date = new Date(); Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); date1 = calendar.get..

10

answers

Split string into array of character strings

I need to split a String into an array of single character Strings. Eg, splitting "cat" would give the array "c", "a", "t"..

16

answers

changing source on html5 video tag

i'm trying to build a video player, that works everywhere. so far i'd be going with: <video> <source src="video.mp4"></source> <source src="video.ogv"></source> ..

17

answers

How do I disable the resizable property of a textarea?

I want to disable the resizable property of a textarea. Currently, I can resize a textarea by clicking on the bottom right corner of the textarea and dragging the mouse. How can I disable this? ..

11

answers

Find Facebook user (url to profile page) by known email address

I have an email address and want to find out if there is a Facebook user linked to this address. If there is, then I want to retrieve the url to this users profile page and save it somewhere. I do not..

11

answers

How to drop columns by name in a data frame

I have a large data set and I would like to read specific columns or drop all the others. data <- read.dta("file.dta") I select the columns that I'm not interested in: var.out <- names(data)..

8

answers

How to take the first N items from a generator or list?

With linq I would var top5 = array.Take(5); How to do this with Python?..

4

answers

using mailto to send email with an attachment

How can i send an email with an attachment (either local file or a file in the intranet) using outlook 2010? <a href="mailto:[email protected]?subject=my report&body=see attachment&attachment=c:..

9

answers

How to return a value from a Form in C#?

I have a main form (let's call it frmHireQuote) that is a child of a main MDI form (frmMainMDI), that shows another form (frmImportContact) via ShowDialog() when a button is clicked. When the user cl..

5

answers

How to load data from a text file in a PostgreSQL database?

I have a file like (CSV file): value1|value2|value2.... value1|value2|value2.... value1|value2|value2.... value1|value2|value2.... and would like to load these data into a postgresql table...

9

answers

How to refresh a page with jQuery by passing a parameter to URL

I am refreshing my page using jQuery: location.reload(); This is working great but I want to refresh the same page by passing a parameter to URL. How can I do this by using jQuery? Ex: If my ur..

10

answers

HTML+CSS: How to force div contents to stay in one line?

I have a long text inside a div with defined width: HTML: <div>Stack Overflow is the BEST !!!</div> CSS: div { border: 1px solid black; width: 70px; } How could I force the ..

2

answers

C# Linq Group By on multiple columns

public class ConsolidatedChild { public string School { get; set; } public string Friend { get; set; } public string FavoriteColor { get; set; } public List<Child> Children { get..

3

answers

Clear MySQL query cache without restarting server

Is there any way to clear mysql query cache without restarting mySQL server?..

7

answers

Can I call methods in constructor in Java?

I have situation, where I want to read configuration file only one time, when class is instantiated. Suppose I have a method named readConfig(), that reads configuration and puts it into a Map object..

6

answers

How can I right-align text in a DataGridView column?

How can I right-align text in a DataGridView column? I am writing a .NET WinForms application...

22

answers

Android Failed to install HelloWorld.apk on device (null) Error

I am new to Android. When I am running my android application in eclipse I am getting these messages in the console: [2011-03-08 12:57:35 - HelloWorld] ------------------------------ [2011-03-08 12:..

7

answers

How get all values in a column using PHP?

I've been searching for this everywhere, but still can't find a solution: How do I get all the values from a mySQL column and store them in an array? For eg: Table Name: Customers Column names: ID..

5

answers

System.BadImageFormatException: Could not load file or assembly

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>InstallUtil.exe C:\_PRODUKCIJA\D ebug\DynamicHtmlTool.exe Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1 Copyright (c) Microso..

11

answers

Get folder name from full file path

How do I get the folder name from the full path of the application? This is the file path below, c:\projects\root\wsdlproj\devlop\beta2\text Here "text" is the folder name. How can I get that fol..

25

answers

How do I check/uncheck all checkboxes with a button using jQuery?

I am trying to check/uncheck all checkboxes using jQuery. Now by checking/unchecking the parent checkbox all the child checkboxes are getting selected/deselected also with the text of parent checkbox ..

15

answers

How to get last inserted id?

I have this code: string insertSql = "INSERT INTO aspnet_GameProfiles(UserId,GameId) VALUES(@UserId, @GameId)"; using (SqlConnection myConnection = new SqlConnection(myConnectionString)) { m..

6

answers

Java: Best way to iterate through a Collection (here ArrayList)

Today I was happily coding away when I got to a piece of code I already used hundreds of times: Iterating through a Collection (here ArrayList) For some reason, I actually looked at the autocomp..

17

answers

Android ADT error, dx.jar was not loaded from the SDK folder

I just downloaded Eclipse Galileo and installed ADT10 and tried to a phonegap app using this guide: http://www.phonegap.com/start But each time i try to build im getting this error: Unknown error: Una..

3

answers

How do I find the distance between two points?

Let's say I have x1, y1 and also x2, y2. How can I find the distance between them? It's a simple math function, but is there a snippet of this online?..

9

answers

How to reference a file for variables using Bash?

I want to call a settings file for a variable, how can I do this in bash? So the settings file will define the variables (eg: CONFIG.FILE) : production="liveschool_joe" playschool="playschool_joe" ..

5

answers

Carriage return and Line feed... Are both required in C#?

When inserting a new line character into a string I have usually done this: str = "First line\nSecond line"; In C#, is this the standard practice? Should I also include the 'carriage return' charac..

11

answers

Installing specific package versions with pip

I'm trying to install version 1.2.2 of the MySQL_python adaptor, using a fresh virtualenv created with the --no-site-packages option. The current version shown in PyPi is 1.2.3. Is there a way to inst..

10

answers

setTimeout in for-loop does not print consecutive values

I have this script: for (var i = 1; i <= 2; i++) { setTimeout(function() { alert(i) }, 100); } But 3 is alerted both times, instead of 1 then 2. Is there a way to pass i, without writing th..

5

answers

CodeIgniter Active Record not equal

In CodeIgniter using active record, how do I perform a not equal to in $this->db->where(). For instance: $this->db->where('emailsToCampaigns.campaignId', $campaignId); Will do equal to..

9

answers

How to open the default webbrowser using java

Can someone point me in the right direction on how to open the default web browser and set the page to "www.example.com" thanks..

5

answers

Can I have H2 autocreate a schema in an in-memory database?

(I've already seen the H2 database In memory - Init schema via Spring/Hibernate question; it is not applicable here.) I'd like to know if there's a setting in H2 that will allow me to auto-create a s..

4

answers

Set timeout for ajax (jQuery)

$.ajax({ url: "test.html", error: function(){ //do something }, success: function(){ //do something } }); Sometimes success function works good, sometimes not. ..

10

answers

curl POST format for CURLOPT_POSTFIELDS

When I use curl via POST and set CURLOPT_POSTFIELD do I have to urlencode or any special format? for example: If I want to post 2 fields, first and last: first=John&last=Smith what is the exac..

5

answers

Position a div container on the right side

I want to develop some kind of utility bar. I can position each element in this bar side by side using float:left; But I want the second element to be positioned at the very right of the bar. This is..

11

answers

asp.net: How can I remove an item from a dropdownlist?

I have a dropdownlist, and in some cases need to remove an item (in the code-behind). I need to remove the item based on the value of the item. How can I do this?..

5

answers

SQL datetime format to date only

I am trying to select the DeliveryDate from sql database as just date. In the database, i am saving it as datetime format. How is it possible to get just date?? SELECT Subject, DeliveryDate from Ema..

7

answers

Column calculated from another column?

Given the following table: id | value -------------- 1 6 2 70 Is there a way to add a column that is automatically calculated based on another column in the same table? Like a VIEW, but pa..

12

answers

How can I get color-int from color resource?

Is there any way to get a color-int from a color resource? I am trying to get the individual red, blue and green components of a color defined in the resource (R.color.myColor) so that I can set the v..

7

answers

How do I set up IntelliJ IDEA for Android applications?

How do I set up IntelliJ IDEA for Android applications?..

7

answers

.attr('checked','checked') does not work

I am trying to check radio. Neither the following works: [edit] $('selector').attr('checked','checked'); $('selector').attr('checked',true); The two alert() in the following code show "1" and "a",..

25

answers

How to determine day of week by passing specific date?

For Example I have the date: "23/2/2010" (23th Feb 2010). I want to pass it to a function which would return the day of week. How can I do this? In this example, the function should return String "Tu..

14

answers

How to hide/show more text within a certain length (like youtube)

I want to have a text to only be a certain amount of characters/length and after that length, I want to put a link to reveal the full length of the text. The link will be (more...). And once the use..

4

answers

How to split comma separated string using JavaScript?

I want to split a comma separated string with JavaScript. How?..

20

answers

css ellipsis on second line

CSS text-overflow: ellipsis on second line, is this possible? I can't find it on the net. example: what I want is like this: I hope someone could help me. I need an ellipsis on the second line of...

8

answers

Online PHP syntax checker / validator

Could someone refer me to an online PHP validator? It would be of much help. Thanks in advance!..

8

answers

multiple packages in context:component-scan, spring config

How can I add multiple packages in spring-servlet.xml file in context:component-scan element? I have tried <context:component-scan base-package="z.y.z.service" base-package="x.y.z.controller" /&g..

6

answers

Find methods calls in Eclipse project

I have a class X containing method myMethod(). I would like to find locations in all projects in my current workspace where this myMethod() is being called. I cannot use any search functions as there ..

10

answers

how to properly display an iFrame in mobile safari

I'm trying to display an iframe in my mobile web application, but I'm having trouble restricting the size of the iframe to the dimensions of the iPhone screen. The height and width attributes on the i..

6

answers

Right query to get the current number of connections in a PostgreSQL DB

Which of the following two is more accurate? select numbackends from pg_stat_database; select count(*) from pg_stat_activity; ..

5

answers

ASP.NET Forms Authentication failed for the request. Reason: The ticket supplied has expired

I am getting this error many times in the event log and users are logged out. Event code: 4005 Event message: Forms authentication failed for the request. Reason: The ticket supplied has expir..

5

answers

Can I get all methods of a class?

Suppose that I have a .class file, can I get all the methods included in that class ?..

4

answers

Xcode 4 - "Archive" is greyed out?

I would like to archive my application, but the Archive option is greyed out. What could cause this? ..

21

answers

How to exit in Node.js

What is the command that is used to exit? (i.e terminate the Node.js process)..

7

answers

$(form).ajaxSubmit is not a function

I'm trying to use the jquery validate plugin to validate a form and submit the contents with an ajax request. This code is in the head of my document. $(document).ready(function() { $('#contact..

18

answers

How to use putExtra() and getExtra() for string data

Can someone please tell me how exactly to use getExtra() and putExtra() for intents? Actually I have a string variable, say str, which stores some string data. Now, I want to send this data from one a..

32

answers

How to get full path of a file?

Is there an easy way I can print the full path of file.txt ? file.txt = /nfs/an/disks/jj/home/dir/file.txt The <command> dir> <command> file.txt should print /nfs/an/disks/jj/..

9

answers

SMTP server response: 530 5.7.0 Must issue a STARTTLS command first

SMTP server response: 530 5.7.0 Must issue a STARTTLS command first I get this error message when i use mail() function in php script file... I m using gmail SMTP server and gmail using STARTTLS whi..

12

answers

Xcode 4: create IPA file instead of .xcarchive

In Xcode 3.2.5 I use "Build And Archive" to create an IPA file. In Xcode 4 you can use "Product -> Archive" to archive an application in an .xcarchive bundle. How can I create an .ipa file with Xcode..

8

answers

Change button text from Xcode?

I have a IBAction connected to a button in my Interface Builder. Is it possible to change the text on the button (in IB) from within my code during runtime?..

6

answers

jQuery - multiple $(document).ready ...?

Question: If I link in two JavaScript files, both with $(document).ready functions, what happens? Does one overwrite the other? Or do both $(document).ready get called? For example, <script type..

21

answers

Print an integer in binary format in Java

I have a number and I want to print it in binary. I don't want to do it by writing an algorithm. Is there any built-in function for that in Java?..

6

answers

Formatting text in a TextBlock

How do I achieve formatting of a text inside a TextBlock control in my WPF application? e.g.: I would like to have certain words in bold, others in italic, and some in different colors, like this exa..

2

answers

argparse module How to add option without any argument?

I have created a script using argparse. The script needs to take a configuration file name as an option, and user can specify whether they need to proceed totally the script or only simulate it. The..

3

answers

Declaring and initializing a string array in VB.NET

I was trying to return an array of strings from a function and got surprised by an error. I would have expected this to work, but it produces an error: Public Function TestError() As String() Re..

9

answers

How do implement a breadth first traversal?

This is what I have. I thought pre-order was the same and mixed it up with depth first! import java.util.LinkedList; import java.util.Queue; public class Exercise25_1 { public static void main(Str..

2

answers

An exception of type 'System.NullReferenceException' occurred in myproject.DLL but was not handled in user code

What does this error mean?, I keep getting this error, it use to work fine and it just started throwing this error.... any help? img1.ImageUrl = ConfigurationManager.AppSettings.Get("Url").Replace("#..

9

answers

How to easily get network path to the file you are working on?

In Excel 2003 there used to be a command that I added to my toolbar that was called Address (if I remember correctly) and it would show the fully-qualified network path to the file I had open. For ex..

9

answers

"No resource identifier found for attribute 'showAsAction' in package 'android'"

I am attempting to update my android application to look better for tablets running Honeycomb. As such, I am targeting version 11 of the SDK (my minSdkVersion = 4). This adds the Honeycomb theme to my..

5

answers

What's the better (cleaner) way to ignore output in PowerShell?

Let's say you have a method or a cmdlet that returns something, but you don't want to use it and you don't want to output it. I found these two ways: Add-Item > $null [void]Add-Item Add-Item | O..

5

answers

Change File Extension Using C#

I have many file types: pdf, tiff, jpeg, bmp. etc. My question is how can I change file extension? I tried this: my file= c:/my documents/my images/cars/a.jpg; string extension = Path.GetExtension(my..

10

answers

subtract two times in python

I have two datetime.time values, exit and enter and I want to do something like: duration = exit - enter However, I get this error: TypeError: unsupported operand type(s) for -: 'datetime.time'..

6

answers

undefined reference to `[email protected]'

When I try to build a program using Eclipse CDT, I get the following: /mingw/lib/libmingw32.a(main.o):main.c:(.text+0x106): undefined reference to `[email protected] Why is that? And, how can I solve..

5

answers

Manually adding a Userscript to Google Chrome

Instead of "installing" User-Scripts I found many tutorials on the web to add it manually. All of them told me to do the same steps: Make the directory C:\Users\Blabla\AppData\Local\Google\Chrome\Us..