Questions Tagged with #Personalization

Personalization involves using technology to accommodate the differences between individuals, such as greeting the user by name or varying content according to what you know about the user's interests. Personalization implies that the changes are based on implicit data, such as items purchased or pages viewed. The term customization is used instead when the site only uses explicit data such as ratings or preferences.

Vagrant error : Failed to mount folders in Linux guest

I have some issues with Vagrant shared folders, my base system is Ubuntu 13.10 desktop. I do not understand why I have this error is something that is not right configured ? Is a NFS issue or Virtual..

SPA best practices for authentication and session management

When building SPA style applications using frameworks like Angular, Ember, React, etc. what do people believe to be some best practices for authentication and session management? I can think of a coup..

What is considered a good response time for a dynamic, personalized web application?

For a complex web application that includes dynamic content and personalization, what is a good response time from the server (so excluding network latency and browser rendering time)? I'm thinking a..

Create JPA EntityManager without persistence.xml configuration file

Is there a way to initialize the EntityManager without a persistence unit defined? Can you give all the required properties to create an entity manager? I need to create the EntityManager from the use..

How to send a simple email from a Windows batch file?

I'm running Windows 2003 Service Pack 2. I have a batch file that runs on demand. I want to have an email sent every time the batch file runs. The email is simple, just a sentence indicating that the ..

Web API Routing - api/{controller}/{action}/{id} "dysfunctions" api/{controller}/{id}

I have the default Route in Global.asax: RouteTable.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = System.Web.Http.R..

Set start value for column with autoincrement

I have a table Orders with the following fields: Id | SubTotal | Tax | Shipping | DateCreated The Id column is set to autoincrement(1,1). This is to be used in an E-commerce storefront. Sometim..

val() vs. text() for textarea

I am using jQuery, and wondering if I should use val() or text() (or another method) to read and update the content of a textarea. I have tried both and I've had issues with both. When I use text() t..

Python3: ImportError: No module named '_ctypes' when using Value from module multiprocessing

