Some Of The Best Answers From Latest Asked Questions

5

answers

Git merge without auto commit

Is it possible to do a git merge, but without a commit? "man git merge" says this: With --no-commit perform the merge but pretend the merge failed and do not autocommit, to give the user a chance to..

4

answers

How do I get into a non-password protected Java keystore or change the password?

I'm trying to import a trusted certificated into the Java cacerts keystore, but I have a problem. I tried to list existing trusted certificates and it seems that the keystore isn't password protected...

2

answers

How to get the last element of an array in Ruby?

Example: a = [1, 3, 4, 5] b = [2, 3, 1, 5, 6] How do I get the last value 5 in array a or last value 6 in array b without using a[3] and b[4]?..

5

answers

Java: Rotating Images

I need to be able to rotate images individually(in java). The only thing I have found so far is g2d.drawImage(image, affinetransform, ImageObserver ). Unfortunately, I need to draw the image at a spec..

15

answers

Jenkins could not run git

I've installed Jenkins on my mac (osx lion). But I couldn't get it work. This is the stacktrace I've got: Started by user anonymous Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/test/workspac..

12

answers

How do I center an SVG in a div?

I have an SVG that I am trying to center in a div. The div has a width or 900px. The SVG has a width of 400px. The SVG has its margin-left and margin-right set to auto. Doesn't work, it just acts as i..

12

answers

:not(:empty) CSS selector is not working?

I'm having a heck of a time with this particular CSS selector which does not want to work when I add :not(:empty) to it. It seems to work fine with any combination of the other selectors: input:not(:..

9

answers

jquery datatables default sort

I am trying to set the default sort to the second column in my jquery datatable. It by default sorts by index 0. I am using the "aaSorting": [[ 1, "asc" ]] syntax but it highlights the column which ..

15

answers

jQuery SVG, why can't I addClass?

I am using jQuery SVG. I can't add or remove a class to an object. Anyone know my mistake? The SVG: <rect class="jimmy" id="p5" x="200" y="200" width="100" height="100" /> The jQuery that wo..

1

answers

How to return images in flask response?

As an example, this URL: http://example.com/get_image?type=1 should return a response with a image/gif MIME type. I have two static .gif images, and if type is 1, it should return ok.gif, else retu..

9

answers

How to get start and end of day in Javascript?

How to get start ( 00:00:00 ) and end ( 23:59:59 ) of today in timestamp ( GMT )? Computer use a local time...

2

answers

IIS7 Settings File Locations

