FAQ Database Discussion Community


how to number questions using class in CSS

html,css,css-counter
I have created a list of questions and plan to add more in the future. I want to number the questions using CSS for example each question is in a section as given below. <section class = "question">The Question</section> Is there any way to number them automatically using the "question"...

In Rails, what's the relation between find_each and where?

ruby-on-rails,ruby,ruby-on-rails-3,ruby-on-rails-4,activerecord
In Rails, both find_each and where are used for retrieving data from Database supported by ActiveRecord. You can pass your query condition to where, like: c = Category.where(:name => 'Ruby', :position => 1) And you can pass batch size to find_each, like: Hedgehog.find_each(batch_size: 50).map{ |p| p.to_json } But what's the...

CSS centered div isn't centered in Firefox

html,css,firefox,mozilla
I did this all entirely within a day on little sleep (final school assignment for the semester ha) so maybe I'm missing something very obvious, but my centered div box, that has an image in it and is centered with CSS, appears really off on Firefox! Somehow it's been offset...

Java MongoDB 3.0 driver query distinct without filter

java,mongodb-query
I imported Yelp Academic Dataset to MongoDB. Now I am attempting to query a list of all the unique categories from locations. In the Mongo shell, this is very simple: db.locations.distinct("categories"); In Java, it's not the same. MongoClient client = new MongoClient(); MongoDatabase db = client.getDatabase("yelp"); //this won't even compile,...

Python- How to convert stringed operator back to its special meaning?

python,string,operators
I am writing a program in python3.3 which requires me to evaluate a stringed expression like : "2+3" I converted the '2' and '3' to numbers using int("2") int("3") But how do i change "+" to get its special meaning?...

Align a fixed width div in center between two auto adjusting divs

html,css
How can I display a div of fixed width 800px and on the both sides (left and right) there should be auto adjusting divs. Till now I have tried using float:left on the left auto adjusting div , widht:800px on the center div and float:right on the auto adjusting right...

how to handle page reload in socket.io client chat applications

node.js,socket.io
I was implementing a chat application. I am not in server and the page which contains javascript file can be any html page on file system with the embeded javascript/socket.io in it. Now the problem is page reload by definition will always trigger a new request resulting in new socket....

c++ getline reads entire file in Windows

