Some Of The Best Answers From Latest Asked Questions

11

answers

How to add System.Windows.Interactivity to project?

My project missing System.Windows.Interactivity. Google says that I have to install Expression Blend, but on my other computer I have this library and I don't have Expression Blend installed. So there..

5

answers

T-SQL Substring - Last 3 Characters

Using T-SQL, how would I go about getting the last 3 characters of a varchar column? So the column text is IDS_ENUM_Change_262147_190 and I need 190..

6

answers

Regex to Match Symbols: !$%^&*()_+|~-=`{}[]:";'<>?,./

I'm trying to create a Regex test in JavaScript that will test a string to contain any of these characters: !$%^&*()_+|~-=`{}[]:";'<>?,./ More Info If You're Interested :) It's for a pre..

4

answers

Deleting records before a certain date

How would I go about deleting all records from a MySQL table from before a certain date, where the date column is in DATETIME format? An example datetime is 2011-09-21 08:21:22...

9

answers

case statement in SQL, how to return multiple variables?

I would like to return multiple values in my case statement, such as : SELECT CASE WHEN <condition 1> THEN <value1=a1, value2=b1> WHEN <condition 2> THEN <value1=a2, va..

4

answers

T-SQL - function with default parameters

I have this script: CREATE FUNCTION dbo.CheckIfSFExists(@param1 INT, @param2 BIT = 1 ) RETURNS BIT AS BEGIN IF EXISTS ( bla bla bla ) RETURN 1; RETURN 0; END GO I want to use it in ..

7

answers

How to update PATH variable permanently from Windows command line?

If I execute set PATH=%PATH%;C:\\Something\\bin from the command line (cmd.exe) and then execute echo %PATH% I see this string added to the PATH. If I close and open the command line, that new string ..

3

answers

List method to delete last element in list as well as all elements

I have an issue with clearing lists. In the current program, I have a method that clears a certain number of lists. This is rather inconvenient since during one part of the program where this method i..

13

answers

Regular Expression to reformat a US phone number in Javascript

I'm looking to reformat (replace, not validate - there are many references for validating) a phone number for display in Javascript. Here's an example of some of the data: 123 4567890 (123) 456-7890..

6

answers

What's the difference between Git Revert, Checkout and Reset?

I am trying to learn how to restore or rollback files and projects to a prior state, and don't understand the difference between git revert, checkout, and reset. Why are there 3 different commands fo..

13

answers

How to automatically convert strongly typed enum into int?

#include <iostream> struct a { enum LOCAL_A { A1, A2 }; }; enum class b { B1, B2 }; int foo(int input) { return input; } int main(void) { std::cout << foo(a::A1) << std::endl;..

18

answers

How to make <a href=""> link look like a button?

I have this button image: I was wondering whether it would be possible to make a simple <a href="">some words</a> and style that link to appear as that button? If it is possible, how do..

12

answers

How to use NSJSONSerialization

