Questions

deny direct access to a folder and file by htaccess

Here is the scenario: - `index.php`- `index.php``includes`- `submit.php` I want to restrict direct user access to the files in `includes` folder by htaccess. also for `submit.php`. But include will ...

T-SQL query to show table definition?

What is a query that will show me the full definition, including indexes and keys for a SQL Server table? I want a pure query - and know that SQL Studio can give this to me, but I am often on "wild" ...

12 Jun at 12:20

No visible cause for "Unexpected token ILLEGAL"

I'm getting this JavaScript error on my console: > Uncaught SyntaxError: Unexpected token ILLEGAL This is my code: ``` var foo = 'bar';​ ``` It's super simple, as you can see. How could it be ca...

Force SSL/https using .htaccess and mod_rewrite

How can I force to SSL/https using .htaccess and mod_rewrite page specific in PHP.

17 May at 15:18

Most efficient T-SQL way to pad a varchar on the left to a certain length?

As compared to say: ``` REPLICATE(@padchar, @len - LEN(@str)) + @str ```

19 Mar at 01:29

How to wait until a predicate condition becomes true in JavaScript?

I have javascript function like this: ``` function myFunction(number) { var x=number; ... ... more initializations //here need to wait until flag==true while(flag==false) {} ...

How to kill all processes matching a name?

Say I want to kill every process containing the word amarok. I can print out the commands I want to execute. But how do I actually make the shell execute them. ie. ``` ps aux | grep -ie amarok | awk ...

18 Sep at 17:9

Convert Json String to C# Object List

I want to convert a json string to a Object list. Please help me. it would be more helpful if done by `NewtonJson`. I tried, but its not working. I dont want all the values of that json. just which a...

How to get evaluated attributes inside a custom directive

I'm trying to get an attribute from my custom directive, but I can't find the right way of doing it. I've created [this jsFiddle](http://jsfiddle.net/neuTA/1/) to elaborate. ``` <div ng-controller=...

How to lowercase a pandas dataframe string column if it has missing values?

The following code does not work. ``` import pandas as pd import numpy as np df=pd.DataFrame(['ONE','Two', np.nan],columns=['x']) xLower = df["x"].map(lambda x: x.lower()) ``` How should I tweak ...

14 May at 23:34

Get unique values from ArrayList in Java

I have an `ArrayList` with a number of records and one column contains gas names as CO2 CH4 SO2, etc. Now I want to retrieve different gas names(unique) only without repeatation from the `ArrayList`. ...

4 May at 03:58

How to read attribute value from XmlNode in C#?

Suppose I have a XmlNode and I want to get the value of an attribute named "Name". How can I do that? ``` XmlTextReader reader = new XmlTextReader(path); XmlDocument doc = new XmlDocument(); XmlNode...

4 Jun at 16:44

ASP.NET MVC on IIS 7.5 - Error 403.14 Forbidden

I'm running Windows 7 Ultimate (64 bit) using Visual Studio 2010 RC. I recently decided to have VS run/debug my apps on IIS rather than the dev server that comes with it. However, every time I try to ...

9 Aug at 21:54

ElasticSearch: Unassigned Shards, how to fix?

I have an ES cluster with 4 nodes: ``` number_of_replicas: 1 search01 - master: false, data: false search02 - master: true, data: true search03 - master: false, data: true search04 - master: false, d...

9 Aug at 14:43

How to deal with persistent storage (e.g. databases) in Docker

How do people deal with persistent storage for your Docker containers? I am currently using this approach: build the image, e.g. for PostgreSQL, and then start the container with ``` docker run --vo...

22 Oct at 12:19

Test a weekly cron job

I have a `#!/bin/bash` file in cron.week directory. Is there a way to test if it works? Can't wait 1 week I am on Debian 6 with root

31 Dec at 05:8

Get the first key name of a JavaScript object

Let's assume we have the following JavaScript object: ``` ahash = {"one": [1,2,3], "two": [4,5,6]} ``` Is there a function that returns the first key name for the given object? From the example above...

18 Dec at 02:29

Append text to input field

I need to append some text to an input field...

8 May at 20:48

@UniqueConstraint annotation in Java

I have a Java bean. Now, I want to be sure that the field should be unique. I am using the following code: ``` @UniqueConstraint(columnNames={"username"}) public String username; ``` But I'm getti...

29 May at 08:36

Are "from Table1 left join Table2" and "from Table2 right join Table1" interchangeable?

For example, there are two tables: ``` create table Table1 (id int, Name varchar (10)) create table Table2 (id int, Name varchar (10)) ``` Table1 data as follows: ``` Id Name ----------...

2 Jul at 01:9

Android - Package Name convention

For the "Hello World" example in [android.com](http://developer.android.com/resources/tutorials/hello-world.html), the package name is `"package com.example.helloandroid;"` Is there any guideline/sta...

18 May at 11:19

How to add a line to a multiline TextBox?

How can i add a line of text to a [multi-line](http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.multiline%28v=VS.80%29.aspx) [TextBox](http://msdn.microsoft.com/en-us/library/s...

16 Dec at 16:15

How can I compare two dates in PHP?

How can I compare two dates in PHP? The date is stored in the database in the following format > 2011-10-2 If I wanted to compare today's date against the date in the database to see which one is ...

12 Jun at 19:22

How do I filter an array with AngularJS and use a property of the filtered object as the ng-model attribute?

If I have an array of objects, and I want to bind the Angular model to a property of one of the elements based on a filter, how do I do that? I can explain better with a concrete example: HTML: ``` ...

30 Apr at 12:11

Trying to use Spring Boot REST to Read JSON String from POST

Am using the latest version of Spring Boot to read in a sample JSON via Restful Web Service... Here's my pom.xml: ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/P...

28 Mar at 04:31