c++,getline
This looks like a similar question to this one, however I think my case might actually be a bit different. The code is as below: void readOmronResults(string fileName) { ifstream inFile(fileName); ofstream testRead("test_read.txt"); string line; //getline(inFile, line); //cout << line << endl; while (getline(inFile, line)) { testRead << line <<...

i want the nav buttons to appear below the logo in the mobile view with auto centering

html,css,html5,css3,media-queries
HTML CODE WRITTEN FOR DESKTOP VIEW <body> <div class="main-container"> <header> <div class="header-logo"></div> <nav class="nav clearfix"> <ul> <li><a class="active" href="#">LOGIN</a></li> <li><a href="#">SIGN UP</a></li> <li><a href="#">PRODUCTS</a></li> <li><a href="#">ABOUT</a></li> <li><a href="#">HOME</a></li> </ul> </nav> </header> CSS CODE...

Is it safe to write directly to RAM using c++? [closed]

c++
I was expirimenting with c++ when i found out that it is possible to write to memory, but it is not safe. However, i think i may have developed a safe way to write to memory. But I want your opinion, is the code below safe? #include <iostream> int _tmain(int...

Footer not staying down

html,css
Alright so i know this is a topic so many people have problems with and i have tried almost every method to keep this footer down the bottom of the website but it just won't stay down. On chrome its working fine, on mobile devices and jsfiddle it won't stay...

Position dodge with geom_point(), x=continuous, y=factor

r,ggplot2
I have made a function that can plot the loadings from many factor analyses at once, also when their variables do not overlap perfectly (or at all). It works fine, but sometimes factor loadings are identical across analyses which means that the points get plotted on top of each other....

In neural networks, why is the bias seen as either a “b” parameter or as an additionnal “wx” neuron?

machine-learning,neural-network,backpropagation
In other words, what is the main reason from switching the bias to a b_j or to an additional w_ij*x_i in the neuron summation formula before the sigmoid? Performance? Which method is the best and why? Note: j is a neuron of the actual layer and i a neuron of...

symfony2 : How to disable APC cache selectively on few routes

symfony2,caching,apc
I am using symfony version 2.3 . I have used following in my config.yml metadata_cache_driver: apc result_cache_driver: apc query_cache_driver: apc I want to disable caching at following URL . www.domain.com/dashboard How can I achieve this ? Any help ...

AngularJS $http.get not retrieving the backend data

javascript,mysql,angularjs,node.js
i am new to the "Angularjs and Nodejs" combination and i am trying to make a simple crud app. The problem is, when i use $http.get in angular, it doesnt go to the backend. Here are my codes: server.js (nodejs) var connection = util.getDBConnection(); app.use(express.static(__dirname + "/public")); app.use(bodyParser.json()); //routes =...

Get pixel color from canvas using jQuery draggable?

javascript,jquery-ui,canvas,pixel,color-picker
I'm using code from this question to make a 'color picker' with colorwheel tool using jQuery UI's draggable function, but I'm having trouble. I can't seem to get the correct location on the canvas image, as my code always returns rgb valeus of 0, 0, 0, no matter where I...

Significance of javascript function name in quotes in Angularjs

javascript,angularjs
I'm going through a javascript file having some functions like this: 'form_validation': function(form,error_bin){ for(var field in form){ if(field.substr(0,1) != "$"){ this.validation_messages(field,form,error_bin); } } } I want to understand what is the difference between defining a function with quotes (like mentioned above) and without quotes EDIT: I've also observed that the...

Taking data from Mysql to JTable in JAVA

java,swing,jdbc,jtable,defaulttablemodel
I am trying to have information in my Jtable and reading the info from mysql and it looks like am the era comes from this segment as I can see am stuck , I dont know what to do, Now I have a DefaultTableModel which defines the methods JTable will...

Reverse query with like - laravel eloquent or raw MySQL query

mysql,laravel,eloquent,laravel-5,reverse
I have a table with links submitted by users. Some of the links do not contain the `http://` I want to list these records by using the below query: $object = Related::whereHas( function($q) { $q->where('URL', 'like', 'http%'); })->get(); How to reverse the query to get them? Thx...

Reguralexpresion which accepts valid float numbers [PHP]

php,regex,preg-match,conditional
I am trying to verify a valid float number. Basically i want to accept numbers with up to four numbers after the coma: 0,2342 123412,2300 1234.0000 1244 1234,12 1234.12 0.23 I also want to reject the numbers with 0 on the front, but pass the 0 if its on its...

KnockoutJS: Add Property to ViewModel through Custom Binding

javascript,mvvm,knockout.js
I'm adding a custom binding to my page. Within it, I'd like to save one of the objects I create as a property of the viewModel. When I do this, I get "undefined" when I try and access it outside of the binding. Why? Here is a reduced down example:...

Unable to cast object of type 'System.Single' to type 'System.Int32'

c#
I am confused by getting the following error: Unable to cast object of type 'System.Single' to type 'System.Int32'. I am fetching data and iterating them as follows: public MyFault { public int fault_throw { get; set; } } protected List<MyFault> myfaults = new List<MyFault>(); foreach (var package in packages2) {...

Linux Move files from base path to multiple paths in a loop

linux,bash
Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created. /Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt /Path/AdminUser/User1/2222/Reports/bbb.txt to /Path/User1/2222/Reports/bbb.txt /Path/AdminUser/User2/3333/Reports/ccc.txt to /Path/User2/3333/Reports/ccc.txt /Path/AdminUser/User2/3333/Reports/ddd.txt to /Path/User2/3333/Reports/ddd.txt I don't want to move directory structure. I want to move files from that source path...

Reference latest Microsoft.Build GAC assembly in F# Interactive?

f#,msbuild,f#-interactive
How do I reference the latest Microsoft.Build in the GAC from a .fsx? When I do #r "Microsoft.Build" I always get version 4.0.0, but I want 12.0.0 to load. #r "Microsoft.Build" open Microsoft.Build.Evaluation printfn "%s" typeof<ProjectCollection>.Assembly.Location This will help me solve this issue. EDIT #1: Doing a fully qualified assembly...

Map Loads; Overlays load; Map responds to jscripts… but map.DrawingManager is undefined

javascript,google-maps,google-maps-api-3
I've got a portal that I'm working on redesigning: it uses Google Maps as a base layer, then overlays a series of different layers that represent planning zones, planning overlays, government authority area boundaries and so forth. These overlays, and mechanisms to make them visible selectable (to fetch data about...

How to specify a model in a default_scope?

ruby-on-rails,ruby,model,scope
My model Chapter has_many Pages, which in turn belong_to only one Chapter. I'm trying to do the following joins: Chapter.joins(:pages) But I'm getting this error: SQLite3::SQLException: ambiguous column name: created_at: SELECT "chapters".* FROM "chapters" INNER JOIN "pages" ON "pages"."chapter_id" = "chapters"."id" AND (created_at >= '2015-04-24 23:22:32.783941') ActiveRecord::StatementInvalid: SQLite3::SQLException: ambiguous column...

fit adobe air app on smaller screen

flash,air
I inherited an Adobe Air project where almost all the UI is created via action script code. The projects dimensions are 1920x1080. When deploy this app to my first generation Galaxy Note 10.1, parts of the screen is cut off because my tablet has a resolution smaller than 1920x1080. Is...

Am I oversimplifying returns?

java,arrays,return
Basically I'm doing the old driver exam program for a uni course and I've drafted out the whole class. When I try to compile it, if working in command prompt, I get the error: missing return statement and in Eclipse: This method must return a result of type int` pertaining...

How parse li class in a ListView Using Jsoup

android,android-listview,arraylist,jsoup
I am parsing a web page http://abcsur.info/clasificados/inmuebles/casas, the page is refreshed and change every week. I want to display the ads on [li class#li.list-group-items]. My idea is to add this li classes to a List View. After search in several sites, i write this code, but the app crash (NullPointerException)...

Space complexity of Java data structures

java,algorithm,memory,data,analysis
I have been searching for many websites that contain information of the space complexity of Java data structures. I am searching specifically for the space complexity of the HashMap, ArrayList, Stack and LinkedList. One site that I found that came close and had information only on the Stack and LinkedList...

Time complexity of Boggle solver

python,algorithm,big-o,time-complexity
Here is a (ugly) algorithm for finding all words in Boggle: d = {'cat', 'dog', 'bird'} grid = [ ['a', 'd', 'c', 'd'], ['o', 'c', 'a', 't'], ['a', 'g', 'c', 'd'], ['a', 'b', 'c', 'd'] ] found = {} N = 4 def solve(row, col, prefix): if prefix in d...

MIPS .data Segment to Machine Code

assembly,mips,machine-code
I have to convert the following code from the .data segment into machine code, but I am unsure as to how this is done. value: .word -39 I understand the process for .asciiz variables, but I cannot find any information on .word variables to machine code. Also, does the processor...

Stored Procedure libraries

sql-server,stored-procedures
Let's say I have a Data Access class library containing thousands of methods, with each one calling a stored procedure in a SQL Server database. The methods are organized in about a hundred separate classes. Is there a way to create collapsible libraries or something to that effect instead of...

Three js raycaster not returning intersections

three.js,raycasting
Very new to Three.js and coding in general so bear with me. I'm trying to implement some draggable cubes similar to the example on threejs.org but I'm having issues with the raycaster in one particular section of my code. For some reason the raycaster is not returning intersections with my...

Testng : Get invoked method parameter information in a listener

testng
I need to get information about method invocation in a method listener at runtime. Precisely the value of the parameter passed to the method thru a data provider. Here is my Test Class @Listeners(MyListener.class) class MyTest{ @Test(dataProvider="myDataProvider") public void myTest(ITestContext context , SomeParam param){ // test something } } Here...

load iframe after DOM ready. document ready

javascript,jquery,html,dom,iframe
How can I delay the loading of an iFrame? The iFrame (at bottom of page) is: A) Slowing the site load time B) Conflicting with slider (see my other question re: slider) To delay the iframe load until after DOM ready I'm trying: <iframe id="iframe_id" src="http://sourcewebsite.com" style="width:100%;height:700px;border:0px;background-color:;" frameborder="0" allowtransparency="true"></iframe> <script...

How to add keywords to the psi class created by the intellij plugin?

intellij-idea,intellij-plugin
I'm working on my first Intellij plug-in which generates lot of java static inner classes in the file that the user is currently working on. I'm able to generate the inner classes and add fields to that inner class, But the generated inner classes are non static how can i...

Very Basic SymPy Error

python,scipy,sympy
I'm trying to learn SymPy. I've written the following and its throwing an error. I haven't even gotten to anything complicated... from sympy.solvers import solve from sympy import Symbol string = "10x+4=7" #equation = raw_input("Enter an equation") left, right = string.split('=') string = left + "-(" + right + ")";...

How to reorder indexed rows based on a list in Pandas data frame

python,pandas
I have a data frame that looks like this: company Amazon Apple Yahoo name A 0 130 0 C 173 0 0 Z 0 0 150 It was created using this code: import pandas as pd df = pd.DataFrame({'name' : ['A', 'Z','C'], 'company' : ['Apple', 'Yahoo','Amazon'], 'height' : [130, 150,173]})...

What's wrong with my function? [closed]

javascript,jquery
can't seem to get the login page to work. I need to check the input email/password against the json data i get from the get request. something isn't working, but I can't figure it out. function isSuccess() { var firstAdmin = { "name": "Admin", "email": "[email protected]", "password": "secret", "admin": true...

What is the difference between `bower install foundation` and `foundation new MY_PROJECT`

sass,gruntjs,zurb-foundation,gulp,bower
On the foundation github page the recommended way to install foundation is bower install foundation yet in their documentation they suggest using foundation new MY_PROJECT. On the documentation page the first method is only listed under the "using a task runner" section. Both methods give different file structures. Are both...

Images not displaying in Django 1.8

django,django-urls,django-media
In Django 1.8, I can upload images and they are saved on the path that they should, but when I add the path to template, the images are not displaying. I GET 200 http code for them in terminal server. Here are the relevant parts in settings.py: BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))...

Make geom's bigger based on density in ggplot

r,ggplot2
I'm currently mapping out values as Geoms on ggplot. These values are on the y axis and their categories are on the x axis. Data looks something like this: Value condition 1 TRUE 1 TRUE 1 TRUE 6 TRUE 10 TRUE Minimal running example: df <- data.frame(c(1,1,1,1,1,2,3,3,1,6), TRUE) colnames(df) <-...

Profiler shows high cpu load in graphics, shows multiple sites?

javascript,firefox,firefox-developer-tools
Why does the Firefox Profiler show javascript from every tab? When profiling my own setup I saw a log of mostly graphics (green), mostly highlighted when I select a script from plus.google.com, and talkgadget.google.com, translate.google.com. I also saw stackoverflow on the profile, so apparently it's profiling all tabs? Why does...

android studio sending string array put extra to new activity

android-listview
Hello im working on a school project. I have a list of strings on a listview. I want to have the user make a selection add that to a string array and then print out the string array in a new listview in a different activity. Here's what I have...

Are end-to-end tests better than unit tests, in situations where both are applicable?

unit-testing,integration-testing,end-to-end
Let me first define what I mean by unit and end-to-end tests. Let's say you have a program with a bunch of Java classes: A invokes B, which invokes C, and so on. A unit test is a test for A mocking out B, and separately a test for B...

Issues when modifying axis color label in ggplot2

r,ggplot2
I have a basic question which has turned a headache for me. I want to change the color for the axis value in a plot to blue, but it has been impossible. In the code, I´m using, I plot the mean and Confidence intervals (CI) values for a data summary....

Android RecyclerView Saving State Information

android,recyclerview
I have a RecyclerView whose adapter holds a SortedList of objects I can not modify. My cards inside the RecyclerView should expand/collapse on click showing additional information when expanded. The problem is that there seems to be no way to store the information whether a card is expanded or collapsed...

Regular expression for latex fonts in emacs

regex,emacs
The following regular expression is taken from font-latex.el - line # 925 (auctex-11). "\\(?:{[^}]+}\\)?" I have tried to transform this expression so that it can accept the following text in Emacs. 1 - \begin{code}{} 2 - \begin{code}{{}} 3 - \begin{code}{Hello World} 4 - \begin{code}{\textbf{Hello World}} Here code environment requires 2...

Bolt CMS - Error > posix_getuid()

bolt-cms
I just installed Bolt CMS (2.1.8) (http://www.bolt.cm) to my CentOS VPS and I like it a lot. I get an error message when I do: File Management>View/edit Templates>base-2014>images The error is: Whoops\Exception\ErrorException thrown with message "Call to undefined function Bolt\Filesystem\posix_getuid()" Stacktrace: #0 in /home/mydomain/public_html/test/src/Filesystem/Local.php:171 The other 3 links (css, javascripts,...

Need to remove the border on text

html,css
I have this jsfiddle that shows my current code but it doesn't serve me well. I want to remove the border that strikes my text Need to have something like -------- Some text ------- Also need the whole border top, bottom, left and right and the background color yellow should...

SQL to find results where a field contains http:// not preceded by

sql,sql-server,sede
I'm trying to create a SEDE query to find posts that contain links in plain-text, but the following query will be no good: SELECT Id AS [Post Link], Body FROM Posts where Body LIKE '%http://%' and Body not like '%<a href="%' and body not like '%<img src="%' Since it will...

What does Web API need to bind models?

c#,angularjs,asp.net-web-api
Using angular, I send an HTTP request $scope.addFiles = function (files) { for (var i = 0; i < files.length; i++) { var file = files[i]; $http.post('/api/files/addFiles', JSON.stringify({ testName: "test", someRandomCrap:"asdf"})); } } I receive the request properly in my controller. However, the response is null: After verifying that the...

Scraping data from dynamically updating command line application

linux,bash
I would like to get some data from the program intel_gpu_top, it updates it's output dynamically much like top or nethogs. intel_gpu_top | grep render displays the appropriate lines, but the lines are still updating in place. Also from that i can't send the lines anywhere else. Something like: intel_gpu_top...

Linux install command for mingw?

windows,make,install,mingw,mingw32
When trying to build a library from source using make and MinGW, I realized (from errors) that I don't have the install command, which I understand to be a combination of cp, chown, chmod, strip, and maybe some other stuff. I figured, hey, someone's got to have a copy of...

WKInterfaceButton IBAction is sending nil sender

ios,watchkit,wkinterfaceobject
2015-05-02 23:56:34.047 TapIt WatchKit Extension[1398:18615] b: <WKInterfaceButton: 0x6080000580c0> 2015-05-02 23:56:34.048 TapIt WatchKit Extension[1398:18615] sender: (null) - (IBAction)tapped:(id)sender { bool success = false; NSLog(@"b: %@", b); NSLog(@"sender: %@", sender); Why is this coming through nil?...

Abstract base class has abstract nested class [closed]

c++,iterator,abstract-class,nested-class
My code structure is as follows. I have a base abstract class which also has a nested abstract iterator. I inherit from the base class and i also inherit from the abstract base inherited class. To allocate the objects I use polymorphism: i am getting errors like: In file included...

How to reset widget in Kivy

android,python,kivy
I have a very simple application having one button and one label. Label have value 0 initially. On each button press, label increase by 1. When label becomes 3, i show a popup with a "play again" button. Now, i want to reset label to 0. My Attempt: #!/usr/bin/kivy import...

Need to access Heroku Postgres DB of a JRuby on Rails app in Java

java,postgresql,heroku,jruby,jrubyonrails
I need access to the Postgres DB in Java within my JRuby on Rails App. Is this allowed/done. Has anyone done it? So could I just make a singleton connection to the db via jdbc and manipulate the postgres db? If so, please can you point me to some resources/examples...

Capture part of name so that I can loop in linux

linux,bash
how do i capture a pattern in a filename and use that to do in linux? example in a folder contains these files: BBB137O19_rc.fa BBB921N08_cleaned.fa BBB002O19_cc.fa I would like to capture the front part of the filename and use that to do things like renaming, run a program etc. Apparently,...

How to clone Greg Kroah-Hartman's stagingtree repository for the Linux kernel?

git,linux-kernel,git-clone
I am using git to try and clone Greg Kroah-Hartman's staging tree repository by using following command. $ git clone -b staging-next git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git However, I keep getting this error: Cloning into 'staging'... fatal: unable to connect to git.kernel.org: git.kernel.org[0: 198.145.20.140]: errno=Connection refused git.kernel.org[1: 199.204.44.194]: errno=Connection refused git.kernel.org[2: 149.20.4.72]: errno=Connection refused...

Java, using throw without try block

java,exception,try-catch,throw
For the following method, is it okay to throw the exception when it isn't inside a 'try' block? public void setCapacity(x) throws CapacityExceededException { if (x > 10) throw new CapacityExceededException(x); else this.x = x; } ...

Scala difference between “+:” and “::”

scala
I am reading a scala book and they use two different type of cons operators when doing pattern matching on sequences and lists +: :: usually most functional languages use :: as cons. I don't know why scala has 2 different type of operators for the cons. I googled on...

WPF Binding to Collection and updating when collection changes [duplicate]

c#,wpf
This question already has an answer here: Updating the listbox after adding a new item 2 answers I'm using a ItemsControl and binding it's ItemsSource to a collection (empty) property in my ModelView. It's a form for new users, so when the client clicks a button, I want to...

Reliable way to convert javascript timestamp into a date tuple

javascript,date,erlang
I want to convert javascript time stamps to erlang dates. I am using the qdate library to help me do that since it also provides functions for date arithmetic. Calling it's to_date function first before midnight and then after midnight results in time displacement of 24 hrs. For example:- qdate:to_date(Timestamp...

make android splash screen animation with xml

android,android-animation,splash-screen
I want to make an animated splash screen in android related to quiz. Can anyone help me for making the splash screen which gives good start to my application of quiz?

I keep getting an error in android studio

android,android-actionbaractivity
The error is android.support.v7.ActionBarActivity is deprecated. Does anyone know if it affects my game or how to fix it? Thank in advance.

Ttk scrollbar's thumb won't resize

tkinter,scrollbar,tk,ttk
It seems that ttk's scrollbar's thumb automatically fills up the whole trough when elements can fit within the view-able area.. Even after I add more elements such that the treeview extends past the view-able area, the scrollbar's thumb still doesn't resize. I've tried updating tk itself but it doesn't seem...

How do I get direct link of file from server link in JavaScript?

javascript,php,html,ajax
So, now I have a file. The file is at /home/johndoe/index.html. I host, using something like XAMPP, which hosts the folder /home at localhost. So this is the list of variables I have: $server_addr = "localhost"; $server_root = "/home"; $file_dir = "/home/johndoe/index.html"; Now, in PHP, I'm trying to get the...

Removing/Consuming Lamda expression events on javafx

java,javafx,event-handling
So, I created an event with lambda expression in a canvas using javafx and I want it to be removed after used, here's the event: can.setOnMouseExited(event->{ gc.clearRect(0, 0, 100, 100); gc.setStroke(Color.BLACK); gc.strokeRect(0, 0, 100, 100); }); ...

Is there a way to inspect map/set entries in eclipse?

java,eclipse,debugging,dictionary
I have below code Map<String, Employee> map1 = new HashMap<String, Employee>(); map1.put("delKey", new Employee()); map1.put("delKey1", new Employee()); When i inspect map1 under variables view with show logical structure i just see value as Employee not an object so that i can inspect further employee object like below Is there a...

Save button didnt working

java,mysql,netbeans
Can somebody help me? I tried to make save button, but when I saved it, It don't do anything. private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { String food_id = txtFoodID.getText(); ButtonModel food_type = btngType.getSelection(); String food_cat = cmbCat.getSelectedItem().toString(); String food_name = txtFoodName.getText(); String...

filter json in logstash

json,logstash,kibana,elasticsearch-plugin
I have a json file with records like this one {"id":1,"first_name":"Frank","last_name":"Mills","date":"5/31/2014","email":"[email protected]","country":"France","city":"La Rochelle","latitude":"46.1667","longitude":"-1.15" and I'm trying to filter the fields in logstash, unsuccessfully so far. I tried the grok debugger and the grokconstructor but cannot make it work. My last attempt is input { file{ path => ["C:/logstash-1.4.2/mock_data.json"] type => "json"...

Jetty HTTP/2 client receive server push example

jetty,server-push,http2,nghttp2
Jetty's HTTP/2 client with server push support has been implemented in Jetty 9.3 RC (Link). However, I have not found any documentation or example code related to this. Could any one provide an example code for example to receive the pushed resource from this site : https://nghttp2.org (public server which...

Convert a class to a possible interface

c#,design-patterns,reflection,interface,inversion-of-control
I have two Interfaces in different projects (these projects are not referenced to each other) which have the same methods like this: In first project we have: public interface IInterfaceA { IAViewModel Do(); } public interface IAViewModel { int Id { get; set; } } public class ServiceA : IInterfaceA...

Difference between cell, mesh and samples

data,graphics,cell,visualization,mesh
What is the difference between cell, mesh and samples from a graphics/Visualization point of view? I read a lot and I still cannot seem to figure out the difference between a cell and a mesh and how does that impact my samples?...

R - get values from multiple variables in the environment

r,environment-variables,value
I have some variables in my current R environment: ls() [1] "clt.list" "commands.list" "dirs.list" "eq" "hurs.list" "mlist" "prec.list" "temp.list" "vars" [10] "vars.list" "wind.list" where each one of the variables "clt.list", "hurs.list", "prec.list", "temp.list" and "wind.list" is a (huge) list of strings. For example: clt.list[1:20] [1] "clt_Amon_ACCESS1-0_historical_r1i1p1_185001-200512.nc" "clt_Amon_ACCESS1-3_historical_r1i1p1_185001-200512.nc" [3] "clt_Amon_bcc-csm1-1_historical_r1i1p1_185001-201212.nc"...

Excel horizontal axis values irregular and ugly

excel,excel-2010
The image shows a chart with time vs temp and humidity data from a high-powered rocket launch (it hit about 7000 ft at the highest point, and then slowly parachuted down). There are about 4000 data points here. What I want to fix is the ugly horizontal axis numbers. How...

Accessing non static members inside static method via passed pointer

c++,multithreading,static,this
Not the actual code, but a representation: I need to initiate a thread from one of my member functions and I do that this way: return_val = pthread_create(&myThread, NULL, myStaticMethod, (void*)(this)); i) I pass this as an argument because static methods do not allow non-static members to be accessed, and...

Pong in PyGame, Moving paddles causes the ball to stop regenerating when hitting the side

python,pygame,pong
So I am trying to create a simple single player Pong game with pygame. The ball starts and when it hits the wall it will regenerate.... as long as I don't move the paddle. When I move the paddle the ball then just bounces off all the walls and doesn't...

How to abstract/remove redundent methods in the following class sample

c#,inheritance,xna,abstraction
I'm trying to remove the redundancy I have in my Enemy0, Enemy1, ... classes that inherit from my abstract Enemy class. This is all Monogame/XNA. My abstract class looks like so: public abstract class Enemy { public abstract Vector2 Position { get; } public Enemy() {} public abstract void Update(GameTime...

EventListener firing for every image subscribed instead of just the one?

lua,corona
I am dynamically creating images and assigning them an event listener, when I tap the image the event for all images fire, instead of just the one I tapped. I would expect it just to fire the once so where have I gone wrong? math.randomseed(os.time()) for i = 1,20 do...

C ++ std::map with custom comparer for keeping tournament of matches

c++,stdmap
I would like to save results of tournament in some container. For every match I need to store names of players and a number of points. For example: map["player1:player2"] = {2,4}; I want to retrieve from this container not only by key "player1:player2", but even by the inverse key "player2:player1"...

How do you setup an AWS Elastic Beanstalk Docker Platform running Django?

django,amazon-web-services,docker,elastic-beanstalk
I have been running a regular Django site using the regular EB Python platform, but for some reasons, I want to migrate to using a Docker image, but still get everything I get from Elastic Beanstalk. In order to demonstrate the problem, I created a small Django project at https://github.com/dkarchmer/aws-eb-docker-django...

How to make an progressBar touch bottom screen border in Android

android,android-layout,android-progressbar
I am having a similar problem as mentioned in here Here is my xml layout : <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentBottom="true"> <ImageButton android:id="@+id/imageButton” android:layout_width="40dip" android:layout_height="match_parent" android:background="@android:color/transparent" android:contentDescription="@string/descrp"...

How do I upload a file via HTML before passing it to a Javascript function?

javascript,html,function,file,upload
So I'm very new to the world of web development and have a project I'm working on in which I'd like a user to upload a .txt file before being returned another file containing an edited version of their file. The difficulty I'm finding is that JS seems to be...

What class to select to remove URL underline?

php,html,css,wordpress
I am trying to remove the underline from a URL on a hover event, but cannot figure out which class/CSS rule is affecting the div. At the bottom of the page is a "Related Posts" section, and when the cursor hovers over the image/article title, the title gets underlined. The...

Kiwi unit tests never failing in Xcode

ios,objective-c,xcode,unit-testing,kiwi
For some reason my tests are passing every time. Even when I add fail(@"failed"); Xcode still says "test succeeded" Any ideas? Heres what my spec looks like #import "SDRViewController.h" #import <UIKit/UIKit.h> #import <Kiwi/Kiwi.h> SPEC_BEGIN(SDRViewControllerSpec) describe(@"SDRViewController", ^{ __block SDRViewController *viewController = [[SDRViewController alloc]init]; beforeAll(^{ [viewController setupCollectionView]; }); describe(@"viewController.collectionView", ^{ describe(@"collectionViewLayout", ^{...

Difference between istream::get(char&) and operator>> (char&)

c++,istream
My question seems to be the same as this one, but I didn't find an answer since the original question seems to ask something more specific. In C++98, what is the difference between char c; cin.get(c); and char c; cin >> c; ? I've checked the cplusplus reference for get...

Django - Keeping history of a field

python,django
Using django 1.7 admin page, I want to Person objects to have a unique Note while keeping the history of the Note field. Here is my code: class Note(models.Model): note = models.TextField(blank=True, default='') date = models.DateTimeField(auto_now_add=True) def __unicode__(self): return self.note class NoteHist(models.Model): id = models.AutoField(primary_key=True) note = models.ForeignKey('Note') def __unicode__(self):...

Use jQuery on Elements from .load()

javascript,jquery,html,css,jquery-load
Is it possible to use jQuery on elements inserted into the page using: jQuery('#here').load('slick.txt'); I want to use jQuery on one of the elements in slick.txt but it doesn't work: jQuery('p').hide(); ...

load JPanel that contains another JPanel

java,swing,jpanel,containers
I'm trying to load a Class that extends JPanel and has components from another Class that also extends JPanel into another Class. And this is what i need to achieve: Example of First.java public class First extends JPanel{ JPanel cont = new JPanel(); public First(){ cont.setBackground(Color.YELLOW); } } Example of...

A little confused with Javascript Array.prototype.map() when working with string

javascript
I'm reading on the map/reduce documentation and this particular string example doesn't make sense to me. var toCode = function(char) { return char.charCodeAt(0); } First, the thing that works. Why does it work? string is not an array. var text = "Hello World"; var map = Array.prototype.map; console.log(map.call(text, toCode)); Now,...

UICollectionViewLayoutAttributes custom derived class instance is not created

xamarin,monotouch,uicollectionviewlayout
I have created this class public class CustomLayoutAttributes: UICollectionViewLayoutAttributes { public float PhotoHeight { get; set; } public override NSObject Copy (NSZone zone) { CustomLayoutAttributes copy = base.Copy(zone) as CustomLayoutAttributes; copy.PhotoHeight = PhotoHeight; return copy; } public override bool IsEqual (NSObject anObject) { CustomLayoutAttributes attributes = anObject as CustomLayoutAttributes; if...

MATLAB Collatz plot

matlab,graph,plot,collatz
I am trying to do the Collatz problem on Matlab. I am having trouble plotting my results. a = input( 'Please enter a value for a:'); b = input( 'Please enter a value for b:'); for n = (a:b), count = 0; while n > 1 count= count+ 1; if...

Change title of Tkinter application in OS X Menu Bar

python,osx,tkinter,menubar,application-name
When you create an application with a GUI using Tkinter in Python, the name of your application appears as "Python" in the menu bar on OS X. How can you get it to appear as something else?

Run a cron job that performs other cron jobs schedules in MYSQL

php,mysql,cron
My system runs some intensive cron jobs twice daily. These are lengthy scripts. Occasionally, an action is performed in my system that requires the cron job to run on demand. My idea is to create a master cron job that checks my database for a table of scheduled events and...

Variables are null even after assigning a value to them (Java)

java,class,variables,methods,null
I'm trying to write a method that will add song information (input by the user) to a database. Once the user adds the song details (name, artist, file size, duration), they should be saved in the first empty song slot (4 song slots total) and then taken back to the...

Working with empty lists

python,for-loop,while-loop,slice
Okay so I am trying to create an empty list, then add integers to the list to then pick out the highest,lowest and 5 middle numbers( in descending order using a slice) and put them on display... seems simple enough.... def main(): nums = [] for i in range(20,80,9): nums.append(i)...

How to change ints in file in java?

java,file,int,export
I am making a simple game in java as my first project but I ran into a problem. In class Undead_Menu, I have been trying to make it so that every time the user chooses the action number one in the while(menuRun) loop,the ints food and water will go will...