Some Of The Best Answers From Latest Asked Questions

6

answers

How to get values from IGrouping

I have a question about IGrouping and the Select() method. Let's say I've got an IEnumerable<IGrouping<int, smth>> in this way: var groups = list.GroupBy(x => x.ID); where list is a..

15

answers

How to remove specific object from ArrayList in Java?

How can I remove specific object from ArrayList? Suppose I have a class as below: import java.util.ArrayList; public class ArrayTest { int i; public static void main(String args[]){ ..

22

answers

Get a file name from a path

What is the simplest way to get the file name that from a path? string filename = "C:\\MyDirectory\\MyFile.bat" In this example, I should get "MyFile". without extension...

6

answers

PuTTY Connection Manager download?

Where can I still download PuTTY Connection Manager? I am a PuTTY user and finally decided I need to upgrade to a tabbed SSH environment. I found a lot of threads/sites talking about PuTTY Connection..

4

answers

compilation error: identifier expected

import java.io.*; public class details { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.println("What is your name?"); String name = in.readLine(); ;..

12

answers

HTTP Status 404 - The requested resource (/) is not available

I integrated Tomcat 7 in Eclipse. When I start it using Eclipse, it shows that Tomcat is up and running, but when I go to http://localhost:8080 in my browser, it gives me following error: HTTP Sta..

23

answers

Eclipse compilation error: The hierarchy of the type 'Class name' is inconsistent

I have downloaded some open source software written in Java and tried to compile it using Eclipse. I got the error: "The hierarchy of the type 'Class name' is inconsistent" in some files. What causes ..

3

answers

Add custom header in HttpWebRequest

I need to add some custom headers to the HttpWebRequest object. How can I add Custom Header to HttpWebRequest object in Windows Phone 7...

8

answers

Replace non ASCII character from string

I have strings A função, Ãugent in which I need to replace character like ç,ã,Ã with empty strings. How can I match only those non ASCII characters? I am using a function public static String ..

12

answers

To show only file name without the entire directory path

ls /home/user/new/*.txt prints all txt files in that directory. However it prints the output as follows: [[email protected]]$ ls /home/user/new/*.txt /home/user/new/file1.txt /home/user/new/file2.txt /ho..

5

answers

how to get text from textview

if I have set text in textview in such way, which is not problem: tv.setText("" + ANS[i]); this simply getting from this way. String a = tv.getText().toString(); int A = Integer.parseI..

7

answers

change image opacity using javascript

how can I change image opacity using javascript? I'm going to create a fading effect using javascript, is there any sample? is there anything like image.opacity that can be changed through JS code? ho..

20

answers

JS search in object values

I have an array of homogeneous objects like so; [ { "foo" : "bar", "bar" : "sit" }, { "foo" : "lorem", "bar" : "ipsum" }, { "foo" : "dolor", "bar" : "amet" } ] I..

6

answers

Send JSON data via POST (ajax) and receive json response from Controller (MVC)

I created a function in javascript like that: function addNewManufacturer() { var name = $("#id-manuf-name").val(); var address = $("#id-manuf-address").val(); var phone = $("#id..

8

answers

Android activity life cycle - what are all these methods for?

What is the life cycle of an Android activity? Why are so many similar sounding methods (onCreate(), onStart(), onResume()) called during initialization, and so many others (onPause(), onStop(), onDes..

14

answers

Aborting a stash pop in Git

I popped a stash and there was a merge conflict. Unlike the question that is listed as a duplicate, I already had some uncommitted changes in the directory which I wanted to keep. I don't just want to..

5

answers

Are there other whitespace codes like &nbsp for half-spaces, em-spaces, en-spaces etc useful in HTML?

Wondering if there are other codes available to use in an HTML newsletter. I would use cell padding or margins but I'm new to this HTML/CSS thing and I can't find a change that does effect both the ..

5

answers

csv.Error: iterator should return strings, not bytes

Sample.csv contains the following: NAME Id No Dept Tom 1 12 CS Hendry 2 35 EC Bahamas 3 21 IT Frank 4 61 EE And the Python file contains the following code: import..

3

answers

What is special about /dev/tty?

ls -la /dev/tty shows the output: crw-rw-rw- 1 root tty 5, 0 Dec 14 22:21 /dev/tty What does c at the beginning mean? When I do something like pwd > /dev/tty it prints to the stdout. What does t..

3

answers

Float vs Decimal in ActiveRecord

Sometimes, Activerecord data types confuse me. Err, often. One of my eternal questions is, for a given case, Should I use :decimal or :float? I've often come across this link, ActiveRecord: :dec..

3

answers

pthread_join() and pthread_exit()

I have a question about C concurrency programming. In the pthread library, the prototype of pthread_join is int pthread_join(pthread_t tid, void **ret); and the prototype of pthread_exit is: void..

7

answers

How do I find all of the symlinks in a directory tree?

I'm trying to find all of the symlinks within a directory tree for my website. I know that I can use find to do this but I can't figure out how to recursively check the directories. I've tried this c..

4

answers

Json.net serialize/deserialize derived types?

json.net (newtonsoft) I am looking through the documentation but I can't find anything on this or the best way to do it. public class Base { public string Name; } public class Derived : Base { ..

10

answers

less than 10 add 0 to number

How can I modify this code to add a 0 before any digits lower than 10 $('#detect').html( toGeo(apX, screenX) + latT +', '+ toGeo(apY, screenY) + lonT ); function toGeo(d, max) { var c = ''; ..

16

answers

Tomcat: LifecycleException when deploying

I just downloaded the Tomcat 7.0.23 package on my Ubuntu 11.10. I followed the instructions on a Google API website to deploy their example webapp. It basically consists of jar files placed in the W..

11

answers

UTF-8 byte[] to String

Let's suppose I have just used a BufferedInputStream to read the bytes of a UTF-8 encoded text file into a byte array. I know that I can use the following routine to convert the bytes to a string, but..

8

answers

"Adaptive Server is unavailable or does not exist" error connecting to SQL Server from PHP

I'm attempting to connect to a SQL Server 2005 DB from my Mac using unixODBC and FreeTDS as I have outlined here. However, when I try to connect in to a different DB using the same setup, I get: Conn..

48

answers

Check if a value is an object in JavaScript

How do you check if a value is an object in JavaScript?..

18

answers

How to run .jar file by double click on Windows 7 64-bit?

Running a .jar file in a command line works fine, but i am not able to run any .jar file by double clicking on my Windows 7 (64). It seems nothing happens after the double click. I tried the ftype hi..

4

answers

Select something that has more/less than x character

Was wondering if it's possible to select something that has more/less than x characters in SQL. For example, I have an employee table and I want to show all employee names that has more than 4 charac..

3

answers

Using find command in bash script

I just start to use bash script and i need to use find command with more than one file type. list=$(find /home/user/Desktop -name '*.pdf') this code work for pdf type but i want to search more tha..

26

answers

How to center a "position: absolute" element

I'm having a problem centering an element that has the attribute position set to absolute. Does anyone know why the images are not centered? _x000D_ _x000D_ body { text-align: center; } #slideshowW..

6

answers

How to select <td> of the <table> with javascript?

I know this is very easy question, but I couldn't find the answer anywhere. Only answers are the ones using jQuery, not pure JS. I've tried the code below and it doesn't work. I don't know why. var ..

10

answers

How to start working with GTest and CMake

I have recently been sold on using CMake for compiling my C++ projects, and would now like to start writing some unit tests for my code. I have decided to use the Google Test utility to help with this..

2

answers

Node.js/Express routing with get params

Let's say I have get route like this: app.get('/documents/format/type', function (req, res) { var format = req.params.format, type = req.params.type; }); So if I make request like http:..

5

answers

Get page title with Selenium WebDriver using Java

How can I verify some text in the title tag using Selenium WebDriver and java?..

3

answers

SQL Server : trigger how to read value for Insert, Update, Delete

I have the trigger in one table and would like to read UserId value when a row is inserted, updated or deleted. How to do that? The code below does not work, I get error on UPDATED ALTER TRIGGER [d..

14

answers

Android - Best and safe way to stop thread

I want to know which is the best way to stop a thread in Android. I know I can use AsyncTask instead of it and that there is a cancel() method. I have to use Threads in my situation. Here is how I'm u..

3

answers

Spring 3 MVC accessing HttpRequest from controller

I would like to handle request and session attributes myself rather then leave it to spring @SessionAttributes, for login of cookies handling for example. I just cant figure out how could I access t..

10

answers

What is the correct SQL type to store a .Net Timespan with values > 24:00:00?

I am trying to store a .Net TimeSpan in SQL server 2008 R2. EF Code First seems to be suggesting it should be stored as a Time(7) in SQL. However TimeSpan in .Net can handle longer periods than 24..

7

answers

What is "Linting"?

PHPLint, JSLint, and I recently came across "you can lint your JS code on the fly" while reading something about some IDE. So, what is "linting"?..

11

answers

Android Lint contentDescription warning

I am getting warning as "[Accessibility] Missing contentDescription attribute on image" for imageview. while using android lint What does that mean?..

27

answers

How to hide action bar before activity is created, and then show it again?

I need to implement splash screen in my honeycomb app. I use this code in activity's onCreate to show splash: setContentView(R.layout.splash); getActionBar().hide(); and this code to show main UI a..

13

answers

Trim a string based on the string length

I want to trim a string if the length exceeds 10 characters. Suppose if the string length is 12 (String s="abcdafghijkl"), then the new trimmed string will contain "abcdefgh..". How can I achieve th..

12

answers

How to display Base64 images in HTML?

I'm having trouble displaying a Base64 image inline. Can someone point me in the right direction? <!DOCTYPE html> <html> <head> <title>Display Image</title> <..

2

answers

Android AudioRecord example

I am designing an Android app and I need to implement an AudioRecord class to record the user's sound. After some research (that didn't provide enough information) and few failed attempts, I was wonde..

27

answers

Extract hostname name from string

I would like to match just the root of a URL and not the whole URL from a text string. Given: http://www.youtube.com/watch?v=ClkQA2Lb_iE http://youtu.be/ClkQA2Lb_iE http://www.example.com/12xy45 htt..

7

answers

How does jQuery work when there are multiple elements with the same ID value?

I fetch data from Google's AdWords website which has multiple elements with the same id. Could you please explain why the following 3 queries doesn't result with the same answer (2)? Live Demo HTML..

4

answers

grep --ignore-case --only

grep fails when using both --ignore-case and --only-match options. Example: $ echo "abc" | grep -io abc abc $ echo "ABC" | grep -io abc $ But $ echo "abc" | grep -i abc abc $ echo "ABC" | grep -i..

3

answers

curl -GET and -X GET

Curl offers a series of different http method calls that are prefixed with a X, but also offers the same methods without. I've tried both and I can't seem to figure out the difference. Can someone exp..

1

answers

Thin Black Border for a Table

I need to have such thin line for the whole table as seen above. The above image is a sample only. My solution, doesn't work. The table shows no border at all. Here is my CSS: table { border-w..

5

answers

Opening a SQL Server .bak file (Not restoring!)

I have been reading a LOT of google posts and StackOverflow questions about how to restore a database in SQL Server from a .bak file. But none of them states how to just READ the tables in the databa..

5

answers

How to identify whether a grammar is LL(1), LR(0) or SLR(1)?

How do you identify whether a grammar is LL(1), LR(0), or SLR(1)? Can anyone please explain it using this example, or any other example? X ? Yz | a Y ? bZ | e Z ? e ..

8

answers

Running Command Line in Java

Is there a way to run this command line within a Java application? java -jar map.jar time.rel test.txt debug I can run it with command but I couldn't do it within Java...

61

answers

Split array into chunks

Let's say that I have an Javascript array looking as following: ["Element 1","Element 2","Element 3",...]; // with close to a hundred elements. What approach would be appropriate to chunk (split)..

7

answers

I get Access Forbidden (Error 403) when setting up new alias

I'm running windows 7 and recently installed XAMPP to build a dev environment. I'm not great with the server side of things so I'm having some problems setting up an alias for a project. So far XAMPP..

9

answers

What's a clean way to stop mongod on Mac OS X?

i'm running mongo 1.8.2 and trying to see how to cleanly shut it down on Mac. on our ubuntu servers i can shutdown mongo cleanly from the mongo shell with: > use admin > db.shutdownServer() ..

18

answers

How can I parse a CSV string with JavaScript, which contains comma in data?

I have the following type of string var string = "'string, duppi, du', 23, lala" I want to split the string into an array on each comma, but only the commas outside the single quotation mar..

4

answers

Hibernate Group by Criteria Object

I would like to implement the following SQL query with Hibernate Criteria: SELECT column_name, aggregate_function(column_name) FROM table_name WHERE column_name <operator> value GROUP BY column..

9

answers

write newline into a file

considering the following function private static void GetText(String nodeValue) throws IOException { if(!file3.exists()) { file3.createNewFile(); } FileOutputStream fop=new FileOut..

10

answers

Spring @Transactional - isolation, propagation

Can someone explain what isolation & propagation parameters are for in the @Transactional annotation via real-world example? Basically when and why I should choose to change their default values..

17

answers

PHP class not found but it's included

I'm including a PHP class with require_once($ENGINE."/classUser.php"); but when the code is executed i receive this error: Fatal error: Class 'User' not found in C:\xampp\htdocs\WebName\resou..

5

answers

Enable Hibernate logging

I'm trying to create a log of hibernate statements. I perform my sql statements using JPA where Hibernate 2.0 is the persistence provider (my application server is JBoss AS 6.0). I call my CRUD method..

8

answers

Notify ObservableCollection when Item changes

I found on this link ObservableCollection not noticing when Item in it changes (even with INotifyPropertyChanged) some techniques to notify a Observablecollection that an item has changed. the Trul..

4

answers

How to get the cookie value in asp.net website

I am creating a cookie and storing the value of username after succesfull login. How can I access the cookie when the website is opened. If the cookie exist I want to fill the username text box from t..

15

answers

check android application is in foreground or not?

I went through a lot of answers for this question.But it's all about single activity..How to check whether the whole app is running in foreground or not ?..

6

answers

Play an audio file using jQuery when a button is clicked

I am trying to play an audio file when I click the button, but it's not working, my html code is: <html> <body> <div id="container"> <button id="play"..

23

answers

Eclipse says: “Workspace in use or cannot be created, chose a different one.” How do I unlock a workspace?

When I start, Eclipse says "Workspace Cannot Be Locked" "Could not launch the product because the associated workspace is currently in use by another Eclipse application." or “Workspace in use or c..

10

answers

How to count the number of lines of a string in javascript

I want to count the number of lines in a string i tried to use this stackoverflow answer : lines = str.split("\r\n|\r|\n"); return lines.length; on this string(which was originally a buffer): ..

16

answers

How to force cp to overwrite without confirmation

I'm trying to use the cp command and force an overwrite. I have tried cp -rf /foo/* /bar, but I am still prompted to confirm each overwrite...

6

answers

How to show matplotlib plots in python

I am sure the configuration of matplotlib for python is correct since I have used it to plot some figures. But today it just stop working for some reason. I tested it with really simple code like: i..

7

answers

Getting full-size profile picture

Is there anyway to get the full-size profile picture using any facebook api? http://graph.facebook.com/{ID}/picture?type=large is way to small. Thanks :)..

7

answers

What are App Domains in Facebook Apps?

I want to add the ability to 'login with Facebook' to my site. But I am confused when I register my site in Facebook Apps. What should I input into App Domains?..

8

answers

How to change port number for apache in WAMP

I am new to WAMP server and installed it on my system but after installing it when I check it by going to localhost url like this http://localhost/ in the browser it is not working. I am getting a 4..

5

answers

Using new line(\n) in string and rendering the same in HTML

I have a string say string display_txt = "1st line text" +"\n" + "2nd line text"; in Jquery, I am trying to use ('#somediv').html(display_txt).css("color", "green") quite clearly I am expecting..

6

answers

Android, How can I Convert String to Date?

I store current time in database each time application starts by user. Calendar c = Calendar.getInstance(); String str = c.getTime().toString(); Log.i("Current time", str); In database side..

12

answers

Border length smaller than div width?

I have following code div { width:200px; border-bottom:1px solid magenta; height:50px; } DEMO The div width is 200px so border-bottom is also 200px but what should I do if I want bord..

21

answers

Generic deep diff between two objects

I have two objects: oldObj and newObj. The data in oldObj was used to populate a form and newObj is the result of the user changing data in this form and submitting it. Both objects are deep, ie. they..

3

answers

Group by with union mysql select query

(SELECT COUNT(motorbike.`owner_id`) as count,owner.`name`,transport.`type` FROM transport,owner,motorbike WHERE transport.type='motobike' AND owner.`owner_id`=motorbike.`owner_id` AND transport.`type_..

4

answers

How does Java deal with multiple conditions inside a single IF statement

Lets say I have this: if(bool1 && bool2 && bool3) { ... } Now. Is Java smart enough to skip checking bool2 and bool2 if bool1 was evaluated to false? Does java even check them from ..

9

answers

selecting unique values from a column

I have a MySQL table which contains the following type of information: Date product 2011-12-12 azd 2011-12-12 yxm 2011-12-10 sdx 2011-12-10 ssd..

20

answers

How to check whether a string is Base64 encoded or not

I want to decode a Base64 encoded string, then store it in my database. If the input is not Base64 encoded, I need to throw an error. How can I check if a string is Base64 encoded?..

5

answers

Pass by pointer & Pass by reference

Possible Duplicate: What are the differences between pointer variable and reference variable in C++? Are there benefits of passing by pointer over passing by reference in C++? In both cas..

5

answers

Change name of folder when cloning from GitHub?

When I clone something from Github, it creates a folder with the same name as the app on my computer. Is there a way to change the name? For example, doing this clone creates a long "sign-in-with..

6

answers

Check element exists in array

In PHP there a function called isset() to check if something (like an array index) exists and has a value. How about Python? I need to use this on arrays because I get "IndexError: list index out of ..

3

answers

Add "Are you sure?" to my excel button, how can I?

I have a button on my form that clears the entire 8 sheet workbook. I do want to clear it occasionally, but I would hate to do it by accident. I've tried googling it, but every result I've found assum..

7

answers

Get the string within brackets in Python

I have a sample string <alpha.Customer[cus_Y4o9qMEZAugtnW] active_card=<alpha.AlphaObject[card] ...>, created=1324336085, description='Customer for My Test App', livemode=False> I only wa..

11

answers

Draggable div without jQuery UI

I'm trying to make a div draggable without using jQuery UI. However, I'm stuck with the code below. I understand that I should use the mouse position relative to the container div (in which the div wi..

5

answers

Is gcc's __attribute__((packed)) / #pragma pack unsafe?

In C, the compiler will lay out members of a struct in the order in which they're declared, with possible padding bytes inserted between members, or after the last member, to ensure that each member i..

4

answers

How to print float to n decimal places including trailing 0s?

I need to print or convert a float number to 15 decimal place string even if the result has many trailing 0s eg: 1.6 becomes 1.6000000000000000 I tried round(6.2,15) but it returns 6.200000000000000..

6

answers

SQL Server - INNER JOIN WITH DISTINCT

I am having a hard time doing the following: select a.FirstName, a.LastName, v.District from AddTbl a order by Firstname inner join (select distinct LastName from ValTbl v where a.LastNa..

23

answers

How to make an AJAX call without jQuery?

How to make an AJAX call using JavaScript, without using jQuery? ..

6

answers

phpexcel to download

hello i am new to phpexcel, and i was wondering if there is some way send the excel i have created to the clients download without saving it on my server or to delete it right after he downloads it ..

3

answers

How can I delay a :hover effect in CSS?

Is there a way to delay the :Hover event without using JavaScript? I know there is a way to delay animations, but I haven't seen anything on delaying the :hover event. I'm building a son-of-suckerfis..

8

answers

How can I make my website's background transparent without making the content (images & text) transparent too?

I'm doing a website for a school project, and I'm currently having a small problem... I can't make the body's background transparent without it also affecting the content in it. Here's my HTML code: ..

10

answers

ios Upload Image and Text using HTTP POST

Thanks for reading. I am new to iOS and I am trying to upload an Image and a text using multi-part form encoding in iOS. The curl equivalent is something like this: curl -F "param1=value1" -F "para..

5

answers

Maven: Command to update repository after adding dependency to POM

I've added a new dependency to my POM. Is there a simple command I can run to download this dependency to my repository?..

10

answers

C# : Out of Memory exception

Today my application threw an OutOfMemoryException. To me this was always almost impossible since I have 4GB RAM and a lot of virtual memory too. The error happened when I tried to add an existing col..

13

answers

Convert number of minutes into hours & minutes using PHP

I have a variable called $final_time_saving which is just a number of minutes, 250 for example. How can I convert that number of minutes into hours and minutes using PHP in this format: 4 hours 10..

4

answers

How to get all checked checkboxes

I have a set of input checkboxes with the same name and I would like to determine which checkboxes have been checked using javascript, how can I achieve that? I know only how to get all the checkboxes..