Where does IIS7 saves its configuration for each virtual directory/ application and its physical path? Is it an XML file? And if so, will editing this XML file affect the IIS configuration (after re..

4

answers

Multiple INSERT statements vs. single INSERT with multiple VALUES

I'm running a performance comparison between using 1000 INSERT statements: INSERT INTO T_TESTS (TestId, FirstName, LastName, Age) VALUES ('6f3f7257-a3d8-4a78-b2e1-c9b767cfe1c1', 'First 0', 'Last ..

7

answers

How do change the color of the text of an <option> within a <select>?

I am trying to change the color of the first option to grey color, that only the text (select one option) but here it's not working here: _x000D_ _x000D_ .grey_color {_x000D_ color: #ccc;_x000D_ ..

5

answers

Python IndentationError: unexpected indent

Here is my code ... I am getting indentation error but i don't know why it occurs. -> # loop while d <= end_date: # print d.strftime("%Y%m%d") fecha = d.strftime("%Y%m%d") # set url ..

5

answers

Convert a string to a datetime

I am developing asp.net site using vb framework 3.5. Im having difficulties converting string data into Date I tried using cdate function, I have a variable sdate which is a string variable and dat..

5

answers

How to find out client ID of component for ajax update/render? Cannot find component with expression "foo" referenced from "bar"

The following code is inspired from PrimeFaces DataGrid + DataTable Tutorials and put into a <p:tab> of a <p:tabView> residing in a <p:layoutUnit> of a <p:layout>. Here is the ..

16

answers

Phone validation regex

I'm using this pattern to check the validation of a phone number ^[0-9\-\+]{9,15}$ It's works for 0771234567 and +0771234567, but I want it to works for 077-1234567 and +077-1234567 and +077-1-23-..

7

answers

Get latitude and longitude automatically using php, API

In one of my php applications I have to find out the latitude and longitude of the place from address. I tried this code: $json = file_get_contents("http://maps.google.com/maps/api/geocode/json?ad..

6

answers

How to keep environment variables when using sudo

When I use any command with sudo the environment variables are not there. For example after setting HTTP_PROXY the command wget works fine without sudo. However if I type sudo wget it says it can't by..

7

answers

How to close a GUI when I push a JButton?

Does anyone know how to make a jbutton close a gui? I think it is like System.CLOSE(0); but that didnt work. it also could be exitActionPerformed(evt);, but that didn't work either. just the line of c..

10

answers

Make scrollbars only visible when a Div is hovered over?

I am trying to figure out how to have a scrollable div that only shows its scrollbars when Hovered. Example is Google Image search, in the image below you can see how the left sidebar does not appe..

10

answers

Get property value from C# dynamic object by string (reflection?)

Imagine that I have a dynamic variable: dynamic d = *something* Now, I create properties for d which I have on the other hand from a string array: string[] strarray = { 'property1','property2',.....

5

answers

GROUP_CONCAT ORDER BY

I've a table like: +-----------+-------+------------+ | client_id | views | percentage | +-----------+-------+------------+ | 1 | 6 | 20 | | 1 | 4 | 55 | | ..

13

answers

How to prevent going back to the previous activity?

When the BACK button is pressed on the phone, I want to prevent a specific activity from returning to its previous one. Specifically, I have login and sign up screens, both start a new activity calle..

5

answers

How to get text and a variable in a messagebox

I just need to know how to have plain text and a variable in a messagebox. For example: I can do this: MsgBox(variable) And I can do this: MsgBox("Variable = ") But I can't do this: MsgBox("Variab..

3

answers

Implementing a slider (SeekBar) in Android

I want to implement a slider, which is basically two lines, one vertical and one horizontal, crossing where the screen is touched. I have managed to make one but I have to issues: The slider is not ..

11

answers

unix - count of columns in file

Given a file with data like this (i.e. stores.dat file) sid|storeNo|latitude|longitude 2|1|-28.03720000|153.42921670 9|2|-33.85090000|151.03274200 What would be a command to output the number of co..

3

answers

How to send HTML-formatted email?

I could be able to let the web application sends automatic emails using Windows Task Scheduler. Now I want to send HTML-Formatted email using the following method that I wrote for sending emails. My ..

3

answers

Java file path in Linux

I have a rather silly question, but I haven't been able to find a solution for this: When I try and read a file I get a "file not found error" is runtime. It compiled the file though. I am on Linux..

12

answers

How to add a new line in textarea element?

I want to add a newline in a textarea. I tried with \n and <br/> tag but are not working. You can see above the HTML code. Can you help me to insert a newline in a textarea? <textarea cols='6..

5

answers

How to search in an array with preg_match?

How do I search in an array with preg_match? Example: <?php if( preg_match( '/(my\n+string\n+)/i' , array( 'file' , 'my string => name', 'this') , $match) ) { //Excelent!! $items[] = ..

7

answers

Adding :default => true to boolean in existing Rails column

I've seen a few questions (namely this one) here on SO about adding a default boolean value to an existing column. So I tried the change_column suggestion but I mustn't be doing it right. I tried: $..

10

answers

How to display loading message when an iFrame is loading?

I have an iframe that loads a third party website which is extremely slow to load. Is there a way I can display a loading message while that iframe loads the user doesn't see a large blank space? PS..

10

answers

How to utilize date add function in Google spreadsheet?

I believe the issue I am having now should be much easier in MS Excel. However, since my company uses Google Spreadsheet so I have to figure out a way. Basically, I have a cell that contains a date v..

9

answers

Save and load MemoryStream to/from a file

I am serializing an structure into a MemoryStream and I want to save and load the serialized structure. So, How to Save a MemoryStream into a file and also load it back from file?..

9

answers

Could not find folder 'tools' inside SDK

I am starting Android Development using Eclipse. I have downloaded all the required software but I am having the same problem as discussed here. Now I do not find the solution of the problem on that d..

19

answers

How come I can't remove the blue textarea border in Twitter Bootstrap?

In Chrome, there is a blue border around the textarea. How come I can't remove it? textarea:hover, input:hover, textarea:active, input:active, textarea:focus, input:focus { outline:0px !impo..

5

answers

JavaScript: IIF like statement

Coming from VB, JavaScript isn't very easy to get the hang of. Please don't be negative, I've tried and searched loads but with no luck. BTW, I'm creating a dropdown control initialized from a Select ..

29

answers

jQuery get value of selected radio button

The problem statement is simple. I need to see if user has selected a radio button from a radio group. Every radio button in the group share same id. The problem is that I don't have control on how t..

18

answers

Is the buildSessionFactory() Configuration method deprecated in Hibernate

When I updated the Hibernate version from 3.6.8 to 4.0.0, I got a warning about deprecated method buildSessionFactory() in this line: private static final SessionFactory sessionFactory = new..

2

answers

access denied for user @ 'localhost' to database ''

I'm seeing a lot of of similar questions to this. but can't find one exactly like mine yet. Not sure where to change these settings or anything, any help appreciated. access denied Access denied for..

13

answers

Maven in Eclipse: step by step installation

I have spent been on the Maven site reading the 5- and 30-minute tutorials, and trialing Maven out for the first time. I want to install a Maven plugin and use it to start building Maven projects fro..

2

answers

onNewIntent() lifecycle and registered listeners

I'm using a singleTop Activity to receive intents from a search-dialog via onNewIntent(). What I noticed is that onPause() is called before onNewIntent(), and then afterwards it calls onResume(). Vi..

24

answers

JavaScript calculate the day of the year (1 - 366)

How do I use JavaScript to calculate the day of the year, from 1 - 366? For example: January 3 should be 3. February 1 should be 32. ..

3

answers

how to create and call scalar function in sql server 2008

I have created a Scalar Functions, it was created successfully, but when I call the function using select statement, it says invalid object, I altered the function, I got the message command completed..

3

answers

CSS :selected pseudo class similar to :checked, but for <select> elements

Is there a way to style the currently selected <option> element in a <select> element? I could then give a background color to the currently selected option element? That way I can style ..

5

answers

Escaping backslash in string - javascript

I need to show the name of the currently selected file (in <input type="file"> element). Everything is fine, the only problem is I'm getting this kind of string "C:\fakepath \typog_rules.pdf" ..

10

answers

Return a 2d array from a function

Hi I am a newbie to C++ I am trying to return a 2d array from a function. It is something like this int **MakeGridOfCounts(int Grid[][6]) { int cGrid[6][6] = {{0, }, {0, }, {0, }, {0, }, {0, }, {0..

5

answers

fast way to copy formatting in excel

I have two bits of code. First a standard copy paste from cell A to cell B Sheets(sheet_).Cells(x, 1).Copy Destination:=Sheets("Output").Cells(startrow, 2) I can do almost the same using Sheets("..

3

answers

How to get a web page's source code from Java

I just want to retrieve any web page's source code from Java. I found lots of solutions so far, but I couldn't find any code that works for all the links below: http://www.cumhuriyet.com.tr?hn=2987..

5

answers

Submit a form in a popup, and then close the popup

This seemed so trivial when I started off with it! My objective is this: When user clicks on a button, open up a form in a new window. Once the form is submitted, close the popup and return to the ..

6

answers

jQuery if statement to check visibility

I'm trying to write a script that will hidden/show div depending on other elements visibility. The action should take place when i click on other element. Here's what I've wrote so far: $('#column-l..

18

answers

Custom Cell Row Height setting in storyboard is not responding

I am trying to adjust the cell height for one of the cells on my table view. I am adjusting the size from the "row height" setting inside the "size inspector" of the cell in question. When I run the a..

7

answers

PHP XML how to output nice format

Here are the codes: $doc = new DomDocument('1.0'); // create root node $root = $doc->createElement('root'); $root = $doc->appendChild($root); $signed_values = array('a' => 'eee', 'b' => '..

9

answers

How to enter a series of numbers automatically in Excel

I have so many records but I need to enter serial numbers automatically in Excel 2007. I have hundreds of records. Instead of entering them manually I want them to show up automatically. Please give m..

11

answers

Access event to call preventdefault from custom function originating from onclick attribute of tag

I have links like this: <a href="#" onclick="myfunc({a:1, b:'hi'})" />click</a> <a href="#" onclick="myfunc({a:3, b:'jo'})" />click</a> And I would like to do a preventDefau..

3

answers

How to close off a Git Branch?

I'm starting out using Git + GitHub. In our distributed team, each member is creating their own branch for each issue/requirement they are allocated. git branch Issue#1 <-- create this branch ..

6

answers

Array of PHP Objects

So I have been searching for a while and cannot find the answer to a simple question. Is it possible to have an array of objects in PHP? Such as: $ar=array(); $ar[]=$Obj1 $ar[]=$obj2 For so..

7

answers

Determine if char is a num or letter

How do I determine if a char in C such as a or 9 is a number or a letter? Is it better to use: int a = Asc(theChar); or this? int a = (int)theChar ..

1

answers

java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;

I have a problem with egovframework of Korea when I have deployed file war to Tomcat after I restarted Tomcat, it showed the error like below : 2011-12-23 09:16:01,101 ERROR [org.springframework.web...

6

answers

How to import an existing directory into Eclipse?

I am on a mac, but I don't think it will make a difference. I have a directory that I want to fully import/add into Eclipse. What I did is this: Right click import General → Existing Projects ..

7

answers

How do you use math.random to generate random ints?

How do you use Math.random to generate random ints? My code is: int abc= (Math.random()*100); System.out.println(abc); All it prints out is 0, how can I fix this?..

16

answers

Python ImportError: No module named wx

Im sorry to ask this question again. I have searched and found endles repeats of it both on stackoverflow and also on general google search. Unfortunatly I just cant get my system sorted. I have the ..

12

answers

Convert a binary NodeJS Buffer to JavaScript ArrayBuffer

How can I convert a NodeJS binary buffer into a JavaScript ArrayBuffer?..

8

answers

How to determine one year from now in Javascript

I'm trying to get one year from now's date, and it's not working. JS: var now = new Date(); var oneYr = new Date(); oneYr.setYear(now.getYear() + 1); $("#yearFromNow").append(oneYr.toString()); va..

21

answers

What is the difference between null=True and blank=True in Django?

When we add a database field in django we generally write: models.CharField(max_length=100, null=True, blank=True) The same is done with ForeignKey, DecimalField etc. What is the basic difference i..

8

answers

Why do we use __init__ in Python classes?

I am having trouble understanding the Initialization of classes. What's the point of them and how do we know what to include in them? Does writing in classes require a different type of thinking vers..

14

answers

IntelliJ Organize Imports

Does IntelliJ have an Organize Imports feature similar to that in Eclipse? What I have is a Java file with multiple classes missing their imports. Example: package com.test; public class Foo { pu..

8

answers

Finding the source code for built-in Python functions?

Is there a way to see how built in functions work in python? I don't mean just how to use them, but also how were they built, what is the code behind sorted or enumerate etc...?..

5

answers

Have a variable in images path in Sass?

I want to have one variable that contains the root path to all my images in my CSS file. I can't quite figure out if this is possible in pure Sass (the actual web project is not RoR, so can't use asse..

8

answers

How to add buttons dynamically to my form?

I want to create 10 buttons on my form when I click on button1. No error with this code below but it doesnt work either. private void button1_Click(object sender, EventArgs e) { List<Button>..

6

answers

JQuery .on() method with multiple event handlers to one selector

Trying to figure out how to use the Jquery .on() method with a specific selector that has multiple events associated with it. I was previously using the .live() method, but not quite sure how to acco..

17

answers

How to Set a Custom Font in the ActionBar Title?

How (if possible) could I set a custom font in a ActionBar title text(only - not the tab text) with a font in my assets folder? I don't want to use the android:logo option. ..

1

answers

Batch file to restart a service. Windows

How can I restart a windows service using a .bat file? I am on windows server...

3

answers

How are environment variables used in Jenkins with Windows Batch Command?

I'm trying to use Jenkins (Global) environment variables in my xcopy script. ${WORKSPACE} doesn't work "${WORKSPACE}" doesn't work '${WORKSPACE}' doesn't work ..

5

answers

How do I deserialize a JSON string into an NSDictionary? (For iOS 5+)

In my iOS 5 app, I have an NSString that contains a JSON string. I would like to deserialize that JSON string representation into a native NSDictionary object. "{\"password\" : \"1234\", \"user\" :..

7

answers

How to verify Facebook access token?

There's only thing that server has to do; just check any access token's validity. Clients send to the server user id and access token obtained by FB.getLoginStatus. As I expected, there would be any ..

19

answers

default select option as blank

I have a very weird requirement, wherein I am required to have no option selected by default in drop down menu in HTML. However, I cannot use this, _x000D_ _x000D_ <select>_x000D_ <option..

5

answers

MySQL "Or" Condition

Check out this MySQL Query and then I'll show you what I really want it to do... mysql_query(" SELECT * FROM Drinks WHERE email='$Email' AND date='$Date_Today' OR date='$Date_Yesterday' ..

9

answers

Center image in table td in CSS

I've been trying to align an image to the center of the table td. It worked with setting margin-left to a specific value but it also increased the size of td too and that isn't exactly what I wanted ..

6

answers

SQLAlchemy IN clause

I'm trying to do this query in sqlalchemy SELECT id, name FROM user WHERE id IN (123, 456) I would like to bind the list [123, 456] at execution time...

21

answers

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated

I have many users on my web site (20000-60000 per day), which is a download site for mobile files. I have remote access to my server (windows server 2008-R2). I've received "Server is unavailable" ..

2

answers

Can we install Android OS on any Windows Phone and vice versa, and same with iPhone and vice versa?

I have 3 smartphones with me , one running Windows Mobile OS , another one running Android OS , and 3rd one running iOS. I am wondering if i can load/install Android OS on any Windows Phone and vice ..

6

answers

Excel how to fill all selected blank cells with text

Is it possible to select all the bank cells in an excel sheet and put the same value in all the cells? I just want to populate them with "null" I have Excel student 2010..

5

answers

Android get image path from drawable as string

Is there any way that I can get the image path from drawable folder in android as String. I need this because I implement my own viewflow where I'm showing the images by using their path on sd card, b..

15

answers

Increasing heap space in Eclipse: (java.lang.OutOfMemoryError)

try { // CompareRecord record = new CompareRecord(); Connection conn = new CompareRecord().getConection("eliteddaprd","eliteddaprd","192.168.14.104","1521"); ResultSet res = null; if ..

3

answers

MySQL select statement with CASE or IF ELSEIF? Not sure how to get the result

I have a two tables. One has manufacturer information and includes the regions where they can sell. The other has their products for sale. We have to limit visibility of the product based on the re..

16

answers

Git on Bitbucket: Always asked for password, even after uploading my public SSH key

I uploaded my ~/.ssh/id_rsa.pub to Bitbucket's SSH keys as explained, but Git still asks me for my password at every operation (such as git pull). Did I miss something? It is a private repository (fo..

9

answers

Executing periodic actions in Python

I am working on Windows. I want to execute a function foo() every 10 seconds. How do I do this?..

11

answers

Send JSON data from Javascript to PHP?

How can I send JSON data from Javascript in the browser, to a server and have PHP parse it there?..

16

answers

Detect if HTML5 Video element is playing

I've looked through a couple of questions to find out if an HTML5 element is playing, but can't find the answer. I've looked at the W3 documentation and it has an event named "playing" but I can't see..

3

answers

SQL DELETE with INNER JOIN

There are 2 tables, spawnlist and npc, and I need to delete data from spawnlsit. npc_templateid = n.idTemplate is the only thing that "connect" the tables. I have tried this script but it doesn't work..

4

answers

Get the position of a spinner in Android

I'm trying to get the position (number) of the spinner when selected to use it in another Activity that will display a different map each time depending on the item selected. when I run the applicatio..

9

answers

Customizing Bootstrap CSS template

I am just getting started with Bootstrap from Twitter and am wondering what the ‘best practices’ is for customization. I want to develop a system that will take advantage of all the power of a css..

20

answers

Truncate to three decimals in Python

How do I get 1324343032.324? As you can see below, the following do not work: >>1324343032.324325235 * 1000 / 1000 1324343032.3243253 >>int(1324343032.324325235 * 1000) / 1000.0 13243430..

5

answers

How to completely DISABLE any MOUSE CLICK

After the user clicks on...."log in" button, and other events, I made a loading script -to let users know they have to wait (Until ajax replies back). How can I DISABLE any MOUSE CLICKS (right click,..

13

answers

How do you share constants in NodeJS modules?

Currently I'm doing this: foo.js const FOO = 5; module.exports = { FOO: FOO }; And using it in bar.js: var foo = require('foo'); foo.FOO; // 5 Is there a better way to do this? It feels aw..

10

answers

How to play only the audio of a Youtube video using HTML 5?

Is it possible to play only the audio from a YouTube video using HTML 5 and Javascript?..

6

answers

Why do some functions have underscores "__" before and after the function name?

This "underscoring" seems to occur a lot, and I was wondering if this was a requirement in the Python language, or merely a matter of convention? Also, could someone name and explain which functions ..