Questions Tagged with #Zend gdata

The Zend_Gdata component is a PHP 5 interface for accessing Google Data from PHP. The Zend_Gdata component also supports accessing other services implementing the Atom Publishing Protocol.

Is there a max size for POST parameter content?

I'm troubleshooting a Java app where XML is sent between two systems using HTTP POST and Servlet. I suspect that the problem is that the XML is growing way too big. Is it possible that this is the pro..

php search array key and get value

I was wondering what is the best way to search keys in an array and return it's value. Something like array_search but for keys. Would a loop be the best way? Array: Array([20120425] => 409 [20..

Unix command-line JSON parser?

Can anyone recommend a Unix (choose your flavor) JSON parser that could be used to introspect values from a JSON response in a pipeline?..

How to group pandas DataFrame entries by date in a non-unique column

A Pandas DataFrame contains column named "date" that contains non-unique datetime values. I can group the lines in this frame using: data.groupby(data['date']) However, this splits the data by the..

How to get JSON data from the URL (REST API) to UI using jQuery or plain JavaScript?

I have a URL "http://localhost:8888/api/rest/abc" which will give following json data. I wants to get this data in my UI using Jquery or java script. I'm trying this from couple of hours but I'm unabl..

Import an Excel worksheet into Access using VBA

I am attempting to import an Excel spreadsheet into Access using some simple VBA code. The issue I have run into is there are 2 worksheets in the Excel file, and I need the 2nd worksheet to be importe..

How to search for an element in an stl list?

Is there a find() function for list as there was in vector? Is there a way to do that in list?..

Generate random int value from 3 to 6

Is it possible in Microsoft SQL Server generate random int value from Min to Max (3-9 example, 15-99 e.t.c) I know, i can generate from 0 to Max, but how to increase Min border? This query generate ..

How to add link to flash banner

I am primarily a developer and dont know to use Adobe Flash CS4. Is there a simple way to add link to flash banner. I have .flv file with some items in Library and two layers. Please, give me step by ..

How to add certificate chain to keystore?

I have file with chain of certificates - certificate.cer: subject=/C... issuer=/C=US/O=VeriSign, Inc... -----BEGIN CERTIFICATE----- ... -----END CERTIFICATE----- subject=/C=US/O=VeriSign, Inc... i..

Phone Number Validation MVC

I am trying to use a regular expression to validate a phone number and return an error when an invalid number or phone number is submitted. MVC Code: <ol class="row"> <li class="cell" ..

How to truncate text in Angular2?

Is there a way that I could limit the length of the string to a number characters? for e.g: I have to limit a title length to 20 {{ data.title }}. Is there any pipe or filter to limit the length?..

How to generate a random alpha-numeric string

I've been looking for a simple Java algorithm to generate a pseudo-random alpha-numeric string. In my situation it would be used as a unique session/key identifier that would "likely" be unique over ..

why numpy.ndarray is object is not callable in my simple for python loop

I loaded a text file containing a two column matrix (e.g. below) [ 1 3 2 4 3 5 2 0] My calculation is just to sum each row i.e. 1+3, 2+4, 3+5 and 2+0. I am using the below code: da..

How to downgrade from Internet Explorer 11 to Internet Explorer 10?

As a developer, I found the new Internet Explorer version to be a complete nightmare. I turned the windows feature off, but I wasn't able to install Internet Explorer 10. It says that i..

IIS Config Error - This configuration section cannot be used at this path

I am getting the below error when I try to run my website. The website is hosted on Windows 2012 R2. Config error: This configuration section cannot be used at this path. This happens when the sect..

How to stop/kill a query in postgresql?

This question is while postmaster is running your query in the background, how to kill or stop it? For example, your shell or any frontend may be disconnected due to network issue, you cannot use ctr..

Run bash script from Windows PowerShell

In cygwin, I could just do ./ args, but this opens the script file in notepad in PowerShell. What do I need to do have it execute?..

Using wget to recursively fetch a directory with arbitrary files in it

I have a web directory where I store some config files. I'd like to use wget to pull those files down and maintain their current structure. For instance, the remote directory looks like: http://mysit..

Skip first line(field) in loop using CSV file?

Possible Duplicate: When processing CSV data, how do I ignore the first line of data? I am using python to open CSV file. I am using formula loop but I need to skip the first row because it h..

git returns http error 407 from proxy after CONNECT

