FAQ Database Discussion Community


jQuery onLoad event fires before anything loads

javascript,jquery,html,css
I am aware there are similar questions but the answers are not working for me (example below). First, my (simplified) code. HTML: <div id="loading_screen"> <img src="<?= base_url()?>images/loading_screen.png" title="The game is loading, please wait.."/> </div> <div id="container"> <!-- a whole lot of HTML content here --> </div> CSS: #container{ display:none; }...

BST : Increment each key value by sum of all other greater keys

java
Problem statement : Given a Binary Search Tree (BST), convert it to a Binary Tree such that every key of the original BST is changed to key plus sum of all greater keys in BST. Input: BST 5 / \ 2 13 / \ 11 14 Output: The given BST...

How to delete save data from a iOS application

ios,save,archive,nscoder
I'm developing an IOS App, and I'm currently working on archiving the data with NSCoder, but I had initially saved the wrong data type to a variable, and now its causing my application to crash, I have fixed the problem that was saving the wrong data, but I now need...

Count difference between distinct and join over distinct

sql,sql-server,join,sql-server-2008-r2,distinct
How do I count the number of distinct rows minus a join over those same distinct rows? I'm writing after triggers where I need to raise an error if the user does not have rights to the rows submitted. I can do this in two statements but this seems inefficient....

How do I create a loop to print the following pattern?

java,algorithm,loops,for-loop
I have to create the following pattern by using loop. * * * * * * * * * * * * * * * * * * Now I can only do that by simply system.out.print statement. I don't know how to construct that with a for loop. My...

How do I identify whether a number is an integer?

javascript
This a script that deals with javascript and var type identifications. What you see below is a small project that I'm doing. It is supposed to calculate the x1 and x2 values of the quadratic equation. The problem that I'm having is that I'm unable to make the program identify...

What does the CSS `not` selector do?

css,css3
I saw the following snippet in a css file. What does it do? h3 ~ *:not(h3) { margin-left: 15px; } Obviously it alters h3 headers in some way but I don't understand what ~ *:not(h3) does. Googling ~ *:not(h3) is unproductive....

Java Quick Sort Implementation (Code fix)

java,quicksort
I have written my version of the Quick Sort in Java but I'm running into a bit of a problem while calling the second recursion. This is my code: public static int[] quickSort(int[] array, int start, int end) { int pIndex; if (start < end) { int left = start;...

Lambda function distinct parameters

