Questions Tagged with #Lokad cqrs

Git: How to return from 'detached HEAD' state

If one would checkout a branch: git checkout 760ac7e from e.g. b9ac70b, how can one go back to the last known head b9ac70b without knowing its SHA1?..

Can I rollback a transaction I've already committed? (data loss)

I committed an incorrect UPDATE statement and have lost some data. Is it possible to rollback now, after I've already committed? Any help? ROLLBACK says NOTICE: there is no transaction in progre..

How to force an entire layout View refresh?

I want to force the main layout resource view to redraw / refresh, in say the Activity.onResume() method. How can I do this ? By main layout view, I mean the one ('R.layout.mainscreen' below) that i..

How do I convert from stringstream to string in C++?

How do I convert from std::stringstream to std::string in C++? Do I need to call a method on the string stream?..

npm global path prefix

I am being more cautious than usual because I have been confused by the behavior of npm in the past. I am on a Mac and have installed node.js through brew install node. Now that I want to run jsli..

MySQL: Selecting multiple fields into multiple variables in a stored procedure

Can I SELECT multiple columns into multiple variables within the same select query in MySQL? For example: DECLARE iId INT(20); DECLARE dCreate DATETIME; SELECT Id INTO iId, dateCreated INTO dCreat..

How can I create a table with borders in Android?

I use a table layout to display data as table, but I want a table with user-defined columns and rows with borders. Suggestions?..

Case insensitive access for generic dictionary

I have an application that use managed dlls. One of those dlls return a generic dictionary: Dictionary<string, int> MyDictionary; The dictionary contains keys with upper and lower case. ..

run program in Python shell

I have a demo file: test.py. In the Windows Console I can run the file with: C:\>test.py How can I execute the file in the Python Shell instead?..

JSON.NET Error Self referencing loop detected for type

I tried to serialize POCO class that was automatically generated from Entity Data Model .edmx and when I used JsonConvert.SerializeObject I got the following error: Error Self referencing loop dete..

<strong> vs. font-weight:bold & <em> vs. font-style:italic

Is there any real difference between using <strong> and <em> instead of the CSS properties: font-weight: bold; font-style: italic; Also, what is really the reason that both options exis..

How to set value in @Html.TextBoxFor in Razor syntax?

I have created an text-box using Razor and trying to set value as follows. @Html.TextBoxFor(model => model.Destination, new { id = "txtPlace", value= "3" }) I have tried appending value with @ ..

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

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

Different ways of adding to Dictionary

What is the difference in Dictionary.add(key, value) and Dictionary[key] = value? I've noticed that the last version does not throw an ArgumentException when inserting a duplicate key, but is there a..

Render Partial View Using jQuery in ASP.NET MVC

How do I render the partial view using jquery? We can render the partial View like this: <% Html.RenderPartial("UserDetails"); %> How can we do the same using jquery?..

Get second child using jQuery

$(t).html() returns <td>test1</td><td>test2</td> I want to retrieve the second td from the $(t) object. I searched for a solution but nothing worked for me. Any idea how ..

How do I fix the npm UNMET PEER DEPENDENCY warning?

I'm on Windows 10, with Node 5.6.0 and npm 3.6.0. I'm trying to install angular-material and mdi into my working folder. npm install angular-material mdi errors with: +-- [email protected] +-- UNMET PEE..

Windows XP or later Windows: How can I run a batch file in the background with no window displayed?

I know I have already answered a similar question (Running Batch File in background when windows boots up), but this time I need to launch a batch: from another batch, without any console window dis..

Adding three months to a date in PHP

I have a variable called $effectiveDate containing the date 2012-03-26. I am trying to add three months to this date and have been unsuccessful at it. Here is what I have tried: $effectiveDate = st..

Swap two items in List<T>

Is there a LINQ way to swap the position of two items inside a list<T>?..

How to read/write arbitrary bits in C/C++

Assuming I have a byte b with the binary value of 11111111 How do I for example read a 3 bit integer value starting at the second bit or write a four bit integer value starting at the fifth bit?..

How do you remove the title text from the Android ActionBar?

I'm looking through the Holo.Light theme, and I can't seem to find the magic style to override to get rid of the title text that briefly shows up when my app first launches. How can I do that?..

Passing argument to alias in bash

Is it possible to do the following: I want to run the following: mongodb bin/mongod In my bash_profile I have alias = "./path/to/mongodb/$1" ..

How can I use threading in Python?

I am trying to understand threading in Python. I've looked at the documentation and examples, but quite frankly, many examples are overly sophisticated and I'm having trouble understanding them. How ..

How to list running screen sessions?

I have a bunch of servers, on which I run experiments using screen. The procedure is the following : ssh to server XXX launch screen start experiments in a few tabs detach screen disconnect from the..

find -exec with multiple commands

I am trying to use find -exec with multiple commands without any success. Does anybody know if commands such as the following are possible? find *.txt -exec echo "$(tail -1 '{}'),$(ls '{}')" \; Ba..

