FAQ Database Discussion Community


Django GROUP BY ForeignKey query

group-by
This is my models.py: class QuestionCategory(models.Model): name = models.CharField(max_length=200) class Question(models.Model): question = models.CharField(max_length=200) answer = models.TextField() category = models.ForeignKey(QuestionCategory) What I want to do is to get the questions and group_by the QuestionCategory So I can display my questions like this: Question_Category (1) Question (1) Answer (1) Question (2)...

Wildfly not starting a deployable war file

gradle,spring-boot,war,wildfly
I have a Spring Boot application that uses Spring Integration to do some SFTP polling... I am trying to follow this guide to package a jar file and deploy it as a war file to a wildfly 8.2 application server. I am using a gradle plugin that only allows the...

JsTree with custom json data

javascript,jquery,json,structure,jstree
I have this structure in json I can not be modified by request. { "allowedUrls": [ { "url": "http://www.google.com" } ], "id": 1, "name": "Redirection Rule", "redirectActivation": { "frequency": 1, "trigger": 1 }, "redirectSet": { "httpDestination": "Redirect Url", "responseCode": 301 } } I need to use this structure to populate...

Running a background process with shell_exec from the PHP built-in webserver

php,shell-exec,php-builtin-server
The PHP built-in webserver does not seem to handle shell_exec()ing background processes properly; the request hangs until the background process is complete, even if it's explicitly placed in the background with &. Example: $ ls runit.php $ cat runit.php <?php echo "Here we are\n"; shell_exec("sleep 5 &"); echo "and the...

Django max based on foreign key queryset

python,django,django-queryset,annotate
I would like to annotate a queryset based on a foreign key, i.e. class A(models.Model): name = models.CharField(max_length=200) class B(models.Model): value = models.IntegerField() a = models.ForeignKey(A) I would like to annotate the B queryset with Max, but each Max being filtered to the a foreign key. I have a feeling...

sbt console how to update to latest Scala version?

sbt
I have installed sbt using the instructions in Installing sbt on Linux. $ sbt --version sbt launcher version **0.13.8** $ sbt console [info] Starting scala interpreter... [info] Welcome to Scala version 2.10.4 (OpenJDK 64-Bit Server VM, Java 1.7.0_79). How to configure (or update) sbt so that sbt console uses the...

mysql ranking for a single user

php,mysql,ranking
Im using a suggestion from Daniel Vassallo here to rank entries in my mysql table. The suggestion doesn't deal with ties and thats the way I want it as a newer entry does not get a higher rank than an older entry with the same score on my scoreboard that...

Map on page using GMAP3 is loading zoomed way out, and only zooms in after clicking the tab button a second time

jquery,google-maps,jquery-gmap3
I inherited working on this site so I'm not 100% on some variables there may be, heres what I know. Up until recently, it did work fine. The site is using the GMAP3 5.1.1 plugin, with jQuery v1.8.2 the link is here:http://www.wcsmith.com/dc-apartments/ When click the Map View button, the map...

Constructor not being called during assignment

c++
I am trying to understand the following code. I created two classes BClass and DClass as follows. //My Header file class BClass { public: BClass(); ~BClass(); virtual void PrintMe() const; }; class DClass : public BClass { public: DClass(); ~DClass(); void PrintMe() const; }; //My cpp file BClass::BClass() { }...

Call Variable from a function to another function within PHP class

