FAQ Database Discussion Community


How to count empty lines inside a string in javascript

javascript,arrays,regex,newline
I'm trying to count all the empty lines inside a string. My current function kind of works: function count_empty(text) { var regex = /\r\n?|\n/g; var lines = text.split(regex); var sep = []; $.each(lines, function(k, val) { if(!val) { //sentence sep.push(val); } }); return sep.length; } ...but I really think it...

Getting entity with referenced entities in EF

entity-framework,repository-pattern,unit-of-work
I have an entity called Study: public class Study { public Study() { Tasks = new List<Task>(); } [Key] public string StudyUid { get; set; } public virtual List<Task> Tasks { get; set; } } I use Unit of work design pattern, I would like to get the study with...

Token with angularjs

javascript,angularjs,node.js,mean-stack
My current problem, is how to redirect signup route to homepage route with the token. The backend of this route does create the token, but for the frontend I couldn't figure out of how to do it. .controller('UserCreateController', function(User, $location, $localStorage) { var vm = this; // function to create...

Using sherlock to check for plagiarism through python subprocess module

python,subprocess,plagiarism-detection
When i write on terminal: ./sherlock *.txt it works but when I try to do the same using python subprocess like import subprocess subprocess.call(['./sherlock','*.txt']) import subprocess subprocess.call('./sherlock','*.txt',shell=True) import subprocess subprocess.call('./sherlock','*.txt',shell=False) Neither of this is working please help....

Android Camera Crashes every time in onResume or onRestart

android,android-camera
I built a camera application from android camera example. it's working but every time my application resume or restart from onPause and onStop, my application crashes. I already tried this two link1, link2 but nothing changed. How should I fix it? The logcat shows this message: 2169-2169/com.exshinigami.theremembrance E/AndroidRuntime﹕ FATAL EXCEPTION:...

MYSQL/PHP: Comparing large sets of 2 specific rows in one table (POKER-calculator)

php,mysql,sql,calculator,poker
I am writing an online poker calculator just for fun :) I tried the pure php calculation approach, to compare two hands it calculates the outcome for every possible deck (C(5,48) = 1712304 decks) That takes around 12 seconds on my sucky one.com server :D What is ofcourse far too...

free server for small files used in an application [closed]

server,host
For specific reasons I need to store a small files (up to 1MB) in a web server so that my application can read data from it. I don't need any server side computing. I know there are commercial solutions for this but since this is a test app I need...

How to layout my android application?

android,android-layout
I am writing a math application for my daughter. It shall consist of upper row with assignment to solve, some progress bar and then keypad on left and function pad on right. This is my idea: I started with a linear layout holding set of linear layouts. Android studio argues...

regex to match an exam result

python,regex
here is the key structure first part + '-' + second part first part is from a list of indicators 'BIL|UBG|LEU|ERY|pH|KET|SG|PRO|NIT|GLU' second part is an int + '+/-' or a 'pos/neg' here is bottom line of what I got (BIL|UBG|LEU|ERY|pH|KET|SG|PRO|NIT)-[0-9][+,-] like these NIT-3+ GLU-pos pH-neg didn't get the second part...

as a block enclosed in the link?

ruby-on-rails,ruby-on-rails-3
please help solve the problem. in the template there is a block of code. I need to enclose it in the link. I try to do so: <%= link_to(show_news_path) do %> <div> <span>title:</span> </div> <% end %> but I get the following error message: NameError in News#index Showing /home/kalinin/rails/visit/app/views/news/index.html.erb where...

Android Service stops automatically without calling stopService()

android,android-service,android-music-player
I have made an android Service to play music, when i close my application then it keeps on playing song for few minutes and then automatically stops without even calling destroy method. I am not able to understand why is it happening. Below is the code of my Service class....

Distribute Query among more than one core (PostgreSQL 9.3)

postgresql,import
Having a paython script that processes a large file (~1GB) then inserts its content into PostgreSQL database 9.3, all in one connection. This process takes very long time so I thought of distrubuting this quesry among more than one core (I got 8 cores) but from what I've read this...

How to tell to GIT, it should take care of only these and these sub-folders?

git,gitignore,mql4
I want to use git in a particular development environment. MetaTrader 4. The structure of development directory is fixed, it is of this type: MQL4 Expert Files imagery Include Indicators Some directories come by default with sample files. My idea would be to create directories under of these directories ,...

Backbone subview events not firing

