Posts

Showing posts from March, 2014

Unresolved external symbol (singleton class C++) -

this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers i looked answers in stackoverflow type of problem, none of helping me out. this question describes how resolve error, , should provide definition , not declaration. i've done that, i'm still getting following error: error 13 error lnk2019: unresolved external symbol "private: __thiscall networkmanager::networkmanager(void)" (??0networkmanager@@aae@xz) referenced in function "public: static class networkmanager * __cdecl networkmanager::instance(void)" (?instance@networkmanager@@sapav1@xz) c:\users\hidden\documents\agk projects\c++ libraries\apps\template_windows_vs2013\networkmanager.obj template here's code: networkmanager.h #ifndef _h_networkmanager_ #define _h_networkmanager_ #include<iostream>...

java - Representing LinkedLists in UML diagrams? -

wondering format represent state of class inside uml diagram private linkedlist<string> list; thanks time it's property multiplicity of 0..* , type string. don't design linked list in uml, use 1 implement association.

css - Adding custom fonts in Rails -

i trying add custom font downloaded in rails app. did: downloaded font (georgia.tff) , put in app/assets/fonts/georgia.tff . main css file looks this: foundation-and-override.scss @font-face { font-family: "georgia"; src: url(/assets/fonts/georgia.ttf) format("truetype"); } .header { font-family: "georgia"; } and want apply font: _header.html.erb <header class="top-bar" data-topbar role="navigation"> <ul class="title-area"> <li class="header"> <h1><a href="/">smart investors's club</a></h1> </ul> </header> it's not working. i'm using rails 4.2.1. referenced adding custom font in app , official way of adding custom fonts rails 4? . no luck.😋 foundation-and-override.scss @font-face{ font-family:"georgia"; src:asset-url("georgia.ttf") format("truetype");...

javascript - Exclude elements from click event handler (jquery) -