Save multiple sheets to .pdf

I have a reporting spreadsheet that grabs some data from a database and forms three sheets of summary report information. I want to run the spreadsheet automatically from the command line, and have it..

How to remove folders with a certain name

In Linux, how do I remove folders with a certain name which are nested deep in a folder hierarchy? The following paths are under a folder and I would like to remove all folders named a. 1/2/3/a 1/..

Regex remove all special characters except numbers?

I would like to remove all special characters (except for numbers) from a string. I have been able to get this far var name = name.replace(/[^a-zA-Z ]/, ""); but it seems that it is removing the fi..

Find all elements with a certain attribute value in jquery

I need to find all elements that has a special attribute value. Here is the div I need to find (I have many of them..) <div imageId='imageN'>... I simply need to loop through the divs which ..

What is a "web service" in plain English?

I've been reading about "web services" here on SO, on Wikipedia, Google, etc., and I don't quite understand what they are. What is the plain English definition/description? If I make a simple websit..

Notepad++ Regular expression find and delete a line

I am trying to find and delete a line using Notepad++ I need to find lines in this file (UNIX Format) that match the string '#RedirectMatch Permanent' and delete that line. Does anyone know how to d..

php.ini & SMTP= - how do you pass username & password

My ISP account requires that I send a username & password for outbound SMTP mail. How do I get PHP to use this when executing php.mail()? The php.ini file only contains entries for the server (S..

How do I update all my CPAN modules to their latest versions?

How do I update all my CPAN modules to their latest versions?..

how to check the jdk version used to compile a .class file

Possible Duplicate: Tool to read and display Java .class versions I'm trying to debug a "Bad version number in .class file' error in java, is there a way for me to check which versi..

How to get EditText value and display it on screen through TextView?

I want to get the user input for the EditText view and display it on the screen through TextView when the Button is clicked. I also, want to know what modifications can be done on the string.xml file ..

Format ints into string of hex

I need to create a string of hex digits from a list of random integers (0-255). Each hex digit should be represented by two characters: 5 - "05", 16 - "10", etc. Example: Input: [0,1,2,3,127,200,25..

How do you write multiline strings in Go?

Does Go have anything similar to Python's multiline strings: """line 1 line 2 line 3""" If not, what is the preferred way of writing strings spanning multiple lines?..

Changing background color of text box input not working when empty

I am having a tough time with this javascript code to change the background color of a text input if the input is empty. Here is the code: function checkFilled() { var inputVal = document.getEle..

Finding partial text in range, return an index

I need to find a partial text in a specific range and get a value which is X rows under cell index of found text. I have tried with INDEX and MATCH functions but without success. As in example: loo..

How can I write variables inside the tasks file in ansible

I have this play.yml --- - hosts: 127.0.0.1 connection: local sudo: false tasks: - include: apache.yml My Apache look like this: vars: url: czxcxz - name: Download apache shell:..

what is Ljava.lang.String;@

I have a string array selectCancel with setter and getter methods, which is a checkbox in my form. I am trying to get the checked values and I am getting the above result when I print. I tried the Ar..

Differences between Oracle JDK and OpenJDK

NOTE: This question is from 2014. As of Java 11 OpenJDK and Oracle JDK are converging. Are there any crucial differences between Oracle and OpenJDK? For example, are the garbage collection a..

Changing the width of Bootstrap popover

I am designing a page using Bootstrap 3. I am trying to use a popover with placement: right on an input element. The new Bootstrap ensures that if you use form-control you basically have a full-width ..

PHP is not recognized as an internal or external command in command prompt

I got the following error when I run a command with php C:\xampp\htdocs>php 'php' is not recognized as an internal or external command, operable program or batch file. I don't get any error when..

How to check if an element does NOT have a specific class?

How do I check if there isn't a class. For example, I know how to check to see if it has the class "test", but how do I check to see if it doesn't have the class "test"? if($(this).hasClass("test")){..

SQL Query for Selecting Multiple Records

I have 9 fields and I need to see all the data from these fields which have a particular set of IDs. Could any one tell me the SQL query for it? Ex: Database contains 100 records. I need to select a ..

Email Address Validation in Android on EditText

How can we perform Email Validation on edittext in android ? I have gone through google & SO but I didn't find out a simple way to validate it...

How to set up a PostgreSQL database in Django

I'm new to Python and Django. I'm configuring a Django project using a PostgreSQL database engine backend, But I'm getting errors on each database operation. For example when I run manage.py syncdb, ..

Identify if a string is a number

If I have these strings: "abc" = false "123" = true "ab2" = false Is there a command, like IsNumeric() or something else, that can identify if a string is a valid number?..

How can I shuffle an array?

I want to shuffle an array of elements in JavaScript like these: [0, 3, 3] -> [3, 0, 3] [9, 3, 6, 0, 6] -> [0, 3, 6, 9, 6] [3, 3, 6, 0, 6] -> [0, 3, 6, 3, 6] ..

Is there any way to specify a suggested filename when using data: URI?

If for example you follow the link: data:application/octet-stream;base64,SGVsbG8= The browser will prompt you to download a file consisting of the data held as base64 in the hyperlink itself. Is th..

Alert after page load

This is my script : <% if (TempData["Resultat"] != null){ %> <script type="text/javascript"> alert('<%: TempData["Resultat"]%>'); </script> <% } %> In this..

how to make UITextView height dynamic according to text length?

As you can see in this image the UITextView changes it's height according to the text length, I want to make it adjust it's height according to the text length. *I saw other questions, but solutions..

Escape regex special characters in a Python string

Does Python have a function that I can use to escape special characters in a regular expression? For example, I'm "stuck" :\ should become I\'m \"stuck\" :\\...

Html5 Full screen video

Is there any way to do this? I wan to play video in full screen. Without browser. setting width:100%; height:100%; keep browser visible yet..

PHP MySQL Google Chart JSON - Complete Example

I have searched a lot to find a good example for generating a Google Chart using MySQL table data as the data source. I searched for a couple of days and realised that there are few examples available..

Tkinter: "Python may not be configured for Tk"

Today I wanted to start working with Tkinter, but I have some problems. Python 3.2 (r32:88445, Mar 28 2011, 04:14:07) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more ..

Command /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

I'm trying to do an application reading pdf using pdf kit in Xcode 4.3 but it gives me the following error ld: duplicate symbol _OBJC_METACLASS_$_OverlayManager in /Users/dt4it/Library/Developer/Xco..

how to set windows service username and password through commandline

Using sc command we can query, start , stop windows services. For ex: sc query "windows service name" The sc config command changes the configuration of the service, but I don't know how to use i..

How to clear cache of Eclipse Indigo

I would like to know what is the standard way to clear the cache of Eclipse Indigo?..

How to stop/kill a query in postgresql?

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

Iterating through all the cells in Excel VBA or VSTO 2005

I need to simply go through all the cells in a Excel Spreadsheet and check the values in the cells. The cells may contain text, numbers or be blank. I am not very familiar / comfortable working with..

Form Submission without page refresh

Maybe someone can assist me with this little issue I'm having. I'm trying to submit this form without a page refresh. But it will skip the post and go directly to the ajax call. I think I miss under..

ASP.NET MVC: No parameterless constructor defined for this object

Server Error in '/' Application. -------------------------------------------------------------------------------- No parameterless constructor defined for this object. Description: An unhandled exce..

How to manually reload Google Map with JavaScript

I am using this piece of code within a Bootstrap template. I am facing issues when loading images within a Bootstrap Tab content pane. This is the JavaScript code which I use to initialize the Map: ..

Unable to install Android Studio in Ubuntu

I'm using Ubuntu Gnome 14.04, and I have Java 8 installed (both the JDK and the JRE). When I was installing Android Studio everything worked, but a message appeared saying: Unable to run mksdcard..

File Explorer in Android Studio

Can anyone tell where the file explorer is located in Android Studio? I tried to search in windows menu but there isn't any option like "show view" that used to be in Eclipse...

How do I generate random number for each row in a TSQL Select?

I need a different random number for each row in my table. The following seemingly obvious code uses the same random value for each row. SELECT table_name, RAND() magic_number FROM information_sche..

PostgreSQL: role is not permitted to log in

I have trouble connecting to my own postgres db on a local server. I googled some similar problems and came up with this manual https://help.ubuntu.com/stable/serverguide/postgresql.html so: pg_hba...

python socket.error: [Errno 98] Address already in use

when i setup application.py, it shows that socket.error: [Errno 98] Address already in use. Traceback (most recent call last): File "application.py", line 121, in <module> main() File "applicat..

How to check whether a string contains a substring in Ruby

I have a string variable with content: varMessage = "hi/thsid/sdfhsjdf/dfjsd/sdjfsdn\n" "/my/name/is/balaji.so\n" "call::myFunction(int const&)\n" ..

How to get All input of POST in Laravel

I am using Laravel 5 and trying to get all input of POST variable in controller like this- public function add_question() { return Request::all(); } So, I am getting this errors- What I am d..

How to convert DOS/Windows newline (CRLF) to Unix newline (LF) in a Bash script?

How can I programmatically (i.e., not using vi) convert DOS/Windows newlines to Unix? The dos2unix and unix2dos commands are not available on certain systems. How can I emulate these with commands li..

How to check for a valid URL in Java?

What is the best way to check if a URL is valid in Java? If tried to call new URL(urlString) and catch a MalformedURLException, but it seems to be happy with anything that begins with http://. I'm..

Replace Line Breaks in a String C#

How can I replace Line Breaks within a string in C#?..

What is function overloading and overriding in php?

In PHP, what do you mean by function overloading and function overriding. and what is the difference between both of them? couldn't figure out what is the difference between them...

How to set default values in Go structs

There are multiple answers/techniques to the below question: How to set default values to golang structs? How to initialize structs in golang I have a couple of answers but further discussion is r..

How to set opacity to the background color of a div?

I have this class .box { background-color:#fff; border:3px solid #eee; } My question is how can I set an opacity to the white background only so that it will kinda mix with my background? Thank yo..

Add border-bottom to table row <tr>

I have a table of 3 by 3. I need a way to add a border for the bottom of every row tr and give it a specific color. First I tried the direct way, i.e.: <tr style="border-bottom:1pt solid black;"&..

How to Set Opacity (Alpha) for View in Android

I have a button as in the following: <Button android:text="Submit" android:id="@+id/Button01" android:layout_width="fill_parent" android:layout_height="wrap_content"> &l..

How can I find where I will be redirected using cURL?

I'm trying to make curl follow a redirect but I can't quite get it to work right. I have a string that I want to send as a GET param to a server and get the resulting URL. Example: String = Kobol..

How to download videos from youtube on java?

how to download videos from youtube on Java? need class(or piece of code) which describes how to do that. Thank you...

Change type of varchar field to integer: "cannot be cast automatically to type integer"

I have a small table and a certain field contains the type "character varying". I'm trying to change it to "Integer" but it gives an error that casting is not possible. Is there a way around this or ..

What is the meaning of polyfills in HTML5?

What is the meaning of polyfills in HTML5? I saw this word in many sites about HTML5, e.g. HTML5-Cross-Browser-Polyfills. So here we're collecting all the shims, fallbacks, and polyfills in orde..

How to get the separate digits of an int number?

I have numbers like 1100, 1002, 1022 etc. I would like to have the individual digits, for example for the first number 1100 I want to have 1, 1, 0, 0. How can I get it in Java?..

Use IntelliJ to generate class diagram

How do I get IntelliJ 10.5 (on the Mac) to generate a class diagram showing all of the classes in my project? I'm sure I'm overlooking something obvious, but I can only get the "Show Diagram" feature..

Copy file remotely with PowerShell

I am writing a PowerShell script that I want to run from Server A. I want to connect to Server B and copy a file to Server A as a backup. If that can't be done then I would like to connect to Server ..

Chrome disable SSL checking for sites?

I'm getting this warning for visiting non https site as https Tried this to disable it by adding that command to shortcut target, but it doesnt work. "C:\Program Files (x86)\Google\Chrome\Applicat..

Access-Control-Allow-Origin error sending a jQuery Post to Google API's

I read a lot for the 'Access-Control-Allow-Origin' error, but I don't understand what I have to fix :( I'm playing with Google Moderator API, but when I try to add new serie I receive: XMLHttpReques..

Will iOS launch my app into the background if it was force-quit by the user?

I am triggering a background fetch by using the content-available flag on a push notification. I have the fetch and remote-notification UIBackgroundModes enabled. Here is the implementation I am usin..

How to tell whether a point is to the right or left side of a line

I have a set of points. I want to separate them into 2 distinct sets. To do this, I choose two points (a and b) and draw an imaginary line between them. Now I want to have all points that are left fro..

Escape double quotes for JSON in Python

How can I replace double quotes with a backslash and double quotes in Python? >>> s = 'my string with "double quotes" blablabla' >>> s.replace('"', '\\"') 'my string with \\"doubl..

How to overcome "datetime.datetime not JSON serializable"?

I have a basic dict as follows: sample = {} sample['title'] = "String" sample['somedate'] = somedatetimehere When I try to do jsonify(sample) I get: TypeError: datetime.datetime(2012, 8, 8, 21, 46..

Please initialize the log4j system properly. While running web service

Maybe it looks silly to ask this but I am confused. I referred to Configuring Log4j property but it doesn't seem to help. I have written a simple web service HelloWorld. And while running it I am get..

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

rsync: difference between --size-only and --ignore-times

I'm trying to understand what the difference is between two options rsync --size-only and rsync --ignore-times It is my understanding that by default rsync will compare both the timestamps and ..

Escape invalid XML characters in C#

I have a string that contains invalid XML characters. How can I escape (or remove) invalid XML characters before I parse the string?..

Simple mediaplayer play mp3 from file path?

I have a very simple mediaplayer that play background. It calls file from the apk, but I want it to play from any directory like as music or sdcard. Here are my codes: private MediaPlayer mpintro; ..

Java - How to access an ArrayList of another class?

Hello I'm a beginner in Java and this is my question: I have this first class with the following variables: import java.util.ArrayList; public class numbers { private int number1 = 50; priva..

background-image: url("images/plaid.jpg") no-repeat; wont show up

I can't seem to make my plaid.jpg the background on any of my pages, let alone all of them, I've tried selecting it by body, html, *, the specific id of "home". nothing works. The image is 300 x 421 p..

Jquery Ajax Call, doesn't call Success or Error

Possible Duplicate: How do I return the response from an asynchronous call? I am using Jquery Ajax to call a service to update a value. function ChangePurpose(Vid, PurId) { var Success..

Date / Timestamp to record when a record was added to the table?

Does anyone know of a function as such that I can use to add an automatic date and timestamp in a column for when a user adds a record to the database table?..

How to calculate a mod b in Python?

Is there a modulo function in the Python math library? Isn't 15 % 4, 3? But 15 mod 4 is 1, right?..

Android studio- "SDK tools directory is missing"

When I start the "android studio" program, displayed a window of "downloading components" which says:   "Android SDK was installed to: C: / Users / user / AppData / Local / android / SDK2  SDK tools..

How do I increase memory on Tomcat 7 when running as a Windows Service?

I am trying to run Tomcat 7 as a Windows Service (XP and Windows 7). I see places to set the -Xmx and -Xms jvm args in catalina.bat, but I'm not sure how to do it when using $CATALINA_HOME/bin/servic..

Handle Button click inside a row in RecyclerView

I am using following code for handling row clicks. (source) static class RecyclerTouchListener implements RecyclerView.OnItemTouchListener { private GestureDetector gestureDetector; private ..

Java reading a file into an ArrayList?

How do you read the contents of a file into an ArrayList<String> in Java? Here are the file contents: cat house dog . . . Just read each word into the ArrayList...

Android Bitmap to Base64 String

How do I convert a large Bitmap (photo taken with the phone's camera) to a Base64 String?..

Vuejs and Vue.set(), update array

I'm new to Vuejs. Made something, but I don't know it's the simple / right way. what I want I want some dates in an array and update them on a event. First I tried Vue.set, but it dind't work out. N..

Programmatically go back to the previous fragment in the backstack

Say I have an activity that has fragments added programmatically: private void animateToFragment(Fragment newFragment, String tag) { FragmentTransaction ft = getFragmentManager().beginTransaction..

How to make a transparent border using CSS?

I'm trying to do something like this for a client who has a blog. She wanted a semi transparent border. I know that's possible with making it just a background. But I can't seem to find the logic..

What's the right way to pass form element state to sibling/parent elements?

Suppose I have a React class P, which renders two child classes, C1 and C2. C1 contains an input field. I'll refer to this input field as Foo. My goal is to let C2 react to changes in Foo. I'..

Using Pandas to pd.read_excel() for multiple worksheets of the same workbook

I have a large spreadsheet file (.xlsx) that I'm processing using python pandas. It happens that I need data from two tabs in that large file. One of the tabs has a ton of data and the other is just a..

How to set time to midnight for current day?

Every time that I create a non-nullable datetime in my mvc3 application it defaults to now(), where now is current date with current time. I would like to default it to today's date with 12am as the ..

Checking if a variable is defined?

How can I check whether a variable is defined in Ruby? Is there an isset-type method available?..

Add a prefix string to beginning of each line

I have a file as below: line1 line2 line3 And I want to get: prefixline1 prefixline2 prefixline3 I could write a Ruby script, but it is better if I do not need to. prefix will contain /. It is ..

How do I validate a date in this format (yyyy-mm-dd) using jquery?

I am attempting to validate a date in this format: (yyyy-mm-dd). I found this solution but it is in the wrong format for what I need, as in: (mm/dd/yyyy). Here is the link to that solution: http://j..

Shared folder between MacOSX and Windows on Virtual Box

I need to set up shared folder. I've got Mac OSX Yosemite host and clean Win7 x64 on the VirtualBox. In MacOSX, i go to the VirtualBox -> win7 settings -> "Shared Folders" -> Add shared folder -> c..

How to check whether java is installed on the computer

I am trying to install java windows application on client machine.I want to check whether requried JRE is installed on the machine or not. I want to check it by java program not by cmd command..

How to tell which commit a tag points to in Git?

I have a bunch of unannotated tags in the repository and I want to work out which commit they point to. Is there a command that that will just list the tags and their commit SHAs? Checking out the tag..

How to find SQL Server running port?

Yes I read this How to find the port for MS SQL Server 2008? no luck. telnet 1433 returns connection failed, so I must specify other port. I tried to use netstat -abn but I don't see sql..

How to select the comparison of two columns as one column in Oracle

I cannot figure out how to add a column to my SELECT query indicating whether two columns contain the same data in Oracle. I would like to write a query like: select column1, column2, column1=column..

How to make the tab character 4 spaces instead of 8 spaces in nano?

When I press TAB in nano editor, the cursor will jump with 8 spaces like this: def square(x): return x * x def cube(y): return y * y * y how can I set the tab stop width to 4 spaces..

Playing a MP3 file in a WinForm application

I am developing a WinForm application. I want to play a MP3 file when the user clicks a button. The MP3 file is located in the file system of the computer where the application is executed. I have ..

How to map a composite key with JPA and Hibernate?

In this code, how to generate a Java class for the composite key (how to composite key in hibernate): create table Time ( levelStation int(15) not null, src varchar(100) not null, dst ..

jQuery SVG, why can't I addClass?

I am using jQuery SVG. I can't add or remove a class to an object. Anyone know my mistake? The SVG: <rect class="jimmy" id="p5" x="200" y="200" width="100" height="100" /> The jQuery that wo..

mysql SELECT IF statement with OR

The following works - returns Y when chargeback equal to 1 else it defaults to N IF(fd.charge_back = 1, 'Y', 'N') AS charge_back however I cannot seem to get this one working? Is the syntax valid ..

how to create a login page when username and password is equal in html

How do I create a login page that goes to the next screen if the password is correct? <html> <p> Enter Username and Password </p> <FORM action="file:///android_asset/www/Browse.h..

No provider for Router?

Im getting this error: EXCEPTION: Error in ./AppComponent class AppComponent - inline template:0:0 caused by: No provider for Router! This is my app component: import {Component} from '@angul..

Problem with SMTP authentication in PHP using PHPMailer, with Pear Mail works

I´m having trouble sending a e-mail with the PHPMailer class, but it works with PEAR Mail::factory. I guess the problem is with the SMTP authentication, but I couldn´t find the problem. The code w..

How to change MenuItem icon in ActionBar programmatically

How to change MenuItem icon in ActionBar programmatically? I tried to use MenuItem menuItem = (MenuItem)findViewById(R.id.action_settings); menuItem.setIcon(getResources().getDrawable(R.drawable.ic_l..

Delete duplicate records from a SQL table without a primary key

I have the below table with the below records in it create table employee ( EmpId number, EmpName varchar2(10), EmpSSN varchar2(11) ); insert into employee values(1, 'Jack', '555-55-5555'); inser..

'git status' shows changed files, but 'git diff' doesn't

I've had a look at all similar questions. However, I've double checked and something strange is definitely happening. On one server (Solaris with Git 1.8.1) I cloned the Git repository then copied th..

Unable to create migrations after upgrading to ASP.NET Core 2.0

After upgrading to ASP.NET Core 2.0, I can't seem to create migrations anymore. I'm getting "An error occurred while calling method 'BuildWebHost' on class 'Program'. Continuing without the ap..

Get all files and directories in specific path fast

I am creating a backup application where c# scans a directory. Before I use to have something like this in order to get all the files and subfiles in a directory: DirectoryInfo di = new DirectoryInfo..

How do I increase the scrollback buffer in a running screen session?

Lets say I have a currently running screen session I am interacting with through putty. I've realized that the scrollback buffer is too small and would like to increase it without starting a new scre..

Git: Permission denied (publickey) fatal - Could not read from remote repository. while cloning Git repository

I am unable to clone a Git repository, and getting this error: krishna.soni@KRISHNACHANDRAS /c/Projects $ git clone http://stage.abc.com:10088/pqr http://<url>/<repository> Cloning into '..

No 'Access-Control-Allow-Origin' header in Angular 2 app

For this project, I'm just learning and practicing Angular 2. I have no server-side and am making API requests to barchart ondemand api . I'm wondering if it is possible to bypass the cors issue. I'..

PHP - print all properties of an object

I have an unknown object in php page. How can I print/echo it, so I can see what properties/values do it have? What about functions? Is there any way to know what functions an object have?..

Create a .txt file if doesn't exist, and if it does append a new line

I would like to create a .txt file and write to it, and if the file already exists I just want to append some more lines: string path = @"E:\AppServ\Example.txt"; if (!File.Exists(path)) { File.C..

jQuery Scroll to bottom of page/iframe

How do I use jquery to scroll right down to the bottom of an iframe or page?..

Sum one number to every element in a list (or array) in Python

Here I go with my basic questions again, but please bear with me. In Matlab, is fairly simple to add a number to elements in a list: a = [1,1,1,1,1] b = a + 1 b then is [2,2,2,2,2] In python this..

Join/Where with LINQ and Lambda

I'm having trouble with a query written in LINQ and Lambda. So far, I'm getting a lot of errors here's my code: int id = 1; var query = database.Posts.Join(database.Post_Metas, ..

Dockerfile copy keep subdirectory structure

I'm trying to copy a number of files and folders to a docker image build from my localhost. The files are like this: folder1 file1 file2 folder2 file1 file2 I'm trying to make the ..

How does Java handle integer underflows and overflows and how would you check for it?

How does Java handle integer underflows and overflows? Leading on from that, how would you check/test that this is occurring?..

How to pretty print XML from the command line?

Related: How can I pretty-print JSON in (unix) shell script? Is there a (unix) shell script to format XML in human-readable form? Basically, I want it to transform the following: <root><fo..

Minimum Hardware requirements for Android development

Need information about minimum hardware requirement for better experience in developing Android application. My current configuration is as follows. P4 3.0 GHz, 512 MB of ram. Started with Hello..

How to create a SQL Server function to "join" multiple rows from a subquery into a single delimited field?

To illustrate, assume that I have two tables as follows: VehicleID Name 1 Chuck 2 Larry LocationID VehicleID City 1 1 New York 2 1 Seattle 3 ..

node.js require() cache - possible to invalidate?

From the node.js documentation: Modules are cached after the first time they are loaded. This means (among other things) that every call to require('foo') will get exactly the same object returned..

Format Date output in JSF

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

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints

I make an outer join and executed successfully in the informix database but I get the following exception in my code: DataTable dt = TeachingLoadDAL.GetCoursesWithEvalState(i, bat); Failed to en..

How to detect Windows 64-bit platform with .NET?

In a .NET 2.0 C# application I use the following code to detect the operating system platform: string os_platform = System.Environment.OSVersion.Platform.ToString(); This returns "Win32NT". The pro..

hexadecimal string to byte array in python

I have a long Hex string that represents a series of values of different types. I wish to convert this Hex String into a byte array so that I can shift each value out and convert it into its proper da..

How to extract HTTP response body from a Python requests call?

I'm using the Python requests library. I'm trying to figure out how to extract the actual HTML body from a response. The code looks a bit like this: r = requests.get(...) print r.content This shoul..

Get LatLng from Zip Code - Google Maps API

All I want is some simple example code that shows me how to obtain a latlng element from an inputted zip code OR a city/state...

Enabling/Disabling Microsoft Virtual WiFi Miniport

I disabled my Microsoft Virtual WiFi Miniport network adapter from Control Panel\Network and Internet\Network Connections. Just right clicked on the miniport nic and clicked disable, and its gone. N..

What does `set -x` do?

I have a shell script with the following line in it: [ "$DEBUG" == 'true' ] && set -x ..

Facebook Application Request limit reached

I am getting an FBerror "This operation can't be completed: Application request limit reached". Does anybody know why is it so? How to check the limit? How to increase the limit? What depends on the l..

How to create a template function within a class? (C++)

I know it's possible to make a template function: template<typename T> void DoSomeThing(T x){} and it's possible to make a template class: template<typename T> class Object { public: ..

Referenced Project gets "lost" at Compile Time

I have a C# solution with two projects: a service (the main project) and a logger. The service uses classes from the logger. I've added a Reference to the logger project within the service project. At..

Undefined reference to sqrt (or other mathematical functions)

I have this simple code: max = (int) sqrt (number); and in the header I have: #include <math.h> But application still says undefined reference to sqrt. Do you see any problem here? It look..

OSX - How to auto Close Terminal window after the "exit" command executed.

When I'm done with Terminal, I want to exit it. Right now, I have three options: killall Terminal. It will end the process, but rather abruptly. I don't think this is the best idea. Call exit. I've ..

Android Facebook style slide

The new Facebook application and its navigation is so cool. I was just trying to see how it can be emulated in my application. Anyone has a clue how it can be achieved? On clicking the the top le..

How to add new column to MYSQL table?

I am trying to add a new column to my MYSQL table using PHP. I am unsure how to alter my table so that the new column is created. In my assessment table I have: assessmentid | q1 | q2 | q3 | q4 | q5 ..

How do I get rid of the b-prefix in a string in python?

A bunch of the tweets I am importing are having this issue where they read b'I posted a new photo to Facebook' I gather the b indicates it is a byte. But this is proving problematic because in my ..

Check for false

Is there any better way of doing this? if(borrar() !== false) { alert('tatatata bum bum bum prapra'); } return false; ..

JavaScript: How to find out if the user browser is Chrome?

I need some function returning a boolean value to check if the browser is Chrome. How do I create such functionality?..

How to center Font Awesome icons horizontally?

I have a table with a Font Awesome icon and I want to align text left and center icons. I tried with centering <i> but doesn't work: HTML: <td><i class="icon-ok"></i></td&..

Export to csv in jQuery

I am dynamically generating a div which is like : <div id='PrintDiv'> <table id="mainTable"> <tr> <td> Col1 ..

Inner join with 3 tables in mysql

I want to select data from more tables with Inner join. These are my tables. Student (studentId, firstName, lastname) Exam (examId, name, date) Grade (gradeId, fk_studentId, fk_examId, grade) I wa..

How do I set bold and italic on UILabel of iPhone/iPad?

How do I set bold and italic on UILabel of iPhone/iPad? I searched the forum but nothing helped me. Could anyone help me?..

jQuery selector first td of each row

I have this stuff: <table> <tr> <td>nonono</td> <!-- FIND THIS --> </td>foobar</td> </tr> <tr> <td>nonono2</td> <..

Exporting results of a Mysql query to excel?

My requirement is to store the entire results of the query SELECT * FROM document WHERE documentid IN (SELECT * FROM TaskResult WHERE taskResult = 2429) to an Excel file...

Dynamically Add C# Properties at Runtime

I know there are some questions that address this, but the answers usually follow along the lines of recommending a Dictionary or Collection of parameters, which doesn't work in my situation. I am us..

Android: How to handle right to left swipe gestures

I want my app to recognize when a user swipes from right to left on the phone screen. How to do this?..

Android, How to read QR code in my application?

In my application I need to read Qr code. I searched the net and found Zing codes however lots of developers had problem with using it and it seems it is buggy! If i assume that my customers has qr r..

How do you store Java objects in HttpSession?

So I am trying to get a servlet to add a Java object to the session of the user, when this servlet is requested. But after the servlet redirects to the next page and I try to retrieve the object, I ge..

Writing Unicode text to a text file?

I'm pulling data out of a Google doc, processing it, and writing it to a file (that eventually I will paste into a Wordpress page). It has some non-ASCII symbols. How can I convert these safely to sy..

Jquery, checking if a value exists in array or not

I believe this question will be fairly easy for the ones who played around with java script / jquery. var arr = new Array(); $.map(arr, function() { if (this.id == productID) { this.price = prod..

How do I create a singleton service in Angular 2?

I've read that injecting when bootstrapping should have all children share the same instance, but my main and header components (main app includes header component and router-outlet) are each getting ..

SHA-1 fingerprint of keystore certificate

Is the method for getting a SHA-1 fingerprint the same as the method of getting the a fingerprint? Previously, I was running this command: It's not clear to me if the result I'm getting is the SHA-..

R not finding package even after package installation

I have always worked with the zoo package, that I have installed a long time ago. Today, I created a new R script, and ran library(zoo) and got the following error: > library(zoo) Error in libra..

Incomplete type is not allowed: stringstream

Why does this line give the error Error: incomplete type is not allowed? stringstream ss; ..

How to check if another instance of the application is running

Could someone show how it is possible to check whether another instance of the program (e.g. test.exe) is running and if so stop the application from loading if there is an existing instance of it...

how to create and call scalar function in sql server 2008

I have created a Scalar Functions, it was created successfully, but when I call the function using select statement, it says invalid object, I altered the function, I got the message command completed..

Getting value of select (dropdown) before change

The thing I want to achieve is whenever the <select> dropdown is changed I want the value of the dropdown before change. I am using 1.3.2 version of jQuery and using on change event but the valu..

Gridview with two columns and auto resized images

I'm trying to make a gridview with two columns. I mean two photos per row side by side just like this image. But my pictures have spaces between them, due to the fact that it's not the same size. H..

WPF TabItem Header Styling

I'm trying to style a TabControl and have got 75% of the way there, but I'm having difficulty styling the actual TabItems: What I am trying to achieve is remove the default ContentPresenter so that..

Checking host availability by using ping in bash scripts

I want to write a script, that would keep checking if any of the devices in network, that should be online all day long, are really online. I tried to use ping, but if [ "`ping -c 1 some_ip_here`" ] ..

Serialize Class containing Dictionary member

Expanding upon my earlier problem, I've decided to (de)serialize my config file class which worked great. I now want to store an associative array of drive letters to map (key is the drive letter, v..

Allowed memory size of X bytes exhausted

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 13965430 bytes) PHPInfo shows that I have a memory_limit of 128M, so I'm confused as to why the error says I only h..

Your configuration specifies to merge with the <branch name> from the remote, but no such ref was fetched.?

I am getting this error for pull: Your configuration specifies to merge with the ref 'refs/heads/feature/Sprint4/ABC-123-Branch' from the remote, but no such ref was fetched. This error is n..

Android Stop Emulator from Command Line

This question is identical to How to shut down Android emulator via command line. However, after attempting the suggested solution from the first answer adb emu kill has not proven successful for me...

How to concatenate string variables in Bash

In PHP, strings are concatenated together as follows: $foo = "Hello"; $foo .= " World"; Here, $foo becomes "Hello World". How is this accomplished in Bash?..

HTTPS using Jersey Client

How do I send GET requests using the Jersey Client API to a server which runs on the HTTPS protocol. Is there any sample code that I can use ?..

Console app arguments, how arguments are passed to Main method

This would be question from c# beginner. When I create console application I get Main method with parameter args as array string. I do not understand how this method is called by system and how args ..

How to reload a page using JavaScript

How can I reload the page using JavaScript? I need a method that works in all browsers...

How to add a default include path for GCC in Linux?

I'd like gcc to include files from $HOME/include in addition to the usual include directories, but there doesn't seem to be an analogue to $LD_LIBRARY_PATH. I know I can just add the include director..

Oracle 12c Installation failed to access the temporary location

I have Windows 8.1 64-bit OS running on 64-bit architecture. I am installing a fresh copy of Oracle 12C, means I haven't installed any version before on my system. During the installation, I encounte..