I am using Ubuntu and have installed Python 2.7.5 and 3.4.0. In Python 2.7.5 I am able to successfully assign a variable x = Value('i', 2), but not in 3.4.0. I am getting: Traceback (most recent call..

Find and Replace Inside a Text File from a Bash Command

What's the simplest way to do a find and replace for a given input string, say abc, and replace with another string, say XYZ in file /tmp/file.txt? I am writting an app and using IronPython to execut..

How do I dynamically change the content in an iframe using jquery?

I was wondering if it is possible to have a site with an iframe and some jquery code that changes the iframe content every 30 seconds. The content is in different webpages. Something like this: <..

Comparing strings in Java

Im trying to compare the values of two edittext boxes. What i would like is to just compare passw1 = passw2. As my code is now comparing two strings i have entered as i could not get to compare them. ..

how to play video from url

I am beginner in android development and try to play video from link. But it's giving error "sorry,we can't play this video". I tried so many links but for all links its show same error. My code is t..

How can I insert vertical blank space into an html document?

I am writing a quiz in html and I would like to insert a consistent blank vertical space between questions (like one would use vspace{3 cm} in LaTeX). For example: <html> <body> ..

How do I add an active class to a Link from React Router?

I've created a bootstrap-style sidebar using Link. Here is a snippet of my code: <ul className="sidebar-menu"> <li className="header">MAIN NAVIGATION</li> <li><Link to=..

Finding the index of elements based on a condition using python list comprehension

The following Python code appears to be very long winded when coming from a Matlab background >>> a = [1, 2, 3, 1, 2, 3] >>> [index for index,value in enumerate(a) if value > 2] ..

Equivalent of typedef in C#

Is there a typedef equivalent in C#, or someway to get some sort of similar behaviour? I've done some googling, but everywhere I look seems to be negative. Currently I have a situation similar to the ..

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. ..

How to Maximize window in chrome using webDriver (python)

Is there a way to maximize the chrome browser window using python selenium WebDriver? Note: I am using Chrome Driver 23.0 Any solution on this would be greatly appreciated!..

Objective-C: Reading a file line by line

What is the appropriate way of dealing with large text files in Objective-C? Let's say I need to read each line separately and want to treat each line as an NSString. What is the most efficient way of..

Split a vector into chunks

I have to split a vector into n chunks of equal size in R. I couldn't find any base function to do that. Also Google didn't get me anywhere. Here is what I came up with so far; x <- 1:10 n <- 3 ..

How can I be notified when an element is added to the page?

I want a function of my choosing to run when a DOM element is added to the page. This is in the context of a browser extension, so the webpage runs independently of me and I cannot modify its source. ..

Is there an eval() function in Java?

I have a string like the following: String str = "4*5"; Now I have to get the result of 20 by using the string. I know in some other languages the eval() function will do this. How can I do this i..

Undefined symbols for architecture arm64

I am getting a Apple Mach-O Linker Error everytime I import a file from CocoaPods. Undefined symbols for architecture arm64: "_OBJC_CLASS_$_FBSession", referenced from: someFile ld: symbol(s) not f..

What is the difference between Scala's case class and class?

I searched in Google to find the differences between a case class and a class. Everyone mentions that when you want to do pattern matching on the class, use case class. Otherwise use classes and also ..

iframe to Only Show a Certain Part of the Page

I am working on iframes, and I need to show a certain portion of the page [say, the top right ] in an iframe with about 300px width and 150px height. Example: Say I wanted to put an iframe of www.my..

c++ Read from .csv file

I have this code which is supposed to cout in console the information from the .csv file; while(file.good()) { getline(file, ID, ','); cout << "ID: " << ID << " " ; g..

Create a jTDS connection string

my sql server instance name is MYPC\SQLEXPRESS and I'm trying to create a jTDS connection string to connect to the database 'Blog'. Can anyone please help me accomplish that? I'm trying to do like th..

This compilation unit is not on the build path of a Java project

When I try to use ctrl+space this error is shown: This compilation unit is not on the build path of a Java project. I see that there are similar topics but my work environment is Eclipse and i pul..

ERROR! MySQL manager or server PID file could not be found! QNAP

I am having an issue where MySQL isn't starting on my QNAP NAS. I found this first by not being able to log in through phpMyAdmin - was getting error: #2002 Cannot log in to the MySQL server I th..

CSS content generation before or after 'input' elements

In Firefox 3 and Google Chrome 8.0 the following works as expected: <style type="text/css"> span:before { content: 'span: '; } </style> <span>Test</span> <!-- produces..

Get today date in google appScript

How do I get the Today date on google appscript? I need to write a code to input today´s date in a cell. function changeDate(){ var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(GA..

How to use in jQuery :not and hasClass() to get a specific element without a class

I have this line of code: $('#sitesAccordion .groupOfSites').click(function() { var lastOpenSite = $(this).siblings().hasClass(':not(.closedTab)'); console.log(lastOpenSite); }); I get "fal..

CFLAGS vs CPPFLAGS

I understand that CFLAGS (or CXXFLAGS for C++) are for the compiler, whereas CPPFLAGS is used by the preprocessor. But I still don't understand the difference. I need to specify an include path for ..

Decrypt password created with htpasswd

I created a protection for my web pages with apache2 in ubuntu. Now I am creating an application in c++ and I want it uses the same file that Apache2 uses for authentification, but my problem is that ..

Saving the PuTTY session logging

I am using PuTTY for logging in to Solaris/Linux servers. Under Sessions ? Logging, we see 'Session Logging' settings. I am not able to save the settings for permanent use. Isn't such feature availa..

AngularJS : Factory and Service?

EDIT Jan 2016: Since this still gets attention. Since asking this I've completed a few AngularJS projects, and for those I mostly used factory, built up an object and returned the object at the end. M..

How do I turn a String into a InputStreamReader in java?

How can I transform a String value into an InputStreamReader?..

SQL left join vs multiple tables on FROM line?

Most SQL dialects accept both the following queries: SELECT a.foo, b.foo FROM a, b WHERE a.x = b.x SELECT a.foo, b.foo FROM a LEFT JOIN b ON a.x = b.x Now obviously when you need an outer join, th..

What's the difference between .so, .la and .a library files?

I know an .so file is a kind of dynamic library (lots of threads can share such libraries so there is no need to have more than one copy of it in memory). But what is the difference between .a and .la..

FormData.append("key", "value") is not working

Can you tell me whats wrong with this: var formdata = new FormData(); formdata.append("key", "value"); console.log(formdata); My output looks like this, I cant find my "key" - "value" pair FormDat..

How exactly does the python any() function work?

In the python docs page for any, the equivalent code for the any() function is given as: def any(iterable): for element in iterable: if element: return True return False ..

Check image width and height before upload with Javascript

I have a JPS with a form in which a user can put an image: <div class="photo"> <div>Photo (max 240x240 and 100 kb):</div> <input type="file" name="photo" id="photoInput" ..

Hide HTML element by id

Hopefully there's a quick and dirty way to remove the "Ask Question" (or hide it) from a page where I can only add CSS and Javascript: <div class="nav" style="float: right;"> <ul>..

How to override the path of PHP to use the MAMP path?

After screwing up entirely my PHP configuration on MAC trying to get the SOAP module working (-bash: /usr/bin/php: No such file or directory ....) I now have to use MAMP but each time I have to type t..

How can I manually generate a .pyc file from a .py file

For some reason, I can not depend on Python's "import" statement to generate .pyc file automatically Is there a way to implement a function as following? def py_to_pyc(py_filepath, pyc_filepath): ..

Add a column in a table in HIVE QL

I'm writing a code in HIVE to create a table consisting of 1300 rows and 6 columns: create table test1 as SELECT cd_screen_function, SUM(access_count) AS max_count, MIN(response_time_min) a..

SVN Commit specific files

Is there any way to commit only a list of specific files (e.q. just one of the list of files that SVN wants to commit). I'm working on MAC OS X under Terminal, without any UI...

How to change icon on Google map marker

I want to use my customize icon on Google map, and added icon url on the code. But it's still not reflecting on the map. Can anyone suggest, what i am missing here. Why icon is not changing, after add..

Groovy executing shell commands

Groovy adds the execute method to String to make executing shells fairly easy; println "ls".execute().text but if an error happens, then there is no resulting output. Is there an easy way to get b..

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..

how to Call super constructor in Lombok

I have a class @Value @NonFinal public class A { int x; int y; } I have another class B @Value public class B extends A { int z; } lombok is throwing error saying it cant find A() c..

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 ..

Specifying an Index (Non-Unique Key) Using JPA

How do you define a field, eg email as having an index using JPA annotations. We need a non-unique key on email because there are literally millions of queries on this field per day, and its a bit slo..

How to remove old Docker containers

This question is related to Should I be concerned about excess, non-running, Docker containers?. I'm wondering how to remove old containers. The docker rm 3e552code34a lets you remove a single one, b..

Is there a better way to do optional function parameters in JavaScript?

I've always handled optional parameters in JavaScript like this: function myFunc(requiredArg, optionalArg){ optionalArg = optionalArg || 'defaultValue'; // Do stuff } Is there a better way to ..

How to view an HTML file in the browser with Visual Studio Code

How can I view my HTML code in a browser with the new Microsoft Visual Studio Code? With Notepad++ you have the option to Run in a browser. How can I do the same thing with Visual Studio Code?..

Calculate mean and standard deviation from a vector of samples in C++ using Boost

Is there a way to calculate mean and standard deviation for a vector containing samples using Boost? Or do I have to create an accumulator and feed the vector into it?..

Best way to track onchange as-you-type in input type="text"?

In my experience, input type="text" onchange event usually occurs only after you leave (blur) the control. Is there a way to force browser to trigger onchange every time textfield content changes? If..

Codeigniter $this->input->post() empty while $_POST is working correctly

On a codeigniter installation, I am trying to use the inbuilt $this->input->post('some_data') function, however $this->input->post() is an empty array. A print_r($_POST) gives all the var..

Understanding string reversal via slicing

I was looking for a way to print a string backwards, and after a quick search on google, I found this method: Suppose a is a string variable. This will return the a string backwards: a[::-1] Can a..

Android EditText for password with android:hint

Just noticed that android:password has been deprecated, and we should be using android:inputType. Was experimenting with it by setting in my xml android:inputType="textPassword" Indeed it behaves..

New features in java 7

What new features in java 7 is going to be implemented? And what are they doing now?..

Update query PHP MySQL

Can anybody help me understand why this update query isn't updating the fields in my database? I have this in my php page to retrieve the current values from the database: <?php $query = mysql_..

Get value of a string after last slash in JavaScript

I am already trying for over an hour and cant figure out the right way to do it, although it is probably pretty easy: I have something like this : foo/bar/test.html I would like to use jQuery to ext..

Browse and display files in a git repo without cloning

Is there a way to browse and display files in a git repo without cloning it first? I can do those in svn using the commands: svn ls /path/to/repo svn cat /path/to/repo/file-in-repo I can supposed..

Why docker container exits immediately

I run a container in the background using docker run -d --name hadoop h_Service it exits quickly. But if I run in the foreground, it works fine. I checked logs using docker logs hadoop there wa..

Search and get a line in Python

Is there a way to search, from a string, a line containing another string and retrieve the entire line? For example: string = qwertyuiop asdfghjkl zxcvbnm token qwerty asdfghj..

How to get a value from the last inserted row?

Is there some way to get a value from the last inserted row? I am inserting a row where the PK will automatically increase, and I would like to get this PK. Only the PK is guaranteed to be unique in ..

How to Select Top 100 rows in Oracle?

My requirement is to get each client's latest order, and then get top 100 records. I wrote one query as below to get latest orders for each client. Internal query works fine. But I don't know how to ..

Creating an XmlNode/XmlElement in C# without an XmlDocument?

I have a simple class that essentially just holds some values. I have overridden the ToString() method to return a nice string representation. Now, I want to create a ToXml() method, that will return..

Rails: How does the respond_to block work?

I'm going through the Getting Started with Rails guide and got confused with section 6.7. After generating a scaffold I find the following auto-generated block in my controller: def index @posts = ..

How to gzip all files in all sub-directories into one compressed file in bash

Possible Duplicate: gzipping up a set of directories and creating a tar compressed file This post describes how to gzip each file individually within a directory structure. However, I need ..

Using true and false in C

As far as I can see there are 3 ways to use booleans in c with the bool type, from then using true and false defining using preprocessor #define FALSE 0 ... #define TRUE !(FALSE) Just to use consta..

How to have conditional elements and keep DRY with Facebook React's JSX?

How do I optionally include an element in JSX? Here is an example using a banner that should be in the component if it has been passed in. What I want to avoid is having to duplicate HTML tags in th..

why is <input type="number" maxlength="3"> not working in Safari?

I like to have an input with maximum 3 characters. In Firefox everything works fine I can only write 3 numbers inside the input - but in safari you can write a lot of numbers inside. You can test it ..

How to insert a timestamp in Oracle?

I have an Oracle DB with a timestamp field in it. What is the correct SQL code to insert a timestamp into this field?..

Add column to dataframe with constant value

I have an existing dataframe which I need to add an additional column to which will contain the same value for every row. Existing df: Date, Open, High, Low, Close 01-01-2015, 565, 600, 400, 450 N..

Detecting attribute change of value of an attribute I made

I created an attribute in HTML data-select-content-val and it is stuffed with information dynamically. Is there a way to detect when the attribute's value has changed? $(document).on("change", "div[..

How to fix 'Notice: Undefined index:' in PHP form action

I received the following error message when I tried to submit the content to my form. How may I fix it? Notice: Undefined index: filename in D:\wamp\www\update.php on line 4 Example Update.php c..

Mean Squared Error in Numpy?

Is there a method in numpy for calculating the Mean Squared Error between two matrices? I've tried searching but found none. Is it under a different name? If there isn't, how do you overcome this? D..

github: server certificate verification failed

I just created a github account and a repository therein, but when trying to create a local working copy using the recommende url via git clone https://github.com/<user>/<project>.git I..

jQuery Mobile - back button

I am developing the application using jQuery Mobile 4.1. In my app, I have two html pages like login.html and home.html. In the home.html have 3 pages. () like menupage, searchpage, resultpage. The..

How to use a class from one C# project with another C# project

In the same solution, I have two projects: P1 and P2. How can I make use of a class of P1 in P2?..

Sorting using Comparator- Descending order (User defined classes)

I want to sort my objects in descending order using comparator. class Person { private int age; } Here I want to sort a array of Person objects. How can I do this?..

Difference between two dates in MySQL

How to calculate the difference between two dates, in the format YYYY-MM-DD hh: mm: ss and to get the result in seconds or milliseconds?..

MySQL Select Date Equal to Today

I'm trying to run a mysql select statement where it looks at today's date and only returns results that signed up on that current day. I've currently tried the following, but it doesn't seem to work. ..

Issue with parsing the content from json file with Jackson & message- JsonMappingException -Cannot deserialize as out of START_ARRAY token

Given the following .json file: [ { "name" : "New York", "number" : "732921", "center" : [ "latitude" : 38.895111, "longitude" : -77.03666..

What is the best way to search the Long datatype within an Oracle database?

I am working with an Oracle database that stores HTML as a Long datatype. I would like to query the database to search for a specific string within the HTML data stored in the Long. I tried, "sele..

Add my custom http header to Spring RestTemplate request / extend RestTemplate

My current code: RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); Mall[] malls = restTemplate.getForObject(url, Mall..

How can I add an item to a SelectList in ASP.net MVC

Basically I am looking to insert an item at the beginning of a SelectList with the default value of 0 and the Text Value of " -- Select One --" Something like SelectList list = new SelectList(reposi..

What exactly does the "u" do? "git push -u origin master" vs "git push origin master"

I'm apparently terrible at using git, despite my best attempts to understand it. From kernel.org for git push: -u --set-upstream For every branch that is up to date or successfully pus..

jQuery Mobile: document ready vs. page events

I am using jQuery Mobile, and I am having trouble understanding differences between classic document ready and jQuery Mobile page events. What is the real difference? Why should <!-- language: ..

Hiding the R code in Rmarkdown/knit and just showing the results

In my R Markdown documents, I sometimes want to just generate a report without showing the actual code (specially when I send it to my boss). How can I hide the R code and just show the graph and resu..

substring index range

Code: public class Test { public static void main(String[] args) { String str = "University"; System.out.println(str.substring(4, 7)); } } Output: ers I do not really un..

Getting all selected checkboxes in an array

So I have these checkboxes: <input type="checkbox" name="type" value="4" /> <input type="checkbox" name="type" value="3" /> <input type="checkbox" name="type" value="1" /> <input..

Android Viewpager as Image Slide Gallery

I am using Jake's ViewPageIndicator and want to display Images like a swipe gallery. Any refernce link where i can get started. I have implemented the basic viewpager and now want to implement image v..

Find file in directory from command line

In editors/ides such as eclipse and textmate, there are shortcuts to quickly find a particular file in a project directory. Is there a similar tool to do full path completion on filenames within a di..

Get Android .apk file VersionName or VersionCode WITHOUT installing apk

How can I get programmatically get the version code or version name of my apk from the AndroidManifest.xml file after downloading it and without installing it. <manifest xmlns:android="http://sche..

How to check if a file exists in a shell script

I'd like to write a shell script which checks if a certain file, archived_sensor_data.json, exists, and if so, deletes it. Following http://www.cyberciti.biz/tips/find-out-if-file-exists-with-conditio..

What is `related_name` used for in Django?

What is the related_name argument useful for on ManyToManyField and ForeignKey fields? For example, given the following code, what is the effect of related_name='maps'? class Map(db.Model): membe..

How to change the background color of the options menu?

I'm trying to change the default color for the options menu which is white: I want a black background for every item on the options menu. I've tried some shoots like android:itemBackground="#000000" ..

How to use: while not in

I'm trying to check if a list has no member as boolean operator AND, OR, NOT. I use: while ('AND' and 'OR' and 'NOT') not in list: print 'No boolean operator' However, when my input is: a1 c2 OR..

How can I use async/await at the top level?

I have been going over async/await and after going over several articles, I decided to test things myself. However, I can't seem to wrap my head around why this does not work: async function main() { ..

Oracle ORA-12154: TNS: Could not resolve service name Error?

I am a SQL Server user . I am on a project that is using oracle (which I rarely use) I need to create an ODBC connection so I can access the some data via MS Access I have a application on my machin..

How to Implement DOM Data Binding in JavaScript

Please treat this question as strictly educational. I'm still interested in hearing new answers and ideas to implement this tl;dr How would I implement bi-directional data-binding with JavaScript? ..

Change a Nullable column to NOT NULL with Default Value

I came across an old table today with a datetime column called 'Created' which allows nulls. Now, I'd want to change this so that it is NOT NULL, and also include a constraint to add in a default val..

Deactivate or remove the scrollbar on HTML

I want to de-activate or remove the vertical scrollbar in an HTML page. How to do that ? Thanks...

Selector on background color of TextView

I'm attempting to change the background color of an Android TextView widget when the user touches it. I've created a selector for that purpose, which is stored in res/color/selector.xml and roughly lo..

The most efficient way to implement an integer based power function pow(int, int)

What is the most efficient way given to raise an integer to the power of another integer in C? // 2^3 pow(2,3) == 8 // 5^5 pow(5,5) == 3125 ..

Renaming Column Names in Pandas Groupby function

Q1) I want to do a groupby, SQL-style aggregation and rename the output column: Example dataset: >>> df ID Region count 0 100 Asia 2 1 101 Europe 3 2 102 ..

Why would one omit the close tag?

I keep reading it is poor practice to use the PHP close tag ?> at the end of the file. The header problem seems irrelevant in the following context (and this is the only good argument so far): ..

Throwing exceptions in a PHP Try Catch block

I have a PHP function in a Drupal 6 .module file. I am attempting to run initial variable validations prior to executing more intensive tasks (such as database queries). In C#, I used to implement IF..

Forking / Multi-Threaded Processes | Bash

I would like to make a section of my code more efficient. I'm thinking of making it fork off into multiple processes and have them execute 50/100 times at once, instead of just once. For example (ps..

dynamically set iframe src

I have a program which will dynamically set an iframe src to load pages. I need to hook a event handler for the page completely loaded. How can i do it? Thanks!..

Adb Devices can't find my phone

I am trying to get adb to see my Samsung Fascinate phone so that I can install my Android apps via usb to the phone. I am using osx 10.6.7. When I run "adb devices" it does not list my device and "a..

Who sets response content-type in Spring MVC (@ResponseBody)

I'm having in my Annotation driven Spring MVC Java web application runned on jetty web server (currently in maven jetty plugin). I'm trying to do some AJAX support with one controller method returnin..

Cell Style Alignment on a range

I'm having a problem fromatting cells in an excel sheet. For some reason my code seems to be changing the style of all cells when I just want to change the style of a few specified, or a specified ran..

How to split a string between letters and digits (or between digits and letters)?

I'm trying to work out a way of splitting up a string in java that follows a pattern like so: String a = "123abc345def"; The results from this should be the following: x[0] = "123"; x[1] = "abc"; ..

Symfony2 Setting a default choice field selection

I am creating a form in the following manner: $form = $this->createFormBuilder($breed) ->add('species', 'entity', array( 'class' => 'BFPEduBundle:Item', ..

How to debug on a real device (using Eclipse/ADT)

I'm trying to figure out how to debug applications directly on my phone (HTC Desire). I've installed the USB driver that came with the phone and the phone is listed when using "adb devices". How do ..

How to test android apps in a real device with Android Studio?

I started to develop in android with Android Studio IDE, I tested my apps on the emulator and works fine, but when I tried to test the apps directly in my device doesn't recognize it and the console s..

Are table names in MySQL case sensitive?

Are table names in MySQL case sensitive? On my Windows development machine the code I have is able to query my tables which appear to be all lowercase. When I deploy to the test server in our datacen..

How can I send an email through the UNIX mailx command?

How can I send an email through the UNIX mailx command?..

Select single item from a list

Using LINQ what is the best way to select a single item from a list if the item may not exists in the list? I have come up with two solutions, neither of which I like. I use a where clause to select..

SHA-256 or MD5 for file integrity

I know that SHA-256 is favored over MD5 for security, etc., but, if I am to use a method to only check file integrity (that is, nothing to do with password encryption, etc.), is there any advantage of..

Use Async/Await with Axios in React.js

Following How to use async/await with axios in react I am trying to make a simple get request to my server using Async/Await in a React.js App. The server loads a simple JSON at /data which looks ..

Can angularjs routes have optional parameter values?

Can I set a route with optional params (same template and controller, but some params should be ignored if they don't exist? So instead of writing the following two rules, have only one? module.conf..

What is an MvcHtmlString and when should I use it?

The documentation for MvcHtmlString is not terribly enlightening: Represents an HTML-encoded string that should not be encoded again. It's not clear to me what exactly the implications of this a..

Get last field using awk substr

I am trying to use awk to get the name of a file given the absolute path to the file. For example, when given the input path /home/parent/child/filename I would like to get filename I have tried: aw..

BehaviorSubject vs Observable?

I'm looking into Angular RxJs patterns and I don't understand the difference between a BehaviorSubject and an Observable. From my understanding, a BehaviorSubject is a value that can change over time..

Array Length in Java

I declared an array as shown below: int[] arr = new int[10]; Then I assigned following values to the array: arr[0] = 1; arr[1] = 2; arr[2] = 3; arr[3] = 4; Then I declared and initialized an int..

How to use HTML to print header and footer on every printed page of a document?

Is it possible to print HTML pages with custom headers and footers on each printed page? I'd like to add the word "UNCLASSIFIED" in Red, Arial, size 16pt to the top and bottom of every printed page, ..

java: HashMap<String, int> not working

HashMap<String, int> doesn't seem to work but HashMap<String, Integer> does work. Any ideas why?..

What is the difference between static_cast<> and C style casting?

Is there any reason to prefer static_cast<> over C style casting? Are they equivalent? Is there any sort of speed difference?..

What is the default font of Sublime Text?

I was looking and could not find an answer on this one. Which is Sublime Text's default font type? ..

Groovy / grails how to determine a data type?

What is the best way to determine the data type in groovy? I'd like to format the output differently if it's a date, etc. ..

Select the values of one property on all objects of an array in PowerShell

Let's say we have an array of objects $objects. Let's say these objects have a "Name" property. This is what I want to do $results = @() $objects | %{ $results += $_.Name } This works, but can ..

What's the complete range for Chinese characters in Unicode?

U+4E00..U+9FFF is part of the complete set, but not all..

How to skip the first n rows in sql query

I want to fire a Query "SELECT * FROM TABLE" but select only from row N+1. Any idea on how to do this?..

UICollectionView Set number of columns

I just started learning about UICollectionViews. I'm wondering if anyone knows how to specify the number of columns in a collectionview. The default is set to 3 (iPhone/portrait). I've looked at the d..

Fastest way to flatten / un-flatten nested JSON objects

I threw some code together to flatten and un-flatten complex/nested JSON objects. It works, but it's a bit slow (triggers the 'long script' warning). For the flattened names I want "." as the delimit..

Angular.js vs Knockout.js vs Backbone.js

I am considering to use either Knockout or Angular or Backbone for my personal project. I need to build some bigger, longer-running client-side interactions to go with my server-side stuff. I want ..

Javascript change Div style

I want that part 1 onclick div style changes and part 2 again on click it comes back to normal. I tried doing so but I failed to achieve the part 2 results. Following is the Javascript code functio..

Get element by id - Angular2

I have a code: document.getElementById('loginInput').value = '123'; But while compiling the code I receive following error: Property value does not exist on type HTMLElement. I have declared ..

Center/Set Zoom of Map to cover all visible Markers?

I am setting multiple markers on my map and I can set statically the zoom levels and the center but what I want is, to cover all the markers and zoom as much as possible having all markets visible A..

How can I output leading zeros in Ruby?

I'm outputting a set of numbered files from a Ruby script. The numbers come from incrementing a counter, but to make them sort nicely in the directory, I'd like to use leading zeros in the filenames. ..

C#: How to access an Excel cell?

I am trying to open an Excel file and populate its cells with data? I have done the following coding so far. Currently I am at this stage with the following code but still I am getting errors: Micro..

"Invalid JSON primitive" in Ajax processing

I am getting an error in an ajax call from jQuery. Here is my jQuery function: function DeleteItem(RecordId, UId, XmlName, ItemType, UserProfileId) { var obj = { RecordId: RecordId, ..

android get real path by Uri.getPath()

I'm trying to get image from gallery. Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Selec..

How do I clone a generic list in C#?

I have a generic list of objects in C#, and wish to clone the list. The items within the list are cloneable, but there doesn't seem to be an option to do list.Clone(). Is there an easy way around thi..

How to open every file in a folder

I have a python script parse.py, which in the script open a file, say file1, and then do something maybe print out the total number of characters. filename = 'file1' f = open(filename, 'r') content ..

NSRange from Swift Range?

Problem: NSAttributedString takes an NSRange while I'm using a Swift String that uses Range let text = "Long paragraph saying something goes here!" let textRange = text.startIndex..<text.endIndex ..

Flexbox Not Centering Vertically in IE

I have a simple web page with some Lipsum content that is centered on the page. The page works fine in Chrome and Firefox. If I reduce the size of the window, the content fills the window until it can..

(grep) Regex to match non-ASCII characters?

On Linux, I have a directory with lots of files. Some of them have non-ASCII characters, but they are all valid UTF-8. One program has a bug that prevents it working with non-ASCII filenames, and I ha..

Get values from a listbox on a sheet

I have a listbox named ListBox1 on Sheet1 of an Excel workbook. Every time the user selects one of the items in the list, I need to copy its name to a variable named strLB. So, if I have Value1, Va..

Execute SQL script from command line

I need to alter a database using a batch file, for a simple example, drop a table. I´m using local SQL Express (SQL Server 2008 R2) with user sa and its password. How would the bat file be? How ca..

How to get the start time of a long-running Linux process?

Is it possible to get the start time of an old running process? It seems that ps will report the date (not the time) if it wasn't started today, and only the year if it wasn't started this year. Is th..

Change visibility of ASP.NET label with JavaScript

I have a ASP.NET page with an asp:button that is not visible. I can't turn it visible with JavaScript because it is not rendered to the page. What can I do to resolve this?..

How to get current time in python and break up into year, month, day, hour, minute?

I would like to get the current time in Python and assign them into variables like year, month, day, hour, minute. How can this be done in Python 2.7?..

How to insert current_timestamp into Postgres via python

I need to insert rows into PG one of the fields is date and time with time stamp, this is the time of incident, so I can not use --> current_timestamp function of Postgres at the time of insertion, so..

Clearing the terminal screen?

I'm reading data from 9 different sensors for my robot and I need to display them all steadily, in the same window so I can compare the values and see if any of the readings is off. The problem I'm h..

Python - add PYTHONPATH during command line module run

I want to run: python somescript.py somecommand But, when I run this I need PYTHONPATH to include a certain directory. I can't just add it to my environment variables because the directory I want t..

Text overflow ellipsis on two lines

I know you can use a combination of CSS rules to make text end with ellipsis (...) when it's time to overflow (get out of parent's bounds). Is it possible (feel free to just say, no) to achieve the s..

How to trim a file extension from a String in JavaScript?

For example, assuming that x = filename.jpg, I want to get filename, where filename could be any file name (Let's assume the file name only contains [a-zA-Z0-9-_] to simplify.). I saw x.substring(0, ..

How to replace values at specific indexes of a python list?

If I have a list: to_modify = [5,4,3,2,1,0] And then declare two other lists: indexes = [0,1,3,5] replacements = [0,0,0,0] How can I take to_modify's elements as index to indexes, then set corr..

How to see JavaDoc in IntelliJ IDEA?

I just switched from Eclipse to IntelliJ. IntelliJ lacks one feature from Eclipse - when you put your mouse over a method, Eclipse shows javadoc info. I think the way to show it is to use a shortcut..

Any way to generate ant build.xml file automatically from Eclipse?

From Eclipse, I found I can easily export an Ant build file for my project. It provides references to 3rd party libraries and some base targets. I'm using it from my global build file. The only thing ..

Finding all the subsets of a set

I need an algorithm to find all of the subsets of a set where the number of elements in a set is n. S={1,2,3,4...n} Edit: I am having trouble understanding the answers provided so far. I would like..

DataTables warning: Requested unknown parameter '0' from the data source for row '0'

Does anybody please know, what is wrong with the very simple HTML file below? I am just trying to use an array of objects as the data source for DataTables: tests.html: <html> <head> ..

How to specify multiple conditions in an if statement in javascript

Here is how I mention two conditions if this or this if (Type == 2 && PageCount == 0) || (Type == 2 && PageCount == '') PageCount= document.getElementById('<%=hfPageCount.Clie..

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 ..

How to change the Spyder editor background to dark?

I've just updated Spyder to version 3.1 and I'm having trouble changing the colour scheme to dark. I've been able to change the Python and iPython console's to dark but the option to change the editor..

programmatically add column & rows to WPF Datagrid

I'm new to WPF. I just want to know how should we add columns and rows programmatically to a DataGrid in WPF. The way we used to do it in windows forms. create table columns and rows, and bind it to D..

What is the proper way to comment functions in Python?

Is there a generally accepted way to comment functions in Python? Is the following acceptable? ######################################################### # Create a new user ##########################..

Which MIME type to use for a binary file that's specific to my program?

My program uses its own binary file type, so I assume I can't use MIME type text/plain, as it is not a 7-bit ASCII file. Should I just call it "application/myappname"?..

How to append contents of multiple files into one file

I want to copy the contents of five files to one file as is. I tried doing it using cp for each file. But that overwrites the contents copied from the previous file. I also tried paste -d "\n" 1.txt..

How to enter ssh password using bash?

Everyday I am connecting to a server through ssh. I go through this routine: IC001:Desktop user$ ssh [email protected] [email protected]'s password: Last login: Tue Jun 4 10:09:01 2013 from 0.0...

How to delete columns in numpy.array

I would like to delete selected columns in a numpy.array . This is what I do: n [397]: a = array([[ NaN, 2., 3., NaN], .....: [ 1., 2., 3., 9]]) In [398]: print a [[ NaN 2. 3...

Failed to load AppCompat ActionBar with unknown error in android studio

Below is my xml file. In preview there is two error'Failed to load AppCompat ActionBar with unknown error' & 'Failed to instaniate more than one class'. How ever am able to run the app.But the app..

How to customize a Spinner in Android

I want to add a custom height to the dropdown of a Spinner, say 30dp, and I want to hide the dividers of the dropdown list of Spinner. So far I tried to implement following style to the Spinner: <..

PHP Date Time Current Time Add Minutes

Simple question but this is killing my time. Any simple solution to add 30 minutes to current time in php with GMT+8?..

How to initialize a dict with keys from a list and empty value in Python?

I'd like to get from this: keys = [1,2,3] to this: {1: None, 2: None, 3: None} Is there a pythonic way of doing it? This is an ugly way to do it: >>> keys = [1,2,3] >>> dict(..

Create a file if one doesn't exist - C

I want my program to open a file if it exists, or else create the file. I'm trying the following code but I'm getting a debug assertion at freopen.c. Would I be better off using fclose and then fopen ..

Untrack files from git temporarily

I have setup a local git on my machine. When I initialized git, I added pre-compiled libs and binaries. However, now during my development I don't want to check in those files intermittently. I dont w..

get size of json object

i have a json object that gets returned by an AJAX request and I am having some trouble with the .length because it keeps returning undefined. Just wondering if I'm using it right: console.log(data.l..

Shell script to delete directories older than n days

I have directories named as: 2012-12-12 2012-10-12 2012-08-08 How would I delete the directories that are older than 10 days with a bash shell script?..

Binding value to input in Angular JS

I have input like this <input type="text" name="widget.title" ng-model="widget.title" value="{{widget.title}}"/> I want to change input value dynamically so i use that but it doesn't change t..

laravel the requested url was not found on this server

I've an Ubuntu 14.04 kernel. I was installing my Laravel application in this server. After installing, I tried to set the root directory to public. sudo nano /etc/apache2/sites-available/000-defaul..

Is there any boolean type in Oracle databases?

Is there any Boolean type in Oracle databases, similar to the BIT datatype in Ms SQL Server?..

How do I install jmeter on a Mac?

We want to use JMeter. I've downloaded the production version as directed in the user manual at http://jmeter.apache.org/usermanual/get-started.html But how do I get started and install the software..

Select rows with same id but different value in another column

I tried for hours and read many posts but I still can't figure out how to handle this request: I have a table like this: +------+------+ |ARIDNR|LIEFNR| +------+------+ |1 |A | +------+-----..

Getting rid of \n when using .readlines()

I have a .txt file with values in it. The values are listed like so: Value1 Value2 Value3 Value4 My goal is to put the values in a list. When I do so, the list looks like this: ['Value1\n', 'Valu..

How to change the font color in the textbox in C#?

If I want to upload a text file into the textbox and want to highlight certain words with a font color change, how can I do that without drawing the text? Thank you. ..

Bootstrap close responsive menu "on click"

On "PRODUCTS" click I slide up a white div (as seen in attached). When in responsive (mobile and tablet), I would like to automaticly close the responsive navbar and only show the white bar. I trie..

Get RETURN value from stored procedure in SQL

I have a stored procedure where it ends with a RETURN value of 0 or 1. I want to use this value in an IF statement in another stored procedure. How can I get the return value of the former stored pr..

Jquery - How to make $.post() use contentType=application/json?

I've noticed that when using $.post() in jquery that the default contentType is application/x-www-form-urlencoded - when my asp.net mvc code needs to have contentType=application/json (See this quest..

How to handle command-line arguments in PowerShell

What is the "best" way to handle command-line arguments? It seems like there are several answers on what the "best" way is and as a result I am stuck on how to handle something as simple as: script...

Java split string to array

I need help with the split() method. I have the followingString: String values = "0|0|0|1|||0|1|0|||"; I need to put the values into an array. There are 3 possible strings: "0", "1", and "" My p..

Get environment value in controller

In my .env file I have the following: IMAP_HOSTNAME_TEST=imap.gmail.com [email protected] IMAP_PASSWORD_TEST=mypw Now I would like to use them in my controller. I've tried this, ..

Creating lowpass filter in SciPy - understanding methods and units

I am trying to filter a noisy heart rate signal with python. Because heart rates should never be above about 220 beats per minute, I want to filter out all noise above 220 bpm. I converted 220/minute ..

Saving awk output to variable

Can anyone help me out with this problem? I'm trying to save the awk output into a variable. variable = `ps -ef | grep "port 10 -" | grep -v "grep port 10 -"| awk '{printf "%s", $12}'` printf "$vari..

Laravel orderBy on a relationship

I am looping over all comments posted by the Author of a particular post. foreach($post->user->comments as $comment) { echo "<li>" . $comment->title . " (" . $comment->p..