javascript,events,backbone.js
For some reason my view events are not firing and I don't know what is wrong... Here is the code: TasksView = ****.Views.BaseView.extend({ id: 'log-container', className: 'row-fluid', initialize : function(){ this.task_selection_view = new TaskSelectionView(); }, remove : function(){ this.task_selection_view.remove(); Backbone.View.prototype.remove.call(this); }, render : function(){ $(this.el).html(Templates['log/log']); $('#selection',this.el).append(this.task_selection_view.render().el); return this; } });...

Ember radio button never be cleared after exiting the view

javascript,jquery,html5,ember.js
I have a handlebar with 5 radio buttons: <ui> <li> <label> {{view Ember.RadioButton id="option1" name="selectionTest" selectionBinding="isSelected" value=1}} <b>{{i18n 'kwoption1'}}</b> </label></li> <li> <label> {{view Ember.RadioButton id="option2" name="selectionTest" selectionBinding="controllerisSelected" value=2 valueBinding="radio1"}} <b>{{i18n 'kwoption2'}}</b> </label></li> <li> <label> {{view Ember.RadioButton id="option3"...

File exists, but open file still always returns -1

c++
File "~/workspace/Test.txt" does exist, but fd always returns -1. Can somebody please give a hint as to what is wrong with the code? Thanks. int fd = open("~/workspace/Test.txt", O_RDONLY); cout << "fd is "<<fd<<endl; if (fd < 0) { cout << "did not find file"<<endl; return false; } ...

Thumbnails Not Centered

html,twitter-bootstrap,twitter-bootstrap-3
So I am working with col-sm-3 sized thumbnails and they are currently not centered aligned (They are left aligned). I want them evenly space and center aligned. I have been playing with the offsets and push, but can never get exactly evenly spaced. I always end up having the spacing...

Bootstrap CSS class not applying on dynamic
  • jquery,css3,twitter-bootstrap-3
    I've a horizontal Menu where I’ve dropdowns. I need li’s in the dropdown-menu which I’ve commented out dynamically. So I added div and thought of appending the div with dynamic <li>’s in jQuery. HTML <li class="dropdown"> <ul class="dropdown-menu" role="menu"> <%-- <li ><a href="Link1">Link1</a></li> <li ><a href="Link2">Link2</a></li> --%> <div id="dvLinks"></div> </ul>...

    Set large value to div's height

    javascript,html,browser,scroll,scrollbar
    I have a problem with height limitation of <div></div> in some web browsers, like Firefox. I have javascript code like this: $('#MyDiv').css("height","20000000px"); // 20,000,000 pixel height But I see height: 2e+7px; rule in the firebug. This problem exist in IE too, But in google chrome everything is ok and I...

    didBeginContact method not working as intended

    ios,objective-c,sprite-kit,skphysicscontact
    I have two nodes and a boolean. Simple enough. When node A contacts Node B and the boolean is 0, nothing happens. However if the boolean is 1, Node A is removed through the didBeganContact method. Extremely simple, however I have an annoying problem on when I want Node A...

    seek for help on java generic method

    java,generics
    I have following class structure, abstract class AbstractA {...} class A1 extends AbstractA {...} class A2 extends AbstractA {...} abstract class AbstractB<T extends AbstractA> { public void handle(T a) { ... } } class B1 extends AbstractB<A1> { public void handle(A1 a) { super.handle(a); ... } } class B2 extends...

    Do parent threads wait for child threads to exit before they also exit in servlet containers?

    java,multithreading,tomcat,java-ee,servlets
    Question: If you spawn new threads inside a servlet/controller and the main thread handling that controller has completed, will the controller thread block until all of its child threads have returned before it also returns? Background: I have some code running in separate threads spawned from inside a controller but...

    Optimize String Parsing

    ios,objective-c,parsing,markup,nsscanner
    I have a requirement to parse data files in "txf" format. The files may contain more than 1000 entries. Since the format is well defined like JSON, I wanted to make a generic parser like JSON, which can serialise and deserialise txf files. On contrary to JSON, the mark up...

    How to set the window's icon

    c#,winforms,icons
    I was wondering how you would set the icon for the window in c#. I have found answers, but the answer does not involve programming. In visual studio they have an application builder, but I would like to program my application instead. Does anyone know who to accomplish this simple...

    Java process notify Node event loop

    java,node.js
    If I have some Java code contained in a Java jar file, and my node.js process kicks off the jar file, how do I notify node.js when the Java process is done?

    creating class structure in mvvm issues

    c#,wpf,class,oop,mvvm
    I have the following Classes: Item public class Item : INotifyPropertyChanged, IDataErrorInfo { private int? id; public int? ID { get { return id; } set { id = value; } } private string name; public string Name { get { return name; } set { if (value != name)...

    Split according to “:” in multiple lines

    python,regex,split
    I have a set of files composed as follows: Product: Name Description: description of product I want to extract only the name and the description's content without the 'Product:' and 'Description:'. For this I do: div = re.split('Product:\s+|Description:\s+', contentOfFile) The problem is that I get a table of 3 elements...

    .fadeTo issues with jQuery on scroll

    jquery,html,css
    I’m trying to change the opacity of my navigation bar as I scroll past a div on my page. My code is below. To change the opacity, I’m trying to use jQuery’s .fadeTo method. I’m attempting to have it fade the opacity to 0.95 (from the 0.75 outlined in the...

    Item not deleting from SQlite Database

    android,sqlite
    In my app I have multiple markers that are added to the map and saved in SQLite, but now i want to delete a specific marker when tapping on that marker and select "delete marker" So what I have done is this: In my LocationsDB.class @Override public void onCreate(SQLiteDatabase db)...

    Display users input from editText field on a textView

    android,android-edittext,textview,gettext
    I use getText(); on an editText using the code below and want the users input to replace a textView then how do I do this? btw the code was taken from this question: Get Value of a Edit Text field Button mButton; EditText mEdit; /** Called when the activity is...

    In which course of computer science will stack and heap be described?

    memory-management
    Although I know the ideas from internet, but I don't know which course covers these topics. I thought it will be in "Operating System", but I didn't find it there. Thanks...

    What does a non-trivial copy constructor do? [duplicate]

    c++,copy-constructor,virtual-functions
    This question already has an answer here: What is a non-trivial constructor in C++? 3 answers In C++, if a copy constructor is not defined the compiler will do that for you. If one is defined, compiler would not. The compiler generated copy constructor can be trivial or non-trivial....

    Android - Google Analytics V4 on FragmentActivity

    android,android-fragments,google-analytics,android-manifest,google-analytics-v4
    I am trying to implement Google Analytics V4 in Android. I tried following Google doc, also I tried following this tutorial. My MainActivity extents FragmentActivity, I have added the GA lib, xml config files and made the modifications showed in the tutorial. My problem is in the following line that...

    textViewDidChange method is not being called when the UITextView.text property is being updated?

    ios,swift
    In the Master Detail template with CoreData, I'm saving 'String' shortcuts to my UITableView. I select a cell and place my shortcut value into the UITextView. When the configureView method is invoked, the textViewDidChange method is not being called; thus not updating my UITextView content properly. Is the UITextView not...

    replace a numerical column by a character column in R with a defined mapping

    r,mapping,dplyr,tidyr
    I did some searching but could not find an answer to my problem. Say I have a data frame with a column student_id in integers and some other columns. I also have another mapping table containing two columns, with the 1st one being student_id and the 2nd one student_name in...

    Wordpress share core directories using symbolic links

    linux,wordpress,hyperlink,symlink
    Backgrounds: I'm deploying several (about 10) wordpress sites in a single ubuntu-server. For each, I have a single mysql database (single schema), and a single wordpress file directories. For each instance of wordpress directories, the structure is like the below: |-- wp-admin | |-- css | |-- images | |--...

    Trouble loading simple mesh into OpenGL

    c++,visual-studio-2010,opengl,blender,.obj
    I need to import a 3D object mesh into my OpenGL code on Visual Studio 2010. I'm relateively new to OpenGL so I've been learning from the following tutorial (Number 7): http://www.opengl-tutorial.org/beginners-tutorials/tutorial-7-model-loading/ Now, the tutorial uses a simple code rather than a library to import ".obj" files Those who've used...

    Is the inter-packet gap is a field in ethernet packet?

    ethernet
    In wikipedia the image of ethernet frame includes a field "inter-packet gap". Other sited I've looked in don't have that field. I don't seem to understand if the gap is predefined according to the protocol or it can be changed using this field.

    non-oop way to display records or fields - mysqli

    php,mysqli
    I've been using mysql and it did what I want, but as my project is getting larger, I decided to opt for mysqli. I looked at the tutorial at enter link description here which was really straight forward up until the point where I want to display some data stored...

    Can you get the property name through which a function was called?

    javascript,properties
    I've done a lot of searching and some playing around, and I'm pretty sure the answer to this question is no, but I'm hoping a JavaScript expert might have a trick up his sleeve that can do this. A JavaScript function can be referenced by multiple properties, even on completely...

    How to rename maven modules?

    eclipse,maven,svn,module,rename
    I have small project in which there are three modules: <modules> <module>ejb</module> <module>web</module> <module>ear</module> </modules> I wish to rename these maven modules. First thing i tried was, just rename module names pom.xml of parent. e.g. <modules> <module>ejb-ext</module> <module>web-ext</module> <module>ear-ext</module> </modules> When I tried to compile the project, maven complained that...

    How to stop the initial evaluation of knockout js binding?

    javascript,knockout.js
    I am learning Knockout JS and following their online interactive tutorial. I have a button to add a new reservation. <button data-bind="click: addSeat($('#passenger-name').val(), $('#selected-meal').val()), enable: seats().length < 5">Reserve another seat</button> However the issue is that the addSeat function is called initially when Knockout is evaluating the binding expressions (or so...

    Receiving undefined references to various Windows libraries when compiling with SDL 2 and -static?

    c++,sdl,sdl-2
    I'm working on a modification of the Wolfenstein 3D engine in SDL2 (using Wolf4SDL as a base) and I've run into a problem - when using -static in the linker options, I get a large variety of undefined references to various things. Here's my build log to show what I...

    how to find the number of consecutive repeats

    mysql
    So I'm trying to write a mysql script to find the number of consecutive repeats in 'value' column of this table. id value result -- ----- ------ 1 1 0 2 1 1 3 2 0 4 3 0 5 3 1 So in this case I want get the...

    In Stored Procedure having error using 'and' after using where-between-parameter

    sql-server,join
    here is the query SET @SQL = ' SELECT name AS BUYER, OrderQty, OrderQty* Rate as Value FROM OrderMaster OM INNER JOIN LineAllocation LA ON LA.OrderRef= OM.OrderRefID INNER JOIN SystemManager..Contacts SC ON SC.Code=OM.BuyerCode INNER JOIN SystemManager..ProductionProcessCostCenter PPC ON PPC.CostCenter= LA.Line INNER JOIN OrderMasterCostBreakdown OCB ON OCB.OrderRefID= OM.OrderRefID INNER JOIN SystemManager..ProductionProcess...

    With jquery want to ad to html id ↑ or img src

    jquery,html
    Here are examples http://jsfiddle.net/j5a1ffLL/15/ For example only html all ok <div> <a href="#">Only html &#8593; &#x2191;</a> <img src="data:image/gif;base64,R0lGODlhBwAKAIABAI3JlgAAACH5BAEAAAEALAAAAAAHAAoAAAIPjGEZqNt+gJxrsnrP26oAADs=" > </div> Want with jquery to show &#8593; &#x2191; or data:image/gif;base64,... like <a href="#" id="third">With jquery third</a> <span id="span_third"></span> $('#third').text( $('#third').text() + ' &#8593; &#x2191;' );...

    Most common value in flat list

    python,list
    What are some ways to get the most common value in a list? l = [1,2,2] So far I'm doing: Counter(l).most_common()[0][0] But I was wondering if there was a list method or something 'simpler' to do this?...

    Algorithm for clustering names

    algorithm,cluster-analysis,spell-checking,levenshtein-distance
    I have people names (first name, last name and surname) in db column. The data is not full, for example some rows have only first name, last name or surname. are in different order (surname, last name) incorrectly spelled I need an algorithm to display a set of rows in...

    Removing inline CSS using div

    html,css
    I have this table containing submit buttons: <table style="border: 0; width: 15%"> <tr style="background-color: transparent"> <td style="border: 0"> <form action="displayevalform" method="post"> <input type="submit" value="Go Back"> </form> </td> <td style="border: 0"> <form action="evaluate" method="post"> <input type="submit" value="Done"> </form> </td> </tr> </table> This works, but to adhere to good practice, I decided...

    Elasticsearch with geo location

    mongodb,elasticsearch,geospatial
    Little Background. Our software uses MongoDB to save data. We have created text index and geo location index on it. Problem is query using both text and goe location is not supported in MongoDB. Our requirement is to search using natural language, restricting search to particular geo location and sorting...

    How to pass unknown uri's in spring

    spring,spring-mvc
    we use for a spring web app angularJS and Jade. The files are located in the static-resource folder. When the user wants to access a page, Jade renders the file and returns the html-page. On loading the page needs other resources like css and js-files. I have the problem, that...

    How do I rotate the contents of a PDF page to an arbitrary angle?

    pdf,pdfbox
    I need to rotate the contents of a PDF page by an arbitrary angle and the PDPage.setRotation(int) command is restricted to multiples of 90 degrees. The contents of the page are vector and text and I need to be able to zoom in on the contents later, which means that...

    Is there a need to initialize variables that are passed as a “class” constructor arguments in Javascript?

    javascript,types,prototype
    I come from a Java background, where everything is Object Oriented. While Getting into a bit more of Javascript (more into the class areas of javascript), I've noticed complete changes. The biggest for me is getting used to the prototyping of the so-called "classes" javascript has. So, my question is...

    Java Override Abstract Interface Method

    java,interface,override,abstract,implements
    I have a BankAccount.java that implements NamedAccount.java which is an abstract interface, but it keeps giving me an error that since BankAccount.java is not abstract it can't override it. How do I fix this problem? I tried adding @Override in both situations but it does not work! BankAccount.java: public class...

    How get item from a listView Android?

    android,android-activity
    How can I get a item from a listView 2 items , I am using to fill the listView a database of queries but there do not know how to do that to get the name of the item ? from = new String[]{manager.CN_NAME,manager.CN_CREDITS}; to = new int[]{android.R.id.text1,android.R.id.text2}; manager =...

    Michael Hartl’s Rails Tutorial chapter 9 (section 9.2.3 Friendly Forwarding) tests failed

    ruby-on-rails,ruby
    I am new to programming and getting the following errors while trying to get through the 9th chapter of Rails Tutorial. I checked the code several times but still didn’t understand why my local variable or method isn’t being defined. Every time I rewrite the code I get similar errors:...

    using find in python

    python,indexing,find,raw-input
    New to python, my assignment asks to ask user for input and then find and print the first letter of each word in the sentence so far all I have is phrase = raw_input("Please enter a sentence of 3 or 4 words: ") ^ That is all I have. So...

    How to download a file in Android

    android,httprequest
    What i have: I have uploaded a .json file to the Dropbox of my account I have made it public What i am trying to do: I want to download the file to my RAW folder of my android project I am familiar with AsyncTask and HttpClient but what methodology(steps)...

    Why do I get the search bar in a separate line?

    html,css,twitter-bootstrap,google-search
    I am trying to add a Google search bar in the navbar, but i do not why it comes in a new line as shown below: This is the html that should brings the navbar and its components all in the same column. <div class='col-lg-12 col-md-12 col-sm-12 col-xs-12'> <nav class="navbar...

    K&R 1.9 \\ exceeding the scope of an array?

    c,arrays,kernighan-and-ritchie,character-arrays
    I'm having a difficult time understanding this function: int getline(char s[], int lim) { int c,i; for (i=0; i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i) s[i] = c; if (c == '\n') { s[i] = c; ++i; } s[i] = '\0'; return i; } I will try to explain...

    How can I get the [Error]: from NSError.description?

    ios,xcode,swift,nserror
    I am trying to create a UIAlertView that displays only the error of NSError.description. For example: var alert = UIAlertView(title: "Oops!", message: error.description, delegate: self, cancelButtonTitle: "OK") alert.show() Say the error.description outputs: 2015-02-01 02:26:43.227 UserLogin[249:13655] [Error]: missing username (Code: 200, Version: 1.6.2) How can I just get the [Error]: missing...

    Why do we need to use the negation part in Turing's Halting Proof?

    loops,logic,proof,turing-machines,halting-problem
    For instance, let's say I have this Turing machine, H, which tells us whether or not a program and input will halt. Let's say we call H on itself. It has to give an answer, so if it prints out "does not halt" then didn't it technically halt to print...

    Django Admin change_list forcing search_form to reject given seach keywords

    django,database,django-templates,django-admin
    Problem: I'd like to enforce the change_list_view when opening the page with "?q=" (that is with no value or whitespace) and simply load the page by not executing queries at all. Possible ways: My question is how can I do that by overriding the queryset, get_queryset, or get_search_results methods ?...

    How to “reset” next indexPath.row to become current indexPath.row?

    ios,didselectrowatindexpath,nsindexpath
    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { self.selectedTrack = self.SPTrackList[indexPath.row]; self.selectedTrackRow = indexPath.row; self.nextTrack = self.SPTrackList[indexPath.row +1]; [self playTrack:self.selectedTrack]; } Hi -- How can I "reset" self.nextTrack to become self.selectedTrack? I've tried self.nextTrack = self.selectedTrack, but that will only work once. I'm guessing I need to traverse -- if that's the...

    ConcurrentModificationException for loop

    java,collections
    ConcurrencyTest.java Set<String> treeSet = new TreeSet<String>(); treeSet.add("Alpha"); treeSet.add("Beta"); treeSet.add("Gamma"); treeSet.add("Delta"); treeSet.add("Epsilon"); for(String str : treeSet) { if("Gamma".equals(str)) { treeSet.add("Zeta"); } } Iterator<String> it = treeSet.iterator(); while(it.hasNext()){ if("Gamma".equals(it.next())) { treeSet.add("Lambda"); } } Since Java's collection framework is fail-fast and for-each is just a wrapper around the Iterator, I was expecting a...

    Mechanize: Unable to redirect to final destination

    ruby,mechanize,mechanize-ruby
    I am using mechanize to try to login to a site. However when logging in with mechanize, I cant seem to get to final destination. Below is the example. Mechanize go to (1) https://app.abc.com/users/login If login successful, webpage will momentarily post to page link below (2) https://paid.abc.com/Login.aspx?CID=123&XRALID=321&LanguageID=1&ExecuteLogin=1 From there automatically...

    How to get Enum Key list

    c#,enums
    Consider I have an enum type : public enum PartyRoleTypeEnum { Stdudent =20, Teacher =21, Manager =22 } I'm trying to get PartyRoleTypeEnum keys by list<int> result = Enum.GetValues(typeOf(PartyRoleTypeEnum)).CastTo<int>(); And I'm expecting result whould be List<int>{20,21,22} But it returns an empty list....

    Problems with Apache mod_rewrite

    php,apache,.htaccess,mod-rewrite
    I decided to use mod_rewrite to make my URLs look better. I created very simple rules: RewriteEngine on RewriteBase / RewriteRule ^(profile|contact|help|events|account|logout)/?$ index.php?p=$1 [NC] RewriteRule ^home/?$ index.php [NC] RewriteRule ^PlaceOrder/([0-9]+)/?$ index.php?p=mos&gc=$1 [NC] It almost works well but it doesn't. So for example, [NC] is supposed to make it case-insensitive. However,...

    Error building Player: CommandInvokationFailure: Unable to convert classes into dex format

    android,build,unity3d,apk
    Please help me to solve this problem. This is what i got in the console: Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details. C:\Program Files\Java\jdk1.8.0_25\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="D:/Android SDK/sdk\tools" -Dfile.encoding=UTF8 -jar "D:/Unity3D/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" - stderr[ UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/qn; at...

    Combine float and absolute position

    javascript,html,css,css-float,absolute
    I am creating a calendar where all the events are displayed in a single div. According to the top and height values, the event should be placed in a determinate place. Let me show you. In this image, both events at 6am are at the same vertical alignment. I can...

    AngularJS CSS animation - animate two elements same time

    css,angularjs
    I'm learning AngularJs specifically angular-animate. I have in the html a toggle which currently transitions the div class "my-first-animation". How do I apply a transition to the background at same time? That is I would like the background-color of the body to fade from white to black when the div...

    Is there an equivalent to Expression.Parameter in C# 2.0

    c#,delegates
    I ask because I'm trying to back port something to use with unity which uses C# 2.0. e.g. I have a line like this: var patternSymbol = Expression.Parameter(typeof (T)); So can I substitute a bit of my own code to make this work? Note: I can change stuff around as...

    MATLAB error: complex integer arithmetic is not supported

    matlab,dft
    Error using .* Complex integer arithmetic is not supported. Error in DFT (line 35) J(u,v) = J(u,v) + I(x,y) .*exp(-1i*2*pi.*((u*(x-1)/M)+(v*(y-1)/N))); ...

    prevent typos in variable keyword args

    python,python-2.x,variableargumentlists,keyword-argument
    In Python3 I can do (thanks to pep 3102): def some_fun(a, *args, log=None, verbose=0): pass and be sure that if I call this with: some_fun(1, 2, 3, lob=debug_log) I get a type error on the unexpected keyword argument lob. On Python2 I cannot define some_fun() with keyword-only arguments after an...

    Docker EXPOSE vs command line -p option (boot2docker)

    networking,docker,boot2docker
    After spending way too long trying to access my node server running from a docker container within a boot2docker instance I realised the issue came down to a difference between expose and docker run -p. In my Dockerfile I had EXPOSE 3001, and I could not access this via my...

    Autofac “action injection” with ASP.NET MVC model binding

    c#,asp.net-mvc,autofac
    I'm using Autofac with ASP.NET MVC and am wondering if my view model setup in the web project is a good approach or not. In the past I only used constructer injection at the Controller level but thought it would be interesting to see if everything could be injected via...

    My subject column contains lot of different keyword, how do I write SQL query?

    php,mysql
    I want to retrieve data based on subject and Class.column name for classes is (Class_I_V Class_VI_VIII Class_IX_X Class_XI_XII). MY query is like this: subject LIKE '%$search%' or subject LIKE '%$search%' or subject LIKE '%$search%' or subject LIKE '%$search%' or subject LIKE '%$search%' or Class_I_V LIKE '%$search%' ". I have lot...

    Why does this C++ program work in some compilers but not others? What is the major difference between c++ compilers?

    c++,visual-c++,g++,clang,compiler-specific
    I have written this program for my class. I have found it compiles and runs just fine with the GNU g++ compiler. My professor auto-grades our programs from his website, which uses the Microsoft Visual Studio compiler and it throws an error. I have also tried this program in the...

    Multi stem jquery form not working

    jquery,forms,jquery-plugins,multi-step
    Below is my multistep form but it is not working properly,what it should happen is to go to next fields for input when next is clicked but when i click next it stays in that form nothing happens.It stays in the same page and even if next is clicked it...

    JAX-WS with async servlets

    java,web-services,servlets,soap,asynchronous
    So, I have this old legacy JAX-WS service, that does a lot of IO per request, so each request takes quite a bit of time, but doesn't consume much CPU/RAM. With amount of clients increasing lately, there's a huge problem of thread starvation. At first, I thought about implementing JAX-WS...

    Why does this for loop that iterates an array throw an exception?

    arrays,exception,swift,for-loop
    I keep returning an error from this seemingly obvious for-loop. for var i = 0; i < self.restaurantNames.count; i++ { self.names += [Name(name: self.restaurantNames[i], city: self.addressCity[i])] } Error fatal error: Array index out of range ...

    Shell script: Complex usage with &/&&/wait/sleep/pkill -HUP -P

    shell
    I'm trying to understand the codes in this project: https://github.com/benoitfragit/google2ubuntu/blob/master/record.sh #!/bin/sh # configuration file CONFIGURATION="$HOME/.config/google2ubuntu/google2ubuntu.conf" # default recording time recording=5 if [ -f "$CONFIGURATION" ]; then { # load the configuration . "$CONFIGURATION" # small security test if [ "$recording" = "" ]; then recording=5 fi } fi # get...

    The multi-part identifier “Transaction_tbl.locid” could not be bound while using join in case statement in sql server

    sql,sql-server,sql-server-2008
    I have a query like this: select sum(status_receved) as Receved, sum(status_parked) as Parked, sum(status_requested) as Requested,sum(status_requestedinprocess) as Requestinprocess, sum(status_deliverd) as Deliverd from (select case when (status = 0 ) then 1 else 0 end as status_receved, case when (status = 2) then 1 else 0 end as status_parked, case when...

    HTTP 400 When Using Nosurf and Appengine Blobstore

    google-app-engine,go
    I am using the Appengine Blob store example and it works fine (I modified to take two files but that is not the issue). However, when I turn on nosurf it gives me a HTTP 400. I am passing in the csrf token to my form. The issue exists even...

    Polymer, template won't evaluate true and bind

    javascript,html5,templates,polymer,web-component
    Using polymer I am very simply trying to evaluate wether an object property is a specific value, and if so bind the contents of truthy template to the dom. I have: <polymer-element name="template-elem"> <template > <div> <template if={{response.data.type === "message"}}> <div>working</div> </template> </div> </template> <script> Polymer({ response: {}, ready: function(){...

    Query work in mongo cmd but not in calling method

    node.js,mongodb,mongoose
    I am working in mongodb. I write a query db.ekgs.find({_id: ObjectId("54cd1dd3adc274b20a7f650d"),"interpretationList.interpretations" : { $all:[[ObjectId("54c09fb3581c4c8c218d1a39"),ObjectId("54c09fb3581c4c8c218d1a3a")]]}}) it work in mongo cmd. but when i write this in a method that take input from user then it doesn't work. req.body contain: { "ekgId":"54cdaed7adc274b20a7f650e", "diagnosis": [ "54c09fb3581c4c8c218d1a39", "54c09fb3581c4c8c218d1a3a" ] }; and in my method...

    Get and set with 2d arrays initialisation

    c#
    What is meaning of public static int[,] key { get; set; } in C# ? Please explain as am newbie to this language and also what size of 2D array will be allotted to this key array ? Here is code . I dont get how to remove error from...

    Capture output from multiple processes asynchronously

    c#,asynchronous,redirectstandardoutput
    I have a windows forms app that launches up to X number of console processes concurrently. I'm taking the JSON output (one object) from each and parsing it for statistics. I'm keeping track of how many processes I've started and capture their output in OutputDataReceived(). I append the output into...

    Reuse Zend 2 form with captcha for editing

    forms,zend-framework2,captcha
    I have a form for some element creation with captcha. It works fine. But I want use this form in Admin page too, and there should be no captcha. When I try to submit form I have an error ["captcha"] => array(1) { ["isEmpty"] => string(36) "Value is required and...

    Check if app is iPhone app opened on iPad

    ios,objective-c,iphone,ipad,swift
    I have developed keyboard for iOS 8. Depending on if device is iPhone or iPad i load different layouts. Now, i have an issue when user opening app (for example: Instagram) which is iPhone app but downloaded on iPad and of course iPad resizes this app. My keyboard detects device...

    For loop in Javascript isn't working

    javascript,html,for-loop
    New to javascript, but in my mind my html should produce a grid that I created. None of the tr or td elements are being populated from my js file. Does anyone know why or what I'm missing? Thanks for your help. Here is my js file: function showGrid() {...

    joint session history backward navigation with iframes

    javascript,ios,cordova,backbone.js,browser-history
    I'm trying to debug navigation issues with my app. The problem is in navigating back through an iframe on a page. I am using a backbone router in a SPA cordova app, testing on iOS. I some of the application pages contain iframes that load web content hosted on the...

    Retrieving an array of numbers from MonoDB with meteor.js

    javascript,mongodb,meteor
    How do I properly retrieve an array of numbers from MongoDB Collection Object with meteor.js? In the code, my alert(temp) suppose to output a number that is added up like 5.95+5.95+5.95 = 17.85, but the output is 0[object Object][object Object][object Object][object Object][object Object][object Object][object Object], which means I did not...

    jQuery Image Slider with Divs

    javascript,jquery,caroufredsel
    so I'm working on this jQuery Image slider (w/carouFredSel) that will be 100% wide and display the previous and next image as well. I got a great example from this site: http://coolcarousels.frebsite.nl/c/2/. However, when I change the img tags to divs, it does not work. I'm not sure as to...

    Click event doesn't fire in jquery

    javascript,jquery,html
    I appended a new element but when I click on it it has no response. HTML <button>add element</button> <div></div> Javascript $(function(){ $('button').click(function(){ $('div').append('<span class="x">x</span>'); }); $('.x').click(function(){ alert('fire'); }); }); ...

    Xpath : how to extract link name using xpath

    xpath
    <table class="genre-table" width="100%" cellpadding="0" cellspacing="0" border="0"> <tbody> <tr class="odd"> <td width="50%"> <h3> <a href="http://www.imdb.com/genre/action/?ref_=gnr_mn_ac_mp">Action <span class="normal">»</span> </a> </h3> I want to extract the word action from this , how to write the relevant xpath , please help I tried with this but nothing is getting printed just blank --> print...

    How to clear memory cache in Ruby?

    ruby-on-rails,ruby,ruby-on-rails-4,rails-activerecord
    I'm new to Ruby. I've got a rails application and I'm keeping site configuration (like site name) in the database. I've set up a helper so I can call: site_param 'site_name'. The helper stores the data in a variable so that the application doesn't hit the database on each call,...

    Java: Uniform Cost Search with Node class

    java,graph-algorithm,priority-queue,comparable
    The below code is supposed to detect an image, create a 2d array containing the pixel values from that image, and determine the path of lowest cost (I used Uniform Cost Search) from a Point A inside the image to a Point B inside the image. When I run my...

    Bootstrap responsive tables inside responsive tabs

    javascript,html,css,twitter-bootstrap,responsive-design
    Using footable inside of Boostrap Responsive Tabs and have an issue after resize. If you load the page on a desktop everything works as expected until you resize your screen. As soon as you resize your screen the tables within the tabs no longer function. This works both ways where...

    How to display ImageGridFSProxy in HTML?

    html,mongodb,flask,pymongo,gridfs
    I have several images stored within MongoDB and I would like to display them now in a web page. I'm using Flask for my application. The record has a binary field named "payload" class BinaryFile(mongo.Document): created_at = mongo.DateTimeField(default=datetime.datetime.now, required=True) file_name = mongo.StringField(max_length=255, required=True) payload = mongo.ImageField(required=False) I want to diplay...