Examples On Programing Languages

Cannot use a CONTAINS or FREETEXT predicate on table or indexed view because it is not full-text indexed

I am getting following error in my SQL server 2008 R2 database: Cannot use a CONTAINS or FREETEXT predicate on table or indexed view 'tblArmy' because it is not full-text indexed. ...

Having both a Created and Last Updated timestamp columns in MySQL 4.0

I have the following table schema; CREATE TABLE `db1`.`sms_queue` ( `Id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `Message` VARCHAR(160) NOT NULL DEFAULT 'Unknown Message Error', `CurrentState` VARCHAR(10) NOT NULL DEFAULT 'None', `Phone` V...

What is the easiest way to get the current day of the week in Android?

What would be the easiest way to get the current day of the week in Android?...

React-router urls don't work when refreshing or writing manually

I'm using React-router and it works fine while I'm clicking on link buttons, but when I refresh my webpage it does not load what I want. For instance, I am in localhost/joblist and everything is fine because I arrived here pressing a link. But If I ...

Relay access denied on sending mail, Other domain outside of network

Sending mail results in error "Relay access denied". It throws "Relay access denied", whenever I tried to send mail to "other_domain" from "outside_network". It works just fine for "myown_domain" from "outside/inside_network" and to "other_domain" ...

How to convert all text to lowercase in Vim

How do you convert all text in Vim to lowercase? Is it even possible?...

How to run Java program in command prompt

I created a Java project to call a Web service. It has one Main java file and another class file. I have used some jar files for HTTP client. In Eclipse it runs fine. I need to run the Java program in command prompt by passing some arguments. In comm...

Delete a row from a SQL Server table

I'm trying to simply delete a full row from my SQL Server database table using a button event. So far none of my attempts have succeeded. This is what I'm trying to do: public static void deleteRow(string table, string columnName, string IDNumber) {...

Ambiguous overload call to abs(double)

I have the following C++ code: #include <math.h> #include <cmath.h> // per http://www.cplusplus.com/reference/clibrary/cmath/abs/ // snip ... if ( (loan_balance < 0) && (abs(loan_balance) > loan_payment) ) { ... ...

Using the last-child selector

My goal is to apply the CSS on the last li, but it doesn't do that. _x000D_ _x000D_ #refundReasonMenu #nav li:last-child {_x000D_ border-bottom: 1px solid #b5b5b5;_x000D_ }_x000D_ <div id="refundReasonMenu">_x000D_ <ul id="nav">...

Listing contents of a bucket with boto3

How can I see what's inside a bucket in S3 with boto3? (i.e. do an "ls")? Doing the following: import boto3 s3 = boto3.resource('s3') my_bucket = s3.Bucket('some/path/') returns: s3.Bucket(name='some/path/') How do I see its contents?...

How to vertical align an inline-block in a line of text?

I want to create an inline-block that will take on some unknown width and height. (It'll have a table inside it with content dynamically generated). Further, the inline-block should be placed inside a line of text, such as "my text (BLOCK HERE)...

jQuery: If this HREF contains

Why can't I get this to work?? $("a").each(function() { if ($(this[href$="?"]).length()) { alert("Contains questionmark"); } }); Ps.: This is just at simplifyed example, to make it easier for you to get an overview....

How to copy a row and insert in same table with a autoincrement field in MySQL?

In MySQL I am trying to copy a row with an autoincrement column ID=1 and insert the data into same table as a new row with column ID=2. How can I do this in a single query?...

Change the default editor for files opened in the terminal? (e.g. set it to TextEdit/Coda/Textmate)

Is there a way to make files opened for editing in the terminal open in Textedit instead? For example, where a command might open a file for editing (like git commit), instead of opening that file in vim or emacs, it would open in Textedit (or perh...

Google Chrome Full Black Screen

I'm facing a weird problem. If a webpage includes jquery graphs or libraries the page loads with a full black screen. I can see the source code and the mouse pointer finds the buttons or links. I uninstalled and reinstall chrome with the latest vers...

Installing Oracle Instant Client

I can't seem to figure out how to install the Oracle client on Windows Server 2008. I downloaded x64 version (the first file on the list) here. There are installation instructions on the bottom of that page: Step 2 ("instantclient") Which executa...

How to show Page Loading div until the page has finished loading?

I have a section on our website that loads quite slowly as it's doing some intensive calls. Any idea how I can get a div to say something similar to "loading" to show while the page prepares itself and then vanish when everything is ready?...

Hello World in Python

I tried running a python script: print "Hello, World!" And I get this error: File "hello.py", line 1 print "Hello, World!" ^ SyntaxError: invalid syntax What is going on?...

How to solve the “failed to lazily initialize a collection of role” Hibernate exception

I have this problem: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: mvc3.model.Topic.comments, no session or session was closed Here is the model: @Entity @Table(name = "T_TOPIC") public class To...

Reading input files by line using read command in shell scripting skips last line

I usually use the read command to read an input file to the shell script line by line. An example code such as the one below yields a wrong result if a new line isn't inserted at the end of the last line in the input file, blah.txt. #!/bin/sh while...

Make the console wait for a user input to close

I have a console application that after performing its tasks, must give feedback to the user, such as "operation completed" or "operation failed" and the detailed error. The thing is, if I just "let it run", the output message will be printed but th...

Two way sync with rsync

I have a folder a/ and a remote folder A/. I now run something like this on a Makefile: get-music: rsync -avzru server:/media/10001/music/ /media/Incoming/music/ put-music: rsync -avzru /media/Incoming/music/ server:/media/10001/music/ sync-musi...

rsync copy over only certain types of files using include option

I use the following bash script to copy only files of certain extension(in this case *.sh), however it still copies over all the files. what's wrong? from=$1 to=$2 rsync -zarv --include="*.sh" $from $to ...

How to print time in format: 2009-08-10 18:17:54.811

What's the best method to print out time in C in the format 2009-08-10 ?18:17:54.811?...

Unzip files programmatically in .net

I am trying to programatically unzip a zipped file. I have tried using the System.IO.Compression.GZipStream class in .NET, but when my app runs (actually a unit test) I get this exception: System.IO.InvalidDataException: The magic number in GZi...

Why can I ping a server but not connect via SSH?

When I ping my server, it responds: user@localhost:~$ ping my.server PING my.server (111.111.111.11) 56(84) bytes of data. 64 bytes from my.server (111.111.111.11): icmp_req=1 ttl=42 time=38.4 ms 64 bytes from my.server (111.111.111.11): icmp_req=2 ...

See last changes in svn

I paused development on a project before going on holidays. Now after a few weeks I'd like to know what were the last things in source I was working on? Is there a chance to see e.g. in WebSVN the last changes in the whole repository?...

Could not create the Java virtual machine

facing some problem with java virtual machine initialization. when i am using root account i can properly work with java. but when i am a user account it returns following errors user@host# $JAVA_HOME/bin/java -version Error occurred during initiali...

R barplot Y-axis scale too short

I'm trying to generate a barplot, but the y-axis scale is too short. Here's my code: barplot(as.matrix(dat), log="y", ylim=c(10000,100000000), beside=TRUE, ylab = "Number of reads", col = c("gray","black","white")) It leaves the room for...

Update label from another thread

I use a thread writing in another class for update a label. The label is contents in Winform Main class. Scanner scanner = new Scanner(ref lblCont); scanner.ListaFile = this.listFiles; Thread trd = new Thread(new ThreadStart(scanner.automaticScan...

$location / switching between html5 and hashbang mode / link rewriting

I was under the impression that Angular would rewrite URLs that appear in href attributes of anchor tags within tempaltes, such that they would work whether in html5 mode or hashbang mode. The documentation for the location service seems to say that ...

Entity Framework rollback and remove bad migration

I'm using EF 6.0 for my project in C# with manual migrations and updates. I have about 5 migrations on the database, but I realised that the last migration was bad and I don't want it. I know that I can rollback to a previous migration, but when I ad...

How to prevent a dialog from closing when a button is clicked

I have a dialog with EditText for input. When I click the "yes" button on dialog, it will validate the input and then close the dialog. However, if the input is wrong, I want to remain in the same dialog. Every time no matter what the input is, the d...

jQuery Mobile: Stick footer to bottom of page

Is there any way, bearing in mind the way the jQuery Mobile framework operates, to fix the page so that the footer always aligns with the bottom of the page - no matter the height. As it stands the height of a jQuery page will change, especially as ...

SQL Server Creating a temp table for this query

I have this query: DECLARE @ProjectID int = 3, @Year int = 2010, @MeterTypeID int = 1, @StartDate datetime, @EndDate datetime SET @StartDate = '07/01/' + CAST(@Year as VARCHAR) SET @EndDate = '06/30/' + CAST(@Year+1 as VARCHAR) SELECT tblMEP_Sit...

How to read string from keyboard using C?

I want to read a string entered by the user. I don't know the length of the string. As there are no strings in C I declared a pointer: char * word; and used scanf to read input from the keyboard: scanf("%s" , word) ; but I got a segmentation fa...

How can I compile and run c# program without using visual studio?

I am very new to C#. I have just run C# 'Hello World' program using Visual Studio. Can I run or compile a C# program without using Visual Studio? If it is possible, then which compiler should I use? Thanks...

Using a dictionary to count the items in a list

I'm new to Python and I have a simple question, say I have a list of items: ['apple','red','apple','red','red','pear'] Whats the simpliest way to add the list items to a dictionary and count how many times the item appears in the list. So for the...

How many parameters are too many?

Routines can have parameters, that's no news. You can define as many parameters as you may need, but too many of them will make your routine difficult to understand and maintain. Of course, you could use a structured variable as a workaround: puttin...

How to Convert unsigned char* to std::string in C++?

I have unsigned char*, want to convert it to std::string. Can you please tell me the safest way to do this?...

How to rollback or commit a transaction in SQL Server

In my stored procedure, I have three insert statements. On duplicate key value insertion first two queries generate the error Violation of PRIMARY KEY constraint and third query runs as usual. Now I want that if any query generates any excep...

How do I rename a column in a SQLite database table?

I would need to rename a few columns in some tables in a SQLite database. I know that a similar question has been asked on stackoverflow previously, but it was for SQL in general, and the case of SQLite was not mentioned. From the SQLite documentati...

How do you use global variables or constant values in Ruby?

I have a program that looks like: $offset = Point.new(100, 200); def draw(point) pointNew = $offset + point; drawAbsolute(point) end draw(Point.new(3, 4)); the use of $offset seems a bit weird. In C, if I define something outside of any fun...

Create component to specific module with Angular-CLI

I'm starting to use angular-cli and I've already read a lot to find an answer about what I want to do...no success, so I came here. Is there a way to create a component to a new module? e.g.: ng g module newModule ng g component newComponent (how...

Calculating Waiting Time and Turnaround Time in (non-preemptive) FCFS queue

I have 6 processes as follows: -- P0 -- arrival time = 0 burst time = 10 -- P1 -- arrival time = 110 burst time = 210 -- P2 -- arrival time = 130 burst time = 70 -- P3 -- arrival time = 130 burst time = 70 -- P4 -- ar...

How do I compile and run a program in Java on my Mac?

How do I compile and run a program in Java on my mac? I'm new. Also I downloaded a program that was suggested to me on here called text wrangler if that has any bearing on the situation. ...

Select multiple images from android gallery

So basically what i am trying to achieve is opening the Gallery in Android and let the user select multiple images. Now this question has been asked frequently but i'm not satisfied with the answers. Mainly because i found something interesting in de...

Apache 13 permission denied in user's home directory

My friend's website was working fine until he moved the document root from /var/www/xxx to /home/user/xxx. Apache gives 13 permission denied error messages when we try to access the site via a web browser. The site is configured as a virtual direct...

The difference between the 'Local System' account and the 'Network Service' account?

I have written a Windows service that spawns a separate process. This process creates a COM object. If the service runs under the 'Local System' account everything works fine, but if the service runs under the 'Network Service' account, the external ...

Using a global variable with a thread

How do I share a global variable with thread? My Python code example is: from threading import Thread import time a = 0 #global variable def thread1(threadname): #read variable "a" modify by thread 2 def thread2(threadname): while 1: ...

Java NoSuchAlgorithmException - SunJSSE, sun.security.ssl.SSLContextImpl$DefaultSSLContext

Background I have been using the Authorize.net SDK in an Eclipse project of it's own. Everything was working great. I then needed to add it to my main project. I added the dependencies to the class path and the copied in the block of code that I nee...

How to merge remote master to local branch

I have a local branch of a project ("configUpdate") that I've forked from somebody else's project and I've done a load of changes on it and would like to merge the changes they've made in to my local branch. I've tried git pull --rebase origin con...

Android - running a method periodically using postDelayed() call

I have a situation in an Android app where I want to start a network activity (sending out some data) which should run every second. I achieve this as follows: In the onCreate() I have the code: tv = new TextView(this); tv.postDelayed(sendData, 100...

How do I change the JAVA_HOME for ant?

I'm doing java work on a class server where I don't have root. Whenever I try to compile using ant, it points to the wrong directory (/usr/tomcat instead of /usr/tomcat/jre ). One of the things we were told to do when setting up our user accounts w...

Disable building workspace process in Eclipse

What is Eclipse doing when building workspace process is running? Can i disable it because it is taking a long time to complete and i dont know if it is necessary. Thank you...

Setting max-height for table cell contents

I have a table which should always occupy a certain percentage of the height of the screen. Most of the rows are of fixed height, but I have one row that should stretch to fill the available space. In the event that the contents of a cell in that row...

Difference between partition key, composite key and clustering key in Cassandra?

I have been reading articles around the net to understand the differences between the following key types. But it just seems hard for me to grasp. Examples will definitely help make understanding better. primary key, partition key, composite key ...

How to display raw html code in PRE or something like it but without escaping it

I'd like to display raw HTML. We all know one has to escape each "<" and ">" like this <PRE> this is a test &ltDIV&gt </PRE> However, I do not want to do this. I'd like a way to keep the HTML code as is (since it is ea...

How do you modify the web.config appSettings at runtime?

I am confused on how to modify the web.config appSettings values at runtime. For example, I have this appSettings section: <appSettings> <add key="productspagedesc" value="TODO: Edit this default message" /> <add key="servicespage...

Uri not Absolute exception getting while calling Restful Webservice

The below code snippet is using to call my web service using restful API. ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); String uri= "https://127.0.0.1:8443/cas-server-webapp-3.5.0/login"; WebReso...

Remove all multiple spaces in Javascript and replace with single space

How can I automatically replace all instances of multiple spaces, with a single space, in Javascript? I've tried chaining some s.replace but this doesn't seem optimal. I'm using jQuery as well, in case it's a builtin functionality....

Binding a Button's visibility to a bool value in ViewModel

How do I bind the visibility of a button to a bool value in my ViewModel? <Button Height="50" Width="50" Style="{StaticResource MyButtonStyle}" Command="{Binding SmallDisp}" CommandParameter="{Binding}" Cursor="Hand" Visibility="{Binding ...

Why is my Git Submodule HEAD detached from master?

I am using Git submodules. After pulling changes from server, many times my submodule head gets detached from master branch. Why does it happen? I have to always do: git branch git checkout master How can I make sure that my submodule is always...

Google Chrome default opening position and size

I am quite a highly OCD and lazy person and currently, I noticed that everyday late at night when I’m doing some work, I leave my Google Chrome split to the right of the screen and some document on the left side. When I open the browser in the morn...

Call another rest api from my server in Spring-Boot

I want to call another web-api from my backend on a specific request of user. For example, I want to call Google FCM send message api to send a message to a specific user on an event. Does Retrofit have any method to achieve this? If not, how I can...

Why won't bundler install JSON gem?

I get the following error when attempting to run cap production deploy. DEBUG [dc362284] Bundler::GemNotFound: Could not find json-1.8.1.gem for installation DEBUG [dc362284] An error occurred while installing json (1.8.1), and Bundler cannot...

Min / Max Validator in Angular 2 Final

According to thoughtgram.io, the currently supported validators are: required minlength maxlength pattern So, considering the following code (plunkr here): @Component({ selector: 'my-app', template: ` <form #formRef="ngForm"&g...

Animate text change in UILabel

I'm setting a new text value to a UILabel. Currently, the new text appears just fine. However, I'd like to add some animation when the new text appears. I'm wondering what I can do to animate the appearance of the new text. ...

Moment.js with ReactJS (ES6)

I am new to Moment.js. I am using ReactJS (ES6) for my new project. How can I use moment.js to format the date? I want to format my post.date in the below mentioned loop. render() { return ( <div> { this.pro...

Is there 'byte' data type in C++?

If exists is there header file to include? This code give compilation error: #include <iostream> using namespace std; int main() { byte b = 2; cout << b << endl; return 0; } ...

LINQ to SQL using GROUP BY and COUNT(DISTINCT)

I have to perform the following SQL query: select answer_nbr, count(distinct user_nbr) from tpoll_answer where poll_nbr = 16 group by answer_nbr The LINQ to SQL query from a in tpoll_answer where a.poll_nbr = 16 select a.answer_nbr, a.user_nbr ...

How can I check if a scrollbar is visible?

Is it possible to check the overflow:auto of a div? For example: HTML <div id="my_div" style="width: 100px; height:100px; overflow:auto;" class="my_class"> * content </div> JQUERY $('.my_class').live('hover', function (event) { ...

How to see what privileges are granted to schema of another user

Consider the case : In a database , I have two users A and B and their corresponding schema. I want to know , How can I get the information : what permissions are there for USER A in Schema B . Consider the case : We have two users and their associ...

Quick Way to Implement Dictionary in C

One of the things which I miss while writing programs in C is a dictionary data structure. What's the most convenient way to implement one in C? I am not looking for performance, but ease of coding it from scratch. I don't want it to be generic eithe...

Regex that accepts only numbers (0-9) and NO characters

I need a regex that will accept only digits from 0-9 and nothing else. No letters, no characters. I thought this would work: ^[0-9] or even \d+ but these are accepting the characters : ^,$,(,), etc I thought that both the regexes above would...

Getting values from query string in an url using AngularJS $location

Regarding $location.search, the docs say, Return search part (as object) of current url when called without any parameter. In my url, my query string has a param '?test_user_bLzgB' without a value. Also '$location.search()' returns an object. H...

Change default icon

I'm trying to change the application icon from default to something else. So what I did, is I made an icon and saved it. Then I went to the application tab in the property of my project and changed the icon. There he shows the icon like I made it, bu...

word-wrap break-word does not work in this example

I cannot get word-wrap to work with this example... <html> <head></head> <body> <table style="table-layout:fixed;"> <tr> <td style="word-wrap: break-word; width:100px;">ThisStringWillNotWrapThisStringWillNo...

Pass by Reference / Value in C++

I would like to clarify the differences between by value and by reference. I drew a picture So, for passing by value, a copy of an identical object is created with a different reference, and the local variable is assigned the new reference, so ...

Autowiring fails: Not an managed Type

I have a big problem in my diploma project and would be very glad if you guys could help me! I made a Maven Multi Module Project and have 3 "Core-projects" NaviClean: (Parent) NaviCleanDomain: contains the domain model with all my entities and an i...

Switching to a TabBar tab view programmatically?

Let's say I have a UIButton in one tab view in my iPhone app, and I want to have it open a different tab in the tab bar of the TabBarController. How would I write the code to do this? I'm assuming I unload the existing view and load a specific ta...

Android Studio gradle takes too long to build

My Android Studio project used to build faster but now it takes a long time to build. Any ideas what could be causing the delays? I have tried https://stackoverflow.com/a/27171878/391401 but no effect. I haven't any Anti virus running which could int...

JsonParseException: Unrecognized token 'http': was expecting ('true', 'false' or 'null')

We have the following string which is a valid JSON written to a file on HDFS. { "id":"tag:search.twitter.com,2005:564407444843950080", "objectType":"activity", "actor":{ "objectType":"person", "id":"id:twitter.com:2302910022", ...

Efficient evaluation of a function at every cell of a NumPy array

Given a NumPy array A, what is the fastest/most efficient way to apply the same function, f, to every cell? Suppose that we will assign to A(i,j) the f(A(i,j)). The function, f, doesn't have a binary output, thus the mask(ing) operations won't help...

How to grant remote access permissions to mysql server for user?

If I do SHOW GRANTS in my mysql database I get GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD 'some_characters' WITH GRANT OPTION If I am not mistaken, root@localhost means that user root can access the server o...

"Not allowed to load local resource: file:///C:....jpg" Java EE Tomcat

I'm trying to retrieve a picture from my file system after a good storage,(instead of putting it in the database I copy it to the disc and i put the path to the db) I had store the picture to c:\images\ folder and supposing...

Remove all special characters except space from a string using JavaScript

I want to remove all special characters except space from a string using JavaScript. For example, abc's test#s should output as abcs tests....

MySQL ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)

First let me mention that I've gone through many suggested questions and found no relevent answer. Here is what I'm doing. I'm connected to my Amazon EC2 instance. I can login with MySQL root with this command: mysql -u root -p Then I created a n...

Where can I find the default timeout settings for all browsers?

I'm looking for some kind of documentation that specifies how much time each browser (IE6/IE7/FF2/FF3, etc) will wait on a request before it just gives up and times out. I haven't had any luck trying to get this. Any pointers?...

Force Internet Explorer to use a specific Java Runtime Environment install?

When viewing someone else's webpage containing an applet, how can I force Internet Explorer 6.0 to use a a particular JRE when I have several installed?...

Format telephone and credit card numbers in AngularJS

Question one (formatting telephone number): I'm having to format a telephone number in AngularJS but there is no filter for it. Is there a way to use filter or currency to format 10 digits to (555) 555-5255? and still preserve the data type of the f...

Connection pooling options with JDBC: DBCP vs C3P0

What is the best connection pooling library available for Java/JDBC? I'm considering the 2 main candidates (free / open-source): Apache DBCP - http://commons.apache.org/dbcp/ C3P0 - http://sourceforge.net/projects/c3p0 I've read a lot about the...

How to use XPath preceding-sibling correctly

I am writing tests for my site using Selenium IDE and I am having trouble with having selenium click on a button using preceding-sibling <td> <div class="btn-group"> <button class="btn btn btn-danger block" title="Warning, Delete" nam...

Logging request/response messages when using HttpClient

I have a method that does a POST like below var response = await client.PostAsJsonAsync(url, entity); if (response.IsSuccessStatusCode) { // read the response as strongly typed object return await response.Content.ReadAsAsync<T&g...

Difference between Big-O and Little-O Notation

What is the difference between Big-O notation O(n) and Little-O notation o(n)?...

Adding a simple spacer to twitter bootstrap

I'm using twitter-bootstrap, with LESS and Rails. I want to add a simple spacer to my CSS that appears between the grid rows to space things out a bit better. I couldn't find anything in the bootstrap that does it for me so I figured I could just ad...

kill a process in bash

How do I kill a process which is running in bash - for example, suppose I open a file: $ gedit file.txt is there any way within the command prompt to close it? This example is fairly trivial, since I could just close the window, but it seems to...

NuGet Package Restore Not Working

I checked in a project on one computer, checked out on another, and find that the binaries installed by NuGet are missing. I could check them in to source control as well, but it looks like there's a better solution: http://docs.nuget.org/docs/work...

Is there a command like "watch" or "inotifywait" on the Mac?

I want to watch a folder on my Mac (Snow Leopard) and then execute a script (giving it the filename of what was just moved into a folder (as a parameter... x.sh "filename")). I have a script all written up in bash (x.sh) that will move some files an...

How does jQuery work when there are multiple elements with the same ID value?

I fetch data from Google's AdWords website which has multiple elements with the same id. Could you please explain why the following 3 queries doesn't result with the same answer (2)? Live Demo HTML: <div> <span id="a">1</span&g...

IE11 prevents ActiveX from running

Our web browser plugin works fine in IE9 and IE10 but in IE11 the plugin is neither recognized as an add-on or allowed to run. It's as if IE11 no longer supports ActiveX. Surely there is a workaround but what do we need to change? NOTE: this questi...

How to display binary data as image - extjs 4

Here is the binary for a valid .JPEG image. http://pastebin.ca/raw/2314500 I have tried to use Python to save this binary data into an image. How can I convert this data to a viewable .JPEG image with extjs 4? I tried this, but it doesn't work. ...

How to upgrade pip3?

I want to use python3.5 to develop basically, but many times when I install the module for the python 3.5, it always failed. And the terminal told me that higher version is available, it did not work when I upgrade it. ...

CSS text-align not working

I have this css code here .navigation{ width:100%; background-color:#7a7a7a; font-size:18px; } .navigation ul { list-style-type: none; margin: 0; } .navigation li { float: left; } .navigation ul a { color: #ffffff; ...

How to convert string to date to string in Swift iOS?

Am learning swift and am struck in converting the date String to NSDate to string. Am getting the date string in this format "Thu, 22 Oct 2015 07:45:17 +0000". I need to show the date in the MM-dd-yyyy format. I tried the following code but, it retur...

How can I tell when HttpClient has timed out?

As far as I can tell, there's no way to know that it's specifically a timeout that has occurred. Am I not looking in the right place, or am I missing something bigger? string baseAddress = "http://localhost:8080/"; var client = new HttpClie...

Callback when CSS3 transition finishes

I'd like to fade out an element (transitioning its opacity to 0) and then when finished remove the element from the DOM. In jQuery this is straight forward since you can specify the "Remove" to happen after an animation completes. But if I wish to a...

PHP Parse error: syntax error, unexpected '?' in helpers.php 233

When I create a new Laravel project, the browser displays an error 500. I found this in the log: PHP Parse error: syntax error, unexpected '?' in vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 233 the code in 233 is: r...

Check element exists in array

In PHP there a function called isset() to check if something (like an array index) exists and has a value. How about Python? I need to use this on arrays because I get "IndexError: list index out of range" sometimes. I guess I could use try/catchin...

How to keep a git branch in sync with master

At the moment git is doing my head in, I cannot come up with the best solution for the following. There are two branches, one called master and one called mobiledevicesupport. I want to keep mobiledevicesupport as a continuous branch that will be me...

Convert Decimal to Varchar

I have a decimal column in a table defined as decimal(8,3). I would like to include this column in a Select statement, convert it to a Varchar and only display two decimal places. I can't seem to find the right combination of options to do this becau...

How to query for today's date and 7 days before data?

I'm using sql server 2008. How to query out a data which is the date is today and 7 days before today ?...

Error: [ng:areq] from angular controller

This is a long shot, but has anyone seen this error before? I am trying to add 'Transporters' using express, angular and mongoDB. I get this error whenever I access a page ruled by the transporters controller: Error: [ng:areq] http://errors.angularj...

How to display alt text for an image in chrome

The image with invalid source displays an alternate text in Firefox but not in chrome unless the width of an image is adjusted. <img height="90" width="90" src="http://www.google.com/intl/en_ALL/images/logos/images_logo_lg.gif" alt="Ima...

How to get longitude and latitude of any address?

Hello what is the formulla to get longitude and latitude of any address , if i have street_name,State_name,City_name,Country_name and zip code in PHP? Thanks...

How can I get the max (or min) value in a vector?

How can I get the max (or min) value in a vector in C++? I have seen a few solutions for this on Google but none of them made sense to me :( Can someone explain in an easy straightforward noob way how to get the max or min value from a vector plea...

String replace method is not replacing characters

I have a sentence that is passed in as a string and I am doing a replace on the word "and" and I want to replace it with " ". And it's not replacing the word "and" with white space. Below is an example of my logic. And when I debug this the logic ...

Capture keyboardinterrupt in Python without try-except

Is there some way in Python to capture KeyboardInterrupt event without putting all the code inside a try-except statement? I want to cleanly exit without trace if user presses Ctrl+C....

Lotus Notes email as an attachment to another email

This is in Notes 8.5 environment. I just wanted to know how to attach an email to another email as real attachment not a "Document Link". I intended to attach an email, so I drag & dropped an email to another email's body but this turned out t...

How to change plot background color?

I am making a scatter plot in matplotlib and need to change the background of the actual plot to black. I know how to change the face color of the plot using: fig = plt.figure() fig.patch.set_facecolor('xkcd:mint green') My issue is that this c...

undefined reference to boost::system::system_category() when compiling

I'm trying to compile a program on Ubuntu 11.10 that uses the Boost libraries. I have the 1.46-dev Boost libraries from the Ubuntu Repository installed, but I get an error when compiling the program. undefined reference to boost::system::system_cate...

Permissions error when connecting to EC2 via SSH on Mac OSx

I am new to EC2. I created my security credentials from this site: http://paulstamatiou.com/how-to-getting-started-with-amazon-ec2 It worked great, I rebooted and now when I try to connect I get a login/password prompt. (Which I never set up.) Afte...

How to convert an address to a latitude/longitude?

How would I go about converting an address or city to a latitude/longitude? Are there commercial outfits I can "rent" this service from? This would be used in a commercial desktop application on a Windows PC with fulltime internet access....

Magento - Retrieve products with a specific attribute value

In my block code I am trying to programmatically retrieve a list of products that have a attribute with a specific value. Alternately if that is not possible how would one retrieve all products then filter them to just list the products with a speci...

How can a add a row to a data frame in R?

In R, how do you add a new row to a data frame once the data frame has already been initialized? So far I have this: df <- data.frame("hi", "bye") names(df) <- c("hello", "goodbye") #I am trying to add "hola" and "ciao" as a new row de <-...

How can I download a file from a URL and save it in Rails?

I have a URL to an image which i want to save locally, so that I can use Paperclip to produce a thumbnail for my application. What's the best way to download and save the image? (I looked into ruby file handling but did not come across anything.) ...

Bootstrap 4 responsive tables won't take up 100% width

I am building a web app using Bootstrap 4 and running into some weird issues. I want to utilize Bootstrap's table-responsive class to allow horizontal scrolling of the tables on mobile devices. On desktop devices the table should take up 100% of t...

Why use Optional.of over Optional.ofNullable?

When using the Java 8 Optional class, there are two ways in which a value can be wrapped in an optional. String foobar = <value or null>; Optional.of(foobar); // May throw NullPointerException Optional.ofNullable(foobar); // Safe from ...

MySQL Calculate Percentage

I have a MySQL database with 4 items: id (numerical), group_name, employees, and surveys. In my SELECT I need to calculate the percentage of 'employees' who, by the number in 'surveys', have taken the survey. This is the statement I have now: SELE...

Dropping Unique constraint from MySQL table

How can I drop the "Unique Key Constraint" on a column of a MySQL table using phpMyAdmin?...

package R does not exist

I'm getting the dreaded package R does not exist, it's killing me. The code is fine I have apps in the market running the code. Now it's effecting simple webview applications. o.0 R.string.app_name is error'd my main.xml and string.xml is fine. I...

Java variable number or arguments for a method

Is it possible to declare a method that will allow a variable number of parameters ? What is the symbolism used in the definition that indicate that the method should allow a variable number of parameters? Answer: varargs...

Read/Parse text file line by line in VBA

I'm trying to parse a text document using VBA and return the path given in the text file. For example, the text file would look like: *Blah blah instructions *Blah blah instructions on line 2 G:\\Folder\...\data.xls D:\\AnotherFolder\...\moredata.x...

Difference between applicationContext.xml and spring-servlet.xml in Spring Framework

Are applicationContext.xml and spring-servlet.xml related anyhow in Spring Framework? Will the properties files declared in applicationContext.xml be available to DispatcherServlet? On a related note, why do I need a *-servlet.xml at all? Why is app...

Timestamp with a millisecond precision: How to save them in MySQL

I have to develop a application using MySQL and I have to save values like "1412792828893" which represent a timestamp but with a precision of a millisecond. That is, the amount of milliseconds since 1.1.1970. I declare the row as timestamp but unfor...

How to disable and then enable onclick event on <div> with javascript

Following is the code which i am trying document.getElementById("id").disabled = true; ...

Why doesn't C++ have a garbage collector?

I'm not asking this question because of the merits of garbage collection first of all. My main reason for asking this is that I do know that Bjarne Stroustrup has said that C++ will have a garbage collector at some point in time. With that said, wh...

How to prevent a double-click using jQuery?

I have a button as such: <input type="submit" id="submit" value="Save" /> Within jQuery I am using the following, but it still allows for double-clicks: <script type="text/javascript"> $(document).ready(function () { $("#submit"...

Git add and commit in one command

Is there any way I can do git add -A git commit -m "commit message" in one command? I seem to be doing those two commands a lot, and if Git had an option like git commit -Am "commit message", it would make life that much more convenient. git co...

How to import multiple .csv files at once?

Suppose we have a folder containing multiple data.csv files, each containing the same number of variables but each from different times. Is there a way in R to import them all simultaneously rather than having to import them all individually? My pro...

Select all child elements recursively in CSS

How can you select all child elements recursively? div.dropdown, div.dropdown > * { color: red; } This class only throws a class on the defined className and all immediate children. How can you, in a simple way, pick all childNodes like thi...

How do I ignore files in a directory in Git?

What is the proper syntax for the .gitignore file to ignore files in a directory? Would it be config/databases.yml cache/* log/* data/sql/* lib/filter/base/* lib/form/base/* lib/model/map/* lib/model/om/* or /config/databases.yml /cache/* /log/*...

Fatal error: iostream: No such file or directory in compiling C program using GCC

Why when I wan to compile the following multi thread merge sorting C program, I receive this error: ap@sharifvm:~/forTHE04a$ gcc -g -Wall -o mer mer.c -lpthread mer.c:4:20: fatal error: iostream: No such file or directory #include <iostream>...

Maven: How to include jars, which are not available in reps into a J2EE project?

in my J2EE project I've a couple of dependencies, which are not available in any Maven repository, because they're proprietary libraries. These libraries need to be available at runtime, so that have to be copied to target/.../WEB-INF/lib ... Right ...

How to Detect Browser Window /Tab Close Event?

I am Trying with onbeforeunload, and Unload function. But it didn't work. When clicking a link or refreshing, this event got triggered. I want an event that is triggered only when a browser window or tab is closed. The code must work in all browsers....

How do I use arrays in cURL POST requests

I am wondering how do I make this code support arrays? At the moment the images array only seems to send the first value. Here is my code: <?php //extract data from the post extract($_POST); //set POST variables $url = 'http://api.example.com/a...

How to disable the ability to select in a DataGridView?

I want to use my DataGridView only to show things, and I want the user not to be able to select any row, field or anything from the DataGridView. How can I do this?...

How to drop rows from pandas data frame that contains a particular string in a particular column?

I have a very large data frame in python and I want to drop all rows that have a particular string inside a particular column. For example, I want to drop all rows which have the string "XYZ" as a substring in the column C of the data frame. Can th...

Create two blank lines in Markdown

I am adding Markdown support to my CMS editor. When writing Markdown content, how do I create two empty lines? I have been trying, but I always get only one line....

Error: Java: invalid target release: 11 - IntelliJ IDEA

I am trying to build an application which was built using java 8, now it's upgraded to java 11. I installed Java 11 using an oracle article in my windows machine and I use IntelliJ IDEA 2017 as my IDE. I changed my system environment variables and s...

React img tag issue with url and class

I have the following simple react code in my JSX file: /** @jsx React.DOM */ var Hello = React.createClass({ render: function() { return <div><img src='http://placehold.it/400x20&text=slide1' alt={event.title} class="img-re...

How do I add slashes to a string in Javascript?

Just a string. Add \' to it every time there is a single quote....

What is the recommended way to make a numeric TextField in JavaFX?

I need to restrict input into a TextField to integers. Any advice?...

Android notification is not showing

I need a program that will add a notification on Android. And when someone clicks on the notification, it should lead them to my second activity. I have established code. The notification should be working, but for some reason it is not working. The...

Ant is using wrong java version

I'm using Ant 1.7.0 and installed java 1.6 which is in JAVA_HOME. I want to build a project using java 1.5, so I've exported JAVA_HOME to be my java 1.5 directory. java -version says "1.5". When I run Ant it uses java 1.6....

Use Font Awesome icon as CSS content

I want to use a Font Awesome icon as CSS content, i.e., a:before { content: "<i class='fa...'>...</i>"; } I know I cannot use HTML code in content, so is it only images left?...

jQuery - Disable Form Fields

I have 2 fields: 1 input, 1 select box. Is it possible to make the browser disable one of the fields when the user uses the other? For example, if the user is entering data into the input, the select box is disabled. If the user is selecting data f...

Hibernate: How to fix "identifier of an instance altered from X to Y"?

org.hibernate.HibernateException: identifier of an instance of org.cometd.hibernate.User altered from 12 to 3 in fact, my user table is really must dynamically change its value, my Java app is multithreaded. Any ideas how to fix it? ...

Converting a UNIX Timestamp to Formatted Date String

Using PHP, I want to convert UNIX timestamps to date strings similar to this: 2008-07-17T09:24:17Z How do I convert a timestamp such as 1333699439 to 2008-07-17T09:24:17Z?...

Error: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp()

I have a firebase database linked up to two apps, one being an iOS app and another being a web app coded in node.js which is a basic algorithm that sets data to the database. When ever i am running the algorithm i am confronted with- Error: No Fi...

What is getattr() exactly and how do I use it?

I've recently read about the getattr() function. The problem is that I still can't grasp the idea of its usage. The only thing I understand about getattr() is that getattr(li, "pop") is the same as calling li.pop. I didn't understand when the book m...

Using new line(\n) in string and rendering the same in HTML

I have a string say string display_txt = "1st line text" +"\n" + "2nd line text"; in Jquery, I am trying to use ('#somediv').html(display_txt).css("color", "green") quite clearly I am expecting my msg to be displayed in 2 lines, but instead \n...

Escape curly brace '{' in String.Format

How do I display a literal curly brace character when using the String.Format method? Example: sb.AppendLine(String.Format("public {0} {1} { get; private set; }", prop.Type, prop.Name)); I would like the output to look like this: public Int32 M...

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 - command+J, but when I click it, I get something...

ReactJS - Add custom event listener to component

In plain old javascript I have the DIV <div class="movie" id="my_movie"> and the following javascript code var myMovie = document.getElementById('my_movie'); myMovie.addEventListener('nv-enter', function (event) { console.log('change ...

How to select a specific node with LINQ-to-XML

I can select the first customer node and change its company name with the code below. But how do I select customer node where ID=2? XDocument xmldoc = new XDocument( new XDeclaration("1.0", "utf-8", "yes"), new XComment("These a...

error, string or binary data would be truncated when trying to insert

I am running data.bat file with the following lines: Rem Tis batch file will populate tables cd\program files\Microsoft SQL Server\MSSQL osql -U sa -P Password -d MyBusiness -i c:\data.sql The contents of the data.sql file is: insert Customer...

How to create an Oracle sequence starting with max value from a table?

Trying to create a sequence in Oracle that starts with the max value from a specific table. Why does this not work? CREATE SEQUENCE transaction_sequence MINVALUE 0 START WITH (SELECT MAX(trans_seq_no) FROM TRANSACTION_LOG) INCREMENT BY 1...

SQL UPDATE SET one column to be equal to a value in a related table referenced by a different column?

I hope that made sense, let me elaborate: There is a table of tracking data for a quiz program where each row has.. QuestionID and AnswerID (there is a table for each). So because of a bug there were a bunch of QuestionIDs set to NULL, but the Ques...

Call An Asynchronous Javascript Function Synchronously

First, this is a very specific case of doing it the wrong way on-purpose to retrofit an asynchronous call into a very synchronous codebase that is many thousands of lines long and time doesn't currently afford the ability to make the changes to "do i...

Inline Form nested within Horizontal Form in Bootstrap 3

I want to build a form in Bootstrap 3 like this: My site (not the above link) just updates from Bootstrap 2.3.2 and the format is not correct anymore. I cannot find any doc about this type of form on getbootstrap.com. Could anyone tell me how to...

How to execute cmd commands via Java

I am trying to execute command line arguments via Java. For example: // Execute command String command = "cmd /c start cmd.exe"; Process child = Runtime.getRuntime().exec(command); // Get output stream to write from it OutputStream out = child.getO...

How to break out of nested loops?

If I use a break statement, it will only break inner loop and I need to use some flag to break the outer loop. But if there are many nested loops, the code will not look good. Is there any other way to break all of the loops? (Please don't use goto ...

Get the last day of the month in SQL

I need to get the last day of the month given as a date in SQL. If I have the first day of the month, I can do something like this: DATEADD(DAY, DATEADD(MONTH,'2009-05-01',1), -1) But does anyone know how to generalize it so I can find the last da...

How do I extract the contents of an rpm?

I have an rpm and I want to treat it like a tarball. I want to extract the contents into a directory so I can inspect the contents. I am familiar with the querying commands of an uninstalled package. I do not simply want a list of the contents of the...

Min/Max-value validators in asp.net mvc

Validation using attributes in asp.net mvc is really nice. I have been using the [Range(min, max)] validator this far for checking values, like e.g.: [Range(1, 10)] public int SomeNumber { get; set; } However - now I need to check the min and max...

What is a 'multi-part identifier' and why can't it be bound?

I continually get these errors when I try to update tables based on another table. I end up rewriting the query, change the order of joins, change some groupings and then it eventually works, but I just don't quite get it. What is a 'multi-part iden...

Append an empty row in dataframe using pandas

I am trying to append an empty row at the end of dataframe but unable to do so, even trying to understand how pandas work with append function and still not getting it. Here's the code: import pandas as pd excel_names = ["ARMANI+EMPORIO+AR0143-boo...

What is a regular expression which will match a valid domain name without a subdomain?

I need to validate a domain name: google.com stackoverflow.com So a domain in its rawest form - not even a subdomain like www. Characters should only be a-z | A-Z | 0-9 and period(.) and dash(-) The domain name part should not start or end with ...

Improve INSERT-per-second performance of SQLite

Optimizing SQLite is tricky. Bulk-insert performance of a C application can vary from 85 inserts per second to over 96,000 inserts per second! Background: We are using SQLite as part of a desktop application. We have large amounts of configuration da...

How to trigger an event in input text after I stop typing/writing?

I want to trigger an event just after I stop typing (not while typing) characters in my input textbox. I've tried with: $('input#username').keypress(function() { var _this = $(this); // copy of this object for further usage setTimeout(func...

curl: (6) Could not resolve host: application

Getting url: (6) Could not resolve host: application error after this command : curl -i -H 'Content-Type: application/json' -d '{"Code":"FR","Name":"France"}' http://127.0.0.1:8080/countries Full error log: curl: (6) Could not resolve host: appli...

How to use JQuery with ReactJS

I'm new to ReactJS. Previously I've used jQuery to set any animation or feature that I needed. But now I'm trying to use ReactJS and minimize the use of jQuery. My Case is: I'm trying to build an accordion with ReactJS. <div class="accor"> ...

javascript unexpected identifier

I am trying to compress my JavaScript code to get less traffic on my site. It has been working fine, but now I came across an error I can't resolve. I turned my ajax function into one line: function(){if(xmlhttp.readyState==4&&xmlhttp.statu...

How to execute a java .class from the command line

I have a compiled java class: Echo.class public class Echo { public static void main (String arg) { System.out.println(arg); } } I cd to the directory and enter: java Echo "hello" I get this error: C:\Documents and Settings...

How do I clear a C++ array?

How do I clear/empty a C++ array? Theres array::fill, but looks like its C++11 only? I am using VC++ 2010. How do I empty it (reset to all 0)? ...

Upgrade python without breaking yum

I recently installed Python 2.7.3 on a CentOS machine by compiling from source. Python 2.7.3 is installed at /opt/python2.7 and when I installed it I just changed /usr/bin/python to point to the new version. This apparently is wrong though because wh...

What is the difference between resource and endpoint?

I have heard both "resource" and "endpoint" to refer to the same thing. It seems that resource is a newer term. What is the difference between them? Does "resource" imply a RESTful design?...

How to break out of the IF statement

I have code like this: public void Method() { if(something) { //some code if(something2) { now I should break from ifs and go to te code outside ifs } return; } // The code i want to go...

how to sync windows time from a ntp time server in command

I am working on windows 7. I can sync time of win7 from a ntp linux server manually. How can I do that in command prompt. So I can run it on windows startup. And windows task plan not work for me. The time should be like this: Linux server --> w...

How to use dashes in HTML-5 data-* attributes in ASP.NET MVC

I am trying to use HTML5 data- attributes in my ASP.NET MVC 1 project. (I am a C# and ASP.NET MVC newbie.) <%= Html.ActionLink("« Previous", "Search", new { keyword = Model.Keyword, page = Model.currPage - 1}, new { @class = "prev", d...

How to save the contents of a div as a image?

Basically, I am doing what the heading states, attempting to save the contents of a div as an image. I plan on making a small online application for the iPad. One function that is a must is having a 'Save' button that can save the full webpage as a...

SQL Server database backup restore on lower version

How to restore a higher version SQL Server database backup file onto a lower version SQL Server? Using SQL Server 2008 R2 (10.50.1600), I made a backup file and now I want to restore it on my live server's SQL Server 2008 (10.00.1600). When I tried...

What is the difference between Left, Right, Outer and Inner Joins?

I am wondering how to differentiate all these different joins ......

How to update SQLAlchemy row entry?

Assume table has three columns: username, password and no_of_logins. When user tries to login, it's checked for an entry with a query like user = User.query.filter_by(username=form.username.data).first() If password matches, he proceeds further. ...

Is there a way to make npm install (the command) to work behind proxy?

Read about a proxy variable in a .npmrc file but it does not work. Trying to avoid manually downloading all require packages and installing....

How can you tell if a value is not numeric in Oracle?

I have the following code that returns an error message if my value is invalid. I would like to give the same error message if the value given is not numeric. IF(option_id = 0021) THEN IF((value<10000) or (value>7200000) or /* Numeric ...

How to stop execution after a certain time in Java?

In the code, the variable timer would specify the duration after which to end the while loop, 60 sec for example. while(timer) { //run //terminate after 60 sec } ...

Get record counts for all tables in MySQL database

Is there a way to get the count of rows in all tables in a MySQL database without running a SELECT count() on each table?...

Java, How to get number of messages in a topic in apache kafka

I am using apache kafka for messaging. I have implemented the producer and consumer in Java. How can we get the number of messages in a topic?...

Use cases for the 'setdefault' dict method

The addition of collections.defaultdict in Python 2.5 greatly reduced the need for dict's setdefault method. This question is for our collective education: What is setdefault still useful for, today in Python 2.6/2.7? What popular use cases of setd...

Finding all positions of substring in a larger string in C#

I have a large string I need to parse, and I need to find all the instances of extract"(me,i-have lots. of]punctuation, and store the index of each to a list. So say this piece of string was in the beginning and middle of the larger string, both of...

Java : Convert formatted xml file to one line string

I have a formatted XML file, and I want to convert it to one line string, how can I do that. Sample xml: <?xml version="1.0" encoding="UTF-8"?> <books> <book> <title>Basic XML</title> <price>100...

Parse JSON String into List<string>

string json = "{\"People\":[{\"FirstName\":\"Hans\",\"LastName\":\"Olo\"} {\"FirstName\":\"Jimmy\",\"LastName\":\"Crackedcorn\"}]}"; var obj = JObject.Parse(json); List<string> first; List<string> last; fore...

Counting null and non-null values in a single query

I have a table create table us ( a number ); Now I have data like: a 1 2 3 4 null null null 8 9 Now I need a single query to count null and not null values in column a ...

Easiest way to open a download window without navigating away from the page

What is the best cross browser way to open a download dialog (let's assume we can set content-disposion:attachment in the headers) without navigating away from the current page, or opening popups, which doesn't work well in Internet Explorer(IE) 6....

My Routes are Returning a 404, How can I Fix Them?

I've just started learning the Laravel framework and I'm having an issue with routing. The only route that's working is the default home route that's attached to Laravel out of the box. I'm using WAMP on Windows and it uses PHP 5.4.3, and Apache 2....

Add column with constant value to pandas dataframe

Given a DataFrame: np.random.seed(0) df = pd.DataFrame(np.random.randn(3, 3), columns=list('ABC'), index=[1, 2, 3]) df A B C 1 1.764052 0.400157 0.978738 2 2.240893 1.867558 -0.977278 3 0.950088 -0.151357 -0.103219 ...

How to map and remove nil values in Ruby

I have a map which either changes a value or sets it to nil. I then want to remove the nil entries from the list. The list doesn't need to be kept. This is what I currently have: # A simple example function, which returns a value or nil def transfo...

Declaring array of objects

I have a variable which is an array and I want every element of the array to act as an object by default. To achieve this, I can do something like this in my code. var sample = new Array(); sample[0] = new Object(); sample[1] = new Object(); This ...

MySQL parameterized queries

I am having a hard time using the MySQLdb module to insert information into my database. I need to insert 6 variables into the table. cursor.execute (""" INSERT INTO Songs (SongName, SongArtist, SongAlbum, SongGenre, SongLength, SongLocation)...

Joining pairs of elements of a list

I know that a list can be joined to make one long string as in: x = ['a', 'b', 'c', 'd'] print ''.join(x) Obviously this would output: 'abcd' However, what I am trying to do is simply join the first and second strings in the list, then join the...

"Error 1067: The process terminated unexpectedly" when trying to start MySQL

I'm using Windows 7 and running XAMPP MySQL SVC service. I'm seeing the following error: Windows could not start the Mysql service on Local Computer. Error 1067: The process terminated unexpectedly. What does this mean, and how can I fix it?...

How do I convert a float number to a whole number in JavaScript?

I'd like to convert a float to a whole number in JavaScript. Actually, I'd like to know how to do BOTH of the standard conversions: by truncating and by rounding. And efficiently, not via converting to a string and parsing....

Git push results in "Authentication Failed"

I have been using Github for a little while and I have been fine with git add, git commit, and git push so far with no problems. Suddenly I am having an error that says: fatal: Authentication Failed In the terminal I cloned a repository, worked...

Difference between Dictionary and Hashtable

Possible Duplicate: Why Dictionary is preferred over hashtable in C#? What is the difference between Dictionary and Hashtable. How to decide which one to use?...

Python list rotation

Possible Duplicate: Efficient way to shift a list in python I'd like to rotate a Python list by an arbitrary number of items to the right or left (the latter using a negative argument). Something like this: >>> l = [1,2,3,4] >...

Can't access RabbitMQ web management interface after fresh install

I've installed the latest RabbitMQ server (rabbitmq-server-3.3.0-1.noarch.rpm) on a fresh Centos 5.10 VM according to the instructions on the official site. I've done this many times before during development and never had any issues. However, this ...

Getting Cannot bind argument to parameter 'Path' because it is null error in powershell

I'm trying to move all the mails after removing the special characters in the filename to some destination based on the filename. FOLDLIST is an array, where I'm having the condition variable and destination foldername. Set-Location 'C:\Users\ab...

Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ' '

I am trying to query from a temp table and i keep getting this message: Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ' '. Can somebody tell me what the problem is? Is it due to convert? The query is select compid,2, convert(datetim...

How to use a client certificate to authenticate and authorize in a Web API

I am trying to use a client certificate to authenticate and authorize devices using a Web API and developed a simple proof of concept to work through issues with the potential solution. I am running into an issue where the client certificate is not ...

How to run a python script from IDLE interactive shell?

How do I run a python script from within the IDLE interactive shell? The following throws an error: >>> python helloworld.py SyntaxError: invalid syntax ...

Can you style html form buttons with css?

I don't like the default button style. It's really boring. I am using <input type="submit"> type buttons. Can I style these somehow in css? If not, the other way of doing it i guess would be to use a div instead, and make it a link. How do ...

Which characters need to be escaped in HTML?

Are they the same as XML, perhaps plus the space one (&nbsp;)? I've found some huge lists of HTML escape characters but I don't think they must be escaped. I want to know what needs to be escaped....

CSS checkbox input styling

Any style for input affects every input element. Is there a way to specify styling to apply for only checkboxes without applying a class to each check box element?...

How to know whether refresh button or browser back button is clicked in Firefox

How to know in Firefox whether refresh button is clicked or browser back button is clicked... for both events onbeforeunload() method is a callback. For IE I am handling like this: function CallbackFunction(event) { if (window.event) { ...

Update row with data from another row in the same table

I've got a table which looks something like this ID | NAME | VALUE | ---------------------------- 1 | Test | VALUE1 | 2 | Test2 | VALUE2 | 1 | Test2 | | 4 | Test | | 1 | Test3 | VALUE...

Set keyboard caret position in html textbox

Does anybody know how to move the keyboard caret in a textbox to a particular position? For example, if a text-box (e.g. input element, not text-area) has 50 characters in it and I want to position the caret before character 20, how would I go about...

What are the best practices for using a GUID as a primary key, specifically regarding performance?

I have an application that uses GUID as the Primary Key in almost all tables and I have read that there are issues about performance when using GUID as Primary Key. Honestly, I haven't seen any problem, but I'm about to start a new application and I ...

Stick button to right side of div

http://jsfiddle.net/kn5sH/ What do I need to add in order to stick the button to the right side of the div on the same line as the header? HTML: <div> <h1> Ok </h1> <button type='button'>Button</button> </d...

Center button under form in bootstrap

i have some problems with Bootstrap. i centered form and button by using span6 offset3 and don't know how to center button under this form right now. i tried with text-align: center but still it's more on the left. <div class="container"> ...

Setting ANDROID_HOME enviromental variable on Mac OS X

Could anybody post a working solution for setting ANDROID_HOME via the terminal? My path to the Android-SDK is /Applications/ADT/sdk....

Removing carriage return and new-line from the end of a string in c#

How do I remove the carriage return character (\r) and the new line character(\n) from the end of a string?...

No module named pkg_resources

I'm deploying a Django app to a dev server and am hitting this error when I run pip install -r requirements.txt: Traceback (most recent call last): File "/var/www/mydir/virtualenvs/dev/bin/pip", line 5, in <module> from pkg_resources imp...

How to determine device screen size category (small, normal, large, xlarge) using code?

Is there any way to determine the category of screen size of the current device, such as small, normal, large, xlarge? Not the density, but the screen size....

How to filter an array from all elements of another array

I'd like to understand the best way to filter an array from all elements of another one. I tried with the filter function, but it doesn't come to me how to give it the values i want to remove. Something Like: var array = [1,2,3,4]; var anotherOne ...

What's the simplest way to list conflicted files in Git?

I just need a plain list of conflicted files. Is there anything simpler than: git ls-files -u | cut -f 2 | sort -u or: git ls-files -u | awk '{print $4}' | sort | uniq I guess I could set up a handy alias for that, however was wondering how ...

C++ initial value of reference to non-const must be an lvalue

I'm trying to send value into function using reference pointer but it gave me a completely non-obvious error to me #include "stdafx.h" #include <iostream> using namespace std; void test(float *&x){ *x = 1000; } int main(){ floa...

passing 2 $index values within nested ng-repeat

So I have an ng-repeat nested within another ng-repeat in order to build a nav menu. On each <li> on the inner ng-repeat loop I set an ng-click which calls the relevant controller for that menu item by passing in the $index to let the app know ...

How do I convert two lists into a dictionary?

Imagine that you have the following list. keys = ['name', 'age', 'food'] values = ['Monty', 42, 'spam'] What is the simplest way to produce the following dictionary? a_dict = {'name': 'Monty', 'age': 42, 'food': 'spam'} ...

How does setTimeout work in Node.JS?

I guess that once it's executed it's on the queue, but in the queue is there any assurance it will invoke exactly after X milliseconds? Or will other heavy tasks higher on the queue delay it?...

Multiple github accounts on the same computer?

Trying to work on both my actual "work" repos, and my personal repos on git hub, from my computer. The work account was set up first, and everything works flawlessly. My personal account, however cannot seem to push to my personal repo, whi...

Rails 4 LIKE query - ActiveRecord adds quotes

I am trying to do a like query like so def self.search(search, page = 1 ) paginate :per_page => 5, :page => page, :conditions => ["name LIKE '%?%' OR postal_code like '%?%'", search, search], order => 'name' end But when it is ...

Getting the first character of a string with $str[0]

I want to get the first letter of a string and I've noticed that $str[0] works great. I am just not sure whether this is 'good practice', as that notation is generally used with arrays. This feature doesn't seem to be very well documented so I'm turn...

When to use RSpec let()?

I tend to use before blocks to set instance variables. I then use those variables across my examples. I recently came upon let(). According to RSpec docs, it is used to ... to define a memoized helper method. The value will be cached across mult...

How to return a class object by reference in C++?

I have a class called Object which stores some data. I would like to return it by reference using a function like this: Object& return_Object(); Then, in my code, I would call it like this: Object myObject = return_Object(); I have...

How do I add the Java API documentation to Eclipse?

I have downloaded Java API documentation from http://www.oracle.com/technetwork/java/javase/downloads/index.html#docs and have supposedly attached it to Eclipse using the Window->Preferences->Java->Installed JREs->Edit->"Select rt.jar"->Javado...

How to trim white spaces of array values in php

I have an array as follows $fruit = array(' apple ','banana ', ' , ', ' cranberry '); I want an array which contains the values without the white spaces on either sides but it can contain empty values how to do this in php.the ou...

Android Error - Open Failed ENOENT

I am trying to save some block coverage using an array of integers that simply saves the number of times a block is executed. For some reason, though, when I try and write to some files that I created ("BlockForHelper.txt" for example, which I made s...

How can I concatenate two arrays in Java?

I need to concatenate two String arrays in Java. void f(String[] first, String[] second) { String[] both = ??? } What is the easiest way to do this?...

Removing numbers from string

How can I remove digits from a string?...

Editing hosts file to redirect url?

I know you can edit a hosts file to redirect a URL to an IP address as so: 127.0.0.1 google.com but how do you force a redirect to a URL instead of an IP address? e.g. mysite.com/welcome.aspx google.com The explicit URL doesn't work and assumin...

Regex for password must contain at least eight characters, at least one number and both lower and uppercase letters and special characters

I want a regular expression to check that: A password contains at least eight characters, including at least one number and includes both lower and uppercase letters and special characters, for example #, ?, !. It cannot be your old password or co...

Differences in boolean operators: & vs && and | vs ||

I know the rules for && and || but what are & and |? Please explain these to me with an example....

Datatable select method ORDER BY clause

HI, I 'm trying to sort the rows in my datatable using select method. I know that i can say datatable.select("col1='test'") which in effect is a where clause and will return n rows that satisfy the condition. I was wondering can i do the followi...

Delete entire row if cell contains the string X

I am new to VBA and I am trying to come up with a way to delete all rows (and shift cells up, if possible) where the website column cell contains the word none. The table contains 5000+ records and this would save me a great amount of time. I appreci...

SQL Server: SELECT only the rows with MAX(DATE)

I have a table of data (the db is MSSQL): ID OrderNO PartCode Quantity DateEntered 417 2144 44917 100 18-08-11 418 7235 11762 5 18-08-11 419 9999 60657 100 18-08-11 420 9999 60657 90...

Find what 2 numbers add to something and multiply to something

Hey so I'm making a factoring program and I'm wondering if anyone can give me any ideas on an efficient way to find what two numbers multiple to a specified number, and also add to a specified number. for example I may have (a)(b) = 6 a + b = 5 S...

How to use environment variables in docker compose

I would like to be able to use env variables inside docker-compose.yml, with values passed in at the time of docker-compose up. This is the example. I am doing this today with basic docker run command, which is wrapped around my own script. Is there ...

Unable to find the requested .Net Framework Data Provider in Visual Studio 2010 Professional

Why am I getting "Unable to find the requested .Net Framework Data Provider" when trying to setup a new datasource in Visual Studio 2010 Professional? My stats: Windows 7 64bit 16gig RAM Visual Studio 2010 Professional SQL Server 2008 (server A, ...

Regarding Java switch statements - using return and omitting breaks in each case

Given this method, does this represent some egregious stylistic or semantic faux pas: private double translateSlider(int sliderVal) { switch (sliderVal) { case 0: return 1.0; case 1: return .9; cas...

Remove a modified file from pull request

I have 3 modified files (no new files) in a pull request at the moment. I would like to remove one of those files from the pull request, so that the pull request only contains changes to two files and leaves the third in its original, untouched sta...

Why do I get a C malloc assertion failure?

I am implementing a divide and conquer polynomial algorithm so I can benchmark it against an OpenCL implementation, but I can't get malloc to work. When I run the program, it allocates a bunch of stuff, checks some things, then sends the size/2 to th...

How should I remove all the leading spaces from a string? - swift

I need a way to remove the first character from a string which is a space. I am looking for a method or even an extension for the String type that I can use to cut out a character of a string....

Return from lambda forEach() in java

I am trying to change some for-each loops to lambda forEach()-methods to discover the possibilities of lambda expressions. The following seems to be possible: ArrayList<Player> playersOfTeam = new ArrayList<Player>(); for (Player p...

Remove all special characters from a string in R?

How to remove all special characters from string in R and replace them with spaces ? Some special characters to remove are : ~!@#$%^&*(){}_+:"<>?,./;'[]-= I've tried regex with [:punct:] pattern but it removes only punctuation marks. Q...

Python: How to check a string for substrings from a list?

Possible Duplicate: Check if multiple strings exist in another string I can't seem to find an equivalent of code that functions like this anywhere for Python: Basically, I'd like to check a string for substrings contained in a list....

"/usr/bin/ld: cannot find -lz"

I am trying to compile Android source code under Ubuntu 10.04. I get an error saying, /usr/bin/ld: cannot find -lz Can you please tell me how can I fix it? What does cannot find -lz mean? Here's the full error message: external/qemu/Makefile.a...

How to change package name of an Android Application

My keystore is corrupt, therefore the Android Market is requiring me to rename the app and resubmit it. However, whenever I go to edit the package names in Manifest and throughout the files, it gives me tons of errors. What's the proper way to chang...

How to get textLabel of selected row in swift?

So i am trying to get the value of the textLabel of the row I select. I tried printing it, but it didn't work. After some research I found out that this code worked, but only in Objective-C; - (void)tableView:(UITableView *)tableView didSelectRo...

How to prevent the "Confirm Form Resubmission" dialog?

How do I clean information in a form after submit so that it does not show this error after a page refresh? See image (from chrome): The dialog has the text: The page that you're looking for used information that you entered. Returning to t...

How to Select Every Row Where Column Value is NOT Distinct

I need to run a select statement that returns all rows where the value of a column is not distinct (e.g. EmailAddress). For example, if the table looks like below: CustomerName EmailAddress Aaron [email protected] Christy aaro...

How does one remove a Docker image?

I'm running Docker under Vagrant under OS X 10.8.4 (Mountain Lion), and whenever I try to delete a saved image, I get an error: $ docker rmi some-image-id 2013/07/15 hh:mm:ss unexpected JSON input According to the rmi help, the proper syntax is d...

How to change the datetime format in pandas

My dataframe has a DOB column (example format 1/1/2016) which by default gets converted to pandas dtype 'object': DOB object Converting this to date format with df['DOB'] = pd.to_datetime(df['DOB']), the date gets converted to: 2016-01-26 and its ...

How to comment and uncomment blocks of code in the Office VBA Editor

In the VBA editor of Office (ALT + F11), how do you comment or uncomment a block of code?...

How to make code wait while calling asynchronous calls like Ajax

I am looking for something like this function someFunc() { callAjaxfunc(); //may have multiple ajax calls in this function someWait(); // some code which waits until async calls complete console.log('Pass2'); } function callAjaxfunc() { //All a...

Didn't Java once have a Pair class?

Am I remembering incorrectly, or did Java, once upon a time, provide a Pair class as part of its API?...

How to access site through IP address when website is on a shared host?

I want to edit my host file to forward a website to another IP, but that IP is on a shared host, so the IP doesn't take me to the domain I want. Is there a way around this? i.e. Website: http://somerandomservice.com/ Ping the site and go to: 67.22...

How to remove all leading zeroes in a string

If I have a string 00020300504 00000234892839 000239074 how can I get rid of the leading zeroes so that I will only have this 20300504 234892839 239074 note that the number above was generated randomly....

how to create insert new nodes in JsonNode?

I have a new JsonNode that I created JsonNode jNode = new ObjectCodec().createObjectNode(); with this node, how do I then add key value pairs within so that I can construct this new node with the new values? What I read in http://www.cowtowncoder....

*.h or *.hpp for your class definitions

I've always used a *.h file for my class definitions, but after reading some boost library code, I realised they all use *.hpp. I've always had an aversion to that file extension, I think mainly because I'm not used to it. What are the advantages an...

How to export library to Jar in Android Studio?

I have downloaded some library sources and would like to export it as a Jar file using Android Studio. Is there a way to export to jar file using Android studio ? edit: The library I want to export as jar is an Android library. It's called "Stand...

TNS-12505: TNS:listener does not currently know of SID given in connect descriptor

I'm trying to connect to Oracle 10.2.0 from NetBeans, using the following connection string: jdbc:oracle:thin:@localhost:1521:XE The weirdest part is that everything worked fine, until the one of the reboots. I started getting this TNS-12505 error...

How to display loading image while actual image is downloading

Sometimes images take some time to render in the browser. I want to show a busy image while the actual image is downloading, and when the image is downloaded, the busy image is removed and the actual image should be shown. How can I do this with JQue...

How can one display images side by side in a GitHub README.md?

I'm trying to show a comparison between two photos in my README.md which is why I want to display them side-by-side. Here is how the two images are placed currently. I want to show the two Solarized color schemes side by side instead of top and botto...

Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity,

$html = file_get_contents("http://www.somesite.com/"); $dom = new DOMDocument(); $dom->loadHTML($html); echo $dom; throws Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity, Catchable fatal error: Object of class DO...

How to get parameter on Angular2 route in Angular way?

Route const appRoutes: Routes = [ { path: '', redirectTo: '/companies/unionbank', pathMatch: 'full'}, { path: 'companies/:bank', component: BanksComponent }, { path: '**', redirectTo: '/companies/unionbank' } ] Component const NAVBAR ...

Safely casting long to int in Java

What's the most idiomatic way in Java to verify that a cast from long to int does not lose any information? This is my current implementation: public static int safeLongToInt(long l) { int i = (int)l; if ((long)i != l) { throw new I...

Checking if an object is null in C#

I would like to prevent further processing on an object if it is null. In the following code I check if the object is null by either: if (!data.Equals(null)) and if (data != null) However, I receive a NullReferenceException at dataList.Add(dat...

How to disable 'X-Frame-Options' response header in Spring Security?

I have CKeditor on my jsp and whenever I upload something, the following error pops out: Refused to display 'http://localhost:8080/xxx/xxx/upload-image?CKEditor=text&CKEditorFuncNum=1&langCode=ru' in a frame because it set 'X-Frame-Options'...

Ping a site in Python?

How do I ping a website or IP address with Python?...

Get Cell Value from Excel Sheet with Apache Poi

How to get cell value with poi in java ? My code is look like this String cellformula_total__percentage= "(1-E" + (rowIndex + 2) + "/" + "D" + (rowIndex + 2) + ")*100"; cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); cell.setCellStyle(this.valueRigh...

Array of an unknown length in C#

I've just started learning C# and in the introduction to arrays they showed how to establish a variable as an array but is seems that one must specify the length of the array at assignment, so what if I don't know the length of the array?...

How do you hide the Address bar in Google Chrome for Chrome Apps?

I want to increase the screen real estate for my Chrome app. The Address Bar is useless in a Chrome App and I was wondering if there was a way to disable it....

Bringing a subview to be in front of all other views

I am working on integrating an ad provider into my app currently. I wish to place a fading message in front of the ad when the ad displays but have been completely unsuccessful. I made a function which adds a subview to my current view and tries to ...

Naming Conventions: What to name a boolean variable?

I need a good variable name for a boolean value that returns false when an object is the last in a list. The only decent name I can come up with is 'inFront', but I don't think that is descriptive enough. Another choose would be 'isNotLast'. Thi...

Make div (height) occupy parent remaining height

http://jsfiddle.net/S8g4E/ I have a container div with two children. The first child has a given height. How can I make the second child to occupy the "free space" of the container div without giving a specific height? In the example, the pink div ...

how to do "press enter to exit" in batch

I am using rake to build my project and I have a build.bat file similar to this: @echo off cls rake When I double click on build.bat the dos window pops up and shows all the progress but closes itself when the task is finished. Is there way to do ...

Preferred way to create a Scala list

There are several ways to construct an immutable list in Scala (see contrived example code below). You can use a mutable ListBuffer, create a var list and modify it, use a tail recursive method, and probably others that I don't know about. Instincti...

ResourceDictionary in a separate assembly

I have resource dictionary files (MenuTemplate.xaml, ButtonTemplate.xaml, etc) that I want to use in multiple separate applications. I could add them to the applications' assemblies, but it's better if I compile these resources in one single assembly...

How to set background image of a view?

I am a beginner at Obj-C/Cocoa Touch/iPhone OS. I wish to have a background for my app with different images everytime the the view is called. Say I have 10 images. I 've used it like this: //random image generation NSString* imageName; int aRando...

how to use json file in html code

I have json file mydata.json, and in this file is some json-encoded data. I want obtain this data in file index.html and process this data in JavaScript. But a don't know how to connect.json file in .html file? Tell me please. Here is my json file...

Pythonic way to combine FOR loop and IF statement

I know how to use both for loops and if statements on separate lines, such as: >>> a = [2,3,4,5,6,7,8,9,0] ... xyz = [0,12,4,6,242,7,9] ... for x in xyz: ... if x in a: ... print(x) 0,4,6,7,9 And I know I can use a list compre...

How to pass a null variable to a SQL Stored Procedure from C#.net code

Im calling a SQL stored procedure from a piece of C#.net code: SqlHelper.ExecuteDataset(sqlConnection, CommandType.StoredProcedure, STORED_PROC_NAME, sqlParameters); where the sqlParameters variable is defined as: SqlParameter[] sqlParame...

POST request send json data java HttpUrlConnection

I have developed a java code that convert the following cURL to java code using URL and HttpUrlConnection. the curl is : curl -i 'http://url.com' -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{"auth": { "passwordCred...

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: #4f5151; display: table; border-left: 1px s...

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 by relevance, (how many of the words are found?) ...

Using JQuery - preventing form from submitting

How do I prevent a form from submitting using jquery? I tried everything - see 3 different options I tried below, but it all won't work: $(document).ready(function() { //option A $("#form").submit(function(e){ ...

JAVA How to remove trailing zeros from a double

For example I need 5.0 to become 5, or 4.3000 to become 4.3....

Page loaded over HTTPS but requested an insecure XMLHttpRequest endpoint

I have a page with some D3 javascript on. This page sits within a HTTPS website, but the certificate is self-signed. When I load the page, my D3 visualisations do not show, and I get the error: Mixed Content: The page at 'https://integration.jsi...

Convert from List into IEnumerable format

IEnumerable<Book> _Book_IE List<Book> _Book_List How shall I do in order to convert _Book_List into IEnumerable format?...

How to count the number of lines of a string in javascript

I want to count the number of lines in a string i tried to use this stackoverflow answer : lines = str.split("\r\n|\r|\n"); return lines.length; on this string(which was originally a buffer): GET / HTTP/1.1 Host: localhost:8888 Connection:...

Overlaying histograms with ggplot2 in R

I am new to R and am trying to plot 3 histograms onto the same graph. Everything worked fine, but my problem is that you don't see where 2 histograms overlap - they look rather cut off. When I make density plots, it looks perfect: each curve is surro...

Using NotNull Annotation in method argument

I just started using the @NotNull annotation with Java 8 and getting some unexpected results. I have a method like this: public List<Found> findStuff(@NotNull List<Searching> searchingList) { ... code here ... } I wrote a JUnit te...

How can I sort a std::map first by value, then by key?

I need to sort a std::map by value, then by key. The map contains data like the following: 1 realistically 8 really 4 reason 3 reasonable 1 reasonably 1 reassemble 1 reassembled 2 recognize 92 ...

TypeScript: correct way to do string equality?

If I know x and y are both of type string, is the correct way to do string equality simply x == y? The linter I'm using complains about this....

ORA-01008: not all variables bound. They are bound

I have come across an Oracle problem for which I have so far been unable to find the cause. The query below works in Oracle SQL developer, but when running in .NET it throws: ORA-01008: not all variables bound I've tried: Changing the Oracle ...

Can't import org.apache.http.HttpResponse in Android Studio

I want to use these libraries in Android Studio: import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; I am following a v...

How to use glob() to find files recursively?

This is what I have: glob(os.path.join('src','*.c')) but I want to search the subfolders of src. Something like this would work: glob(os.path.join('src','*.c')) glob(os.path.join('src','*','*.c')) glob(os.path.join('src','*','*','*.c')) glob(os.p...

Failed to find 'ANDROID_HOME' environment variable

I am trying to build an ionic-android project and i have android sdk installed. The name of my project is myApp.I have successfully added android platform to myApp. But when i tries to build the project ~/myApp$ sudo ionic build android result...

Change status bar text color to light in iOS 9 with Objective-C

In iOS 9, how do I change the color of the status bar text to white?...

jQuery - getting custom attribute from selected option

Given the following: <select id="location"> <option value="a" myTag="123">My option</option> <option value="b" myTag="456">My other option</option> </select> <input type="hidden" id="setMyTag" /> &...

How to Change color of Button in Android when Clicked?

I am working on Android Application. I want to have 4 buttons to be placed horizontally at the bottom of the screen. In these 4 buttons 2 buttons are having images on them. The border of the buttons should be black color and the border should be as t...

How do I test a website using XAMPP?

This is a fairly general query as I'm very confused about how to do this. I want to use the apache server which I have downloaded as part of XAMPP in order to test the website I am building, which will use php and mysql. The general question is: how ...

How to install SQL Server 2005 Express in Windows 8

I tried to install SQL Server 2005 Express SP3 x64 on Windows 8 but the installer gives me an error: An installation package for the product Microsoft SQL server native Client cannot be found. Try the installation again using a valid copy of ...

Remove leading zeros from a number in Javascript

Possible Duplicate: Truncate leading zeros of a string in Javascript What is the simplest and cross-browser compatible way to remove leading zeros from a number in Javascript ? e.g. If I have a textbox value as 014 or 065, it should only ...

How do I specify C:\Program Files without a space in it for programs that can't handle spaces in file paths?

A configuration file needs position of another file, but that file is located in "C:\Program Files", and the path with space in it is not recognized, Is there another way to specify the location without space in it?...

Explain ExtJS 4 event handling

I've recently started learning ExtJS, and have trouble understanding how to handle Events. I have no experience of any previous versions of ExtJS. From reading various manuals, guides and documentation pages, I've figured out how to use it, but I'm...

Python Prime number checker

I have been trying to write a program that will take an inputed number, and check and see if it is a prime number. The code that I have made so far works perfectly if the number is in fact a prime number. If the number is not a prime number it acts...

Display Python datetime without time

I have a date string and want to convert it to the date type: I have tried to use datetime.datetime.strptime with the format that I want but it is returning the time with the conversion. when = alldates[int(daypos[0])] print when, type(when...

Transfer data between iOS and Android via Bluetooth?

I've been reading up on how to transfer data between iOS devices over Bluetooth using GameKit. I'm not writing a game, per se, but do have a need to transfer a small amount of binary data between two devices. Between two iOS devices, this is easy e...

How to force a line break in a long word in a DIV?

Okay, this is really confusing me. I have some content inside of a div like so: <div style="background-color: green; width: 200px; height: 300px;"> Thisisatest.Thisisatest.Thisisatest.Thisisatest.Thisisatest.Thisisatest. </div> Howev...

How do I print all POST results when a form is submitted?

I need to see all of the POST results that are submitted to the server for testing. What would be an example of how I can create a new file to submit to that will echo out all of the fields which were submitted with that form? It's dynamic, so some...

In a Git repository, how to properly rename a directory?

I think it should work to copy the directory to be renamed to a new directory with desired name, and delete the old directory, and git add, git commit and push everything. But is this the best way?...

Why maven? What are the benefits?

What are the main benefits of using maven compared to let's say ant ? It seems to be more of a annoyance than a helpful tool. I use maven 2, with plain Eclipse Java EE (no m2eclipse), and tomcat. Supporters of maven believe that Maven lets you ge...

PostgreSQL - fetch the row which has the Max value for a column

I'm dealing with a Postgres table (called "lives") that contains records with columns for time_stamp, usr_id, transaction_id, and lives_remaining. I need a query that will give me the most recent lives_remaining total for each usr_id There are mult...

Get statistics for each group (such as count, mean, etc) using pandas GroupBy?

I have a data frame df and I use several columns from it to groupby: df['col1','col2','col3','col4'].groupby(['col1','col2']).mean() In the above way I almost get the table (data frame) that I need. What is missing is an additional column that con...

How do I create a copy of an object in PHP?

It appears that in PHP objects are passed by reference. Even assignment operators do not appear to be creating a copy of the Object. Here's a simple, contrived proof: <?php class A { public $b; } function set_b($obj) { $obj->b = "after...

How to increase font size in a plot in R?

I am confused. What is the right way to increase font size of text in the title, labels and other places of a plot? For example x <- rnorm(100) hist(x, xlim=range(x), xlab= "Variable Label", ylab="density", main="Title of plot", prob=TRUE...

Prevent PDF file from downloading and printing

I am trying to find a way to prevent a PDF from being printed or downloaded when view from web. Also, it is prefered that user cannot print screen. I am thinking about converting those PDF files to Flash. Any other ideas?...

How to replace all strings to numbers contained in each string in Notepad++?

I'm trying to find all values with following pattern : value="4" value="403" value="200" value="201" value="116" value="15" and replace it with value inside scopes. I'm using the following regex to find the pattern : .*"\d+" How can I do a rep...

How do I pass command-line arguments to a WinForms application?

I have two different WinForms applications, AppA & AppB. Both are running .NET 2.0. In AppA I want to open AppB, but I need to pass command-line arguments to it. How do I consume the arguments that I pass in the command line? This is my current...

Generate 'n' unique random numbers within a range

I know how to generate a random number within a range in Python. random.randint(numLow, numHigh) And I know I can put this in a loop to generate n amount of these numbers for x in range (0, n): listOfNumbers.append(random.randint(numLow, numH...

Linux command line howto accept pairing for bluetooth device without pin

Is there a way to pair a device in linux without requiring a pin(for testing purposes so I need it to be done w/out human interaction, assuming you have root access)? bluez-simple-agent seems to require a pin except with some simple devices such as ...

Get last 30 day records from today date in SQL Server

I have small question about SQL Server: how to get last 30 days information from this table Sample data: Product: Pdate ---------- 2014-11-20 2014-12-12 2014-11-10 2014-12-13 2014-10-12 2014-11-15 2014-11-14 2014-11-16 2015-01-18 Based on this ...

Difference between array_map, array_walk and array_filter

What exactly is the difference between array_map, array_walk and array_filter. What I could see from documentation is that you could pass a callback function to perform an action on the supplied array. But I don't seem to find any particular differen...

Saving a Numpy array as an image

I have a matrix in the type of a Numpy array. How would I write it to disk it as an image? Any format works (png, jpeg, bmp...). One important constraint is that PIL is not present....

Change the "From:" address in Unix "mail"

Sending a message from the Unix command line using mail TO_ADDR results in an email from $USER@$HOSTNAME. Is there a way to change the "From:" address inserted by mail? For the record, I'm using GNU Mailutils 1.1/1.2 on Ubuntu (but I've seen the sam...

"Undefined reference to" template class constructor

I have no idea why this is happenning, since I think I have everything properly declared and defined. I have the following program, designed with templates. It's a simple implementation of a queue, with the member functions "add", "substract" and "p...

Where does the .gitignore file belong?

Does the .gitignore file belong in the .git folder structure somewhere or in the main source files?...

Multiple inputs with same name through POST in php

Is it possible to get multiple inputs of the same name to post and then access them from PHP? The idea is this: I have a form that allows the entry of an indefinite number of physical addresses along with other information. If I simply gave each of...

How to convert String to DOM Document object in java?

I have a case like getting an XML and convert the XML elements to document object and getting the element values and attributes which i have been created already Here is the piece of code i have tried to convert the string to DOM document object St...

What's the difference between "super()" and "super(props)" in React when using es6 classes?

When is it important to pass props to super(), and why? class MyComponent extends React.Component { constructor(props) { super(); // or super(props) ? } } ...

Execute script after specific delay using JavaScript

Is there any JavaScript method similar to the jQuery delay() or wait() (to delay the execution of a script for a specific amount of time)?...

What is the most elegant way to check if all values in a boolean array are true?

I have a boolean array in java: boolean[] myArray = new boolean[10]; What's the most elegant way to check if all the values are true?...

How do you check if a JavaScript Object is a DOM Object?

I'm trying to get: document.createElement('div') //=> true {tagName: 'foobar something'} //=> false In my own scripts, I used to just use this since I never needed tagName as a property: if (!object.tagName) throw ...; So for the second...

HttpServletRequest get JSON POST data

I am HTTP POST-ing to URL http://laptop:8080/apollo/services/rpc?cmd=execute with POST data { "jsondata" : "data" } Http request has Content-Type of application/json; charset=UTF-8 How do I get the POST data (jsondata) from HttpServletRequest? ...

Get the current date in java.sql.Date format

I need to add the current date into a prepared statement of a JDBC call. I need to add the date in a format like yyyy/MM/dd. I've try with DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); Date date = new Date(); pstm.setDate(6, (java.sql...

Rails where condition using NOT NIL

Using the rails 3 style how would I write the opposite of: Foo.includes(:bar).where(:bars=>{:id=>nil}) I want to find where id is NOT nil. I tried: Foo.includes(:bar).where(:bars=>{:id=>!nil}).to_sql But that returns: => "SELEC...

Getting the index of a particular item in array

I want to retrieve the index of an array but I know only a part of the actual value in the array. For example, I am storing an author name in the array dynamically say "author = 'xyz'". Now I want to find the index of the array item contai...

How to parse JSON with VBA without external libraries?

I have a json like below: {"sentences":[{"trans":"something ru","orig":"english word","translit":"Angliyskoye slovo","src_translit":""}], "src":"en","server_time":69} and parse it: Function jsonDecode(jsonString As Variant) Set sc = CreateObj...

Comparing two collections for equality irrespective of the order of items in them

I would like to compare two collections (in C#), but I'm not sure of the best way to implement this efficiently. I've read the other thread about Enumerable.SequenceEqual, but it's not exactly what I'm looking for. In my case, two collections would...

MySQL Query to select data from last week?

Hi I have a table with a date field and some other information. I want to select all entries from the past week, (week start from Sunday). table values: id date 2 2011-05-14 09:17:25 5 2011-05-16 09:17:25 6 2011-05-17 09:17:25 8 2011-05-20...

Nested ifelse statement

I'm still learning how to translate a SAS code into R and I get warnings. I need to understand where I'm making mistakes. What I want to do is create a variable which summarizes and differentiates 3 status of a population: mainland, overseas, foreign...

How to delete from select in MySQL?

This code doesn't work for MySQL 5.0, how to re-write it to make it work DELETE FROM posts where id=(SELECT id FROM posts GROUP BY id HAVING ( COUNT(id) > 1 )) I want to delete columns that dont have unique id. I will add that most of the time...

Make text wrap in a cell with FPDF?

Right now when I use a cell with text, it all stays on one line. I know I could use the write function, but I want to be able to specify the height and width. This is what I have now, but as I said the text does not wrap to stay in the dimensions: ...

Executing Javascript code "on the spot" in Chrome?

I have a page in chrome which contains many textboxes and I wish to feed values automatically to them. I already have the list of name-value pairs, so if I could simple execute a series of Javascript commands on the form "document.getElementsByName(N...

How to change identity column values programmatically?

I have a MS SQL 2005 database with a table Test with column ID. ID is an identity column. I have rows in this table and all of them have their corresponding ID auto incremented value. Now I would like to change every ID in this table like this: I...

Batch Script to Run as Administrator

I'm writing a client/server checking program but it needs to run as Administrator. I want this to run silently on my network and users, and I don't want the "Run as" Administrator" prompt. Is there any beginning code that I can place into the batch ...

How to check if IsNumeric

Possible Duplicate: How to identify if string contain a number? In VB there's an IsNumeric function, is there something similar in c#? To get around it, I just wrote the code: if (Int32.Parse(txtMyText.Text.Trim()) > 0) I was ...

java.io.InvalidClassException: local class incompatible:

I created client and server and then added a class in client side for serializing purposes, then simply just went to the folder of the client in my hard drive and copy paste it to the server correponding location, both classname.class and classname.j...

Passing parameters to a Bash function

I am trying to search how to pass parameters in a Bash function, but what comes up is always how to pass parameter from the command line. I would like to pass parameters within my script. I tried: myBackupFunction("..", "...", &qu...

Failed to load the JNI shared Library (JDK)

When I try opening Eclipse, a pop-up dialog states: Failed to load the JNI shared library "C:/JDK/bin/client/jvm.dll"`. Following this, Eclipse force closes. Here's a few points I'd like to make: I checked to see if anything exists at that...

How to use Simple Ajax Beginform in Asp.net MVC 4?

I am new in Asp.net MVC and i researched about Ajax.BeginForm but when i apply codes it did not work. Can you share very simple example with Ajax.Beginform with View, Controller, Model? Thanks....

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. In other words file_001... instead of fi...

calling javascript function on OnClientClick event of a Submit button

In my asp.net page, I have three text boxes and one button. First two text boxes are being used to get the value from the user and third one is being used to show the sum of first two boxes. I am calling a javascript function to sum the values and...

HTML Input - already filled in text

I was wondering, is there a way to put text into an input field? What i've got now is a placeholder, but that's actually an empty inputfield. So that's not what i'm looking for. I'm looking for an (kind of) placeholder that's actually filled in into ...

How to view the assembly behind the code using Visual C++?

I was reading another question pertaining the efficiency of two lines of code, and the OP said that he looked at the assembly behind the code and both lines were identical in assembly. Digression aside, how could I view the assembly code created whe...

How to read a file in Groovy into a string?

I need to read a file from the file system and load the entire contents into a string in a groovy controller, what's the easiest way to do that?...

What is the non-jQuery equivalent of '$(document).ready()'?

What is the non-jQuery equivalent of $(document).ready()?...

php timeout - set_time_limit(0); - don't work

I'm having a problem with my PHP file that takes more than 30 seconds to execute. After searching, I added set_time_limit(0); at the start of the code,cbut the file still times out with a 500 error after 30 seconds. log: PHP Fatal error: Maximum e...

Grant all on a specific schema in the db to a group role in PostgreSQL

Using PostgreSQL 9.0, I have a group role called "staff" and would like to grant all (or certain) privileges to this role on tables in a particular schema. None of the following work GRANT ALL ON SCHEMA foo TO staff; GRANT ALL ON DATABASE mydb TO s...

Increment value in mysql update query

I have made this code for giving out +1 point, but it doesn't work properly. mysql_query(" UPDATE member_profile SET points= ' ".$points." ' + 1 WHERE user_id = '".$userid."' "); the $points variable is the user´s points right now.....

Java GC (Allocation Failure)

Why always "GC (Allocation Failure)"? Java HotSpot(TM) 64-Bit Server VM (25.25-b02) for linux-amd64 JRE (1.8.0_25-b17), CommandLine flags: -XX:CMSInitiatingOccupancyFraction=60 -XX:GCLogFileSize=10485760 -XX:+HeapDumpOnOutOfMemoryError -XX:Ini...

Get year, month or day from numpy datetime64

I have an array of datetime64 type: dates = np.datetime64(['2010-10-17', '2011-05-13', "2012-01-15"]) Is there a better way than looping through each element just to get np.array of years: years = f(dates) #output: array([2010, 2011, 2012], dtype...

org.hibernate.QueryException: could not resolve property: filename

I am using Hibernate Criteria to get values from column filename in my table contaque_recording_log. But when I'm getting the result, it throws an exception org.hibernate.QueryException: could not resolve property: filename of: com.contaque.hibe...

How to replicate vector in c?

In the days before c++ and vector/lists, how did they expand the size of arrays when they needed to store more data?...

How to list the size of each file and directory and sort by descending size in Bash?

I found that there is no easy to get way the size of a directory in Bash? I want that when I type ls -<some options>, it can list of all the sum of the file size of directory recursively and files at the same time and sort by size order. Is t...

Groovy write to file (newline)

I created a small function that simply writes text to a file, but I am having issues making it write each piece of information to a new line. Can someone explain why it puts everything on the same line? Here is my function: public void writeToFil...

Not equal string

I'm trying to set a condition like this if (myString=!"-1") { //Do things } But it fails. I've tried if(myString.Distinct("-1")) { //Do things } but it doesn't work either. ...

Confirm password validation in Angular 6

I want to perform password and confirm password validations using material components only,and an error message below the confirm password field if confirm password field doesn't match And if it is empty.Tried many resources unable to achieve. Trie...

How to URL encode in Python 3?

I have tried to follow the documentation but was not able to use urlparse.parse.quote_plus() in Python 3: from urllib.parse import urlparse params = urlparse.parse.quote_plus({'username': 'administrator', 'password': 'xyz'}) I get AttributeEr...

Apply Calibri (Body) font to text

I have a div and in this div I want to display some text in Calibri (Body) font. How can I do this? This is the css I have been given : .an_account_join_1 { float:left; width:100%; color:#000000; font-family:Calibri (Body); let...

Write to file, but overwrite it if it exists

echo "text" >> 'Users/Name/Desktop/TheAccount.txt' How do I make it so it creates the file if it doesn't exist, but overwrites it if it already exists. Right now this script just appends....

nginx 502 bad gateway

I get a 502 Bad Gateway with nginx when using spawn fcgi to spawn php5-cgi. I use this to span an instance on server start using the following line in rc.local /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P...

How do I raise the same Exception with a custom message in Python?

I have this try block in my code: try: do_something_that_might_raise_an_exception() except ValueError as err: errmsg = 'My custom error message.' raise ValueError(errmsg) Strictly speaking, I am actually raising another ValueError, not...

How to connect Android app to MySQL database?

I have a website already setup which uses mysql database. I want to know how can i connect my app to that database. What i wanna achieve is that my app should make a request to find a table of a defined "ID" or name. The table contains links to imag...

Currency format for display

Is there a way to format the correct currency representation for a country? Example UK -£127.54 Netherlands € 127,54- USA $127.54 etc.. Some things to consider, Currency Symbol Currency symbol placement -- It can be either place before or after...

MVC ajax json post to controller action method

I am trying to achieve a JQuery AJAX call to a controller action method that contains a complex object as a parameter. I have read plenty blogs and tried several techniques learned from these. The key post on which I have constructed my best attempt ...

Why do table names in SQL Server start with "dbo"?

At least on my local instance, when I create tables, they are all prefixed with "dbo.". Why is that?...

Android studio Error "Unsupported Modules Detected: Compilation is not supported for following modules"

I am using Android studio 1.0.1. I have a java module referred by other modules in my project. I have checked it out from SVN But now every Unsupported Modules Detected: Compilation is not supported for following modules: . Unfortunately you can't ...

Set TextView text from html-formatted string resource in XML

I have some fixed strings inside my strings.xml, something like: <resources> <string name="somestring"> <B>Title</B><BR/> Content </string> </resources> and in my layout I've got a ...

SQL how to increase or decrease one for a int column in one command

I have an Orders table which has a Quantity column. During check in or check out, we need to update that Quantity column by one. Is there a way to do this in one action or we have to get the existing value and then add or minus one on top of it? Ano...

Check if a variable exists in a list in Bash

I am trying to write a script in bash that check the validity of a user input. I want to match the input (say variable x) to a list of valid values. what I have come up with at the moment is: for item in $list do if [ "$x" == "$ite...

Easiest way to copy a single file from host to Vagrant guest?

I have a use case where I occasionally want to copy a single file from my host machine to the Vagrant guest. I don't want to do so via traditional provisioners (Puppet / Chef) because this is often a one-off -- I just want something quick to add to ...

#1071 - Specified key was too long; max key length is 1000 bytes

I know questions with this title have been answered before, but please do read on. I've read thoroughly all the other questions/answers on this error before posting. I am getting the above error for the following query: CREATE TABLE IF NOT EXISTS `...

PL/SQL, how to escape single quote in a string?

In the Oracle PL/SQL, how to escape single quote in a string ? I tried this way, it doesn't work. declare stmt varchar2(2000); begin for i in 1021 .. 6020 loop stmt := 'insert into MY_TBL (Col) values(\'ER0002\')'; dbms_output.put_li...

How to determine day of week by passing specific date?

For Example I have the date: "23/2/2010" (23th Feb 2010). I want to pass it to a function which would return the day of week. How can I do this? In this example, the function should return String "Tue". Additionally, if just the day ordinal is desi...

Encrypt and decrypt a password in Java

I want to encrypt and decrypt a password in Java and store into database in the form of encrypted. It will great if it is open source. Any suggestions / pointers ?...

Using CSS :before and :after pseudo-elements with inline CSS?

I'm making an HTML email signature with inline CSS (i.e. CSS in style attributes), and I am curious as to whether it's possible to use the :before and :after pseudo-elements. If so, how would I implement something like this with inline CSS? td { te...

get the latest fragment in backstack

How can I get the latest fragment instance added in backstack (if I do not know the fragment tag & id)? FragmentManager fragManager = activity.getSupportFragmentManager(); FragmentTransaction fragTransacion = fragMgr.beginTransaction(); /****Af...

Change border-bottom color using jquery?

I want to change the color of the bottom border using jquery..Thanks...

How to export iTerm2 Profiles

I needed to reformat my computer and now I'm having trouble copying the settings/profiles over. I copied the files in ~/Library/Application\ Support/iTerm/ I also copied ~/Library/Preferences/com.googlecode.iterm2.plist but it keeps giving me this ...

How can I convert a string with dot and comma into a float in Python

How can I convert a string like 123,456.908 to float 123456.908 in Python?...

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" on the item element within the menu element but it...

What is the difference between Scope_Identity(), Identity(), @@Identity, and Ident_Current()?

I know Scope_Identity(), Identity(), @@Identity, and Ident_Current() all get the value of the identity column, but I would love to know the difference. Part of the controversy I'm having is what do they mean by scope as applied to these functions ab...

Java LinkedHashMap get first or last entry

I have used LinkedHashMap because it is important the order in which keys entered in the map. But now I want to get the value of key in the first place (the first entered entry) or the last. Should there be a method like first() and last() or somet...

How can I require at least one checkbox be checked before a form can be submitted?

I have a list of multiple check boxes. The user can check all of them, but at least one should be checked to allow form submission. How can I enforce that requirement? <p>Box Set 1</p> <ul> <li><input name="BoxSelect[]"...

Adjust UILabel height to text

I have some labels which I want to adjust their height to the text, this is the code I wrote for this now func heightForView(text:String, font:UIFont, width:CGFloat) -> CGFloat{ let label:UILabel = UILabel(frame: CGRectMake(0, 0, width, CGFlo...

Add Favicon with React and Webpack

I am attempting to add a favicon to a React-based website that I made using webpack. It has been a total nightmare to add a favicon and I have tried many solutions to no avail. The latest solution that has been recommended to me is called 'favicons-w...

The simplest possible JavaScript countdown timer?

Just wanted to ask how to create the simplest possible countdown timer. There'll be a sentence on the site saying: "Registration closes in 05:00 minutes!" So, what I want to do is to create a simple js countdown timer that goes from "05:00" t...

jQuery Get Selected Option From Dropdown

Usually I use $("#id").val() to return the value of the selected option, but this time it doesn't work. The selected tag has the id aioConceptName html code <label>Name</label> <input type="text" name="name" /> <select id="aioC...

How to restart service using command prompt?

I want to restart Windows service using command prompt in [Icons] section using Inno Setup. Please help me to solve the problem....

Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' with pdo

$db = new PDO('mysql:dbname=xnews;host=localhost;port=' . $LOCAL_DB_PORT, $LOCAL_DB_USER, $LOCAL_DB_PASS, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'") ); reports: Undefined class constant ...

how to call url of any other website in php

how to call url of any other website in php....

How to animate the change of image in an UIImageView?

I have an UIImageView with an image. Now I have a completely new image (graphic file), and want to display that in this UIImageView. If I just set myImageView.image = newImage; the new image is visible immediately. Not animatable. I want it to ...

Multiple left joins on multiple tables in one query

I've got one master table, which has items stored in multiple levels, parents and childs, and there is a second table which may or may not have additional data. I need to query two levels from my master table and have a left join on my second table, ...

How do I update pip itself from inside my virtual environment?

I'm able to update pip-managed packages, but how do I update pip itself? According to pip --version, I currently have pip 1.1 installed in my virtualenv and I want to update to the latest version. What's the command for that? Do I need to use distr...

javascript function wait until another function to finish

I have two javascript functions that are called from android. After long debug sessions finally I realized that the problem is arising from the fact that second function is getting called before first one is finished. I already searched the examples ...

Trigger event on body load complete js/jquery

I want to trigger one event on page load complete using javascript/jquery. Is there any way to trigger event or call a simple function once page loading fully completes. Please suggest folks if you any reference....

CodeIgniter Select Query

I have a simple CodeIgniter Active record query to select an ID: $q = $this -> db -> select('id') -> where('email', $email) -> limit(1) -> get('users'); How can I assign the above ID to a ...

JavaScript adding decimal numbers issue

So I am making a script that adds two numbers (decimal numbers) together, which I have encountered a problem. http://jsfiddle.net/DerekL/esqnC/ I made the script, it turns out pretty good: 0.1 + 0.5 //0.6 0.2 + 0.3 //0.5 But soon I see: 0.1 +...

How to copy from CSV file to PostgreSQL table with headers in CSV file?

I want to copy a CSV file to a Postgres table. There are about 100 columns in this table, so I do not want to rewrite them if I don't have to. I am using the \copy table from 'table.csv' delimiter ',' csv; command but without a table created I get E...