i have defined event handler elements on page. var selector = "div, select, input, button"; $(selector).on('click', function (e) { //deactivate function of elements , prevent propagation e.preventdefault(); e.stoppropagation(); //... //dialog loaded , created here //e.g. $(body).append('<see-dialog-html-from-below>'); //... alert('selector click'); } i add (and remove) dialog dom @ runtime (one dialog @ time). simplified dialog this: <div id="dialog" class="ui vertical menu"> <div class="item"> <label for="constraints">constraints:</label> <select id="constraints" name="constraints"> <option value="0">option 0</option> <option value="1">option 1</option> <option value="2">option 2</option> ...

jquery - Detect righ click on CKEDITOR focus handler -

when attaching focus handlers multiple ckeditor's in loop: for(i=0; i<editors.length; i++){ .... ckeditor.instances[editors[i]].on('focus', handlefocus); }; var handlefocus = function(){ console.log("this= ",this); }; how can actual "event" in handlefocus function, can skip right click (context menu) clicks, using existing function skipping right clicks inside editor: var isrightclick = function(event){ switch (event.which) { case 1: return false; // left mouse button case 2: return false; // middle mouse button case 3: return true; // right mouse button default: return false; // strange mouse! } }; use provided event data: var handlefocus = function(ev){ console.log("event= ", ev); }; that way can info editor on event fired, cancel event, original event data, ... this applies event listener attach in ckeditor event model.

c# - Opening Command Prompt and Performing Commands -

first , foremost, first program , new programming overall outside of html , js. being said, building application gathers , collects system files used troubleshooting purposes. have basic understanding of have done far, having issues dxdiag arguments here: var process = new process(); var startinfo = new processstartinfo(); // startinfo.windowstyle = system.diagnostics.processwindowstyle.hidden; startinfo.filename = "cmd.exe"; startinfo.arguments = @"/c dxdiag /whql:on /t %userprofile%\desktop\my system files\dxdiag.txt"; process.startinfo = startinfo; process.start(); process.waitforexit(); *to clarify, commented out hidden line can see cmd windows doing while build application. now have looked , have found multiple other threads relating usage of similar code cannot figure out why variant not work using arguments have included. block bring cmd , execute dxdiag command. have tested command in cmd multiple times ensure wo...

JSON - Make popup navigate to Google -

i'm trying write chrome extension where, when clicked, drop down google. now, loads local .html file. here code have: { "manifest_version": 2, "name": "thename", "description": "thedesc", "version": "1.0", "browser_action": { "default_icon": "icon.png", "default_popup": "http://www.google.com", "default_title": "tooltip" }, "permissions": [ "activetab", "https://ajax.googleapis.com/" ] } i have 4 files in folder: icon.png, manifest.json, popup.html, & popup.js. using "getting started" tutorial https://developer.chrome.com/extensions/getstarted template, extremely new of (vb6 programmer years). edit: got open webpage in little popup. now, need grab title of current tab's url, remove spaces it, trim down 30 characters max, assign string, navigate www.website.com/string. i'm th...

shell - How can I put a python program with multiple files in /usr/local/bin? -

i know if program 1 python script file, start shebang , put in /usr/local/bin invoke @ time command prompt. however, if program multiple files, want 1 invokable command line? example, if i've got my_program.py , dependency.py, , my_program needs dependency, don't want dependency invokable? as understand it, if dump both in /usr/local/bin, invoking either of names attempt execute them... want my_program visible, needs in same dir dependency module. i know copy/paste them 1 single file feels wrong... put python files in folder , put folder installation directory (may in /usr/local/foldername ). use chdir in script/s change directory file containing folder (may os.path.dirname(os.path.realpath(sys.argv[0])) ) import dependencies there, or use absolute path. now make symbolic link of executable file , put in /usr/local/bin .

swift - Can you apply delta time to an SKAction -

i've started notice in game i'm making fps goes down more nodes on screen, nodes start move little choppiness them. move nodes with: let ran = int(arc4random_uniform(1400)); let monster = skspritenode(texture: text) monster.position = cgpoint(x: ran, y: 800); let move = skaction.moveto(cgpointmake(monster.position.x, -100), duration: 2); let remove = skaction.runblock { () -> void in score += 1; monster.removefromparent() } monster.runaction(skaction.sequence([move,remove])); can use delta time effect nodes movements? how do this? make difference? you cannot fps slowing down add more nodes view. device running app determines fps. newer models have faster cpu. to use delta time can this: -(void)update:(nstimeinterval) currenttime { nstimeinterval delta = currenttime - self.lastupdatetime; self.lastupdatetime = currenttime; // use delta time determine how sprites need move stay in sync. } if lookin...

javascript - Set jQuery cookie with auto-submit -

i'm trying use jquery cookie set languages. have following form: <select id="lang"> <option value="en_us">english</option> <option value="it_it">italiano</option> <option value="fr_fr">français</option> </select> <input id="btn" type="button" value="submit"> <noscript><input id="btn" type="button" value="submit"></noscript> within following script: // set cookie $(document).ready(function () { $("#btn").on("click", function () { $.cookie('lang_cookie', $("#lang").val(), { expires: 365 }); }); }); the form above works nicely i'd remove button , auto-submit. can change form using onchange="this.form.submit()" : <select id="lang" onchange="this.form.submit()"> <option value="en_us"...

python 3.x - msvcrt.getch() returning b'a' instead of 'a'? -

i have following code 1 class: class _getch: def __init__(self): self.impl = _getchwindows() def read_key(self): return self.impl() class _getchwindows: def __init__(self): import msvcrt def __call__(self): import msvcrt return msvcrt.getch() and have class imported _getch. within other class, tried use read_key provided _getch things in conditional: r = _getch() key = r.read_key() print(key) if key = 'a': #do things elif key = 's': # other things else: continue when tried input 'a', expecting key 'a', returned b'a' instead. thus, key not fulfill of conditionals, , go continue. why did return b'a'? can make return 'a' instead? according documentation , msvcrt.getch() returns byte-string . so need use bytes.decode() method on turn unicode string. hint : if this, should environments encoding , use instead of default utf-8 . or can use er...

node.js - Why is the "this" keyword different in a mongoose pre-save hook versus a post-save hook? -

this relevant snippet of code myschema .pre('save', function (next) { var self = this; console.log(self); return next(); }); myschema .post('save', function (next) { var self = this; console.log(self); }); for reason, in situation pre-save hook gives proper object { farm: 557ce790a893e4e0118059e3, _id: 557ce791a893e4e011805a35, privileges: [ { instanceid: 557ce790a893e4e0118059bb, access: 5, modeltype: 'user' } ], public: 0, properties: { crop: 'no crop', name: 'pirani tract 50' }, geometry: { type: 'polygon', coordinates: [ [object] ] } } but post save hook logs { domain: null, _events: { save: [ [function: notify], [function] ], isnew: [function: notify], init: [function] }, _maxlisteners: 0 } post middleware receives document parameter instead of next flow control callback parameter pre middleware receive. myschema .post('save...

Change Color of MenuBar, Menu, and MenuItem in Java using the AWT Components -

i've been searching around bit, haven't found answer whether or not it's possible , how change background, text, foreground, selection, , text selection colors of menubar, menu, , menuitem awt components. so-far i've tried following solutions, neither affect of colors of of menu-related components. first solution attempts grab component , change color , second tries change through uimanager. // example of did, not code i'm working with. menubar bar = new menubar(); menu menu = new menu(); menuitem item = new menuitem(); bar.getaccessiblecontext().getaccessiblecomponent().setbackground(color.red); bar.getaccessiblecontext().getaccessiblecomponent().setforeground(color.blue); menu.getaccessiblecontext().getaccessiblecomponent().setbackground(color.red); menu.getaccessiblecontext().getaccessiblecomponent().setforeground(color.blue); item.getaccessiblecontext().getaccessiblecomponent().setbackground(color.red); item.getaccessiblecontext().getaccessiblecom...

r - how to generate elements not included in my sample -

this bit trivial how can generate set of numbers in x not included in sample. x=rnorm(6,0,1) k=sample(x,3) rather sampling values, sample indexes. set.seed(15) (x <-rnorm(6,0,1)) # [1] 0.2588229 1.8311207 -0.3396186 0.8971982 0.4880163 -1.2553858 idx <- sample(length(x),3) (selected <- x[idx]) # [1] 0.8971982 -1.2553858 0.4880163 (notselected <- x[-idx]) # [1] 0.2588229 1.8311207 -0.3396186

readChar in R is unable to read the tiff tag -

i trying read a tiff file in little endian format. in image file directory first tag value 0100(in hex). when trying read these 2 bytes gives following result. >readchar(fptr,nchars=2,true) [1] "" when read single bytes correctly gives >readchar(fptr,nchars=1,true) [1] "" >readchar(fptr,nchars=1,true) [1] "\001" > here's tiff file: filename <- "test.tiff" tiff(filename) plot(1) dev.off() you can read in raw bytes using readbin . n <- file.info(filename)$size bytes <- readbin(filename, raw(), n = n) you may prefer read in using tiff::readtiff . library(tiff) the_plot <- readtiff(filename) then can include inside other plots using rasterimage . plot(1, 1, 'n') rasterimage(the_plot, 0.8, 0.8, 1.2, 1.2)

regex - Replace a double backslash followed by quote (\\') using sed? -

i unable replace double backslash followed quote \\' in sed. current command echo file.txt | sed "s:\\\\':\\':g" the above command not replaces \\' \' replaces \' ' how replace exact match? input: 'one', 'two \\'change', 'three \'unchanged' expected: 'one', 'two \'change', 'three \'unchanged' actual: 'one', 'two \'change', 'three 'unchanged' $ sed "s/\\\\\\\'/\\\'/g" file 'one', 'two \'change', 'three \'unchanged' here discussion on why sed needs 3 backslashes one

In the django admin console how do you stop fieldset fields from escaping html? -

Image
i have stacked inline display. model inline class has child in manytomany relationship. want display images cannot see how stop django escaping html. seems need function similar "display_as", how django gather available images , display them in "checkboxselectmultiple". fyi: want add sorting images after them display. models.py class blogwidgetcarousel(models.model): entry = models.textfield() blog = models.foreignkey(blog, blank=true, null=true) position = models.positivesmallintegerfield("position") images = models.manytomanyfield("image") class meta: ordering = ('position', ) def __str__(self): return str(self.position) def save(self, *args, **kwargs): self.entry = "<b><i>todo: create image slider</i></b>" super(blogwidgetcarousel, self).save(*args, **kwargs) def display(self): return self.entry class image(models....

android - updating textview in an activity from a service -

below example updating textiviews in activity service via broadcast receiver want send calculated bandwidth usage service text views in other activity, have tried approach not working (it shows package names in text fields) broadcast service (transmitter) public class broadcastservice extends service { private static final string tag = "broadcastservice"; public static final string broadcast_action = "com.websmithing.broadcasttest.displayevent"; private final handler handler = new handler(); intent intent; int counter = 0; @override public void oncreate() { super.oncreate(); intent = new intent(broadcast_action); } @override public void onstart(intent intent, int startid) { handler.removecallbacks(sendupdatestoui); handler.postdelayed(sendupdatestoui, 1000); // 1 second } private runnable sendupdatestoui = new runnable() { public void run() { displ...

objective c - Animating a subview with CentreY constraint -

Image
i have uitableviewcell 2 uilabels , uiswitch. labels multilined , placed on top of each other. uiswitch centred vertically. when turn off switch hide 1 of labels , height of row changes. causes switch jump though call: [self.tableview reloadrowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationautomatic]; here tableviewcell class implementation: - (void)setbounds:(cgrect)bounds { [super setbounds:bounds]; self.contentview.frame = self.bounds; } - (void)setupview{ self.numberlabel.text = [nsstring stringwithformat:@"quote number %ld", [self.celldata[@"rownumber"] integervalue]]; [self.controlswitch seton:[self.celldata[@"checked"] boolvalue]]; [uiview animatewithduration:0.5 animations:^{ if ([self.controlswitch ison]) { self.quotelabel.text = self.celldata[@"quote"]; self.quotelabel.hidden = no; self.bottomconst.constant = ...

Get the longest path in a graph with OrientDB -

Image
i'm newbie orientdb , graph (database , concept). want understand how find longest path in graph. this graph: the shortest path is: 13:0 -> 13:1 -> 13:2 (with sst() or dijkstra()) but want longest : 13:0 -> 13:3 -> 13:1 -> 13:2 how can do? must create scratch new function? thanks in advance luis you're asking solution np-hard problem :) see here .

php - Unable to get session data from paypal express checkout in laravel 4 -

i unable session information in omnipay laravel 4 after getting express checkout return after making express checkout. i tokens , payerid noting else. session data of site become empty. please tell how can completepurchase process. there way purchase order id paypal. using omnipay. public function dosaveandprocessedtopaypal( $purchaseorder) { $purchaseorderid = $purchaseorder->id; session::put('currentuseremail', $email); session::put('purchaseorderid', $purchaseorderid); session::put('amount', $amount); $gateway = $this->getpaypalgateway(); $items = new omnipay\common\itembag(); $items->add(array( 'name' => $productname, 'quantity' => '1', 'price' => (float)$amount, )); $response = $gateway->purchase( array( 'cancelurl' => cancel_url, ...

java - ActiveMQ, why RedeliveryCounter dont increase when shutdown consumer before Ack -

my consumer running in application server. activemq config: optimizeacknowledge=true optimizeacknowledgetimeout=5000 destination=queue.test.msg?consumer.prefetchsize=10 after sent 10 messages, "web console( http://localhost:8161/admin )" see 3 messages dont ack(used optimizeacknowledge), @ time when restarted consumer server, received 3 message again , redeliverycounter=0. dont determine redelivery messages or sent producer. this question find in transaction. run test class: org\apache\activemq\redeliverypolicytest.java, methoed:testrepeatedredeliveryreceivenocommit. debug in "connection.close();" , stop it. message's redeliverycounter "0". question: when determine message redelivery or not, must use store save message's id after consumer processed , check if exist when consumer received message? the code below: public void testrepeatedredeliveryreceivenocommit() throws exception { connection.start(); session dlqsess...

python - how to install panda using easy_install? -

i using python 2.7.8 in windows 8 , on cmd wrote easy_install pandas. after processing gave me error , asked me download vcpython27. on cmd: c:\python27\scripts>easy_install.exe pandas searching pandas best match: pandas 0.16.2 processing pandas-0.16.2-py2.7-win32.egg pandas 0.16.2 active version in easy-install.pth using c:\python27\lib\site-packages\pandas-0.16.2-py2.7-win32.egg processing dependencies pandas searching numpy>=1.7.0 reading https://pypi.python.org/simple/numpy/ best match: numpy 1.9.2 downloading https://pypi.python.org/packages/source/n/numpy/numpy-1.9.2.zip#md5= e80c19d2fb25af576460bb7dac31c59a processing numpy-1.9.2.zip writing c:\users\dell\appdata\local\temp\easy_install-ifrvr4\numpy-1.9.2\setup.c fg running numpy-1.9.2\setup.py -q bdist_egg --dist-dir c:\users\dell\appdata\local \temp\easy_install-ifrvr4\numpy-1.9.2\egg-dist-tmp-1tqap5 running numpy source directory. non-existing path in 'numpy\\distutils': 'site.cfg' non-existing ...

javascript - datetimepicker. widget doesn't show -

i trying repeat example datepicker documenation on jsfiddle tutorial i have wrote following html code: <div class="container"> <div class="row"> <div class='col-sm-6'> <div class="form-group"> <div class='input-group date' id='datetimepicker1'> <input type='text' class="form-control" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> </div> </div> and following js: $(function () { $('#datetimepicker1').datetimepicker(); }); but when start see simple input: demo what did forget ? p.s. wrote following html doesn't w...

php - Laravel 5 Eloquent ORM -

hi have problem code. this view @extends('layouts.main') @section('content') <h2>all todo lists</h2> <ul> <?php @foreach ($todo_lists $list) <li>{{$list->name}}</li> @endforeach ?> </ul> @stop this controller (only method index use public function index() { $todo_lists = todolist::all(); return view('todos/index')->with('todo_lists', $todo_lists); } public function create() { return "create new list"; } this model class todolist extends eloquent{ protected $tabel = 'todo_lists'; } i have database todo_lists table have information id , name want display. th view returns me blank page. seems problem in controller in $todo_lists = todolist::all();. me please? you can try : public function index() { $todo_lists = todolist::all(); // send variables view, use compact('var1', 'var2',...) return view('todos/index', comp...

android - adb: device not found -

i'm trying build kivy app on android phone using buildozer. adb not finding device. error getting: dan@dan-asus:~/kivy$ adb usb error: device not found dan@dan-asus:~/kivy$ adb devices list of devices attached i've added vendor , product id got lsusb in /lib/udev/rules.d/70-android-tools-adb.rules file so: # lenovo a789 subsystem=="usb", attr{idvendor}=="17ef", attr{idproduct}=="7497", mode="0666", owner="dan", tag+="uaccess" have 2 1.1 , 2 2.0 usb outlets. tried 4 of them. made sure restarted adb every time made change , tried reboot phone few time. what missing? adb version 1.0.31 i know should comment, don't have enough reputation that... here "answer". i can think of couple of things don't mention in question: do have file ~/.android/adb_usb.ini ? if yes, vendor id written there? (in case should 0x17ef in single line). try , restart adb server. is adb enabled in...

c preprocessor - Conditional Compilation in C for getting different versions of one function -

i asked myself if there nice way different versions of 1 function without copying whole source code. have different versions 1 one hand measuring execution time , on other hand writing intermediate result (for analytic purpose). let me explain example: writing iterative solver solving linear system, in case gmres algorithm. measure runtime in 1 run , write residual @ every iteration step in different run. structure of program looks like: //main.c #include "gmres.h" // setup arrays flag_print_res = 0; gmres(a,x,b,tol,maxtiter,flag_print_res); // reset arrays flag_print_res = 1; gmres(a,x,b,tol,maxtiter,flag_print_res); //.. and function: //gmres.c void gmres(double* a, double *x, double *b, double tol, int maxiter, int flag_print_res) { // … start_time = ((double) clock ())/clocks_per_sec; for(iter=0; iter<maxiter; iter++) { // ... if(flag_print_res) { fprintf(file, "%d %13.5e\n", iter, res); ...

php - SMTP connect failed - PHPMailer Error on Localhost -

i using phpmailer latest version , able send emails using it. don't know had happened? i'm not able send mail using it. gives me following error - mailer error: smtp connect() failed. https://github.com/phpmailer/phpmailer/wiki/troubleshooting i have checked openssl extension. here code - <form method="post" action="mail.php"> <input type="text" placeholder="enter email subscribe" name="emailid" /> <input type="submit" value="submit" /> </form> the contents of mail.php file <?php $emailsubscr = $_post['emailid']; $sub = 'new subscriber'; $message = $emailsubscr.' has subscribed newsletter'; require 'phpmailer/phpmailerautoload.php'; $mail = new phpmailer; //$mail->smtpdebug = 3; $mail->issmtp(); $mail->host = 'smtp.gmail.com'; // smtp host name $mail->smtpauth = true; ...

unity3d - Scoring scale object -

i started working unity platform few days ago. want create , object one: ( http://www.bankingsense.com/wp-content/uploads/2014/09/credit-score-ratings.png ) user choose appropriate answer. each option generate different score should stored later use. can give me tips ad guidelines this? thank much! vânia this simple. use 1 image scale background. use image pointer. set pivot , anchor of pointer @ position want rotate it. use transform.rotate() in code rotate pointer.

php - How do I replace a comma separated list of strings with the first occurrence? -

where match (coalesce(f1, f2, f3)) against (?) > 0 match (coalesce(f1)) against (?) > 0 wanted: where match (f1) against (?) > 0 match (f1) against (?) > 0 need substritute coalesce(f1, f2, f2, ...) f1 , first string if multiple string present (separated , ) or string itself. i'm working on this : #\s*match\s*\((\s*coalesce\s*\((.+)\s*\))\s*\)\s+against#/i and i'm capturing both what's inside match (1, what's need replaced) , what's inside coalesce (2, replacement). how substituite 1 first value inside 2? replace should start @ coalesce previous part must match. use \k resetting after (where replacing should start). first part match\s*\(\k here starts replacing , pattern continues: \s*coalesce\s*\(\s*([^,)]+) ... capturing in first capture group. and optional part (?:,[^)]*)? meet closing bracket. against part lookahead can used: (?=\)\s*against) . whole pattern be: /match\s*\(\k\s*coalesce\s*\(\s*([^,)]+)(?:,[^)]*...

regex - remove quotes from specific field - integer between quotes -

i want remove quotes specific field there integer between quotes. from line : "aaa","99" to line : "aaa",99 using sed : s='"aaa","99"' sed 's/"\([0-9]*\)"/\1/g' <<< "$s" "aaa",99

What is usage of binary sequence type in python? -

python has many types. usage of binary sequence types in python? there 3 binary sequence types: bytes bytearray memoryview what use for? actually of these 3 types' use discussed already: 1) bytes @ answers question the bytes type in python 2.7 , pep-358 2) bytearray usage @ answers question where python bytearrays used? 3) memoryview @ answers questions when should memoryview used? , what point of memoryview in python

c++ - How to sort multidimentional array -

new coding ! after many attempts use sort without success, here actual code : #include <algorithm> #define n 5 int a[n] = { 3, 6, 2, 4, 1 }; int b[n] = { 6, 3, 1, 2, 9 }; int c[n][3]; ( size_t = 0; < n; i++ ) { c[i][0] = a[i]; c[i][1] = b[i]; c[i][2] = i; } ( size_t = 0; < n; i++ ) printf( "%d,%d, %d\n", c[i][0], c[i][1], c[i][2] ); actual output : 3,6,0 6,3,1 2,1,2 4,2,3 1,9,4 and need sort first key , outputtexpected should : 1,9,4 2,1,2 3,6,0 4,2,3 6,3,1 i tried desperate sort(c, c + n); see im beginer.. use qsort version #include <cstdio> #include <cstdlib> #define n 5 using namespace std; int cmp(const void *a, const void *b){ int *x = (int*)a; int *y = (int*)b; return (*x > *y) - (*x < *y); } int main(){ int a[n] = { 3, 6, 2, 4, 1 }; int b[n] = { 6, 3, 1, 2, 9 }; int c[n][3]; ( size_t = 0; < n; i++ ) { c[i][0] = a[i];...

Application report for application_ (state: ACCEPTED) never ends for Spark Submit (with Spark 1.2.0 on YARN) -

i running kinesis plus spark application https://spark.apache.org/docs/1.2.0/streaming-kinesis-integration.html i running below command on ec2 instance : ./spark/bin/spark-submit --class org.apache.spark.examples.streaming.myclassname --master yarn-cluster --num-executors 2 --driver-memory 1g --executor-memory 1g --executor-cores 1 /home/hadoop/test.jar i have installed spark on emr. emr details master instance group - 1 running master m1.medium 1 core instance group - 2 running core m1.medium i getting below info , never ends. 15/06/14 11:33:23 info yarn.client: requesting new application cluster 2 nodemanagers 15/06/14 11:33:23 info yarn.client: verifying our application has not requested more maximum memory capability of cluster (2048 mb per container) 15/06/14 11:33:23 info yarn.client: allocate container, 1408 mb memory including 384 mb overhead 15/06/14 11:33:23 info yarn.client: setting container launch context our 15/06/14 11:33:23 info yarn.clie...

c++ - Nested template parameters and type deduction -

hi practicing templates , type deduction , wanted try making simple function template nested template parameters print out contents of stl container: template <template<t, alloc> cont> void print(const cont<t, alloc> &c) { (const t &elem : c) std::cout << elem << " "; std::cout << std::endl; } and test case: int main() { std::list<int> intlist{ 1, 2, 3, 4, 5 }; std::vector<float> floatvec{ 0.2f, 0.5f }; print(intlist); print(floatvec); } however getting compiler error whereby types t , alloc cannot deduced. there way me write function without having explicit state types template arguments? note object here able deduce type stored within passed in stl container. hence if vector of ints passed in t deduced type int. in case, may do template <typename cont> void print(const cont& c) { (const auto& elem : c) std::cout << elem << " ";...

algorithm - What is the reason behind calculating GCD in Pollard rho integer factorisation? -

Image
this pseudo code calculating integer factorisation took clrs. point in calculating gcd involved in line 8 , need doubling k when i == k in line 13 .? please. that pseudocode not pollard-rho factorization despite label. 1 trial of related brent's factorization method . in pollard-rho factorization, in ith step compute x_i , x_(2i), , check gcd of x_(2i)-x_i n. in brent's factorization method, compute gcd(x_(2^a)-x_(2^a+b),n) b=1,2, ..., 2^a. (i used indices starting 1 agree pseudocode, elsewhere sequence initialized x_0.) in code, k=2^a , i=2^a+b. when detect has reached next power of 2, increase k 2^(a+1). gcds can computed rapidly euclid's algorithm without knowing factorizations of numbers. time find nontrivial gcd n, helps factor n. in both pollard-rho factorization , brent's algorithm, 1 idea if iterate polynomial such x^2-c, differences between values of iterates mod n tend candidates numbers share nontrivial factors n. because (by chinese rem...

javascript - Formatting Elements After an Ajax Call -

i'm trying have ajax call apply formatting elements won't exist until complete. using success function in actual call isn't working. function called element ('.content-cell') isn't found, presumably because doesn't exist yet. majority of similar answers address event delegation not applying styles. am approaching correctly? best method applying styling , handlers after ajax retrieval? $("#calendar-panel").load("url", setupcal()); function setupcal(){ console.log("setupcal"); var cell_width = $('.weekday-cell').width(); if ($('.content-cell').length){ console.log("content cell exists"); } else { console.log("content cell not exist"); } $('.content-cell').css({height:cell_width}); the console output of code is: 'setupcal'; 'content cell not exist'. i think issue might calling setupcal function in line execu...

gnu make - What does the following makefile command do? /no-symbols-control-file -

i cam across following command in makefile: %-nosyms.$(target).elf: %.co $(project_objectfiles) $(interrupt_objectfiles) contiki-$(target).a $(cc) $(cflags) -o $@ $(filter-out %.a,$^) $(filter %.a,$^) $(filter %.a,$^) $(ldflags) source: contiki/cpu/arm/stm32f103/makefile.stm32f103 . does command generate no-symbols-control-file? use of no symbol image file? piece piece analysis: the makefile's target is: %-nosyms.$(target).elf the list of prerequisites is: %.co $(project_objectfiles) $(interrupt_objectfiles) contiki-$(target).a the target recipe is: $(cc) $(cflags) -o $@ $(filter-out %.a,$^) $(filter %.a,$^) $(filter %.a,$^) $(ldflags) makefile's logic is: if *-nosyms.$(target).elf file exists, compare file's timestamp of all pre-requisites. rebuild file (i.e., run given recipe) if of pre-requisites newer. if target marked .phony ) (seems not case), rebuild without checking timestamp. else, go each prerequisite recipe , execute 1 one (...

syntax - Checking, if optional parameter is provided in Dart -

i'm new dart , learning basics. the dart-homepage shows following: it turns out dart indeed have way ask if optional parameter provided when method called. use question mark parameter syntax. here example: void aligndinglearm(num axis, [num rotations]) { if (?rotations) { // parameter used } } so i've wrote simple testing script learning: import 'dart:html'; void main() { string showline(string string, {string printbefore : "line: ", string printafter}){ // check, if parameter set manually: if(?printbefore){ // check, if parameter set null if(printbefore == null){ printbefore = ""; } } string line = printbefore + string + printafter; output.appendtext(line); output.appendhtml("<br />\n"); return line; } showline("hallo welt!",printbefore: null); } the dart-editor marks questionmark error: multiple markers @ line - unexpec...

ruby - Issue with Rails migrations Postgresql -

i have strange problem rails migrations. db/migrate folder contains migration files , worked fine. few moment ago, created new file using rails g migration migrationname , generated new file. when had runned rake db:migrate rollbacks , schema version became 0. when run rake db:migrate nothing whereas db/migrate contains migrations. tried rake db:reset db:drop db:create db:migrate no migrations performed. says "migrations pending run rake db:migrate rails_env=development" i've done in vain. i'm confused. ever had problem? i've tried rails_env=development rake db:migrate --trace , returns: ** invoke db:migrate (first_time) ** invoke environment (first_time) ** execute environment ** invoke db:load_config (first_time) ** execute db:load_config ** execute db:migrate ** invoke db:_dump (first_time) ** execute db:_dump ** invoke db:schema:dump (first_time) ** invoke environment ** invoke db:load_config ** execute db:schema:dump running: rake db:migra...

geolocation - how to spoof location so google autocomplete API will provide local results, ideally with R -

Image
google has api downloading search suggestions: https://www.google.com/support/enterprise/static/gsa/docs/admin/70/gsa_doc_set/xml_reference/query_suggestion.html unfortunately, far can tell, these results specific location. analysis, able define city/location google thinks making suggestion to. here's happens when scrape dar es salaam, tanzania: http://suggestqueries.google.com/complete/search?client=firefox&q=insurance ["insurance",["insurance","insurance companies in tanzania","insurance group of tanzania","insurance principles","insurance act","insurance policy","insurance act tanzania","insurance act 2009","insurance definition","insurance industry in tanzania"]] i understand vpn partially solve issue, giving me different location , not lots of locations. there reasonable way replicate sort of thing , from, say, 100 largest cities in united states? ...

php - Select all fields from a table where a field in another table with an ID is equal to a string -

i have 2 tables: ads : fields id , a , b , c : +----+---+-------+------+ | id | | b | c | +----+---+-------+------+ | 1 | x | y | z | | 2 | c | v | b | | 3 | n | n | m | +----+---+-------+------+ requests : fields id , adid , , status : +----+------+----------+ | id | adid | status | +----+------+----------+ | 3 | 1 | pending | | 4 | 2 | approved | | 5 | 3 | pending | +----+------+----------+ id (from ads ) = adid (from requests ). now, want records ads adid 's (from requests ) status equals pending . adid here the value id ads . so, above tables, result i'd id 1 , 3 ads: +----+---+---+---+ | id | | b | c | +----+---+---+---+ | 1 | x | y | z | | 3 | n | n | m | +----+---+---+---+ this closest i've got far, doesn't work because can select 1 row - whereas need select many: select * ads id = (select adid requests status = 'pending') this might not make sense - please ask if haven...

C# delegate: literal constructor -

this question has answer here: c# delegate instantiation vs. passing method reference 3 answers suppose have delegate in c#: public delegate void exampledelegate(); and somewhere have samplemethod want delegate reference: exampledelegate sample = new exampledelegate(samplemethod); what i've seen people in 2 lines instead this: exampledelegate sample; sample = samplemethod; is same line above in terms of functionality or there (unintended) side effect going on? basically, don't understand difference between: exampledelegate sample = new exampledelegate(samplemethod); and exampledelegate sample; = samplemethod; they seem working same.. there no difference, same. second implicit method group conversion. this syntax introduced in c# 2.0 , covered in programming guide in how to: declare, instantiate, , use delegate .