php,class
i use this class below i want use the variables array or property array ($g_types) in first_function how i can do this? class My_Class { function first_function() { //HOW I CAN USE THE $g_types array Variable values in this function? } function second_function() { $g_types = array( 'Person Widget' =>...

mssql filter by date range

sql,sql-server,tsql
I'm writing a little query that builds a count of rows per month&year, to mimic the behavior you'd see in google analytics. this is my query: USE MyDatabase; SELECT COUNT(*) AS Rows, DATENAME(mm, OpenDate) AS Month, DATENAME(yyyy, OpenDate) AS Year FROM MyTable WHERE Priority = 1 GROUP BY DATENAME(mm, OpenDate),...

Why is my python code so slow (leetcode)? [duplicate]

python,algorithm
This question already has an answer here: Accenture interview question - find the only unpaired element in the array 4 answers Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement...

My UIAlertController keeps adding new buttons each time the alert is called, causing endless buttons

ios,swift,alert,uialertcontroller
I am adding alerts to prevent the user from overwriting previously used data, and I am using a UIAlertController as recommended in a different post. The involved code looks like this : var alert:UIAlertController = UIAlertController(title: "Are you sure?", message: "This will overwrite your information", preferredStyle: UIAlertControllerStyle.Alert) func showAlert() {...

How do I deploy a meteor app to my custom domain?

meteor
I want to deploy my meteor app to milf.monster.com. I have tried several things like hitting meteor deploy milf.monster.com but so far no luck. I pointed the record hosts to ghs.google.com just like in this tutorial : https://www.namecheap.com/support/knowledgebase/article.aspx/79/95/web-hosting-tutorial-how-to-setup-hosting-for-a-subdomain but still no luck. How do i do this effectively?

Is there a way to highlight closest series in R dygraphs?

r,dygraphs
I am using dygraphs for R https://rstudio.github.io/dygraphs/ and I am wondering is there a way to highlight closest series like it is done in original dygraphs? Demo gallery here: http://dygraphs.com/gallery/#g/highlighted-series I am really unfamiliar with CSS nor HTML. Thanks for any help and advice....

Get Variables From Arrays [closed]

php,arrays
I have 3 arrays like this. Array ( [id] => 4 ) Array ( [id] => 6 ) Array ( [id] => 7 ) What I would like to do is make a variable called $id that prints the id values as a string 4,6,7. How would I accomplish this?...

Namespace, class and compiler order…

c++,class,header,namespaces,source
I'm experiencing with OpenGL and I built and edit a Vector3 header that works perfectly that works with struct Vector3 but the problem starts when I tried create a Vector3 zero = Vector3(0,0,0) variable, the compiler doesn't let me build due to the compiling order so I copied a new...

undefined method `-' for nil:NilClass

ruby-on-rails,ruby
I have the following code in my Rails view: -if program.description.length > 214 -total = 0 -perfect_index = 0 -program.description.split(' ').each do |word, index| -total += word.length -if total >= 214 -perfect_index = index - 1 -break =program.description.split(' ')[0..perfect_index].join(' ') \... -else =program.description I don't know why index could have...

How do I load a resource in Javascript?

javascript
I'd like to load something like a properties or XML file from within my JS (web page) (like including a .js file in the .html). Right now I have some resources included as <script type="resources">blabla</script> and locate these in the DOM, but I'd like to externalize the resources into an...

Select mySQL data with help of other table

php,mysql,sql,select
I'm currently working on a message board which only displays data if values in another table are set. My 2 tables look like this: tbsubscribers: -subID (int) -msg1 (tinyint) -msg2 (tinyint) -msg3 (tinyint) -email (varchar) tbmessage -id (int) -name (varchar) -mitteilung (varchar) -sender (varchar) -datum (datetime) The actual messages are...

How to align multiple floating elements

html,css,css-float
I'd like to align two elements (A & C) properly: <div> <div class="a">A</div> <div class="b">B</div> <div class="c">C</div> <div class="d">D</div> </div> My stylesheet: .a, .b { float: left; clear: left; width: 40%; } .c, .d { float: right; clear: right; width: 40%; } However, this results in: I'd like to align...

Hard code window.document.referrer

javascript,jquery,referrer
I have a form that needs to pull a value from the referrer URL and set it as the value of an input field. I need to be able to test this locally before pushing a change, but not sure how to set the header in chrome/firefox to hard code...

async.waterfall never executes second function

javascript,async.js
Why does the second function here never get executed: async.waterfall([ function(waterfallCb) { console.log("step1"); countDocuments(db,waterfallCb); }, function(waterfallCb) { console.log("Step2"); insertDocument(db,waterfallCb); }], function(err,data){ console.log("in waterfall callback"); db.close(); }); Output: step1 in waterfall callback Why is the second function (which prints step 2) never getting called? EDIT: Here is countDocuments: var countDocuments =...

php preg_replace to find this value = }},]}}

php,preg-replace
I want to use PHP preg_replace to find this value = }},]}} and replace it with this other value = }}]}} Something like this but I don't know how to use it: $cadena = $array; echo preg_replace('/}}[,]]}}/', '}}]}}', $cadena); ...

I cant Upload SWF Files With PHP

php,file,input,swf
I'm sorry for my bad english. I hope u guys can understand me :) I have 2 input file in 1 form. When i trying post with a image print_r or var_dump showing its properties. But when I trying post with an swf print_r or var_dump saying empty and cant...

put element out of bootstrap backdrop

html,css,angularjs,twitter-bootstrap
<div id='header'> <button style="z-index:9999"></button> <div class="modal-backdrop am-fade"></div> </div> I have a html look like this, and the modal-backdrop covers the whole page. But I want to show this particular button, and I add z-index of the button to 9999, but it didn't work. The backdrop's z-index is 1040, is there...

Download blobs from azure storage asynchronously and save them in DataTable

c#,azure,asynchronous,datatable
The following code shows how I download blobs from azure blob storage and save them into a DataTable: foreach (var currIndexGroup in blobsGroupedByIndex) { DataRow dr = dtResult.NewRow(); foreach (var currIndex in currIndexGroup) { long fileByteLength = currIndex.Properties.Length; byte[] serializedAndCompressedResult = new byte[fileByteLength]; currIndex.DownloadToByteArray(serializedAndCompressedResult, 0); dr[currIndex.Metadata["columnName"]] = DeflateStream.UncompressString(serializedAndCompressedResult); } dtResult.Rows.Add(dr);...

Find a math algorithm for an equation

algorithm,math,recursion
I just post a mathematic question at math.stackexchange, but I'll ask people here for a programmatically recursive algorithm. The problem: fill in the blank number from 1 to 9 (once and only once each blank) to finish the equation. Additional conditions: 1. Mathematic priority DOES matter. 2. All numbers (include...

How to find coordinates of largest rectangle in OpenCV?

c++,opencv,contour
I have the following code: findContours( src, contours, hierarchy, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE ); Mat drawing = Mat::zeros( src.size(), CV_8UC3 ); double largest_area = 0; for( int i = 0; i < contours.size(); i++) { // get the largest contour area = fabs( contourArea( contours[i] ) ); if( area >= largest_area ){...

Java Array structure

java,arrays
I am a rookie in Java Programming. I am clearing all my concepts before making a step ahead. I was reading an array chapter which says the basic structure to create an array is: Type[] var_name = new Type[limit]; I was going through some slides of opencourseware. In these slides,...

Correct way to compress webapi POST

c#,asp.net,asp.net-web-api
I have a webform page that calls a webapi method to save some data. I am using the HttpClient to make the call and execute the webapi. I tried to use webAPI compression to post a huge xml to the API. I basically used these two websites as reference: http://www.ronaldrosier.net/blog/2013/07/16/implement_compression_in_aspnet_web_api...

SQL Create Statement for Multiple Columns Containing all Given Values

sql,database,postgresql
I have a PostgreSQL database. What I'm asking is when I have a table where A, B and C are the column names and the other numbers beyond are the values: A | B | C --------- 0 | 1 | 2 1 | 2 | 3 2 | 1...

How to compare all of the elements in an array using assert_equal in MiniTest

ruby,minitest
I am comparing the values in the array, but when the condition fails, it exits. Here I wanted to compare all the elements of the array irrespective of pass and fail: val.each do | x | #assert_equal 48000.00, x assert(48000.00 == x, message = " :Pass") end Suppose the array...

How to change only one label when condition met in a table of records on form in MS Access?

vba,ms-access,table,access-vba
I want to display a label of a particular record in a form that displays all the records being red when a certain condition, such as date/time being some date/time, is met. I know how to change the forecolor and such, but I want to change one specific label where...

OpenGL - Depth test doesn't work

c++,opengl
I am leanring OpenGL and at the moment I learn how to add the 3rd dimension. I want to make a Cube but only one of its sides is not transparent: My draw-function looks like this: void draw() { glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH); glUseProgram(program); // The...

Why can't set a value for a row and column with the Apache POI?

java,excel,apache-poi
I need to set a value for a specific row and column of the spreadsheet, but I get a null pointer before even i = 1. I've tried changing the code but this error keeps happening and I have no more idea why.Does anyone have any idea why this happens?...

How to perform same action as changing Windows 7 display from Landscape to Portrait

c++,c,winapi,graphics,windows-7
I need to write a program which programmatically changes the Landscape mode to Portrait of a touchscreen in Windows 7. The resolution is 1920 x 1080 and I thought I could switch the 1920 with the 1080 and use ChangeDisplaySettings or ChangeDisplaySettingsEx to make the change. but it doesn't work....

I need a delay when I change some text

javascript,jquery,delay
I need a hint! I want to change some text with a delay in it. With .delay it isn't working because it isn't a queue. Then I tried it with .setTimeout. That worked, but only for one textbox. When I add another one, it doesn't work properly. Can anyone help...

What is a magical array in Perl?

arrays,perl,reverse
In the Perl documentation for reverse I find this: "Note that reversing an array to itself (as in @a = reverse @a ) will preserve non-existent elements whenever possible; i.e., for non-magical arrays or for tied arrays with EXISTS and DELETE methods." What properties differentiate a magical from a non-magical...

How to install an external package to /usr/local without troubling Homebrew?

osx,homebrew
I'm trying to install a package called Geant4 by compiling from source (HomeBrew actually has the package but it's an old version and doesn't have support for Python which I need). I want to put the Geant4 package in /usr/local/geant4 (perhaps this is not the proper place to put it...

Rotating div with mouse

javascript,css
I am building time picker in js where you can set hours on "Real" clocks. I'm rotating div with this script: if (e.target.id == "rotationSliderContainer") { g = e.offsetX; h = e.offsetY; } var atan = Math.atan2(g - radius, h - radius); deg = -atan / (Math.PI / 180) +...

Plotting multiple tracks (sequence of 2D points) on an image

matlab,matlab-figure
I have multiple tracks (a sequence of 2D points) which I want to plot over an image. For instance, in the example below I have 10 tracks, each having its own set of 3 points. I iterate over all tracks and plot each one of them individually. Note, that all...

How to substitute NA by space in this situation?

r
I have a dataset like this: >Mydata SampleID mean sd F1 NA NA F2 215.7400 1.5881646 F3 NA NA F4 NA NA F5 NA NA I use the following code to round the numerical variable 'mean' and 'sd': mydata$mean<-format(round(mydata$mean,2),nsmall=2) mydata$sd<-format(round(mydata$sd,2),nsmall=2) And it becomes like this: >mydata Sample.ID mean sd F1...

Make last td as row

html,css,table,html-table
Please take a look at https://jsfiddle.net/wYA9K/55/ <table> <thead> <th colspan="1" style="width: 10%">TH1</th> <th colspan="1" style="width: 60%">TH2</th> <th colspan="1" style="width: 30%">&nbsp;</th> <th>&nbsp;</th> <-- what should i do?? </thead> <tr> <td colspan="1" style="width: 10%">a</td> <td colspan="1" style="width: 60%">b</td> <td colspan="1" style="width: 30%">c</td> <td>UNDERNEATH SPANNING WHOLE...

how can i pass data from one activity to another

android
I tried to look up something similar to what I want, but I can't find anything... I want to pass data that I received from my database (echo json_encode($response); ) from one activity to another. The data is displayed in a listview and by clicking one item (in this case...

How to extract both type of users count

database
I have a action table. It contain a user type admin or consumer, some actions like login, change password etc.. userID actiontype usertype 1 login admin 2 login consumer 3 Change Password admin 4 Change password admin 5 Change Password consumer ................... ........ Now i have to create a result...

How can I count fields in a JSON based on their content

javascript,json
I'm new to JS an this is likely a noob question, but I can't seem to find an answer which I figure may be due to my lack of correct terminology. Basically I'm trying to count how many "active" fields in a JSON file are set to true vs false...

How to get closest SUMMED mySQL value to an existing value?

php,mysql,sql
Two tables in MySQL database... players (playerid, teamid, position, firstname, lastname) stats (statsid, playerid, points, year) Let's say my baseline player has 83 points (i.e. the "existing value"). I want to find the ONE player from the database that has the closest point total to 83. NOTE: This existing question...

JavaScript regex is giving false positives [duplicate]

javascript,regex
This question already has an answer here: Why RegExp with global flag in Javascript give wrong results? 4 answers I'm checking the first character of a string for any non-alphanumeric characters from a multi-line textbox. If I pass in this string in, I get some hits. ATest BTest2 CAnother1...

Structures in C finding element larger than certain varriable

c,arrays,pointers,struct
Hello i am trying to find an element with the highest price after year 2007 using data structs in C tried everything all sorts of statements, but i cannot seem to do it. Here is a piece of the code. Could someone please offer a suggestions to my problem ?...

How to get List from async Task>

c#,asp.net-mvc,asynchronous
I have this code to fetch an RSS feed async via HttpClient. How do I call this from an MVC controller and pass the data back to the view as a List<RssFeedItem>? public class RssManager { public async Task<List<RssFeedItem>> GetFeedItems(string url) { List<RssFeedItem> result = await ReadFeed(url); return result; }...

isSubstring method İn ML

sml,ml
fun appear(x:string,y:string)= if String.isSubstring x y then print("APPEAR ") else print("NOT APPEAR "); appear("abc","asabcbc"); I wrote this function and compiled in Moskow ML.But there is an error like this: ! Unbound value component: String.isSubstring Can anybody help me ?...

How to perform quick upleveling in python?

python
I have the following object in python: { name: John, age: { years:18 }, computer_skills: { years:4 }, mile_runner: { years:2 } } I have an array with 100 people with the same structure. What is the best way to go through all 100 people and make it such that...

fopen access denied no access to php.ini

php
I've a problem. I have a website from a friend who has created the website on his own server and now trying to set it on my hosting. The problem now is that I've no permission to the php.ini file so I can't use fopen becease that is not allow...

Cordova/HTML5 SQLite does not retrieve data inserted

html5,sqlite,cordova
I'm trying to fetch some data from a sqlite database. this database is fill with a JSON ajax query. When I trace the data, I see that the SQL Insert query is executed correctly, and is displayed the last insert id of each table. here is part of my code....

Exception during integration test in new jhipster app with mongodb

java,mongodb,zlib,jhipster
When i create new jhipster app and run integration tests i have such exception: Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mongodb.Mongo]: Factory method 'mongo' threw exception; nested exception is de.flapdoodle.embed.process.exceptions.DistributionException: java.io.EOFException: Unexpected end of ZLIB input stream at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]...

R How can I emphasize the x axis using ggplot?

r,ggplot2,axis
If I use ggplot, then the horizontal line for the x axis (y==0) is the same as any other value for y. I'd like to highlight the fact that the bottom of the graph is NOT the x axis, and that the x axis is higher in the plot. How...

R- set working directory to hdfs

r,out-of-memory,working-directory,revolution-r
I need to create some data frames from very large data sets in R. Is there a way to change my working directory so that R objects that I create are saved into hdfs? I don't have enough space under /home to save these large data frames, but I need...

getElementById() not working input type time

javascript,html5
Why the code below does not return a value? <input type="time" id="hora" style="margin: 0 auto;" class="button button-block button-stable"> JS: var hora = document.getElementById('hora').innerHTML; console.log(hora); Print " "...

How to write unit test for http request?

javascript,angularjs,unit-testing,jasmine,karma-jasmine
I am trying to do an unit test a service in my case In my test controller myService.getItem('/api/toy/' + scope.id).success( function(toy) { $scope.toy = toys.details; } ); MyService angular.module('toyApp').service('myService', ['$http', function($http) { var service = {}; return { getItem: function(url) { return $http.get(url); }, }; } ]); Test file. describe('toy...

Cabal fails to install dependencies, but can install them if asked directly

haskell,cabal,cabal-install
I've seen a very strange recurring problem with Cabal that's interfering with my ability to get repeatable Haskell builds. I have a cabal project with a sandbox. If I do cabal install, I get errors of the form Y failed during the building phase. The exception was: ExitFailure 1 X...

Padding in android, untidy my layout

android,layout
I have this layout inside a linerar layout (It is a custom Dialog), and when i add padding in the buttons, my layout become untidy. <RadioGroup android:id="@+id/toggleGroupEntrega" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <ToggleButton android:id="@+id/toggleButtonEntregaOK" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:background="@color/bgOff" android:checked="false" android:paddingLeft="5dp"...

Setting Socket Receive Buffer Size, gets truncated to 244KB

linux,sockets,buffer
I'm trying to increase the size of my socket receive buffer size using setsockopt() on linux. I can set it successfully to any value below 244KB. Any value above 244KB gets truncated to 244KB. There appears to be some sort of system limit in place, but I can't figure where...

Retrieving one object from JSON using Angular factory and lodash

javascript,json,angularjs,lodash
I have a locally stored JSON named "Productos", and using UI-router I pass in a $stateParams which I then use to find that object by its unique ID using the new page's controller and a factory shared between several controllers. Right now my console retrieves the correct id number being...

redirect to page on a different project in same solution

c#,asp.net
I have a solution with 2 projects. prjLauncher -- Launcher.aspx prjTestHarness -- TestPage.aspx TestHarness is the start up project with testpage.aspx at the startup page. On a button click on testpage i would like to redirect to Launcher.aspx page with a querystring appended. Response.Redirect(string.Format("/prjLauncher/Launcher.aspx?{0}", ToQueryString(post))); above is the code i...

Opencv draw a rectangle in a picture were never shown

python-3.x,callback,mouse,opencv3.0,drawrectangle
Hey everybody i have some trouble using opencv 3.x and python 3.x. What i want to do is to draw a basic rectangle in a picture but the rectangle will never be drawn. I read this similar thread but it doesn't helped me with my fault. Python OpenCV: mouse callback...

All code after MySqlDataReader.ExecuteReader getting skipped

c#,mysql
I am in the process of connecting my C# Windows Forms application with a MySql database. The issue occurs during the use of MySqlDataReader for execution of data retrieval. In the method of concern, I am attempting to retrieve the courseId of a University Course if a previous entry corresponding...

How can I get my PdfPTable's border and background color to display (iTextSharp)?

pdf-generation,itextsharp,pdfptable
As you can see, I've got a table which sports borders and a background color (Section 1): ...but section 3 lacks these sartorial refinements, and I don't know why. Here is the pertinent code for section 1 (which displays as it should): PdfPTable tblHeadings = new PdfPTable(3); tblHeadings.WidthPercentage = 100;...

R Shiny: need consistent random sample with each customization

r,shiny,random-sample
This is my first ever question, so apologies in advance if I don't follow any of the site's norms! I'm experimenting with R Shiny. I am attempting to make an application that allows someone to customize a lot of the components of different distributions and kernel estimators. Before I go...

Knockout - Fetch Options for Select and select one of them

javascript,jquery,knockout.js
When I load my page i have a <select> positioned. I use knockout data-bind to fetch the values as <select data-bind="attr: { id: 'input-' + id(), required: !allowBlank }, options: valuesArray, optionsText: 'description', optionsValue: 'itemValue', optionsCaption: 'Select One...', value: value, enable: isEnabled, event: { focus: $parent.getOptions}" class="form-control" /> Right now...

How do I get the name of a Div that has been clicked?

javascript,jquery,css
I am using the following html <div id="chatid" name="1"> <img src="http://placehold.it/50/55C1E7/fff" alt="User Avatar" class="img-circle" /> John </div> <div id="chatid" name="2"> <img src="http://placehold.it/50/55C1E7/fff" alt="User Avatar" class="img-circle" /> James </div> I am using the following jquery script $(document).ready(function() { $("#chatid").click(function() { thread = $(this).attr('name'); $("#chatmessages").load('fetchmessages.php?id=' + thread); //alert($(this).attr('name')); return...

filter file with specift words linux

linux,bash,grep
I have files in which the first column is an ID, and the second column is an option, like this: $ cat file.txt 1234;m11 6758;m11;m14 8796;mm14 0303;m11 and I need to create a files with the IDs depending with the option. It is to say: file_m11.txt => (1234,0303) file_m11_m14 =>...

c3js line chart all data unselected how to show tick values

javascript,d3.js,data-visualization,c3
I have a simple c3js line chart w/3 different lines. When I "unselect" all 3 data sources, the x-axis tick values disappear. I was wondering if there was anyway to reverse this behavior? I'd like to show the x-axis tick values even when there is no data present. The xaxis...

Check if object is active.Unity

c#,unity3d
I want to check if object is active and if it is i want to inactivate other objects. here is my method. It is not the best one but i just want it to work. This method i have doesn't work right because it only runs once even though i...

Date comparison in xsl

xml,date,xslt
I have two dates in format YYYYMMDD in variables. <xsl:variable name ="date1" select =" 20140401" /> <xsl:variable name ="date2" select =" 20140801" /> How to compare and get the most recent date in xsl...

PHP rows inserting in reverse order to Mysql

php,mysql
I'm stumped; I'm guessing this is something simple...? I am inserting data gathered from PHPExcel (though this probably doesn't matter). On my test box (Windows WAMP server), this works perfectly. When I run in production on a linux server, the data is entering the database from bottom to top. My...

Calling Textview values using Android app

java,android,xml,android-layout
I am doing a Android app where I want to show the travels contact numbers. Here is the code: App2Activity.java package com.example.android; import android.app.Activity; import android.os.Bundle; import android.widget.Button; public class App2Activity extends Activity { Button button; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main2); } } AppActivity.java package com.example.android; import...

Issue creating map shading in Matplotlib imshow by setting opacity to data gradient

python,matplotlib,gradient,opacity,pixel-shading
I am trying to add shading to a map of some data by calculating the gradient of the data and using it to set alpha values. I start by loading my data (unfortunately I cannot share the data as it is being used in a number of manuscripts in preparation,...

Java XML format to save directly to relational or non-relational DB

java,xml,relational-database,non-relational-database
Is there a standard XML format to save Java objects into relational or non-relational databases? I am looking for something in Java akin to how you can save JSON directly into MongoDB (as BSON). It doesn't have to be a non-relational database, something with an ORM process would do. So...

Adding underscore to variable

ruby
I have a variable title. It can look like: title = 'One two three' Is it possible to replace the blanks with underscores?...

How to extract table data from PDF as CSV from the command line?

pdf,grep,pdftotext
I want to extract all rows from here while ignoring the column headers as well as all page headers, i.e. Supported Devices. pdftotext -layout DAC06E7D1302B790429AF6E84696FCFAB20B.pdf - \ | sed '$d' \ | sed -r 's/ +/,/g; s/ //g' \ > output.csv The resulting file should be in CSV spreadsheet format...

Umbraco rendering content using razor from api service that inherits UmbracoApiController

api,razor,umbraco
I have an umbraco api controller that I created that inherits the UmbracoApiController class and returns a list of items. I also have another umbraco site that is to call that api url using razor and to render the content onto the page. I was trying the following: dynamic xmlv...

GET ID from an array and POST to JOIN table

php,mysql,forms,pdo
I have 3 tables which are linked with a join so the idea is I have an array as part of my form which lists out all my categories form my cat_list table: <input type="checkbox" value="<?php echo $cat["cat_id"]; ?>" name="cat_no[$cat]"><?php echo $cat["cat_title"]; ?></a><br> So I am looping through my cat_list...

Unchecking a switch depending on user decision

ios,objective-c,uialertview,uilocalnotification,uiswitch
I'm building an app that asks the user for permission to post notifications when the user enables a switch. I'm using this code: - (IBAction)mySwitchValueChanged:(id)sender { if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){ [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]]; // ask the user for permission } if ([[UIApplication...

How to change default appearance of Fabric.js resize handles?

javascript,customization,fabricjs
Fabric.js is really handy with its interactive mode that allows manipulating objects like in a vector drawing program such as Inkscape. I would like to use this capacity into my web application project where a kind of collage editor is needed. By default, when an object is selected, the bounding...

While loop through text file stops unexpectedly

c,file,while-loop,integer,fscanf
I am trying to loop through a text file that contains random content. It's current contents are: "13 -35 57 - 23723724 12taste-34the+56rain-bow845" My program should only get the numbers from the file (-35 as a negative number, but not - 23723724 due to the space in between) and no...

JWPlayer fires onPlay() twice. How to get it to only fire once?

jwplayer
I'm using jwplayer for a video and I'm trying to track the number of seconds the player is playing. In the example, when you click the On/Off button, it does advance properly, but when you click Play on the video player, best I can figure is that the onPlay fires...

How to make live voice phone call using Twilio instead of just playing an MP3 when call is answered?

javascript,asp.net-mvc,sip,twilio,telephony
To call phone number from notebook through Twilio I created ASP.NET-MVC 5.2 application. I can call a number and answer the phone but I don't know how to achieve live voice(to be able to talk) connection instead of just playing music. I created an action method inside HomeController: public ActionResult...

how to put to work Ionic generator?

ionic-framework,generator,yeoman
I have an Ionic app running with the basics of Ionic and running it in the browser by doing ionic serve, but I want some new stuff and run it trough the grunt serve command, also has the feature for JSLint, I am already using this scss this: https://github.com/diegonetto/generator-ionic/ and...

com.parse.FacebookAuthenticationProvider error

android,facebook,parse.com
The app works fine until I've modified the graddle file to put the dependecies of new jar files. This is the dependecies of the graddle of my app: dependencies { compile 'com.parse.bolts:bolts-android:1.1.4' compile 'com.android.support:support-v4:22.0.0' provided 'com.facebook.android:facebook-android-sdk:3.23.1' provided files('libs/Parse-1.9.2.jar') //this is the dependence that I've modified provided files('libs/ParseFacebookUtils-1.8.4.jar') } And this...

Make IntEnum members callable while keeping their comparison behavior

python,python-3.x
Let's say the class Color is an enumeration: from enum import IntEnum class Color(IntEnum): red = 1 blue = 2 green = 3 Now, let's say I want to associate each of those member with a function AND keeping their value. i.e doing something like this Colors.red() Would call a...

Android: cannot write object to file

android
I'm working on an android project and I have two objects that I will need to save and read. I've written out the code for one of the objects so far but when I run it I get the error "java.io.FileNotFoundException: tripfile.ser: open failed: ENOENT (No such file or directory)"...

How do I use variables in a UIColor?

swift,variables,uicolor
What type of variable should I be using for UIColor() and Why won't this code work? I am trying to using variables created in a different class to be the amounts for red, green, and blue. I did the variables the same for all the colors but get the error:...

Rscript: how is $ interpreted in strings passed as inline code

r,special-characters,rscript
Does anyone know how $ is interpreted within an inline call to rscript? In the example below, I am trying to get z to be the "a" element within the x list. However, z=x$a gives me x instead of the element of the list. > Rscript -e "x = list(a=c(1,2,3),...

c++ store special characters (“ç”, “á”,..etc) on SQLite db

c++,qt,sqlite,visual-studio-2012,sqlite3
My program uses SQLite3 lib to open and execute some querys to a local DB. This is the function I use to execute a query (with error displaying): void exec(string query, string place_error){ if( sqlite3_exec(sqldb,query.c_str(),0,0,&db_err) != SQLITE_OK) sql_error(place_error+" - "+(string)db_err); } Now, if I try to execute something like: exec("INSERT...

Codeigniter object cache doesnt work

codeigniter,caching,codeigniter-2
I'm trying to save into the cache a json web response, my controller it's pretty simple, here's: <?php defined('BASEPATH') OR exit('No direct script access allowed'); include_once APPPATH . 'models/presenters/Radio.php'; use Streame\Model\Presenter\Radio as Radio; use Streame\Model\Presenter\Genre as Genre; class Test extends MY_Controller { public function index(){ $this->load->driver('cache'); if (! $cache_data =...

Nhibernate dialect, precision for Casting decimal from 5 places to 2 places

nhibernate
We have a currency field in database of type decimal(20,5). How do I add a CAST or COnvert to the outgoing Nhibernate criterion? SELECT TOP (1000) this_.DepositAccountId as DepositA1_71_0_, this_.BranchId as BranchId71_0_, this_.ConfigurationStatusId as Configu14_71_0_, this_.ConfiguredBy as Configu41_71_0_, this_.ConfiguredDate as Configu15_71_0_, this_.DepositAccountBalance as DepositA9_71_0_ FROM dbo.DepositAccount this_ WHERE Convert(Decimal(20,2), this_.DepositAccountBalance)...

Specific string in python requests.get gives ValueError

python,python-3.x,python-requests
Trying to get this specific page... request = requests.get('http://market.yandex.ru/catalog/90555/list') ...gives me a strange error: ValueError Traceback (most recent call last) C:\Python34\lib\site-packages\requests\packages\urllib3\response.py in read_chunked(self, amt) 406 try: --> 407 self.chunk_left = int(line, 16) 408 except ValueError: ValueError: invalid literal for int() with base 16: '' I figured out that some part...

compress file with zip4j on android

android,zip4j
i need to add files on a zip package but on the line code "zipFile.addFiles(filesToAdd, parameters)" the "addFiles()" appears in red, can anyone help me, please? im using: Android Studio 1.2.1.1 RC Java 1.8 update 45 Windows professional zip4j_1.3.2.jar (source: http://www.lingala.net/zip4j/download.php) image reference: https://lh6.googleusercontent.com/HTfDOT1yZBb7k-oxLulCYukhBMv7xksHj2UhK-_YXSAkNmpQKkgdrSCJpa4T3cs1vWMNnHBWPxwkbKM=w1342-h513-rw...

split CSV single line file with awk

awk
Single line CSV file (VoIP rates) need to be insert in mysql. File pattern: citycode01,city name01,rate01 citycode02,city name02,rate02 citycode0n,city name0n,rate0n where FS="," and RS=" ". how can I split single line into every destination in separate line or build straight sql insert file using AWK? CSV file 1201,New Jersey,0.012500 1202,USA...