I have a JSON string (from PHP's json_encode() that looks like this: [{"id": "1", "name":"Aaa"}, {"id": "2", "name":"Bbb"}] I want to parse this into some sort of data structure for my iPhone app. ..

1

answers

How to write "Html.BeginForm" in Razor

If I write like this: form action="Images" method="post" enctype="multipart/form-data" it works. But in Razor with '@' it doesn't work. Did I make any mistakes? @using (Html.BeginForm("Upload..

3

answers

-XX:MaxPermSize with or without -XX:PermSize

We've run into a Java.lang.OutOfMemoryError: PermGen space error and looking at the tomcat JVM params, other than the -Xms and -Xmx params we also specify -XX:MaxPermSize=128m. After a bit of profilin..

16

answers

jQuery Date Picker - disable past dates

I am trying to have a date Range select using the UI date picker. in the from/to field people should not be able to view or select dates previous to the present day. This is my code: $(function() {..

8

answers

utf-8 special characters not displaying

I moved my website from my local test server to NameCheap shared hosting and now I'm running into a problem - some of the pages aren't displaying utf-8 special characters properly (showing question ma..

4

answers

How to redirect Valgrind's output to a file?

While working with Valgrind tool, i need to log the details produced by valgrind tool. How can I accomplish that? I tried something like, valgrind a.out | test and valgrind a.out > test It ..

4

answers

How do I check two or more conditions in one <c:if>?

How do I check two conditions in one <c:if>? I tried this, but it raises an error: <c:if test="${ISAJAX == 0} && ${ISDATE == 0}"> ..

8

answers

How to close Browser Tab After Submitting a Form?

<?php /* ... SQL EXECUTION TO UPDATE DB ... */ ?> <form method = "post" action = "<?=$_SERVER['php_self']?>" onSubmit= "window.close();"> ... <input type="..

4

answers

How to display string that contains HTML in twig template?

How can I display a string that contains HTML tags in twig template? My PHP variable contains this html and text: $word = '<b> a word </b>'; When I do this in my twig template: {{ wor..

27

answers

How can I limit possible inputs in a HTML5 "number" element?

For <input type="number"> element, maxlength is not working. How can I restrict the maxlength for that number element?..

4

answers

Quotation marks inside a string

I need some help from you guys. I have a string name = "john" But I want to save this String name as "john", including ""(quotations) String name = ""john""; String name1 = "[john]" Can some one ..

6

answers

Private vs Protected - Visibility Good-Practice Concern

I've been searching and I know the theoretic difference. public - Any class/function may access the method/property. protected - Only this class and any subclasses may access the method/property. pr..

18

answers

How to call one shell script from another shell script?

I have two shell scripts, a.sh and b.sh. How can I call b.sh from within the shell script a.sh?..

2

answers

How to check if file already exists in the folder

I am trying to copy some files to folder. I am using the following statement to check if the source fie exists If My.Computer.FileSystem.FileExists(fileToCopy) Then But I donot know how to check i..

8

answers

AmazonS3 putObject with InputStream length example

I am uploading a file to S3 using Java - this is what I got so far: AmazonS3 s3 = new AmazonS3Client(new BasicAWSCredentials("XX","YY")); List<Bucket> buckets = s3.listBuckets(); s3.putObject..

5

answers

How to import module when module name has a '-' dash or hyphen in it?

I want to import foo-bar.py. This works: foobar = __import__("foo-bar") This does not: from "foo-bar" import * My question: Is there any way that I can use the above format i.e., from "foo-bar" ..

4

answers

Set variable value to array of strings

I want to set a variable as a string of values. E.g. declare @FirstName char(100) select @FirstName = 'John','Sarah','George' SELECT * FROM Accounts WHERE FirstName in (@FirstName) I'm getting a ..

8

answers

Splitting String and put it on int array

I have to input a string with numbers ex: 1,2,3,4,5. That's a sample of the input, then I have to put that in an array of INT so I can sort it but is not working the way it should work. package array..

21

answers

grant remote access of MySQL database from any IP address

I am aware of this command: GRANT ALL PRIVILEGES ON database.* TO 'user'@'yourremotehost' IDENTIFIED BY 'newpassword'; But then it only allows me to grant a particular IP address to access this rem..

13

answers

Entity Framework is Too Slow. What are my options?

I have followed the "Don't Optimize Prematurely" mantra and coded up my WCF Service using Entity Framework. However, I profiled the performance and Entity Framework is too slow. (My app processes 2 ..

13

answers

htaccess - How to force the client's browser to clear the cache?

For my site I have the following htaccess rules: # BEGIN Gzip <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript ap..

9

answers

How to convert string to Title Case in Python?

Example: HILO -> Hilo new york -> New York SAN FRANCISCO -> San Francisco Is there a library or standard way to perform this task? ..

3

answers

How to save a data.frame in R?

I made a data.frame in R that is not very big, but it takes quite some time to build. I would to save it as a file, which I can than again open in R?..

8

answers

On select change, get data attribute value

The following code returns 'undefined'... $('select').change(function(){ alert($(this).data('id')); }); <select> <option data-id="1">one</option> <option data-id="2"..

5

answers

Rotate camera in Three.js with mouse

I have quite a few objects in my scene so rotating all of them could be a pain. So what is the most easy way to move camera around origin on mouse click and drag? This way all the lights, objects in t..

12

answers

Getting the parent of a directory in Bash

If I have a file path such as... /home/smith/Desktop/Test /home/smith/Desktop/Test/ How do I change the string so it will be the parent directory? e.g. /home/smith/Desktop /home/smith/Desktop/ ..

8

answers

AJAX Mailchimp signup form integration

Is there any way to integrate mailchimp simple (one email input) with AJAX, so there is no page refresh and no redirection to default mailchimp page. This solution doesn't work jQuery Ajax POST not w..

11

answers

File path issues in R using Windows ("Hex digits in character string" error)

I run R on Windows, and have a csv file on the Desktop. I load it as follows, x<-read.csv("C:\Users\surfcat\Desktop\2006_dissimilarity.csv",header=TRUE) but the R gives the following error messa..

3

answers

What does request.getParameter return?

// index.jsp <form method="post" action="backend.jsp"> <input type="text" name="one" /> <input type="submit value="Submit" /> </form> In backend.jsp what does request.getPar..

7

answers

Creating a new dictionary in Python

I want to build a dictionary in Python. However, all the examples that I see are instantiating a dictionary from a list, etc . .. How do I create a new empty dictionary in Python?..

4

answers

Link to a section of a webpage

I want to make a link that when clicked, sends you to a certain line on the page (or another page). I know this is possible, but how do I do it?..

18

answers

Export/import jobs in Jenkins

Is it possible to exchange jobs between 2 different Jenkins'? I'm searching for a way to export/import jobs...

3

answers

Enable & Disable a Div and its elements in Javascript

I am looking for a method to Enable and Disable the div id="dcalc" and Its children. <div id="dcalc" class="nerkheArz" style="left: 50px; top: 150px; wid..

10

answers

Freeze the top row for an html table only (Fixed Table Header Scrolling)

I want to make an html table with the top row frozen (so when you scroll down vertically you can always see it). Is there a clever way to make this happen without javascript? Note that I do NOT nee..

9

answers

How to create a custom exception type in Java?

I would like to create a custom exception in Java, how do I do it? ... try{ ... String word=reader.readLine(); if(word.contains(" ")) /*create custom exception*/ } catch(){ When I create my ..

8

answers

How do you run a SQL Server query from PowerShell?

Is there a way to execute an arbitrary query on a SQL Server using Powershell on my local machine?..

11

answers

jQuery checkbox checked state changed event

I want an event to fire client side when a checkbox is checked / unchecked: $('.checkbox').click(function() { if ($(this).is(':checked')) { // Do stuff } }); Basically I want it to happen f..

16

answers

What dependency is missing for org.springframework.web.bind.annotation.RequestMapping?

What dependency am I missing? I am currently using: <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>3..

5

answers

How to call a stored procedure (with parameters) from another stored procedure without temp table

I have stored procedure A and want to call store procedure B from A by passing a @mydate parameter. Stored procedure B will return a rowset which I can further use in procedure A. I researched this ..

7

answers

Rotating a two-dimensional array in Python

In a program I'm writing the need to rotate a two-dimensional array came up. Searching for the optimal solution I found this impressive one-liner that does the job: rotated = zip(*original[::-1]) I..

11

answers

Example use of "continue" statement in Python?

The definition of the continue statement is: The continue statement continues with the next iteration of the loop. I can't find any good examples of code. Could someone suggest some simple ca..

17

answers

Visual Studio C# IntelliSense not automatically displaying

Just recently, my Visual Studio 2010 stopped displaying IntelliSense suggestions automatically while I am typing. I can still press ctrl+space to get it to work, but it doesn't automatically show a l..

6

answers

How to enable relation view in phpmyadmin

When working in XAMPP with phpmyadmin, after creating a table I have the option to click "relation view" after clicking on the structure tab. See below: However anytime when I create a table with m..

6

answers

How to concat string + i?

for i=1:N f(i) = 'f'+i; end gives an error in MatLab. What's the correct syntax to initialize an array with N strings of the pattern fi? It seems like even this is not working: for i=1:4 f(i)..

6

answers

ValueError: could not convert string to float: id

I'm running the following python script: #!/usr/bin/python import os,sys from scipy import stats import numpy as np f=open('data2.txt', 'r').readlines() N=len(f)-1 for i in range(0,N): w=f[i].s..

11

answers

How to calculate a Mod b in Casio fx-991ES calculator

Does anyone know how to calculate a Mod b in Casio fx-991ES Calculator. Thanks..

3

answers

SQL Error: ORA-00922: missing or invalid option

CREATE TABLE chartered flight(flight_no NUMBER(4) PRIMARY KEY , customer_id NUMBER(6) REFERENCES customer(customer_id) , aircraft_no NUMBER(4) REFERENCES aircraft(aircraft_no) , flight_type VARCHAR2 (..

6

answers

Difference between two dates in Python

I have two different dates and I want to know the difference in days between them. The format of the date is YYYY-MM-DD. I have a function that can ADD or SUBTRACT a given number to a date: def addo..

12

answers

Get HTML5 localStorage keys

I'm just wondering how to get all key values in localStorage. I have tried to retrieve the values with a simple JavaScript loop for (var i=1; i <= localStorage.length; i++) { alert(localSto..

5

answers

How to make Bitmap compress without change the bitmap size?

I use this method to compress an image if(bitmapObject.compress(Bitmap.CompressFormat.PNG, 100, fOut)) { ... } But the image I get is much smaller ( in the dimension ) that was before the com..

7

answers

Php - testing if a radio button is selected and get the value

I'm using php. I'd like to know how can I test if a radio button is selected and get the value? i can test if the radio button is selected but i cannot get the value. I created a button to test this ..

15

answers

Java: String - add character n-times

Is there a simple way to add a character or another String n-times to an existing String? I couldn’t find anything in String, Stringbuilder, etc...

3

answers

Go to next item in ForEach-Object

I have a PowerShell script that does some checks on all Domain Admins in a number of domains. For each user account a number of checks are preformed. When one of them fails the script should go to the..

4

answers

spring autowiring with unique beans: Spring expected single matching bean but found 2

I am trying to autowire some beans (for dependency injection) using Spring for a webapp. One controller bean contains another bean which in turn holds a hashmap of another set of beans. For now the ..

3

answers

Jquery array.push() not working

I have been trying to add variables from a dropdown into an array using Jquery array.push() function but for some odd reason it is not working. Following is the jsFiddle link: http://jsfiddle.net/dKWn..

15

answers

Get current URL/URI without some of $_GET variables

How, in Yii, to get the current page's URL. For example: http://www.yoursite.com/your_yii_application/?lg=pl&id=15 but excluding the $GET_['lg'] (without parsing the string manually)? I mean, ..

7

answers

client denied by server configuration

I try to setup kohana 3 project as virtual host. Config: <VirtualHost *:80> DocumentRoot "D:/Devel/matysart/matysart_dev1" ServerName matysart-one.local ServerAlias www.matysart-one.loca..

3

answers

Send data from javascript to a mysql database

I have this little click counter. I would like to include each click in a mysql table. Can anybody help? var count1 = 0; function countClicks1() { count1 = count1 + 1; document.getElementById("p1").i..

6

answers

How do I check in python if an element of a list is empty?

I have a list like l = [] How do I check if l[i] is empty? l[i] = '' and l[i] = "" dont't work...

4

answers

how to convert numeric to nvarchar in sql command

I need to convert a numeric value to nvarchar in sql command. Can anyone please help me...

5

answers

How do I make this file.sh executable via double click?

First off I'm using Mac. Next, I need to execute this "file.sh" we will call it. Everytime I need to execute it I have to open Terminal and type: cd /Users/Jacob/Documents/folderWithFileInIt bash fi..

2

answers

AttributeError: 'numpy.ndarray' object has no attribute 'append'

I am trying to run the code presented on the second page: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/video-..

6

answers

Set markers for individual points on a line in Matplotlib

I have used Matplotlib to plot lines on a figure. Now I would now like to set the style, specifically the marker, for individual points on the line. How do I do this? To clarify my question, I want t..

6

answers

How to parse a String containing XML in Java and retrieve the value of the root node?

I have XML in the form of a String that contains <message>HELLO!</message> How can I get the String "Hello!" from the XML? It should be ridiculously easy but I am lost. The XML isn't ..

6

answers

Android, landscape only orientation?

How can I make it so the screen orientation is always landscape? Do I need to add something to the manifest.xml?..

8

answers

How to change the name of a Django app?

I have changed the name of an app in Django by renaming its folder, imports and all its references (templates/indexes). But now I get this error when I try to run python manage.py runserver Error: Co..

6

answers

Best HTML5 markup for sidebar

I'm setting up my WordPress sidebars for an HTML5 theme and really wanting to use before_widget and after_widget right. So my question is this: which of the two markup patterns is more appropriate? T..

13

answers

Set type for function parameters?

Is there a way to let a javascript function know that a certain parameter is of a certain type? Being able to do something like this would be perfect: function myFunction(Date myDate, String myStrin..

8

answers

Could not load file or assembly '' or one of its dependencies

Any help please? I have only one library and it is driving me crazy. this is the error that I receive. I am not using any other dependancies. Could not load file or assembly 'FOD.Intranet.Lib, Versi..

8

answers

What is this date format? 2011-08-12T20:17:46.384Z

I have the following date: 2011-08-12T20:17:46.384Z. What format is this? I'm trying to parse it with Java 1.4 via DateFormat.getDateInstance().parse(dateStr) and I'm getting java.text.ParseExc..

3

answers

Where could I buy a valid SSL certificate?

I need to have a valid SSL certificate, by valid I mean not self signed. I don't want my customers to have to deal with the 'exception'. How much does it cost? I'm bit lost because I checked on Veris..

4

answers

Increasing Google Chrome's max-connections-per-server limit to more than 6

As far as I know, at the current moment, late 2011 the max-connections-per-server limit remains 6. Please correct me if I am wrong. This is bad that we cannot fix this easily as in Firefox. As far as ..

12

answers

Why can't I see the "Report Data" window when creating reports?

I'm creating RDLC reports in VS10. When the program is NOT running, I can see the toolbox, and add controls to the report, but the "Report Data" pane is nowhere to be found, so I can't fill the contr..

4

answers

Error: vector does not name a type

I'm having lots of errors in my final project (a poker and black jack sim). I'm using a vector to implement the "hands" in the blackJack class, and I'm using a structured data type declared in another..

6

answers

Swapping pointers in C (char, int)

I have been struggling to understand the different behaviour when swapping pointers in C. If I want to swap two int pointers, then I can do void intSwap (int *pa, int *pb){ int temp = *pa; *p..

7

answers

How to make GREP select only numeric values?

I use the df command in a bash script: df . -B MB | tail -1 | awk {'print $4'} | grep .[0-9]* This script returns: 99% But I need only numbers (to make the next comparison). If I use the grep r..

11

answers

Sequelize.js delete query?

Is there a way to write a delete/deleteAll query like findAll? For example I want to do something like this (assuming MyModel is a Sequelize model...): MyModel.deleteAll({ where: ['some_field != ?',..

4

answers

C# DateTime.ParseExact

I have a tab delimited file which is being parsed and then inserted into a database. When I run into the date column, I have trouble parsing it. The code I have is: var insert = DateTime.ParseExact(..

5

answers

Read a XML (from a string) and get some fields - Problems reading XML

I have this XML (stored in a C# string called myXML) <?xml version="1.0" encoding="utf-16"?> <myDataz xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/..

4

answers

syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

I have been staring at this code for hours now and I cannot figure out where my mistake is. I know this syntax error usually comes up because of some missing or out of place curly brace or some issue ..

5

answers

Accessing session from TWIG template

I've searched a lot on the net how to access the global $_SESSION array from TWIG template and found this: {{app.session.get('index')}}, but when I'm calling it, it returns an empty string. I have a $..

9

answers

How to implement zoom effect for image view in android?

I have to implement image zooming, I have tried with so many codes.But i didnt get full idea of gesture events. I want to implement when we apply double tap, image will be zooming according to the tou..

2

answers

R plot: size and resolution

I have stacked into the question: I need to plot the image with DPI=1200 and specific print size. By default the png looks ok... png("test.png",width=3.25,height=3.25,units="in",res=1200) par(mar=c..

30

answers

How to get current date in jquery?

I want to know how to use the Date() function in jQuery to get the current date in a yyyy/mm/dd format...

11

answers

CSS image resize percentage of itself?

I am trying to resize an img with a percentage of itself. For example, I just want to shrink the image by half by resizing it to 50%. But applying width: 50%; will resize the image to be 50% of the co..

8

answers

JOptionPane Yes or No window

I am trying to create a message with a Yes or No button. Then a window will appear with a certain message that depends on if the user clicked Yes or No. Here is my code: public class test{ pu..

3

answers

setting content between div tags using javascript

I'm trying to set some content in between some div tags on a JSP page using javascript. currently the div tag on the JSP page looks like this: <div id="successAndErrorMessages"></div> ..

8

answers

jQuery - What are differences between $(document).ready and $(window).load?

What are differences between $(document).ready(function(){ //my code here }); and $(window).load(function(){ //my code here }); And I want to make sure that: $(document).ready(function(){ ..