lisp
I'm trying to create lambda functions that use the same code but have different Internal parameters. To clarify, I'm putting here the code: (defun testes () (setf lol '()) (loop for i in (list 1 2 3 4 5 ) do (loop for j in (list 1 2 3 4...

How do I check for existence of a resource from within the same Google Chrome extension?

javascript,google-chrome,google-chrome-extension
Say I have the following files in my unpacked Google Chrome extension: manifest.json my.extension.js image.png How do I check if image.png exists using Javascript in my.extension.js? Edit: I know (and I think it would work) that we could create an <img> element and use the onerror event OR use XMLHttpRequest...

Invalid token '=' in class member declaration in C# [closed]

c#
I have this code: public class Probna1 : INotifyPropertyChanged { Person person = new Person(); person.FirstName = "Joseph"; person.LastName = "Samuel"; FirstNameTextBox.DataContext = person; } The signs = have this error mesage: Invalid token '=' in class member declaration. I have Class Person with public fields FirstName and LastName with...

Yii2 - yii\base\InvalidRouteException

php,exception,controller,action,yii2
I'm trying to do an aplication with Yii2 and when I add a new action to the default controller: public function actionMostrarArticle($id) { $article = (new Query)->select('*')->from('subasta_actual')->where('id = :id'); $article->addParams([':id' => $id]); $imatges = obtenir_imatges_active_from_objecteId($id); return $this->render('article',['article' => $article, 'imatges' => $imatges]); } and I ask for it: <a href="<?=Url::toRoute(['site/mostrarArticle',...

Add-Migration not creating new migration - Asp.Net - Entity Framework

c#,asp.net,asp.net-mvc,entity-framework,migration
I have used the MVC template in ASP.Net to create a new web application. Now I have added a points variable to the user. public class ApplicationUser : IdentityUser { public long Points {get; set;} } I first enabled migrations Enable-Migrations Now I have tried migrating using: Add-Migration Points Now...

R: 'vectorizing' a triple loop

r,sum,vectorization,apply,sapply
I've written a piece of code in R that computes a double sum of the so called rank statistics. I need to repeat the computation of Q minimum 1000 times but with 3 loops inside, it takes a quite long time to do it just once. Here is my code:...

Android Layout- Part of TextView goes off edge of screen

android,xml,android-layout,textview
I have a LinearLayout with a custom button and then another LinearLayout with two TextViews, which is always partly cut off on the edge of the screen. I have tried tons of different combinations of fill_parents, match_parents, and wrap_contents, as well as trying to add layout_weights, but nothing solved it,...

Check Format error response in Travelport Universal API AirCreateReservationReq

c#,asp.net,xml,soap-client
I am using the Travelport Universal API in Trial mode right now. My goal is to develop a Web Portal for handling B2B requirements of a client. All is well until I came to the second last step, i.e. Creating reservation (Booking). I have tried to fill the request object...

Mutex-managed threads processed in “chunks” instead of interlacing

c++,multithreading,boost,mutex,boost-thread
I'm currently trying to get two boost::threads to get equal processing time on the CPU using a shared mutex called mutexCOM. As it currently stands both threads are set to run infinitely. One thread (The main thread) simply prints out "testing!" while the other thread, running the Navigation::begin() function, prints...

$scope.variable not changed after AJAX

javascript,ajax,angularjs
I'm making an ajax call to get some info from a server and then update a list on the screen. The information is coming back, but the scope isn't being updated! I've tried using $apply(), and I'm only getting an error Code looks like this: Inside correct controller, in HTML:...

Multiply 2 matrices in Javascript

javascript,arrays,matrix,matrix-multiplication
I'm doing a function that multiplies 2 matrices. The matrices will always have the same number of rows and columns. (2x2, 5x5, 23x23, ...) When I print it, it doesn't work. Why? For example, if I create two 2x2 matrices: matrixA: [1][2] [3][4] matrixB: [5][6] [7][8] The result should be:...

If size() method of ArrayList returns a number which is too big to be stored in an int how will Java store it

java,arraylist,size
Lets assume that there is a variable "x" of type int. If size() method of ArrayList returns a number which is too big to be stored in an int how will Java store it. Will there be upcasting of int to double or will there be some exception.

No default constructor and errors out

c++,c++11,c++14
Error received: error: no matching function for call to ‘stout::SCGI::SCGI()’ Code: #include <gtest/gtest.h> #include <vector> #include "../../../../stout/cgi/scgi/scgi.hpp" class SCGITest : public ::testing::Test { protected: int string_length; std::vector<char> netstring; stout::SCGI scgi; public: SCGITest() { const char *c_netstring = "70:CONTENT_LENGTH\00027\0" "SCGI\0001\0" "REQUEST_METHOD\0POST\0" "REQUEST_URI\0/deepthought\0" "," "What is the answer to life?"; string_length =...

cordova push + angular - implement logic on when notification recieved

javascript,android,angularjs,cordova
I am using cordova push notification plugin un my angular application. I have created this service for the notifications: define(["app"], function (app) { 'use strict'; var pushNotificationService = function ($q, localStorageService) { var registrationDefered; function registrationSuccess(result) { } function registrationError(error) { } function test(notificationData) { localStorageService.set('notification_url', notificationData.url); } function isOnBrowser()...

Twilio Ability to use same number for two simultaneous outgoing calls?

api,grails,twilio
I have a helpdesk app I am developing for a client and they have a few people they have on as call people. Does each one need a different twilio number to be able to call out at the same time to different people? I have tried this already with...

Getting NegativeArraySizeException while JSON parsing from openweathermap

android,json
I am trying to fetch the data using Async class but instead of getting the data I am getting a NegativeArraySizeException. While all the other things are right and I don't know what mistake I have made. Thanks in advance for the help. Below is the code I am using...

Result of grep as a boolean

perl
I am using the below code. On the right of and is a grep without a numerical comparison. Does that make sense? if ( scalar( grep { $_ eq $ServerTypeId } keys %ServerTypes ) > 0 and grep { isRegionOK( $_, $DC ) == 1 } keys %$destinationSummary ) {...

R: Populating matrix from loop

r,loops,matrix
I have a problem that is very very similar to this: Populating a data frame in R in a loop. I cannot seem to populate my matrix in a loop. myDF <- read.csv('corpusFiltered.txt.gz', header = TRUE, sep = '\t') phylum = sort(unique(myDF$PHYLUM)) myDF.mean = ddply(myDF, .(ENVIRONMENT, FILENAME, PHYLUM), summarize, MeanX...

does user defined callback function uses thread pool in node.js?

node.js
This question is to understand how event loop calls thread pool to process task. Say, I want to create a function (say to process small task) not any i/o operation, i want that to process using a callback function, so that it can call thread pool and task can be...

What is wrong with this Autocomplete script?

php,jquery,html,jquery-ui,jquery-ui-autocomplete
Here is my HTML page. <form action="" method="post"> <input type="text" class="auto" name="search" autocomplete="off"> </form> <script> $(document).ready(function($){ $('.auto').autocomplete({ source:'connect.php', minLength:1 }); }); </script> Here is my connect.php if(isset($_GET['term'])) { require "db.php"; $con = mysqli_connect("$host","$user","$password","$db"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $term = mysqli_real_escape_string($con,...

Elastic search query scenario

design,elasticsearch,nested-queries
I am building an application which requires a location based search of hotels. I have three Main classes class Hotel { String name String latitude String longitude } class HotelResource { Hotel hotel String name } class HotelResourceAvailability{ HotelResource resource } HotelResourceAvailability - holds the availability data of a hotel...

Where to find data folder (Processing)

java,osx,data,folder,processing
MAC I have this error: java.lang.RuntimeException: Could not load font CenturyGothic-72.vlw. Make sure that the font has been copied to the data folder of your sketch But I cannot find the data folder in my current sketch, I went to /Users/seb/Documents/Processing/sketchName and the only things in there are: s.pde sketch.properties...

Javascript Simple check for webform to make sure it contains both numbers and letters (instead of my code)

javascript
I have this code: if(address.length<=0) { msg.setAttribute("style", "color:red"); msg.innerHTML='Please enter address'; return false; } I would like to change so it checks whether the webform contains BOTH numbers and letters. Can you help me? Thank you so much, Jones p.s.: So I want to make sure they also enter street...

Program execution time for extremely small run times

c++
I looked up a bunch of other examples of how to time my code but none of the ones that utilized either chrono or time seemed to work (they return 0). However, what did work QueryPerformanceCounter. The only downside to using it is that it is only available for Windows...

Elasticsearch tokenization for international languages

elasticsearch
I wanted to find out how elasticsearch tokens the languages other than english and i tried out the analyze api provided by it. But I cannot understand the output at all. Take for example GET myindex/_analyze?analyzer=hindi&text="में कहता हूँ और तुम सुनना " Now in the above text there are 6...

Android MenuItem showAsAction=“always” Ignored When Have a Group

java,android,android-menu,appcompat
I need implement a sort action on my application, maintaining the selected item checked. But when I use a group for it my main MenuItem begins to ignore the attribute showAsAction="always". Follows the layout used. I'm using the API 19 and AppCompat in version 21.0.2: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" > <item...

Weird Switch Statement Bug [duplicate]

java,debugging,switch-statement
This question already has an answer here: User Input Validation, enforcing a string containing only letters 4 answers choice = UserInput.validString(); while(ValidOption == false){ switch(choice){ case "y": ValidOption = true; roll(); break; case "n": ValidOption = true; MainMenu.menu(); break; default: System.out.print("You must pick Y or N, try again :...

How to check if a value is already present in DataGridView?

vb.net
I created a code that allows me to send values from form1 to form2, I need to know, however, before sending the values, if these are already present. I would avoid the redundancy of information in form2. I access DataGridView through this object: mChildForm.DataGrid1 Who can help me build this...

SQL - Use a reference of a CTE to another CTE

sql,common-table-expression
Is it possible in SQL use a reference inside a Common Table Expression inside another C.T.E in the same query? Here there is an example: WITH CT1 AS (SELECT * FROM T), CT2 AS (SELECT * FROM CT1) SELECT * FROM CT2; I tried this in SQLite3 and it works,...

Sort HashMap of ArrayList Based on ArrayList5 Size

java,hashmap
I realize there are questions similar to this, but they do not answer my question. I need to return the keys of my HashMap, based on the size of the corresponding value's ArrayList. For example, if I have: HashMap<String,ArrayList<Integer>> unsortedMap = new HashMap<String,ArrayList<Integer>>(); unsortedMap.put("A",new ArrayList<Integer>(Arrays.asList(1,2,3))); unsortedMap.put("B",new ArrayList<Integer>(Arrays.asList(4))); unsortedMap.put("C",new ArrayList<Integer>(Arrays.asList(2,3,1,4))); I'd...

AnuglarJS & asp.net MVC - passing data to controller?

c#,asp.net-mvc,angularjs
From this example http://xombe.com/2014/02/17/combine-angular-js-with-asp-net-mvc/, how do I pass data to the asp.net MVC controller? In the example, he doesn't do this. He accesses the controller and creates a new object, which is passed back to the view. It's all read only. Here's my Angular code: <script type="text/javascript"> var myApp =...

MSVS2013 Debugger Not Working (Autos, Locals, and Watches)

c++,visual-studio-2013,visual-studio-debugging
VS2013 Info: Microsoft Visual Studio Professional 2013 Version 12.0.30723.00 Update 3 Microsoft .NET Framework Version 4.5.51209 So here is what is going on. I installed VS2013 the the other day just to see what kind of improvements have been made and was pleasantly surprised and happy with the changes to...

Simple Android App to launch URL in external browser keeps crashing

android,eclipse,android-activity,apk
I've read how to create a simple app that launches a website in the phone's external browser in this post. I followed those steps, yet my simple App keeps crashing. I'm trying to create the absolute simplest possible app with the highest compatibility which simply opens a URL in the...

Is there a built-in function to copy a directory in Dart?

directory,copy,dart
Is there a built-in function to copy a directory and recursively copy all the files (and other directories) in Dart?

timeago.js Not Working as Expected

javascript,jquery,timeago
I have a class that holds the time each article is created. I want the time to be realtime, which is what timeago.js does but my time just stays at about 1 minute ago even though it is actually 4 minutes ago. I have to refresh the page to get...

EF6 Multiple foreign keys for ApplicationUser Error

c#,entity-framework-6,asp.net-identity
I'm pretty new to Entity Framework and the code first approach and I'm stuck. Sorry if it's a dumb question. I found some questions around here that look the same, but I get an other error then the ones other people get and I would love to solve it without...

How to define predicates using C++ API for CVC4

c++,smt,cvc4
This is an example in native CVC language: isblue: STRING -> BOOLEAN; ASSERT isblue("sky"); ASSERT isblue("water"); QUERY isblue("sky"); //valid QUERY isblue("pig"); //invalid How would I write it using the C++ API for CVC4? Couldn't find any documentation on how to do this. ...

LinearLayout Weight issue

android,android-layout,android-linearlayout
Well I have a vertical LinearLayout inside a ScrollView, it's a kind of form where I register a payment, the points is than i'm trying to make it responsive, on every thing inside this list view will have a vertical weigh of 1, to make the elements get engages equitably...

Function Pointers not working in getopt

c,function-pointers,getopt
I have some code which tests the robustness of a variety of PRNGs, and I want to choose which PRNG is being tested using options. I have a function pointer type: typedef double (*voidPRNG_ptr)(void); I have a testing function: test_results* investigator_alloc(int N, voidPRNG_ptr RNGp) Where test_results is a typedef'ed struct....

Dedicated database server setup. Where should my Sphinx and Thinking Sphinx configurations/indices go?

ruby-on-rails,sphinx,thinking-sphinx
Using Rails 3.2, Thinking Sphinx 3.0.6, Sphinx 2.2.4-id64-beta. I am setting up a dedicated database server for my app. May I know the following: Where should I install Sphinx? App server or database server? Is the following /path/to/app/server/current/config/thinking_sphinx.yml correct: address: database_server_ip_address pid_file: /path/to/app/server/shared/pids/searchd.pid indices_location: /path/to/app/server/shared/db/sphinx configuration_file: /path/to/app/server/shared/config/production.sphinx.conf ...

Service and AsyncTask

android
How can i run and AsyncTask in a Service so that the UI does not freeze when i do my work in a service? Today i implemented a very basic service: public class ImageSendEmailService extends Service { private NotificationManager notificationManager = null; private Notification notification = null; @Override public void...

How to create a list of duplicated arrays in R

r
I'm trying to create a list of repeated entries for an arbitrary number of times. For example, I want to have list(c(1.0,1.0),c(1.0,1.0),c(1.0,1.0)) but bigger. I tried rep(c(1.0,1.0),3) and that doesn't work because it outputs [1] 1 1 1 1 1 1 1 1. My goal is to get something of...

Clear canvas context without knowing the canvas dimensions

html5-canvas
To clear a canvas to transparency, you do this: var ctx = canvas.getContext("2d"); ctx.clearRect(0,0, //Starting coordinates canvas.width, canvas.height //Ending coordinates ); But I'm writing a more complex abstract system. To avoid calling .getContext all over the place, I have a pseudo-class to manage contexts of all layers. Every sub-program is...

Point in circle segment

algorithm,math
I have a circle I want to divide up in to a number of segments all defined by X and Y coordinates. How to I test to see if a point (X, Y) is in a particular segment? A code example would be preferable....

Extract link with regex

regex,vb.net,visual-studio-2010
How can I extract all links with regex? Link example: <a class="link" title="somehing" href="https://www.website.com/link" data-jsid="anchor" target="_blank"> (more html stuff..) I want to this: https://www.website.com/link I try something like this, but not enough specific. href=""(.*?)"".*?>(.*?) ...

MIDI Application on 64 bit Windows 8.1 and Qt - Troubles with pointers size

windows,qt,winapi,32bit-64bit,midi
I am trying to develop a C++ Windows application to process MIDI information coming from some MIDI device. The OS I am force to work with is Windows 8.1 64 bit. The development environment is Qt. After having read tons of web pages I've found out that windows has a...

Compiling Unix code on Mac

c,osx,gcc
We were given course work to create the game Mine Sweeper. We are still early in the semester so this homework shouldn't be too difficult. We were given header and source files that are to be used for the visual part of the program. Main problem is that I can't...

c# Form with custom design code doesn't show up

c#,winforms,show
I am currently working on a project that allows the user to design his own WinForm (using DesignSurface). Therefore I wrote an algrotithm to create Designer-Code for the form. Everything works fine, except for one thing: The form, once compiled, won't show up. Everything should be working; I could not...

DirectX11 Engine in C++ and Interface in C#

c#,c++,.net,winforms,directx-11
I have my DirectX11 Engine written in C++, a wrapper in C++ with CLR, and an interface in C#. 1) I am curious about where the bottleneck is in this structure, and I'm wondering if there is a more efficient way to let me host the DirectX11 rendering in a...

How can i use modulus the loop through integers -10 to 10?

processing,modulus
I understand that i can use modulus to loop through positive numbers e.g 0 to 10 would look something like this: i++; i %= 10; But how can i make it so instead of starting back at 0 it starts at -10? Thanks....

How can I add the additional information below file icons in OS X?

objective-c,xcode,osx,swift
DropBox has started adding status text underneath files and folders in the Finder and I was wondering if anyone knows how this is done? Searching the web has proven fruitless (unless I'm just searching for the wrong things. Any ideas? Here's an example of what I'm looking for: (Apparently first...

iOS contentStretch has been deprecated, how to stretch table cell?

ios,uitableview
I have some older iOS code which includes a generic custom Composite Subview derived from UITableViewCell which overrides setFrame and uses contentStretch to achieve the resizing. This is a generic custom Table View Cell class which I can use to display any content I want to in a table row...

Create InputRadioGroups in a loop in Play 2.4

java,html,forms,playframework,playframework-2.0
I am looking for a way to create inputRadioGroups with different names and values in a for loop. For example, I have a list of 10 applicants. index.scala.html displays every applicant's name and offers 3 radio buttons (hire, decline, maybe) to the user. This is what I got so far....

Should all my activities always extend ActionBarActivity while using AppCompat?

android,android-layout,android-styles
I would like to apply Material Theme to my app and make it available also on devices not running Lolipop. My application targets: android:minSdkVersion="14 and android:targetSdkVersion="21". I've made a simple test application and changed themes in styles.xml to: <style name="AppTheme" parent="@Theme.AppCompat.Light"> <item name="colorPrimary">@color/primary</item> <item name="colorPrimaryDark">@color/primary_dark</item> <item name="colorAccent">@color/accent</item> <item...

Having issue with pattern match incorrectly validating in Yii 2

php,regex,yii,yii2
I have a bunch of validation rules within my rules method and all the errors seem to work, but having an issue with this one: ['username', 'match', 'pattern' => '/[a-zA-Z0-9_-]+/', 'message' => 'Your username can only contain alphanumeric characters, underscores and dashes.'], It validates, which is the incorrect behavior. Am...

Sum of Prime numbers

php
I have the following code, to output all prime numbers from array. I would like to get the sum of the output in ex: 2+3+5 = 10, Any hint how to get that ? $n = array(1,2,3,4,5,6); function prime($n){ for($i=0;$i<= count($n);$i++){ $counter = 0; for($j=1;$j<=$i;$j++){ if($i % $j==0){ $counter++; }...

writing to a file in android, couldn't locate file

android,file-writing
so i have this code below in my MainActivity, after I call this method, it pop up Toast "file saved" but i could not locate this file to be sure it saves what i wanted to, anyone? private void saveToFile(String data){ try { outFile = new FileWriter(Environment.getExternalStorageDirectory().getAbsolutePath()+"/batteryLogFile.txt", true); PrintWriter out...

Using values from array to set states of multiple UISwithces

arrays,swift,tags,xcode6,uiswitch
I have created an array pisteet() that stores the states of nine UISwitches. For off 0 and for on 1. Array pisteet() is global so when I pop out of the page where the switches are, the values are stored in the array but on re-entry, the switches are all...

A cheap way to frequently check connection to MS SQL Server from client app?

sql-server,client-server,ping
In relatively small server-client environment (up to 100 client connections to database server) what is the resource-effective way for every running client application to check whether its database connection is alive? I was thinking about implementing execution of SELECT 1 every 20 seconds from every client app. Is this good...

How To Include angular-ui-route in my project

angularjs,angular-ui,angular-ui-router
I'm trying to be consistent with how I add libraries to my project that uses Bower and Angular. I've used bower to install my packages so far by doing things like bower install angular bower install angular-resource It seems to have created files as follows: /vendor/angular/angular.js /vendor/angular-resource/angular-resource.js Now, when I...

Removing multiple blanks using putchar and getchar in C

c,string,getchar,blank-space,putchar
Problem: Write a program that receives textual input using getchar() and outputs the string, having removed multiples blanks. Here's how I wrote the pseudo-code: While each input character is received before reaching EOF, do the following: 1) if character is non-blank, print it out 2) otherwise: a. print out the...

How to change all characters except for the two?

python,regex,python-3.x,regex-lookarounds
Let's suppose we have a string: a = "I would like to go to dinner." It is easy to change all i's and o's in the string to -'s. If we define: b = re.sub("i|o","-", a, flags = re.I) we get: b = "- w-uld l-ke t- g- t- d-nner."...

How to generate array from multiple mysql rows with a common value

mysql,sql,database
I have a mysql database with the following structure. id|form_id|element_label|element_value|group_id|date|ip This is generated from a form plugin in joomla so I have no control over its structure. The form id is the form the value is related to, element_label is the input that it relates to, element_value is the value...

Editing Magento 1.9 CSS to customize category layout

php,magento,phtml
I'm trying to customize the list.phtml page on magento for a specific category . I took away the product image as well as the product description and now I want to push the product name over to the left where the image was . I tried using a negative value...

Clean Code - Are output parameters bad?

c#,solid-principles
I was looking at a former colleagues post. He quoted something from an article "In Clean Code Bob Martin disparages output arguments, saying “In general output arguments should be avoided.” My current code base is C#. I am working in a rather large application. It was written primarily in procedural...

Material color splash lib

android,animation,background-color,material-design
Maybe a week ago I found lib wich fill view with color and animation. Now I cant find it, maybe someone sought it? Here is example of what I mean. Need the same as in calculator on delete, or dialer on start calling. ...

Can't lookup an RMI server in a Servlet

java,servlets,bind,rmi
I can't lookup a object from a RMI servlet! The error is: (no security manager: RMI class loader disabled) Server code: public class CrecheServer { /** * @param args the command line arguments * @throws java.rmi.RemoteException * @throws java.rmi.AlreadyBoundException */ public static void main(String[] args) throws RemoteException, AlreadyBoundException { Registry...

Saving file path imported by file.choose () in R

r
I'm looking for a way to save file path of a file that's imported to R using file.choose(). Suppose I have a function that imports a csv file and saves the first N columns in a new file in the same directory as the original file.Something like this: Split<-function(N,...){ data<-read.csv(file.choose(),header=T)...

Does cudaMallocHost() give access to pointers in struct

cuda
I am working on a project and I have a struct containing pointers. When I use cudaMalloc() and copy the struct to device memory, it seems that it does not copy the content pointed by the pointers in the host memory, which is obvious I guess. I went through few...

terminal current directory symbol

linux,unix,terminal
Is there a symbol for the current directory? For example instead of type the full path name for the current directory i.e. cp /User/Name/f1/f2/ /User/Name/f3/f4/f5 and your current direct is /User/Name/f1/f2/ Is there any symbol that acts as pwd?

How do I use Jangaroo to convert a single As3 function to javascript?

javascript,actionscript,code-conversion,code-converter
I've stumbled upon Jangaroo, and it seems to provide what i need. The problem is that to use it the docs say that i need to setup maven. I really have a single function, so all that is a bit of an overkill. The ideal solution would be something similar...

Send / Receive Emails through external VServer with Plesk?

imap,plesk,cname,mail-server,virtual-server
I have: Google Cloud Engine (Google does not allow to Send Mails) Domain (GoDaddy) External VServer with Plesk. I want to user my VServer as an external Mailserver. But i don´t know what to write in the "CName (Alias)" and "MX (Mail Exchanger)". And where do i have to point...

Auto size Button Style

wpf,xaml,autosize,wpfstyle
I have this Style: <!--Normal Button Style --> <Style TargetType="{x:Type Button}" x:Key="NormalButtonStyle"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ButtonBase}"> <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Effect="{DynamicResource ShadowEffect}" > <Grid.ColumnDefinitions> <ColumnDefinition Width="16"/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Image Source="{Binding...

mail sends several time the same email

centos,roundcube
I have install the latest version of vestaCP (0.9.8-12) with Centos 6.6 and the following mail packages: roundcubemail-1.0.3-1.el6.remi.noarch mailcap-2.1.31-2.el6.noarch mailx-12.4-7.el6.x86_64 My problem is that each time I use the mail() function, it sends 7/10 email to the same recipient instead of one. Is there anything to do? Sincerely....

How to convert binary tree to polygon triangulation and vice versa

algorithm,binary-tree,polygon,triangulation
According to wikipedia, there is bijection (1:1 correspondence) between binary tree of n - 2 nodes and simple n-vertex polygon triangulation. I am wondering, how to convert between each other*? In other words, how to convert set of triangles to binary tree and how to convert binary tree to set...

How to create a iAd banner?

ios,iphone,swift,iad,banner
I'm still a noob developper and I just finished my little game and now I want to integrate AdBanner. With the code bellow the banner appear and disappear instantly. I tried on another ViewController/GameScene and the banner appear and stay. I can't understand the problem. My Game is under gravity....

Why is https always used with www subdomain? [closed]

redirect,ssl,https,subdomain
I have been trying to reason this out, but haven't been able to. All the https websites that I have surfed use www subdomain. Is it possible to have something like https://foo.com. If yes, then why is it so rare or uncommon?

How do you add a new folder to app/ in ember-cli?

ember.js,ember-cli
I want to add an SDK type to ember-cli to wrap up complex ajax calls into a simple javascript wrapper returning a known format of POJO that can be tested. I added an app/sdk/login.js and exported a simple empty class there. When I import it elsewhere I get a broccoli...

fatal error nsarray element failed to match the swift array element type

json,swift
This question is related to this answered question fatal error: NSArray element failed to match the Swift Array Element type but with an additional problem. I'm trying to parse some JSON input and have the following two classes class EndDiskMeridian:NSObject { var dispUcoefficients:Array<Double> var dispVcoefficients:Array<Double> var dispWcoefficients:Array<Double> init(dict: NSDictionary) {...

Python numpy nan compare to true in arrays with strings

python,arrays,numpy
I am trying to compare two numpy arrays which contain numbers, string and nans. I want to know how many items in the array are equal. When comparing these two arrays: c =np.array([1,np.nan]); d =np.array([2,np.nan]); print (c==d) [False False] Which is the expected behaviour. However, when comparing: a =np.array([1,'x', np.nan]);...

Java: Sorting a map

java
I'm looking for a way to hold scores for players for a highscore. A typical input : map.put(p1, 9); map.put(p2, 7); map.put(p3, 9); Now I need a way of ordering the map so to be able to see the order of players based on their scores. However, I've tried just...

PHP Composer Laravel Installation Fatal Error

laravel,composer-php
Can someone help me with resolving this error ? I have tried the options available across GIT and Stackoverflow but nothing works for me as of now. I am trying to install larvel but always get stuck on this step. composer global require "laravel/installer=~1.1" Changed current directory to /Users/Jay/.composer ./composer.json...

Duplicate column name error during union

mysql,count,union
I'm using this query to count rows resulting from 2 tables using union and an alias at the end of the query but it's not working: SELECT COUNT(*) FROM ( (SELECT * FROM bills INNER JOIN cats INNER JOIN suppliers INNER JOIN new_cards WHERE new_cards.`Card_Code` LIKE '%8%' AND bills.`Sup_ID` =...

Xcode 6.1 crashing when running the project

crash,xcode6
I searched StackOverflow and it doesn't look like many people are having this problem, but for me, this happens very, very frequently. Maybe not every time, but perhaps every other time. Once I try to build and run the app, Xcode crashes, and in a strange way: it just disappears...

MvvmCross and injecting view model into a view constructor

c#,windows-phone,windows-phone-8.1,mvvmcross,win-universal-app
Is it possible within MvvmCross to inject a view model into the constructor of a view? The constructor for my view looks like this: public HomeView(IHomeViewModel viewModel) { ... } In the Setup.cs class I manually map view models to views using the following: protected override void InitializeViewLookup() { IDictionary<Type,...

compare value in different node in Xpath

xml,xpath,xquery
So, here is an example of the XML <a> <b id=0> <c k=1/> </b> <b id=1> <c k=2/> </b> </a> I need to find all pairs of c where the K value is the same, and report the id of b ... I tried loops, following::b , all not working...

Not abstract and does not override abstract method

android,android-fragments,interface,navigation-drawer,abstract
Hi everyone I have this Main Class Home public class Home extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks, FriendsFragment.OnFragmentInteractionListener { Error:(42, 8) error: Home is not abstract and does not override abstract method onFragmentInteraction(String) in OnFragmentInteractionListener I created a Navigation Drawer, and want to have a new Fragment to show another Content then...

Rails and embedded ruby

ruby-on-rails,ruby,html5
For my website I have the following title helper: <% provide(:title, 'My Page') %> Which produces something like this: Instead of the generic 'My Page' I'm trying to add the user name, for instance 'mtcrts70'. To do this I tried the following code: <% provide(:title, '<%= current_user.email[/[^@]+/] %>') %> Note...

Replace parts of string using package stringi (regex)

regex,r,string,stringi
I have some string string <- "abbccc" I want to replace the chains of the same letter to just one letter and number of occurance of this letter. So I want to have something like this: "ab2c3" I use stringi package to do this, but it doesn't work exactly like...

How do you add someone else's project to your current project?

c#
I'm trying to use this color dialog written by someone else in my program but I don't know how to integrate it. I'm very new to C# so I am not really sure what I'm doing. http://www.codeproject.com/Articles/33001/WPF-A-Simple-Color-Picker-With-Preview...

Joining array doesn't return string

arrays,vb.net,string
I'm trying to make a generic toString method that converts both char() and string() into a string: Function toString(ByVal arr As Array) As String If arr.GetType() Is GetType(String()) Then Return String.Join(".", arr) Else Return New String(arr) End If End Function Joining the string() returns System.String[] instead of the string itself....

C++ - Getting and setting member variable within same method?

c++,virtual,setter,getter
I have a class that derives from a base class that contains its own member variable. In order to keep everything in the classes encapsulated, I'm trying to figure out a clean approach to setting this member variable at the same time retrieving it in the same method. Here is...