I have a problem while connecting to github from my PC, using git. System Win 7. I have connection through proxy, so i specified it in git config files (both in general git folder, and in git repo fo..

Execute function after Ajax call is complete

I am new to Ajax and I am attempting to use Ajax while using a for loop. After the Ajax call I am running a function that uses the variables created in the Ajax call. The function only executes two ti..

Position DIV relative to another DIV?

Is it possible to position a DIV relative to another DIV? I imagine this can be done by first placing it inside of the reference DIV, and then using position: relative. However, I can't figure out how..

jQuery `.is(":visible")` not working in Chrome

if ($("#makespan").is(":visible") == true) { var make = $("#make").val(); } else { var make = $("#othermake").val(); } Make:<span id=makespan><select id=make></select><..

How to target only IE (any version) within a stylesheet?

I have an inherited project and there are places where it's an utter mess. This is one of them. I need to target only IE (any version). #nav li { float: left; height: 54px; background: #..

AngularJS : The correct way of binding to a service properties

I’m looking for the best practice of how to bind to a service property in AngularJS. I have worked through multiple examples to understand how to bind to properties in a service that is created usi..

Datatype for storing ip address in SQL Server

What datatype should I choose for storing an IP Address in a SQL Server? By selecting the right datatype would it be easy enough to filter by IP address then?..

Send HTTP POST message in ASP.NET Core using HttpClient PostAsJsonAsync

I want to send dynamic object like new { x = 1, y = 2 }; as body of HTTP POST message. So I try to write var client = new HttpClient(); but I can't find method client.PostAsJsonAsync() So I ..

Extract text from a string

How do I extract the "program name" from a string. The string will look like this : % O0033(SUB RAD MSD 50R III) G91G1X-6.4Z-2.F500 G3I6.4Z-8. G3I6.4 G3R3.2X6.4F500 G91G0Z5. G91G1X-10.4 G..

.substring error: "is not a function"

I don't understand why I get an error message using the substring method to declare a variable. I want to use the first part of the URL in a comparison. Site: This ..

Skip to next iteration in loop vba

I am trying to create a simple conditional loop that will go to the next iteration if a condition is true. The code I have so far is: For i = 2 To 24 Level = Cells(i, 4) Return = Cells(i, 5) ..

Can I apply the required attribute to <select> fields in HTML5?

How can I check if a user has selected something from a <select> field in HTML5? I see <select> doesn't support the new required attribute... do I have to use JavaScript then? Or is the..

How to convert a const char * to std::string

What is the correct/best/simplest way to convert a c-style string to a std::string. The conversion should accept a max_length, and terminate the string at the first \0 char, if this occur before max_..

regex to remove all text before a character

Is there an easy way to remove all chars before a "_"? For example, change 3.04_somename.jpg to somename.jpg. Any suggestions for where to learn to write regex would be great too. Most places I check..

Executing "SELECT ... WHERE ... IN ..." using MySQLdb

I'm having a problem executing some SQL from within Python, despite similar SQL working fine from the mysql command-line. The table looks like this: mysql> SELECT * FROM foo; +-------+-----+ | fo..

App crashing when trying to use RecyclerView on android 5.0

I'm trying to mess with the new RecyclerView and whenever I try to run it, my app immediately crashes. It gives me NullPointerException for trying to access methods from

How do I create variable variables?

How do I accomplish variable variables in Python? Here is an elaborative manual entry, for instance: Variable variables I hear this is a bad idea in general though, and it is a security hole in PHP. I..

How do you remove an invalid remote branch reference from Git?

In my current repo I have the following output: $ git branch -a * master remotes/origin/master remotes/public/master I want to delete remotes/public/master from the branch list: $ git branch -..

Center align a column in twitter bootstrap

I've started learning Bootstrap. My question is how to center align a column horizontally, bootstrap contains 12 column layout, there is no middle number. To be more clear if it was 11 column layout, ..

Find the number of downloads for a particular app in apple appstore

I need to do a market research on specific type of apps. so is there a way for me to know the download count of the app / any app. Is there a way to find the number of downloads for a particular app ..

Calling a function of a module by using its name (a string)

What is the best way to go about calling a function given a string with the function's name in a Python program. For example, let's say that I have a module foo, and I have a string whose content is ..

convert month from name to number

Is there an easy way to change $month = "July"; so that $nmonth = 7 (07 would be fine too). I could do a case statement, but surely there is already a function to convert? EDIT: I wish I could accept..

Difference between map and collect in Ruby?

I have Googled this and got patchy / contradictory opinions - is there actually any difference between doing a map and doing a collect on an array in Ruby/Rails? The docs don't seem to suggest any, ..

How to create a hex dump of file containing only the hex characters without spaces in bash?

How do I create an unmodified hex dump of a binary file in Linux using bash? The od and hexdump commands both insert spaces in the dump and this is not ideal. Is there a way to simply write a long st..

How can I avoid ResultSet is closed exception in Java?

As soon as my code gets to my while( loop it produces the ResultSet is closed exception. What causes this exception and how can I correct for it? EDIT: I notice in my code that I am nesting..

HTML form input tag name element array with JavaScript

This is a two part question. Someone answered a similar question the other day (which also contained info about this type of array in PHP), but I cannot find it. 1.) First off, what is the correct t..

C: How to free nodes in the linked list?

How will I free the nodes allocated in another function? struct node { int data; struct node* next; }; struct node* buildList() { struct node* head = NULL; struct node* second = NULL..

Extract a single (unsigned) integer from a string

I want to extract the digits from a string that contains numbers and letters like: "In My Cart : 11 items" I want to extract the number 11...

Why can't I define my workbook as an object?

Why can't I define a workbook either of these ways? (I have the range bit in there just for a quick test.) How do I fix it? This produces a "Compile Error: Type Mismatch" Sub Setwbk() Dim wbk..

What is REST? Slightly confused

I was under the assumption that REST was a web service but it seems that I am incorrect in thinking this - so, what is REST? I've read through Wikipedia but still cant quite wrap my head around it. W..

Configuring IntelliJ IDEA for unit testing with JUnit

I decided to try out IntelliJ this morning via the trial version and installed the JUnit plugin. I made a new Java project and I want to write a test case for it. How do I add the junit.jar file to m..

How can I force WebKit to redraw/repaint to propagate style changes?

I have some trivial JavaScript to effect a style change: sel = document.getElementById('my_id'); sel.className = sel.className.replace(/item-[1-9]-selected/,'item-1-selected'); return false; This w..

How to SELECT the last 10 rows of an SQL table which has no ID field?

I have an MySQL table with 25000 rows. This is an imported CSV file so I want to look at the last ten rows to make sure it imported everything. However, since there is no ID column, I can't say: SE..

What's the name for hyphen-separated case?

This is PascalCase: SomeSymbol This is camelCase: someSymbol This is snake_case: some_symbol So my questions is whether there is a widely accepted name for this: some-symbol? It's commonly used in ..

How to test the type of a thrown exception in Jest

I'm working with some code where I need to test the type of an exception thrown by a function (is it TypeError, ReferenceError, etc.?). My current testing framework is AVA and I can test it as a secon..

Can I use tcpdump to get HTTP requests, response header and response body?

I am using tcpdump to get HTTP data by executing the below command: sudo tcpdump -A -s 1492 dst port 80 The result of above command: Headers, I think request and response headers. Unread..

Just what is an IntPtr exactly?

Through using IntelliSense and looking at other people's code, I have come across this IntPtr type; every time it has needed to be used I have simply put null or IntPtr.Zero and found most functions t..

How to extract text from the PDF document?

How to extract text from the PDF document using PHP? (I can't use other tools, I don't have root access) I've found some functions working for plain text, but they don't handle well Unicode characte..

How to run server written in js with Node.js

I have installed node.js from here . in my windows8 machine. copied the example server code in my server.js file var http = require('http'); http.createServer(function (req, res)..

Application Installation Failed in Android Studio

Yesterday my app was running perfect from Android Studio but today when I started working on my app and running it i am getting error message continuously Installation failed with message Failed t..

What does DIM stand for in Visual Basic and BASIC?

What does DIM stand for in Visual Basic? ..

Check if Variable is Empty - Angular 2

How can one check if a variable is empty in Angular 2? I know that there are native ways such as if (myVar === null) {do stuff} but I am looking for something like Angular 1 had such as if (angu..

Deep copy an array in Angular 2 + TypeScript

I have an array of objects that is an input. Lets call it content. When trying to deep copy it, it still has a reference to the previous array. I need to duplicate that input array, and change one p..

Write variable to a file in Ansible

I am pulling JSON via the URI module and want to write the received content out to a file. I am able to get the content and output it to the debugger so I know the content has been received, but I do..

Binding an enum to a WinForms combo box, and then setting it

a lot of people have answered the question of how to bind an enum to a combo box in WinForms. Its like this: comboBox1.DataSource = Enum.GetValues(typeof(MyEnum)); But that is pretty useless withou..

increment date by one month

Let's say I have a date in the following format: 2010-12-11 (year-mon-day) With PHP, I want to increment the date by one month, and I want the year to be automatically incremented, if necessary (i.e...

A cron job for rails: best practices?

What's the best way to run scheduled tasks in a Rails environment? Script/runner? Rake? I would like to run the task every few minutes...

Div not expanding even with content inside

I have a stack of divs inside of each other, all of which have an ID which specifies CSS only. But for some reason the surrounding DIV tag only expands to it's anointed height value, and not it's def..

Write objects into file with Node.js

I've searched all over stackoverflow / google for this, but can't seem to figure it out. I'm scraping social media links of a given URL page, and the function returns an object with a list of URLs. ..

Add Whatsapp function to website, like sms, tel

I have a website that a lot of people view on mobile. I have link for : Call and SMS and I want to add one for Whatsapp, so a user can click the whatsapp link I create and start a conversation with me..

Implementing IDisposable correctly

In my classes I implement IDisposable as follows: public class User : IDisposable { public int id { get; protected set; } public string name { get; protected set; } public string pass { ge..

How do I sleep for a millisecond in Perl?

How do I sleep for shorter than a second in Perl?..

Foreach value from POST from form

I post some data over to another page from a form. It's a shopping cart, and the form that's being submitted is being generated on the page before depending on how many items are in the cart. For exam..

Where does pip install its packages?

I activated a virtualenv which has pip installed. I did pip3 install Django==1.8 and Django successfully downloaded. Now, I want to open up the Django folder. Where is the folder located? Normally it..

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)

I'm getting this error ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2) even though I have managed to start mysql via command line in ubuntu ..

Turning multi-line string into single comma-separated

Let's say I have the following string: something1: +12.0 (some unnecessary trailing data (this must go)) something2: +15.5 (some more unnecessary trailing data) something4: +9.0 (some ..

Replacing a character from a certain index

How can I replace a character in a string from a certain index? For example, I want to get the middle character from a string, like abc, and if the character is not equal to the character the user spe..

GROUP BY to combine/concat a column

I have a table as follow: ID User Activity PageURL 1 Me act1 ab 2 Me act1 cd 3 You act2 xy 4 You act2 st I want to group by User and Activi..

Check if all values in list are greater than a certain number

my_list1 = [30,34,56] my_list2 = [29,500,43] How to I check if all values in list are >= 30? my_list1 should work and my_list2 should not. The only thing I could think of doing was: boolean = 0 de..

Bootstrap Modal Backdrop Remaining

I am showing a Bootstrap modal window for loading when performing AJAX calls. I broadcast a "progress.init" event when the loading modal should show and a "progress.finish" when I want the modal to hi..

Static Classes In Java

Is there anything like static class in java? What is the meaning of such a class. Do all the methods of the static class need to be static too? Is it required the other way round, that if a class co..

How to select some rows with specific rownames from a dataframe?

I have a data frame with several rows. I want to select some rows with specific rownames (such as stu2,stu3,stu5,stu9) from this dataframe. The input example dataframe is as follows: attr1 at..

Session variables not working php

Here are the code of my login page where the login script checks for the authenticity of the user and then redirects to inbox page using header function. <?php session_start(); include_once('conf..

Python Write bytes to file

I have a function that returns a string. The string contains carriage returns and new line feeds (0x0D, 0x0A). However when I write to a file it contains only the new line feeds. Is there a way to get..

Using grep to help subset a data frame in R

I am having trouble subsetting my data. I want the data subsetted on column x, where the first 3 characters begin G45. My data frame: x <- c("G448", "G459", "G479", "G406") y <- c(1:4) M..

Unit test naming best practices

What are the best practices for naming unit test classes and test methods? This was discussed on SO before, at What are some popular naming conventions for Unit Tests? I don't know if this is a very..

Which one is the best PDF-API for PHP?

Which one of these is the best PDF-API for PHP? ApacheFOP dompdf FPDF html2ps mPDF PDFlib TCPDF wkhtmltopdf Zend_Pdf ..

Is it possible to use std::string in a constexpr?

Using C++11, Ubuntu 14.04, GCC default toolchain. This code fails: constexpr std::string constString = "constString"; error: the type ‘const string {aka const std::basic_string}’ of const..

Format Date output in JSF

If #{myBean.birthdate} is of java.util.Calendar or java.util.Date type, can I possibly format this inside the EL itself using an existing function perhaps, with the output of like the one produced by ..

Hide Button After Click (With Existing Form on Page)

I am trying to hide a button (not inside form tags) after it has been clicked. Below is the existing code. All solutions I have tried either break the functionality or interfere with the form on the p..

How to get the html of a div on another page with jQuery ajax?

I'm using jQuery's ajax code to load new pages, but wanted him to get only the html of a div. My codes: HTML: <body> <div id="content"></div> </body> Script: $.ajax({ ..

Returning unique_ptr from functions

unique_ptr<T> does not allow copy construction, instead it supports move semantics. Yet, I can return a unique_ptr<T> from a function and assign the returned value to a variable. #include..

How can you debug a CORS request with cURL?

How can you debug CORS requests using cURL? So far I couldn't find any way to "simulate" the preflight request ...

Unable to send email using Gmail SMTP server through PHPMailer, getting error: SMTP AUTH is required for message submission on port 587. How to fix?

I would like to send an email using Gmail SMTP server through PHP Mailer. this is my code <?php require_once('class.phpmailer.php'); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->CharSe..

VS Code - Search for text in all files in a directory

Is there a way to search for text in all files in a directory using VS Code? I.e., if I type "find this" in my search, it will search through all the files in the current directory and return the fil..

Change Primary Key

I have a table in Oracle which has following schema: City_ID Name State Country BuildTime Time When I declared the table my primary key was both City_ID and the BuildTime, but now I want to chan..

JavaScript: Alert.Show(message) From ASP.NET Code-behind

I am reading this JavaScript: Alert.Show(message) From ASP.NET Code-behind I am trying to implement the same. So I created a static class like this: using System; using System.Collections.Generic; u..

Find duplicate characters in a String and count the number of occurances using Java

How can I find the number of occurrences of a character in a string? For example: The quick brown fox jumped over the lazy dog. Some example outputs are below, 'a' = 1 'o' = 4 'space' = 8 '.' = 1 ..

Can I have a video with transparent background using HTML5 video tag?

We filmed a spokesperson on a green screen and have the video files ready in multiple formats. With Flash we could use the wmode transparent within the param and embed tags, but is there something s..

GitLab git user password

I have just installed GitLab. I created a project called project-x. I have created few users and assigned it to the project. Now I tried to clone: git clone [email protected]:project-x.git It p..

Make Div overlay ENTIRE page (not just viewport)?

So I have a problem that I think is quite common but I have yet to find a good solution for. I want to make an overlay div cover the ENTIRE page... NOT just the viewport. I don't understand why this..

Stacking DIVs on top of each other?

Is it possible to stack up multiple DIVs like: <div> <div></div> <div></div> <div></div> <div></div> </div> So that all those inner DIVs ..

How can I convert a cv::Mat to a gray scale in OpenCv?

How can I convert a cv::Mat to a gray scale? I am trying to run drawKeyPoints func from opencv, however I have been getting an Assertion Filed error. My guess is that it needs to receive a gray scale..

Golang append an item to a slice

Why does the slice a remain the same? Does append() generate a new slice? package main import ( "fmt" ) var a = make([]int, 7, 8) func Test(slice []int) { slice = append(slice, 100) fm..

Entity Framework (EF) Code First Cascade Delete for One-to-Zero-or-One relationship

Following the "Code First Modeling" section of the Pluralsight "Getting Started with Entity Framework 5" course by Julie Lerman, I created two POCO classes with a one-to-zero-or-one relationship: a pa..

XMLHttpRequest cannot load file. Cross origin requests are only supported for HTTP

I am getting the following error: XMLHttpRequest cannot load file:///C:/Users/richa.agiwal/Desktop/get/rm_Library/templates/template_viewSettings.html. Cross origin requests are only supported for HT..

Executing another application from Java

I need to execute a batch file which executes another Java application. I don't care whether it executes successfully or not and I don't have to capture any errors. Is it possible to do this with Pro..

Copy values from one column to another in the same table

How can I make a copy values from one column to another? I have: Database name: list number | test 123456 | somedata 123486 | somedata1 232344 | 34 I want to have: Database name: list number | tes..

Populate a datagridview with sql query results

I'm trying to present query results, but I keep getting a blank data grid. It's like the data itself is not visible Here is my code: private void Employee_Report_Load(object sender, EventArgs e) ..

MySQL match() against() - order by relevance and column?

Okay, so I'm trying to make a full text search in multiple columns, something simple like this: SELECT * FROM pages WHERE MATCH(head, body) AGAINST('some words' IN BOOLEAN MODE) Now i want to order..

Using XAMPP, how do I swap out PHP 5.3 for PHP 5.2?

I'm using XAMPP 1.7.2, but need to swap out PHP 5.3 for PHP 5.2 - how do I do this?..

How do I replace a character in a string in Java?

Using Java, I want to go through the lines of a text and replace all ampersand symbols (&) with the XML entity reference &amp;. I scan the lines of the text and then each word in the text wit..

How to redirect all HTTP requests to HTTPS

I'm trying to redirect all insecure HTTP requests on my site (e.g. to HTTPS ( I'm using PHP btw. Can I do this in .htaccess?..

Create Hyperlink in Slack

Is there a way to create a hyperlink without it auto resolving? I simply want some text I type to be clickable to some url when I post in slack. I don't see a way to do this yet...

Output ("echo") a variable to a text file

I'm running a PowerShell script against many servers, and it is logging output to a text file. I'd like to capture the server the script is currently running on. So far I have: $file = "\\server\sha..

How to open a website when a Button is clicked in Android application?

I am designing an app, with several button for users to click on. Once button is clicked, user is directed to appropriate website. How do I accomplish this?..

The entity name must immediately follow the '&' in the entity reference

I want to put a packman game on my *.xhtml page.(I am using jsf 2 and primefaces 3.5) However, when I "translated" the html page in xhtml I get an error at this script: <script> var ..

How to get a .csv file into R?

I have this .csv file: ID,GRADES,GPA,Teacher,State 3,"C",2,"Teacher3","MA" 1,"A",4,"Teacher1","California" And what I want to do is read in the file using the R statistical software and read in t..

Entity Framework code first unique column

I am using Entity Framework 4.3 and using Code Fist. I have a class public class User { public int UserId{get;set;} public string UserName{get;set;} } How do I tell Entity Framework that Us..

scp (secure copy) to ec2 instance without password

I have an EC2 instance running (FreeBSD 9 AMI ami-8cce3fe5), and I can ssh into it using my amazon-created key file without password prompt, no problem. However, when I want to copy a file to the ins..

How can I quickly and easily convert spreadsheet data to JSON?

I want to convert spreadsheet data (such as from Excel/*.xls files or Open Office, etc.) to JSON files. What is the easiest way to accomplish this?..

Angularjs - ng-cloak/ng-show elements blink

I have an issue in angular.js with directive/class ng-cloak or ng-show. Chrome works fine, but Firefox is causing blink of elements with ng-cloak or ng-show. IMHO it's caused by the converting ng-clo..

Simple calculations for working with lat/lon and km distance?

Is there a simple calculation I can do which will convert km into a value which I can add to a lat or lon float to calculate a bounding box for searches? It doesn't need to be completely accurate. Fo..

Convert to absolute value in Objective-C

How do I convert a negative number to an absolute value in Objective-C? i.e. -10 becomes 10?..

How can I return the difference between two lists?

I have two array lists e.g. List<Date> a; contains : 10/10/2014, 10/11/2016 List<Date> b; contains : 10/10/2016 How can i do a check between list a and b so the value that is missing ..

Mongodb service won't start

I am not sure why, and the service was working fine just yesterday, all of a sudden I can not get MongoDB to start up. [root@purr ~]# service mongod start Starting mongod: Thu Aug 29 23:26:07.550 Th..

Django: multiple models in one template using forms

I'm building a support ticket tracking app and have a few models I'd like to create from one page. Tickets belong to a Customer via a ForeignKey. Notes belong to Tickets via a ForeignKey as well. I'd ..

What strategies and tools are useful for finding memory leaks in .NET?

I wrote C++ for 10 years. I encountered memory problems, but they could be fixed with a reasonable amount of effort. For the last couple of years I've been writing C#. I find I still get lots of memo..

How to Get a Sublist in C#

I have a List<String> and i need to take a sublist out of this list. Is there any methods of List available for this in .NET 3.5?..

How to include a Font Awesome icon in React's render()

Whenever I try to use a Font Awesome icon in React's render(), it isn't displayed on the resulting web page although it works in normal HTML. render: function() { return <div><i class="f..

SQL Stored Procedure set variables using SELECT

I have a stored procedure in SQL Server 2005 with multiple variables and I want to set the values of these variables using a select statement. All three variables come from a same table and there shou..

What's the difference between setWebViewClient vs. setWebChromeClient?

What's the difference between setWebViewClient vs. setWebChromeClient in Android?..

"python" not recognized as a command

I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is..

Possible to restore a backup of SQL Server 2014 on SQL Server 2012?

I know that you can't (at least not easily) restore a SQL Server 2012 backup on SQL Server 2008. But how does it work for SQL Server 2014 to SQL Server 2012 ? On database level there is the property ..

Console.WriteLine and generic List

I frequently find myself writing code like this: List<int> list = new List<int> { 1, 3, 5 }; foreach (int i in list) { Console.Write("{0}\t", i.ToString()); } Console.WriteLine(); B..

Auto-refreshing div with jQuery - setTimeout or another method?

How exactly do you make an auto-refreshing div with JavaScript (specifically, jQuery)? I know about the setTimeout method, but is it really a good practice ? Is there a better method? function updat..

How to center and crop an image to always appear in square shape with CSS?

I need to always crop a random-sized image to a square 160x160 using only CSS. The images should stay centered when cropped. My markup should be: <a href="#" class="cropper"> <img src="i..

How to determine the longest increasing subsequence using dynamic programming?

I have a set of integers. I want to find the longest increasing subsequence of that set using dynamic programming...

Rewrite URL after redirecting 404 error htaccess

So I know this may seem a little strange but I for sake of consistency, I would like all my urls to appear in this form: So far I have gotten the regular pages working but I ca..

Laravel back button

I am trying to create a simple back button on a page. The user can arrive to this page from two different pages so I would like to know from which page he arrived. Is that possible?..

Warning message: In `...` : invalid factor level, NA generated

I don't understand why I got this warning message. > fixed <- data.frame("Type" = character(3), "Amount" = numeric(3)) > fixed[1, ] <- c("lunch", 100) Warning message: In `[<-.factor`(..

Bash scripting missing ']'

I am getting an error ./ line 13: [: missing `]' in the file I tried using brackets and other options such as -a or by checking the size of the file p1 but the error is always there an..

Debugging JavaScript in IE7

I need to debug JavaScript in Internet Explorer 7. Unfortunately, its default debugger doesn't provide me with much information. It tells me the page that the error showed up on (not the specific scri..

Plot a horizontal line using matplotlib

I have used spline interpolation to smooth a time series and would also like to add a horizontal line to the plot. But there seems to be an issue that is out of my grips. Any assistance would be reall..

How to call an element in a numpy array?

This is a really simple question, but I didnt find the answer. How to call an element in an numpy array? import numpy as np arr = np.array([[1,2,3,4,5],[6,7,8,9,10]]) print arr(0,0) The code abov..

(WAMP/XAMP) send Mail using SMTP localhost

How to send mail from localhost SMTP (using Wamp,Xampp or etc..)? PHP mail() doesn't seem to work natively. Can anybody give the instructions?..

how to add lines to existing file using python

I already created a txt file using python with a few lines of text that will be read by a simple program. However, I am having some trouble reopening the file and writing additional lines in the file ..

Interview Question: Merge two sorted singly linked lists without creating new nodes

This is a programming question asked during a written test for an interview. "You have two singly linked lists that are already sorted, you have to merge them and return a the head of the new list wi..

How do you create a read-only user in PostgreSQL?

I'd like to create a user in PostgreSQL that can only do SELECTs from a particular database. In MySQL the command would be: GRANT SELECT ON mydb.* TO 'xxx'@'%' IDENTIFIED BY 'yyy'; What is the equi..

LEFT JOIN only first row

I read many threads about getting only the first row of a left join, but, for some reason, this does not work for me. Here is my structure (simplified of course) Feeds id | title | content -------..

Alternative for frames in html5 using iframes

I am new to HTML5 and I have done some research and found out that the use of <frameset> is outdated and from what I read <iframes> are not. So can someone help me, I want to obtain the sa..

Continuous Integration vs. Continuous Delivery vs. Continuous Deployment

What's the difference between these three terms? My university provides the following definitions: Continuous Integration basically just means that the developer's working copies are synchronized wit..

Unique constraint violation during insert: why? (Oracle)

I'm trying to create a new row in a table. There are two constraints on the table -- one is on the key field (DB_ID), the other constrains a value to be one of several the the field ENV. When I do a..

How to push elements in JSON from javascript array

I want to add javascript array values into JSON values object. The other element is also replaced my element like recipients, subject, message. I got Json like: Below is my code. var BODY = { ..

Add Bean Programmatically to Spring Web App Context

Because of a plug-in architecture, I'm trying to add a bean programmatically to my webapp. I have a Spring bean created through the @Component annotation, and i am implementing the ApplicationContext..

postgresql return 0 if returned value is null

I have a query that returns avg(price) select avg(price) from( select *, cume_dist() OVER (ORDER BY price desc) from web_price_scan where listing_Type='AARM' and u_kbalikepart..

How to add image that is on my computer to a site in css or html?

I have an image that I made in photoshop on my computer and I was wondering if there is a way to add the image to my website with CSS or HTML without having to image on a website. Thanks...

Dynamically create and submit form

Is there a way in jQuery to create and submit a form on the fly. Something like below. <html> <head> <title> Title Text Goes Here </title> <script src="http://..

How to get memory available or used in C#

How can I get the available RAM or memory used by the application? ..

What does += mean in Python?

I see code like this for example in Python: if cnt > 0 and len(aStr) > 1: while cnt > 0: aStr = aStr[1:]+aStr[0] cnt += 1 What does th..

Creating a new directory in C

I want to write a program that checks for the existence of a directory; if that directory does not exist then it creates the directory and a log file inside of it, but if the directory already exists,..

python how to "negate" value : if true return false, if false return true

if myval == 0: nyval=1 if myval == 1: nyval=0 Is there a better way to do a toggle in python, like a nyvalue = not myval ?..

What is the --save option for npm install?

I saw some tutorial where the command was: npm install --save What does the --save option mean? Not able to find the answer on Google...

How to get base url in CodeIgniter 2.*

In config.php $config['base_url'] = 'http://localhost/codeigniter/'; In View <link rel="stylesheet" href="<?php base_url(); ?>css/default.css" type="text/css" /> => Error: Call ..

How do I enumerate the properties of a JavaScript object?

How do I enumerate the properties of a JavaScript object? I actually want to list all the defined variables and their values, but I've learned that defining a variable actually creates a property of ..

setInterval in a React app

I'm still fairly new at React, but I've been grinding along slowly and I've encountered something I'm stuck on. I am trying to build a "timer" component in React, and to be honest I don't know if I'..

'router-outlet' is not a known element

I have a mvc 5 project with a angular frontend . I wanted to add routing as described in this tutorial So in my _Layout.cshtml I added a <base href="/"> and ..

iOS Launching Settings -> Restrictions URL Scheme

I've recently discovered the awesome iOS5 custom Settings URL Scheme, which can be explained in detail at this great website. I've found this to work, directing the user to the Settings app from my a..

cpp / c++ get pointer value or depointerize pointer

I was wondering if it's possible to make a pointer not a pointer.. The problem is I have a function that accepts a pointer for an paramater for me to easily get a value to that pointer. It's a simple..

Android Notification Sound

I've used the newer NotificationCompat builder and I can't get the notification to make a sound. It will vibrate and flash the light. The android documentation says to set a style which I've done with..

bind/unbind service example (android)

can you give me a simple example of an application with background service which uses bind/unbind methods to start and stop it? I was googling for it for a half-hour, but those examples use startServi..

Get first and last day of month using threeten, LocalDate

I have a LocalDate which needs to get the first and last day of the month. How do I do that? eg. 13/2/2014 I need to get 1/2/2014 and 28/2/2014 in LocalDate formats. Using threeten LocalDate class...

DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled

While importing the database in mysql, I have got following error: 1418 (HY000) at line 10185: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging..

Property 'catch' does not exist on type 'Observable<any>'

On the Angular 2 documentation page for using the Http service, there is an example. getHeroes (): Observable<Stuff[]> { return this.http.get(this.url) .map(this.extractData..

The PowerShell -and conditional operator

Either I do not understand the documentation on MSDN or the documentation is incorrect. if($user_sam -ne "" -and $user_case -ne "") { Write-Host "Waaay! Both vars have values!" } else { Write..

Why do I get an error instantiating an interface?

I have a class and an interface, and when I try to instantiate the interface, I get an error: Cannot create an instance of the abstract class or interface My code is below: namespace MyNamespac..

Clear all fields in a form upon going back with browser back button

I need a way to clear all the fields within a form when a user uses the browser back button. Right now, the browser remembers all the last values and displays them when you go back. More clarificatio..

Appending a line to a file only if it does not already exist

I need to add the following line to the end of a config file: include "/configs/projectname.conf" to a file called lighttpd.conf I am looking into using sed to do this, but I can't work out how. ..

How can I parse a YAML file in Python

How can I parse a YAML file in Python?..

If file exists then delete the file

I have a vbscript that is used to rename files. What I need to implement into the script is something that deletes the "new file" if it already exists. For example: I have a batch of files that are ..

Linq UNION query to select two elements

I want to select 2 elements from my database table using LINQ query and I saw an example which use UNION I don't have much experience but I think that maybe this is what I need but I get an error whic..

Changing the resolution of a VNC session in linux

I use VNC to connect to a Linux workstation at work. At work I have a 20" monitor that runs at 1600x1200, while at home I use my laptop with its resolution of 1440x900. If I set the vncserver to run ..

firefox proxy settings via command line

How do I change Firefox Proxy settings via command line on windows xp/2k? Thanks..

Get the value of a dropdown in jQuery

I have a drop down that has an 'ID, Name' Pair. Example Jon Miller Jim Smith Jen Morsin Jon MIller has ID of 101 Jim Smith has ID of 102 Jen Morsin has ID of 103 When I do the followng: var arNam..

How to get tf.exe (TFS command line client)?

What's the minimum amount of software I need to install to get the 'tf.exe' program?..

How to get current timestamp in milliseconds since 1970 just the way Java gets

In Java, we can use System.currentTimeMillis() to get the current timestamp in Milliseconds since epoch time which is - the difference, measured in milliseconds, between the current time and mid..

Firing a Keyboard Event in Safari, using JavaScript

I'm trying to simulate a keyboard event in Safari using JavaScript. I have tried this: var event = document.createEvent("KeyboardEvent"); event.initKeyboardEvent("keypress", true, true, null, false,..

Color text in terminal applications in UNIX

I started to write a terminal text editor, something like the first text editors for UNIX, such as vi. My only goal is to have a good time, but I want to be able to show text in color, so I can have s..

How can I implement static methods on an interface?

I have a 3rd party C++ DLL that I call from C#. The methods are static. I want to abstract it out to do some unit testing so I created an interface with the static methods in it but now my program e..

How to include layout inside layout?

How to include layout inside layout in Android? I am creating common layout. I want to include that layout in another page...

How to resize the jQuery DatePicker control

I'm using the jQuery DatePicker control for the first time. I've got it working on my form, but it's about twice as big as I would like, and about 1.5 times as big as the demo on the jQuery UI page. I..

How do I install Composer on a shared hosting?

I have these things: the file ftp access cPanel Cron jobs on FreeBSD PHP, Perl, CGI-BIN, Python, Curl. How can I install Composer? (..

How do I translate an ISO 8601 datetime string into a Python datetime object?

I'm getting a datetime string in a format like "2009-05-28T16:15:00" (this is ISO 8601, I believe). One hackish option seems to be to parse the string using time.strptime and passing the first six ele..

How to get phpmyadmin username and password

I have intalled phpmyadmin recently in my system. Now I lost its username and password. I tried the below methods for login. in etc/phpmyadmin/ I activated the AllowNoPassword $cfg[..

How to know installed Oracle Client is 32 bit or 64 bit?

OS: Windows 2008 Server R2 Oracle Client: 11.2 Many Thanks..

Remove Server Response Header IIS7

Is there any way to remove "Server" response header from IIS7? There are some articles showing that using HttpModules we can achieve the same thing. This will be helpful if we don't have admin right t..

How to thoroughly purge and reinstall postgresql on ubuntu?

Somehow I've managed to completely bugger the install of postgresql on Ubuntu karmic. I want to start over from scratch, but when I "purge" the package with apt-get it still leaves traces behind such..

What is the @Html.DisplayFor syntax for?

I understand that in Razor, @Html does a bunch of neat things, like generate HTML for links, inputs, etc. But I don't get the DisplayFor function... Why would I write: @Html.DisplayFor(model => ..

Twitter bootstrap hide element on small devices

I have this code: <footer class="row"> <nav class="col-sm-3"> <ul class="list-unstyled"> <li>Text 1</li> <li>Text 2</li> <li>Te..

(XML) The markup in the document following the root element must be well-formed. Start location: 6:2

Just started out in my XML class and having a bit of trouble finding a solution to my error. I get this error: "The markup in the document following the root element must be well-formed. Start locatio..