Monday 15 August 2011

significance of -si in any linux command -



significance of -si in any linux command -

what significance of -si in linux command write logs in csv file. want know exact role -si part play in entire command write perfmon logs csv file.

thanks in advance

linux command perfmon

ios - Pushing a navigation controller after a modal view controller is presented -



ios - Pushing a navigation controller after a modal view controller is presented -

i have tab view controller has button , when gets pressed modal appears:

postviewcontroller *post = [[postviewcontroller alloc] init]; // [self.navigationcontroller pushviewcontroller:post animated:yes]; // presentation [self presentviewcontroller:post animated:yes completion:nil];

when modal done want dismiss , force new view controller so:

profilesviewcontroller *profile = [[profilesviewcontroller alloc] init]; [self.navigationcontroller pushviewcontroller:profile animated:yes];

but can't in post vc modal. how do this?

you can seek using completionblock.

completionblock called when presentviewcontroller done.

postviewcontroller *post = [[postviewcontroller alloc] init]; [con presentviewcontroller:post animated:yes completion:^{ profilesviewcontroller *profile = [[profilesviewcontroller alloc] init]; [self.navigationcontroller pushviewcontroller:profile animated:yes]; }];

more info presentviewcontroller:animated:completion: apple doc

completion : block execute after presentation finishes. block has no homecoming value , takes no parameters. may specify nil parameter.

ios uiviewcontroller uinavigationcontroller uitabview

MySQL ADD_DATE for date equal to or after today -



MySQL ADD_DATE for date equal to or after today -

i want display date calculate within query if date equal or after current date. in table have 'created' field, date on deposit business relationship opened (timestamp), , 'maturity' field, number in months. calculate next maturity this:

date_add(from_unixtime(created), interval maturity month)

but when seek add together comparison:

(date_add(from_unixtime(created), interval maturity month) >= now()) next_maturity

i '01.01.1970'.

could help me please?

edit: seems need more complicated query, perhaps 1 in repeat() function implemented. so, tried this:

select *, repeat date_add(from_unixtime(created), interval maturity month) next_maturity until next_maturity >= now()) end repeat next_maturity ?n

but query doesn't work @ all, returns empty array.

here's actual illustration of want do: created '05.02.2013' , maturity '2'. need add together maturity created many times necessary next_maturity equal or after today.

mysql date

html - Java Read spcific items such as Title -



html - Java Read spcific items such as Title -

this question has reply here:

which html parser best? [closed] 3 answers

what i'm trying accomplish read text (html) website have entered , stored in str1. have been able open website , print of html code inside. want print words between <title><\title> can print title of page.

url oracle = new url(str1); bufferedreader in = new bufferedreader( new inputstreamreader(oracle.openstream())); string inputline; while ((inputline = in.readline()) != null) system.out.println(inputline); in.close();

you utilize stringbuilder read out lines , append them have websites source in 1 string. can search <title> or </title> in string.

look @ string functions indexof or split, what's between tags.

i'd recommend reading this. http://docs.oracle.com/javase/6/docs/api/java/lang/string.html

java html url bufferedreader

pointers - C++ Binary Tree -



pointers - C++ Binary Tree -

alright, i've been debugging few hours , getting nowhere. i'm trying test straightforward recursion-using binary tree.

when tested, stack overflow @ 3rd phone call in main's print_attributes function (noted below). quick inspection of callstack shows it's total of hundreds of calls bintree's bintree's height(node < t >* node) (also noted below). when "go-to" phone call call stack, takes me size(node < t >* node)'s phone call of leftside = size(node->left) (also noted below). don't know that's supposed indicate, because neither of these functions phone call each other.

here's image of compiler says right stack overflow occurs (i'm using vs2013): http://puu.sh/ca3ti/e00f653282.png

then here's image of compiler, after breaking, , clicking of height() calls in phone call stack: http://puu.sh/ca2qz/d35348ccce.png

considering (appears be) inserting nodes tree fine before while using bintree's height()and/or size() function, have no thought why same function begins having issues here. i'm sorry not beingness able able more explain issue is. i've been coding few years i'm lost this. i've tried provide much info perchance could. give thanks much takes time help this.

node class:

#include "340.h" #ifndef h_node #define h_node // definition class of nodes in bin tree template < class t > class bintree; // forwards declaration template < class t > class node { friend class bintree < t >; // bintree friend public: // default constructor node ( const t& x = t ( ), node < t >* l = 0, node < t >* r = 0 ) : info ( x ), left ( l ), right ( r ) { } private: t data; // info component node < t > *left, *right; // left , right links }; #endif

nodetree class:

#include "node.h" #ifndef h_tree #define h_tree template < class t > class bintree { public: bintree(node < t >* emptyroot = nullptr) : // default constructor root(emptyroot) { } bool empty() const // checks if tree empty { if (root == 0) homecoming true; else homecoming false; } unsigned size() const // returns no of nodes { if (root == 0) homecoming 0; else homecoming size(root); } unsigned height() const // returns height of tree { if (root == 0) homecoming 0; else homecoming height(root); } virtual void insert(const t& t) // inserts node in shortest subtree { if (empty()) { node< t >* n = new node< t >; n->data = t; root = n; } else insert(root, t); } protected: node < t >* root; // root of tree private: unsigned size(node < t >* node) const // private version of size ( ) { unsigned leftside; unsigned rightside; if (node->left == 0) leftside = 0; else leftside = size(node->left); //******issue(?) here****** if (node->right == 0) rightside = 0; else rightside = size(node->right); return(leftside + rightside + 1); } unsigned height(node < t >* node) const // private version of height ( ) //*****issue(?) here************ { unsigned leftside; unsigned rightside; if (node->left == 0) leftside = 0; else leftside = height(node->left); if (node->right == 0) rightside = 0; else rightside = height(node->right); homecoming 1 + max(leftside, rightside); } void insert(node < t >* node, const t& t) // private version of insert ( ) { if (node->left == 0) { node< t >* n = new node< t >; n->data = t; root = n; node->left = n; return; } else if (node->right == 0) { node< t >* n = new node< t >; n->data = t; root = n; node->right = n; return; } unsigned lefth = height(node->left); unsigned righth = height(node->right); if (lefth <= righth) { insert(node->left, t); } else { insert(node->right, t); } } }; #endif

main:

#include "bintree.h" // vectors used in testing const vector < int > { 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15 }; // prints out val passed argument template < class t > void print ( t& x ) { cout << x << ' '; } // increments val passed argument template < class t > void increment ( t& x ) { x++; } // decrements val passed argument template < class t > void decrement ( t& x ) { x--; } // prints out attributes, such size , height of bin tree, // , prints out info val in each node in inorder, preorder, // , postorder template < class t > void print_attributes ( bintree < t >& tree, const string& name ) { cout << name; // print name of tree // check if tree empty cout << ": tree " << ( tree.empty ( ) ? "" : "not " ) << "empty\n"; // print size , height of tree cout << "\tno of nodes = " << setw ( 2 ) << tree.size ( ) << "\n\theight of tree = " << setw ( 2 ) << tree.height ( ) << endl << endl; //*******issue here************ system("pause"); homecoming 0; }

firstly, in class bintree, both size() , height() methods have next line:

if (root = 0)

obviously should ==.

the actual stack overflow problem though seems caused insert function. takes first parameter, node reference. when phone call insert(root, t), node ends reference root. when new node allocated in insert, root set point new node, , changes node reference well.

if utilize debugger set breakpoint @ top of insert function , step through can watch values change.

what means root , node same thing, when set node->left = n or node->right = n node ends pointing @ itself.

all should have prepare alter definition of insert pass node value rather reference:

void insert(node < t >* node, const t& t) // private version of insert ( )

c++ pointers recursion binary-tree stack-overflow

zend framework - Apigility content validator - enable to fetch service validator -



zend framework - Apigility content validator - enable to fetch service validator -

i next tutorials on https://apigility.org/documentation/content-validation/basic-usage. but, when tried inject input filter service addressbook\v1\rest\contact\validator in contactresource, next error:

zend\servicemanager\exception\servicenotfoundexception file: /users/.../src/apigility-tutorials/vendor/zendframework/zendframework/library/zend/servicemanager/servicemanager.php:529 message: zend\servicemanager\servicemanager::get unable fetch or create instance addressbook\v1\rest\contact\validator

i not sure if it's issue apigility itself, why i'm asking if illustration shown in link above works when using dependency injection. thanks

got it. according zf-content-validation doc, input filter registered through zend\inputfilter\inputfilterpluginmanager means have inputfiltermanager service first contact input filter service follows:

$inputfilter = $servicelocator->get('inputfiltermanager') ->get('addressbook\v1\rest\contact\validator');

thanks looking it.

zend-framework apigility

python subprocess with /dev/zero input -



python subprocess with /dev/zero input -

i'm trying write in python next command : netcat ip port < /dev/zero works in terminal , far attempts in python failed miserably hints please ?

fd = os.open("/dev/zero", os.o_rdonly); buf = os.read(fd, 1024) os.close(fd) ip='192.168.1.45' port= 56 netc =subprocess.popen(['netcat',ip,str(port)],stdin=buf)

stdin needs python file object. fortunately, there 1 handy...

import subprocess ip='192.168.1.45' port= 56 open("/dev/zero", "rb", 0) file: netc = subprocess.popen(['netcat', ip, str(port)], stdin=file)

python subprocess

python - How do I pass a variable by reference? -



python - How do I pass a variable by reference? -

the python documentation seems unclear whether parameters passed reference or value, , next code produces unchanged value 'original'

class passbyreference: def __init__(self): self.variable = 'original' self.change(self.variable) print self.variable def change(self, var): var = 'changed'

is there can pass variable actual reference?

arguments passed assignment. rationale behind twofold:

the parameter passed in reference object (but reference passed value) some info types mutable, others aren't

so:

if pass mutable object method, method gets reference same object , can mutate heart's delight, if rebind reference in method, outer scope know nil it, , after you're done, outer reference still point @ original object.

if pass immutable object method, still can't rebind outer reference, , can't mutate object.

to create more clear, let's have examples.

list - mutable type

let's seek modify list passed method:

def try_to_change_list_contents(the_list): print 'got', the_list the_list.append('four') print 'changed to', the_list outer_list = ['one', 'two', 'three'] print 'before, outer_list =', outer_list try_to_change_list_contents(outer_list) print 'after, outer_list =', outer_list

output:

class="lang-none prettyprint-override">before, outer_list = ['one', 'two', 'three'] got ['one', 'two', 'three'] changed ['one', 'two', 'three', 'four'] after, outer_list = ['one', 'two', 'three', 'four']

since parameter passed in reference outer_list, not re-create of it, can utilize mutating list methods alter , have changes reflected in outer scope.

now let's see happens when seek alter reference passed in parameter:

def try_to_change_list_reference(the_list): print 'got', the_list the_list = ['and', 'we', 'can', 'not', 'lie'] print 'set to', the_list outer_list = ['we', 'like', 'proper', 'english'] print 'before, outer_list =', outer_list try_to_change_list_reference(outer_list) print 'after, outer_list =', outer_list

output:

class="lang-none prettyprint-override">before, outer_list = ['we', 'like', 'proper', 'english'] got ['we', 'like', 'proper', 'english'] set ['and', 'we', 'can', 'not', 'lie'] after, outer_list = ['we', 'like', 'proper', 'english']

since the_list parameter passed value, assigning new list had no effect code outside method see. the_list re-create of outer_list reference, , had the_list point new list, there no way alter outer_list pointed.

string - immutable type

it's immutable, there's nil can alter contents of string

now, let's seek alter reference

def try_to_change_string_reference(the_string): print 'got', the_string the_string = 'in kingdom sea' print 'set to', the_string outer_string = 'it many , many year ago' print 'before, outer_string =', outer_string try_to_change_string_reference(outer_string) print 'after, outer_string =', outer_string

output:

class="lang-none prettyprint-override">before, outer_string = many , many year ago got many , many year ago set in kingdom sea after, outer_string = many , many year ago

again, since the_string parameter passed value, assigning new string had no effect code outside method see. the_string re-create of outer_string reference, , had the_string point new string, there no way alter outer_string pointed.

i hope clears things little.

edit: it's been noted doesn't reply question @david asked, "is there can pass variable actual reference?". let's work on that.

how around this?

as @andrea's reply shows, homecoming new value. doesn't alter way things passed in, allow info want out:

def return_a_whole_new_string(the_string): new_string = something_to_do_with_the_old_string(the_string) homecoming new_string # phone call my_string = return_a_whole_new_string(my_string)

if wanted avoid using homecoming value, create class hold value , pass function or utilize existing class, list:

def use_a_wrapper_to_simulate_pass_by_reference(stuff_to_change): new_string = something_to_do_with_the_old_string(stuff_to_change[0]) stuff_to_change[0] = new_string # phone call wrapper = [my_string] use_a_wrapper_to_simulate_pass_by_reference(wrapper) do_something_with(wrapper[0])

although seems little cumbersome.

python reference pass-by-reference argument-passing

asp.net mvc 4 - AsyncController used to run a console application -



asp.net mvc 4 - AsyncController used to run a console application -

there's few questions address async controller workings none quite deal needed. someone's done , can tell me if i'm doing wrong.

i've got combination of web application deals configuring tasks , console application counterpart deals running configured tasks. wanted able run tasks web application clicking button on command returned user , task executed in background. asynccontroller seems perfect match. both applications access same database using ef6, unity dependency injection , sql server 2012. web interface targeting .net 4.5 on mvc4.

i can run console application fine without hitch. can trigger run web interface using below code. problem when triggered through web application, task run point (i can see in logs (nlog)) stops executing until rebuild solution - solution contains both applications, replace .exe beingness run. don't pauses when run console application directly.

it's first time using task , i'm bit shy process class too. please don't harsh if i'm doing incredibly stupid.

here's code controller:

public class taskrunnercontroller : asynccontroller { private readonly itaskprocessservice _taskprocessservice; private readonly iauthenticationcontext _context; private readonly iservicebase<task> _taskservice; public taskrunnercontroller(itaskprocessservice taskprocessservice, iauthenticationcontext context, iservicebase<task> taskservice) { _taskprocessservice = taskprocessservice; _context = context; _taskservice = taskservice; } private string taskrunnerexe { { var setting = configurationmanager.appsettings["taskrunner.exe"]; guard.against<configurationerrorsexception>(string.isnullorempty(setting), "missing configuration setting: taskrunner.exe"); homecoming setting; } } [customauthorize(typeof(canrun))] public actionresult runtaskasync(long id) { var task = _taskservice.find(i => i.taskid == id); guard.againstload(task, id); var fileinfo = new fileinfo(taskrunnerexe); guard.against<configurationerrorsexception>(!fileinfo.exists, "taskrunner not found @ specified location: {0}", taskrunnerexe); var taskprocess = _taskprocessservice.schedule(task, _context.principal.identifier); asyncmanager.outstandingoperations.increment(); system.threading.tasks.task.factory.startnew(() => { processstartinfo info = new processstartinfo(fileinfo.fullname, string.format("{0} {1}", task.taskid, taskprocess.taskprocessid)); info.useshellexecute = false; info.redirectstandardinput = true; info.redirectstandardoutput = true; info.createnowindow = true; var process = new process { startinfo = info, enableraisingevents = true }; process.exited += (sender, e) => { asyncmanager.outstandingoperations.decrement(); }; process.start(); }); if (_context.principal.haspermission<canviewlist>()) homecoming redirecttoaction("index", "tasks"); homecoming redirecttoaction("index", "home"); } public actionresult runtaskprogress() { homecoming view(); } public actionresult runtaskcompleted() { homecoming content("completed", "text/plain"); } }

dependencies:

taskprocessservice: repository each event of task runs context: keeps info current user taskservice: repository tasks

the console application (.exe) exits when it's finished. mentioned, when invoked through web application, task finish when rebuild application - @ point should - seems working whole time, stopped logging or reporting @ point in process.

perhaps it's of import - had seek @ without async controller, same setup - run process, wrapped in task had same end effect. thought process beingness killed when main thread returned pool, that's why tried asynccontroller.

if open task manager can see process exe sits there idle. application logs it's progress point sits there. problem vs? i'm using vs2012.

am wrong wrap process task? there way run executable straight via task class , action class?

many insight.

more likely, application beingness terminated because worker process ends. iis terminate threads or kid processes running under requests thread after has finished.

as such, it's not viable you're doing. move console app schedule task, , trigger scheduled task web application.

asp.net-mvc-4 process console-application executable asynccontroller

objective c - How do I Isolate an Event's Title/Time in a variable to display on Storyboard? -



objective c - How do I Isolate an Event's Title/Time in a variable to display on Storyboard? -

here's total description of problem: fetching events of calendar total day (i.e.today) , storing them in array. how isolate next relevant (one has not passed) event's title , time array display them separately labels? here's code:

//load calendar events ekeventstore *store = [[ekeventstore alloc] init]; [store requestaccesstoentitytype:ekentitytypeevent completion:^(bool granted, nserror *error) { if (granted) { nslog(@"user has granted permission"); // appropriate calendar nscalendar *calendar = [nscalendar currentcalendar]; // create start date components nsdatecomponents *begindaycomponents = [[nsdatecomponents alloc] init]; begindaycomponents.day = 0; nsdate *todaystart = [calendar datebyaddingcomponents:begindaycomponents todate:[nsdate date] options:0]; // create end date components nsdatecomponents *enddaycomponents = [[nsdatecomponents alloc] init]; enddaycomponents.day = 0; nsdate *todayend = [calendar datebyaddingcomponents:enddaycomponents todate:[nsdate date] options:0]; // create predicate event store's instance method nspredicate *predicate = [store predicateforeventswithstartdate:todaystart enddate:todayend calendars:nil]; // fetch events match predicate nsarray *events = [store eventsmatchingpredicate:predicate]; nslog(@"here events in array, %@", events); } else { nslog(@"user has not granted permission"); } }];

thanks in advance, , have day!

as apple states in ekeventstore-documentation have sort array first, next pending event @ index 0.

note: retrieving events calendar database not homecoming events in chronological order. sort array of ekevent objects date, phone call sortedarrayusingselector: on array, providing selector comparestartdatewithevent: method.

i'd suggest pick ekevent-object @ index 0 of array , read properties , set them on label.

ekevent *event = [events objectatindex:0]; yourtitlelabel.text = event.text; nsdateformatter *formatter = [[nsdateformatter alloc] init]; formatter.dateformat = @"dd.mm hh:mm"; yourdatelabel.text = [formatter stringfromdate:event.startdate];

edit: sort array events this:

events = [events sortedarrayusingselector:@selector(comparestartdatewithevent:)];

for work, have import eventkit/eventkit.h

objective-c ekevent

java - webjars -> HTTP 406 -



java - webjars -> HTTP 406 -

i creating basic little web application using spring boot, thymeleaf , webjars.

what want: include jquery , bootstrap using webjars

what did: included dependencies pom.xml

<dependency> <groupid>org.webjars</groupid> <artifactid>bootstrap</artifactid> <version>3.2.0</version> </dependency> <dependency> <groupid>org.webjars</groupid> <artifactid>jquery</artifactid> <version>2.1.1</version> </dependency>

i added jquery template index.html:

<script src="/webjars/jquery/2.1.1/jquery.min.js" type="text/javascript"></script>

problem: although thymeleaf jars in /lib directory , looks right me, not work. html file shown in browser shows script line, trying fetch jquery library straight (click on source in chrome browser) ends http 406 error, while path shown http://localhost:8080/webjars/jquery/2.1.1/jquery.min.js:

whitelabel error page application has no explicit mapping /error, seeing fallback. fri oct 17 09:34:32 cest 2014 there unexpected error (type=not acceptable, status=406). not find acceptable representation

how configure webmvc?

here can find introduction how utilize webjars spring webmvc.

java spring-boot thymeleaf webjars

java - autowire distinct beans in abstract class -



java - autowire distinct beans in abstract class -

i have next problem:

suppose have abstract class lets say:

public abstract class abstracthbmdao implements someinterface { @autowired protected sessionfactory sessionfactory; //getters & setters //interface stuff }

then several implementations of someinterface -> a_interface, b_interface, etc. ok if utilize same sessionfactory every implementation.

the problem want utilize distinct sessionfactory distinct grouping of of implementations , not want specify @qualifier. less flexible define these groups since need alter code. putting sessionfactory in abstract class if impossible specify @qualifier annotation.

is there way in xml bean definition ? tried declaring 2 sessionfactory beans , each of ref corresponding class, still homecoming nouniquebeandefinitionexception.

field injection fragile on own, , constructor injection should preferred whenever possible. that's clean solution here: create abstract (protected) constructor on base of operations class takes bean argument, , utilize @qualifier on subclass constructors.

java spring spring-annotations spring-bean

How to make webview content editable in android? -



How to make webview content editable in android? -

i displaying info in webview. need create content editable 1 time user clicks on displayed info. keyboard should appear well. tried setting contenteditable = true webview. works in ios, not sure how in android. please suggest if can done or other way accomplish editing info? tia

android android-webview contenteditable

Internet issue in Android SDK 5.0 API 21Emulator -



Internet issue in Android SDK 5.0 API 21Emulator -

i trying test android app on emulator.i using vpn , vpn proxy settings connect net on machine.so in previous version of android emulator,i setting vpn proxy on emulator net connection on emulator.but in latest sdk (sdk 5.0),this not working.does experience issue.please advise.

thanks in advance

i'm experiencing such issue, , emulator stops because isvalidfd(fd) returns number higher 1024.

i've found workaround working, @ to the lowest degree in case: launching emulator command line -no-audio parameter added.

android android-emulator

angularjs - In Angular, what's the point of a service? -



angularjs - In Angular, what's the point of a service? -

in angular documentation services, came across code:

angular. module('myservicemodule', []). controller('mycontroller', ['$scope','notify', function ($scope, notify) { $scope.callnotify = function(msg) { notify(msg); }; }]). factory('notify', ['$window', function(win) { var msgs = []; homecoming function(msg) { msgs.push(msg); if (msgs.length == 3) { win.alert(msgs.join("\n")); msgs = []; } }; }]);

my question is, why not much simpler , define function notify within $scope.callnotify function?

if services functions defined elsewhere, aren't there much simpler ways of accomplishing same thing?

just think resuing code in controller; not able it.

but if place in service, can injected , reused everywhere.

angularjs service

php - iOSpush notification return code 102 -



php - iOSpush notification return code 102 -

i'm running force notification form server iphone.

... ... // encode payload json

$payload = json_encode($body);

// build binary notification

$msg = chr(0) . pack('n', 32) . pack('h*', $devicetoken) . pack('n', strlen($payload)) . $payload;

$result = fwrite($fp, $msg, strlen($msg));

when echo $result. shown "102". mean?

1xx informational

**102 processing (webdav; rfc 2518)**

as webdav request may contain many sub-requests involving file operations, may take long time finish request. code indicates server has received , processing request, no response available yet.[2] prevents client timing out , assuming request lost. source of wikipedia list of http status codes

php ios

ruby on rails - heroku push error: "rake assets:precompile rake aborted!" -



ruby on rails - heroku push error: "rake assets:precompile rake aborted!" -

i'm trying force changes heroku next command: git force heroku master

when running rake assets:precompile, next error(s):

-----> preparing app rails asset pipeline running: rake assets:precompile rake aborted! nameerror: undefined local variable or method `fkalkhalidi' #<pinteresting::application:0x007f48fd2d6fc0> /tmp/build_deb19ff2fabe605365740a1f29b87f8b/config/environments/production.rb:80:in `block in <top (required)>' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/railtie.rb:210:in `instance_eval' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/railtie.rb:210:in `configure' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/config/environments/production.rb:1:in `<top (required)>' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/engine.rb:594:in `block (2 levels) in <class:engine>' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/engine.rb:593:in `each' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/engine.rb:593:in `block in <class:engine>' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:30:in `instance_exec' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:30:in `run' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:55:in `block in run_initializers' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:44:in `each' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:44:in `tsort_each_child' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:54:in `run_initializers' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/application.rb:300:in `initialize!' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/config/environment.rb:5:in `<top (required)>' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/application.rb:276:in `require_environment!' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/application.rb:389:in `block in run_tasks_blocks' /tmp/build_deb19ff2fabe605365740a1f29b87f8b/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.2.0/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define' tasks: top => environment (see total trace running task --trace) ! ! precompiling assets failed. ! ! force rejected, failed compile ruby app

appreciate help. first time learning ror.

what's within file config/environments/production.rb @ line 80?

search code, in production.rb file. it's there fkalkhalidi string somewhere causing error.

ruby-on-rails git heroku

c++ - Resolving shadowing of local scope with class scope -



c++ - Resolving shadowing of local scope with class scope -

the scope resolution operator can used resolve name clashes between class scope , global scope (as shown in initialization of g::sum below). possible resolve similar clashes between local class' scope , surrounding local scope (as (not) shown in initialization of l::sum below)?

#include <cassert> int clash_g = -332; struct g { int clash_g = 333; int sum = clash_g + ::clash_g; }; int main() { int clash_l = -332; struct l { int clash_l = 333; int sum = clash_l + clash_l; }; assert(g().sum == 1); assert(l().sum == 666); // want 1, in g::sum }

first of clash_l -332 not 333 reply cannot resolve such clash because struct a datatype declaration , main function local scope not global scope can't address variable in main function struct even if have different names

edit: still can't access "surrounding local scope" ask because you're in struct definition new datatype definition work around declare static variable in main

static int x = -332

and phone call in struct

int sum = clash_l + x;

c++ scope

c# - How can I send DropDownList's SelectedValue to the Controller from View with BeginForm? -



c# - How can I send DropDownList's SelectedValue to the Controller from View with BeginForm? -

how can send dropdownlist's selectedvalue controller view beginform?

here's code:

@using (html.beginform(new { newvalue=ddl.selectedvalue})) { @html.dropdownlist("categories", (list<selectlistitem>)viewdata["categories"], new { onchange = "this.form.submit()", id = "ddl" })

do not utilize viewdata or viewbag in place of model. it's sloppy, prone error , unorganized way of giving view data.

{ newvalue=ddl.selectedvalue} going nil when placed on form itself. need understand you're writing evaulated on server before beingness sent downwards client. if newvalue resolves 1 go on remain 1 forever unless have javascript changes on clientside (which you're not doing , shouldn't doing).

first need model:

public class categorymodel() { public ienumberable<selectlistitem> categorieslist {get;set;} public int selectedcategoryid {get;set;} }

controller

public class categorycontroller() { public actionresult index() { var model = new categorymodel(); model.categorieslist = new list<selectlistitem>{...}; homecoming view(model); } public actionresult savecategory(categorymodel model) { model.selectedcategoryid ... } }

view

@model categorymodel @using(html.beginform("savecategory","category")) { @html.dropdownlistfor(x=> x.selectedcategoryid, model.categorieslist) <button type="submit">submit</button> }

what's happening here selectlist beingness populated ienumerable , it's form name selectedcategoryid, that's posed server.

i'm not sure knowledge of http , html ends, should not using framework until understand how http , html work , these helpers such begin form , html.dropdownlist doing you. understand how screw works before seek utilize screw driver.

c# asp.net-mvc entity-framework

c++ - How can I store data to be accessed as if along a value line? -



c++ - How can I store data to be accessed as if along a value line? -

i working on model importer simple game engine, importing handled simple (for lovely compatibility) i'm stuck on how should organize bones , animations.

as each bone holding list of timing values , matrices (a timing , matrix per keyframe), i'd of course of study need access matrices using value won't exact keyframe time, how store info in such way may nearest matrix of lower timing value , nearest matrix of higher timing value, may interpolate them?

c++ animation dictionary map linear

ios - View Controller Segue from didSelectRowAtIndexPath -



ios - View Controller Segue from didSelectRowAtIndexPath -

trying set 4 different segues triggered 4 different cells in uitableview segue different view controllers in app. main menu embedded in navigation controller. setup segues command dragging main menu view controller 4 different view controllers. in didselectrowatindexpath switch indexpath.row , instantiate segues method. problem i'm running sigabrt crash when segue performed. prepareforsegue called know segue beingness triggered it's causing crash can't seem figure out. code posted below, help appreciated, give thanks you.

-(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { switch(indexpath.row) { case 0: break; case 1: { [self performseguewithidentifier:@"secondviewcontroller" sender:self]; //also tried passing in cell parameter "sender:" //doesnt work either. break; } //other segues performed in similar manner. case 2: break; case 3: break; case 4: break; case 5: break; } }

your segue configured "push" segue. means instance of secondviewcontroller pushed on navigation controller's navigation stack. (see push segues on apple's storyboard tutorial.)

however, table view controller isn't within navigation controller, impossible. (there's no stack of view controllers force on to.)

your simple choices:

change segue "show" (in xcode 6), or "modal" (in xcode 5) embed table view controller in navigation controller, there's stack force on to

more complex solutions involve building custom parent view controllers , defining custom transitions, i'm assuming that's not you're after.

some unrelated general information:

your effort alter "sender" doesn't matter. "sender" allow pass object want prepareforsegue:sender: method. parameter otherwise ignored. when crash, should read console, , stack trace. if can't figure out, include them on stack overflow question. my app crashed, what? first-class reading if you're new debugging stuff.

ios objective-c iphone uitableview swift

how to set prefetch when using spring rabbitmq -



how to set prefetch when using spring rabbitmq -

if using spring rabbitmq, how set prefetch size 1? utilize case send task definition in xml rabbitmq, , many working servers connect , task 1 one. since i'd have max performance , allow each server busy, should set prefetch 1 otherwise, server much busier other.

actually simplemessagelistenercontainer has setprefetchcount option, available rabbit namespace:

<rabbit:listener-container prefetch="1"> <rabbit:listener queues="foo, bar" ref="mylistener"/> </rabbit:listener-container>

spring rabbitmq

java - Error at SolrLoggerUsageEventListener that stop registering statistics -



java - Error at SolrLoggerUsageEventListener that stop registering statistics -

i have dspace 4.2 instalation throw next exception. same code work @ pc , other server. problem avoid statistical info registered.

has had similar problem?

error org.dspace.statistics.solrloggerusageeventlistener @ java.lang.nullpointerexception @ org.dspace.statistics.util.spiderdetector.isspider(spiderdetector.java:208) @ org.dspace.statistics.util.spiderdetector.isspider(spiderdetector.java:258) @ org.dspace.statistics.solrlogger.getcommonsolrdoc(solrlogger.java:287) @ org.dspace.statistics.solrlogger.postsearch(solrlogger.java:469) @ org.dspace.statistics.solrloggerusageeventlistener.receiveevent(solrloggerusageeventlistener.java:51) @ org.dspace.services.events.systemeventservice.firelocalevent(systemeventservice.java:144) @ org.dspace.services.events.systemeventservice.fireevent(systemeventservice.java:86) @ org.dspace.app.xmlui.cocoon.searchloggeraction.act(searchloggeraction.java:65) @ org.apache.cocoon.sitemap.impl.defaultexecutor.invokeaction(defaultexecutor.java:55) @ org.apache.cocoon.components.treeprocessor.sitemap.acttypenode.invoke(acttypenode.java:105) @ org.apache.cocoon.components.treeprocessor.abstractparentprocessingnode.invokenodes(abstractparentprocessingnode.java:55) @ org.apache.cocoon.components.treeprocessor.sitemap.matchnode.invoke(matchnode.java:87) @ org.apache.cocoon.components.treeprocessor.abstractparentprocessingnode.invokenodes(abstractparentprocessingnode.java:78) @

you experiencing next bug: https://jira.duraspace.org/browse/ds-2355

java dspace

c# - Automatically change subject of sent email -



c# - Automatically change subject of sent email -

is possible code/script/pop server or in configuration of outlook, alter subject of sent email, or whenever email auto populate 3rd party,

let's each time find "blank invoice" in subject replace "invoice", or have kind of macro find , replace automatically?

thanks.

sure, trap aplication.itemsend event, examine item passed parameter event handler, alter subject.

c# email vbscript outlook

d3.js - Avoid duplicate dates in d3js axes -



d3.js - Avoid duplicate dates in d3js axes -

i have many charts beingness generated dynamically. charts, dates near each other, so, axis labels getting repeated

example:

date format used:

d3.time.format("%d-%b-%y")

is there in-built way avoid duplication of labels? or there generic procedure can avoid such duplication? note charts have zooming feature , incoming info dynamic, can't set in hardcoded values of "ticks" or "tickvalues". generating ticks or tickvalues dynamically, way go.

thank @lars kotthoff helping out. basic solution:

var ticks = scale.ticks(userspecifiedticks); var nonduplicatetickvalues = []; var tickalreadyexists = function(tickvalin) { for(var i=0;i<nonduplicatetickvalues.length;i++) { var t = nonduplicatetickvalues[i]; var formattedtickvalin = formatter(tickvalin); var formattedtickval = formatter(t); if(formattedtickvalin == formattedtickval) {return true;} } homecoming false; }; var removeduplicateticks = function() { for(var i=0;i<ticks.length;i++) { var tickval = ticks[i]; if(!tickalreadyexists(tickval)) { nonduplicatetickvalues.push(tickval); } } }; scale.tickvalues(nonduplicatetickvalues);

here, formatter function like:

var formatter = function(d){ var format = d3.time.format("%d-%b-%y"); homecoming format(d); }

d3.js charts axis-labels

"non-integer arg 1 for randrange()" in python libary -



"non-integer arg 1 for randrange()" in python libary -

i utilize randomizer create random number 5 10. can't hard? have used on code (+2000 lines of code, much here) , no coding errors occurred.

my code easter egg game broke code:

... def slowp(t): l in t: sys.stdout.write(l) sys.stdout.flush() x=random.randint(0.1,0.9) time.sleep(x) print("") if act=="++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>": slowp("hey, hello world made in brainfuck!") ...

act string value provided user act=str(input("type here.")). straight done before part.

error message:

traceback (most recent phone call last): file "startgame.py", line 2084, in <module> slowp("hey, hello world made in brainfuck!") file "startgame.py", line 140, in slowp x=random.randint(0.1,0.9) file "/usr/lib/python3.4/random.py", line 216, in randint homecoming self.randrange(a, b+1) file "/usr/lib/python3.4/random.py", line 180, in randrange raise valueerror("non-integer arg 1 randrange()") valueerror: non-integer arg 1 randrange()

what actual problem?

you trying pass floating point values random.randint(). function takes integers.

you need utilize random.uniform() function instead; it'll produce uniformly random value between lower , upper bound (inclusive):

return random floating point number n such <= n <= b <= b , b <= n <= b < a.

demo:

>>> import random >>> random.uniform(0.1, 0.9) 0.6793304134926453

python python-3.x random

c# - ASP.NET Beginner: Form roundtrip with model validation -



c# - ASP.NET Beginner: Form roundtrip with model validation -

i'm beggining larn asp.net , c# week. until now, i've been developing in php , symfony quite big transition me. i'm learning asp.net book asp.net mvc 4 in action.

i'm trying validate model can't find online help newbie me. model validates contact form name, email , message. simple, right?. not me.

this model...

public class contactmodel { [required(errormessage = "the name has provided, fictional one")] public string name { set; get; } [required(errormessage = "email address has provided, invalid one")] [datatype(datatype.emailaddress)] public string email { set; get; } [required(errormessage = "don't lazy. write message")] [datatype(datatype.multilinetext)] public string message { set; get; } }

i have controller called contactcontroller. has these actions...

public actionresult contact() { contactmodel contactmodel = new contactmodel(); homecoming view(contactmodel); } [httppost] public viewresult savemodel(contactmodel model) { homecoming view(model); }

also, here razor template shows model in ui.

<div class="ui__main main__contact"> <h1 class="ui__main--sectionheader">contact administrators of life</h1> @using (html.beginform("savemodel", "contact", formmethod.post, new { @class="form form__contact" })) { <div class="form__row"> @html.labelfor(model => model.name, new { @class="form__label" }) @html.textboxfor(model => model.name, new { @class="form__texttype form__textinput" }) @html.validationmessagefor(model => model.name) </div> <div class="form__row"> @html.labelfor(model => model.email, new { @class = "form__label" }) @html.textboxfor(model => model.email, new { @class = "form__texttype form__textinput" }) </div> <div class="form__row"> @html.labelfor(model => model.message, new { @class="form__label" }) @html.textarea("message", new { @class = "form__texttype form__textarea" }) </div> <div class="form__row submit__row"> <input id="submit__button" type="submit" value="send" /> </div> }

when user submits form, form have go savemodel action in contactcontroller action attribute of <form> blank action="" don't think it's going save model. also, validation messages not displayed. tried @html.validationmessagefor displays text when don't submit form.

i don't know problem here allow lone find it.

if has suggestions, tutorials, articles or creating form in asp.net mvc 4 , razor, please give me.

i've read article doesn't solve problem. found this stack question , this stack question said, i'm newbie , don't understand problems in questions.

edit:

here routes of app...

routes.maproute( name: null, url: "", defaults: new { controller = "home", action="index" } ); routes.maproute( name: null, url: "contact", defaults: new { controller = "contact", action = "contact" } );

your action stays empty because mvc framework can not resolve url given controller+action. have explicitly define url in routing table:

routes.maproute( name: null, url: "contact/send-form", defaults: new { controller = "contact", action = "savemodel" } );

or can alternatively generate generic fallback route

routes.maproute( name: null, url: "{controller}/{action}", defaults: new { controller = "home", action = "index" } );

which result in controller/actions available direct urls.

alternatively; can utilize attribute routing routes defined straight @ actions, less looking here & there. have to:

add routes.mapmvcattributeroutes(); in registerroutes.cs append attributes actions [route("contact")]

you can re-use same route if http method differs:

[httpget] [route("contact"} public actionresult contact() { contactmodel contactmodel = new contactmodel(); homecoming view(contactmodel); } [httppost] [route("contact")] public viewresult contact(contactmodel model) { if(modelstate.isvalid){ //persist contact form, redirect somewhere } homecoming view(model);//re-render form error messages }

c# asp.net-mvc

java - Android: unable to retrieve date -



java - Android: unable to retrieve date -

i new android programming. trying retrieve info mysql database. unable retrieve data. code

public class news_updates extends activity implements view.onclicklistener { edittext ettitle, etdescription, etdate; // et edit text string title; string description; string date; inputstream = null; string result = null; string line = null; int code; jsonarray json_data; string custtitle[]; // cus means custom string custdescrption[]; string custdate[]; // listview declaration listview lvcust; context c; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_news__updates); lvcust = (listview) findviewbyid(r.id.mylistview); myasyncsearch asr = new myasyncsearch(); asr.execute(); } // insert asynctask class myasync extends asynctask<void, void, void> { @override protected void doinbackground(void... params) { // todo auto-generated method stub // insert(); homecoming null; } } // search async task search query class myasyncsearch extends asynctask<void, void, void> { @override protected void doinbackground(void... params) { // todo auto-generated method stub search(); homecoming null; } @override protected void onpostexecute(void result) { // todo auto-generated method stub super.onpostexecute(result); // fill listview records through myadapter myadapter aa = new myadapter(c, custtitle, custdescrption, custdate); lvcust.setadapter(aa); } } // search method extracting records public void search() { arraylist<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(); seek { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost( "http://10.0.0.1/fyp/admin/search_android.php"); httppost.setentity(new urlencodedformentity(namevaluepairs)); httpresponse response = httpclient.execute(httppost); httpentity entity = response.getentity(); = entity.getcontent(); log.e("pass 1", "connection success "); } grab (exception e) { log.e("fail 1", e.tostring()); } seek { bufferedreader reader = new bufferedreader(new inputstreamreader( is, "iso-8859-1"), 8); stringbuilder sb = new stringbuilder(); while ((line = reader.readline()) != null) { result = line; json_data = new jsonarray(result); } custtitle = new string[json_data.length()]; custdate = new string[json_data.length()]; custdescrption = new string[json_data.length()]; // processing result row row , storing in arrays called // custnamelist , custphonelist (int = 0; < json_data.length(); i++) { jsonobject jsonobject = json_data.getjsonobject(i); title = jsonobject.getstring("news_title"); date = jsonobject.getstring("news_date"); description = jsonobject.getstring("news_desc"); custtitle[i] = jsonobject.getstring("news_title"); // (news_title // database // field // name custdate[i] = jsonobject.getstring("news_date"); custdescrption[i] = jsonobject.getstring("news_desc"); } is.close(); } grab (exception e) { log.e("fail 2", e.tostring()); } } @override public void onclick(view v) { // todo auto-generated method stub } }

my logcat

11-07 09:59:34.296: e/androidruntime(1263): java.lang.nullpointerexception: storage == null 11-07 09:59:34.296: e/androidruntime(1263): @ java.util.arrays$arraylist.<init>(arrays.java:38) 11-07 09:59:34.296: e/androidruntime(1263): @ java.util.arrays.aslist(arrays.java:154) 11-07 09:59:34.296: e/androidruntime(1263): @ android.widget.arrayadapter.<init>(arrayadapter.java:141) 11-07 09:59:34.296: e/androidruntime(1263): @ com.example.bcs_final_project.myadapter.<init>(myadapter.java:17) 11-07 09:59:34.296: e/androidruntime(1263): @ com.example.bcs_final_project.news_updates$myasyncsearch.onpostexecute(news_updates.java:89) 11-07 09:59:34.296: e/androidruntime(1263): @ com.example.bcs_final_project.news_updates$myasyncsearch.onpostexecute(news_updates.java:1) 11-07 09:59:34.296: e/androidruntime(1263): @ android.os.asynctask.finish(asynctask.java:631) 11-07 09:59:34.296: e/androidruntime(1263): @ android.os.asynctask.access$600(asynctask.java:177) 11-07 09:59:34.296: e/androidruntime(1263): @ android.os.asynctask$internalhandler.handlemessage(asynctask.java:644) 11-07 09:59:34.296: e/androidruntime(1263): @ android.os.handler.dispatchmessage(handler.java:99) 11-07 09:59:34.296: e/androidruntime(1263): @ android.os.looper.loop(looper.java:137) 11-07 09:59:34.296: e/androidruntime(1263): @ android.app.activitythread.main(activitythread.java:5103) 11-07 09:59:34.296: e/androidruntime(1263): @ java.lang.reflect.method.invokenative(native method) 11-07 09:59:34.296: e/androidruntime(1263): @ java.lang.reflect.method.invoke(method.java:525) 11-07 09:59:34.296: e/androidruntime(1263): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:737) 11-07 09:59:34.296: e/androidruntime(1263): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553)

adapter code public class myadapter extends arrayadapter { string title[], date[], description[]; activity c;

@suppresswarnings("unchecked") public myadapter(context context, string ti[], string dt[], string des[]) { super(context, r.layout.custom_rows, r.id.title, ti); c = (activity) context; title = ti; date = dt; description = des; } @override public view getview(int position, view convertview, viewgroup parent) { // todo auto-generated method stub super.getview(position, convertview, parent); layoutinflater l = c.getlayoutinflater(); view v = l.inflate(r.layout.custom_rows, null); textview tv1 = (textview) v.findviewbyid(r.id.news_title); textview tv2 = (textview) v.findviewbyid(r.id.news_description); textview tv3 = (textview) v.findviewbyid(r.id.news_date); tv1.settext(title[position]); tv2.settext(description[position]); tv1.settext(date[position]); homecoming v; } }

looks me never instantiate 'c' variable, causing npe.

java android mysql eclipse android-asynctask

android - set a listener for widgets in items of a listview -



android - set a listener for widgets in items of a listview -

i meet problem developing android project. using adapter, place many items in listview, , there imagebutton in each item. want set click listener these imagebuttons. should do?

this achieves desired result. functionality button has click response different container, has response.

mainactivity.java

import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import java.util.arraylist; import android.app.activity; import android.os.bundle; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.listview; import android.widget.toast; public class mainactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.list); listview lv = (listview) findviewbyid( r.id.list ); lv.setonitemclicklistener( new onitemclicklistener() { public void onitemclick(adapterview<?> arg0, android.view.view arg1, int arg2, long arg3) { toast.maketext( mainactivity.this, "list item clicked", toast.length_short).show(); } }); arraylist<string> items = new arraylist<string>(); items.add( "item1"); items.add( "item2"); items.add( "item3"); listadapter adapter = new listadapter( this, items); lv.setadapter( adapter ); } }

listadapter.java

import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.view.view.onclicklistener; import android.widget.imagebutton; import android.widget.textview; import android.widget.baseadapter; import android.widget.toast; import java.util.list; public class listadapter extends baseadapter { public listadapter(context context, list<string> items ) { inflater = layoutinflater.from( context ); this.context = context; this.items = items; } public int getcount() { homecoming items.size(); } public object getitem(int position) { homecoming items.get(position); } public long getitemid(int position) { homecoming position; } public view getview(int position, view convertview, viewgroup parent) { string item = items.get(position); view v = null; if( convertview != null ) v = convertview; else v = inflater.inflate( r.layout.item, parent, false); textview itemtv = (textview)v.findviewbyid( r.id.item); itemtv.settext( item ); imagebutton button = (imagebutton)v.findviewbyid( r.id.button); button.setonclicklistener( new onclicklistener() { public void onclick(view v) { toast.maketext( context, "imagebutton clicked", toast.length_short).show(); } }); homecoming v; } private context context; private list<string> items; private layoutinflater inflater; }

item.xml

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:descendantfocusability="blocksdescendants" > <textview android:id="@+id/item" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:textsize="28sp" /> <imagebutton android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_centervertical="true" android:background="@android:color/transparent" android:src="@drawable/emo_im_cool" /> </relativelayout>

list.xml

<?xml version="1.0" encoding="utf-8" ?> <listview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/list" />

try out , can see what's going on larn need

android

algorithm - How to convert the half-spaces that constitute a convex hull to a set of extreme points? -



algorithm - How to convert the half-spaces that constitute a convex hull to a set of extreme points? -

i have convex set in euclidean space (3d, answers nd) characterized finite set of half-spaces (normal vector + point).

is there improve algorithm find extreme points of convex set other compute brute forcefulness points intersections of 3 (or, n) half-spaces , eliminate not extreme points?

the key term vertex enumeration of polytope p. thought of algorithm described below consider dual polytope p*. vertices of p correspond facets of p*. facets of p* efficiently computed qhull, , remains find vertices solving corresponding sub-systems of linear equations.

the algorithm implemented in bsd-licensed toolset analyze n-dimensional polyhedra in terms of vertices or (in)equalities matlab, authored matt j, specifically, component lcon2vert. however, purpose of reading algorithm , re-implementing language, easier work older , simpler con2vert file michael kleder, matt j's project builds on.

i'll explain step step. individual matlab commands (e.g., convhulln) documented on mathworks site, references underlying algorithms.

the input consists of set of linear inequalities of form ax<=b, matrix , b column vector.

step 1. effort locate interior point of polytope

first seek c = a\b, least-squares solution of overdetermined linear scheme ax=b. if a*c<b holds componentwise, interior point. otherwise, multivariable minimization attempted objective function beingness maximum of 0 , numbers a*c-b. if fails find point a*c-b<0 holds, programme exits "unable find interior point".

step 2. translate polytope origin interior point

this done b = b - a*c in matlab. since 0 interior point, entries of b positive.

step 3. normalize right hand side 1

this partition of ith row of b(i), done d = ./ repmat(b,[1 size(a,2)]); in matlab. on, matrix d used. note rows of d vertices of dual polytope p* mentioned @ beginning.

step 4. check polytope p bounded

the polytope p unbounded if vertices of dual p* lie on same side of hyperplane through origin. detected using built-in function convhulln computes volume of convex hull of given points. author checks whether appending 0 row matrix d increases volume of convex hull; if does, programme exits "non-bounding constraints detected".

step 5. computation of vertices

this loop

for ix = 1:size(k,1) f = d(k(ix,:),:); g(ix,:)=f\ones(size(f,1),1); end

here, matrix k encodes facets of dual polytope p*, each row listing vertices of facet. matrix f submatrix of d consisting of vertices of facet of p*. backslash invokes linear solver, , finds vertex of p.

step 6: clean-up

since polytope translated @ step 2, translation undone v = g + repmat(c',[size(g,1),1]);. remaining 2 lines effort eliminate repeated vertices (not successfully).

algorithm math geometry convex-hull polyhedra

android - arm-linux-androideabi/bin/ld: fatal error: -soname: must take a non-empty argument -



android - arm-linux-androideabi/bin/ld: fatal error: -soname: must take a non-empty argument -

i cross compiling gdcm cmake android goes till end of compilation @ lastly next error. how guys set -soname in cmake-gui or cmake while compiling libraries can avoid below kind of error.

/opt/android/android-ndk-r10c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux- androideabi/bin/ld: fatal error: -soname: must take non-empty argument collect2: error: ld returned 1 exit status make[2]: *** [/home/likewise-open/slktechlabs/kirtan.patel/desktop/gdcm/gdcmsource/libs/armeabi-v7a/libgdcmjni.so] error 1 make[1]: *** [wrapping/java/cmakefiles/gdcmjni.dir/all] error 2 make[1]: *** waiting unfinished jobs.... /home/kirtan.patel/desktop/gdcm/gdcmsource/source/mediastorageandfileformat/gdcmimagewriter.h:36: warning 822: covariant homecoming types not supported in java. proxy method homecoming gdcm::pixmap const &. /home/kirtan.patel/desktop/gdcm/gdcmsource/source/mediastorageandfileformat/gdcmimagecodec.h:45: warning 473: returning pointer or reference in director method not recommended.

as romanski pointed out cmake versions 3.2 , 3.0 have different behaviour because of difference in useswig.cmake files. in 3.2 no_soname property enabled default looks raises conflict in android build producing invalid linking alternative -wl,-soname, empty target_soname.

there 2 ways prepare build 3.2 version

string(replace "<cmake_shared_library_soname_cxx_flag><target_soname>" "" cmake_cxx_create_shared_module "${cmake_cxx_create_shared_module}") eliminates broken linking alternative @ all set_target_properties(${my_target} properties no_soname off) prepare broken linking alternative right so-name.

android c++ android-ndk cmake

objective c - Read and store multiple NSArray -



objective c - Read and store multiple NSArray -

can store info multiple nsmutablearrays in objective c single plist file? if how write file , how read it? or need separate file each array want store?

i typically read, 1 array:

nsarray *array = [[nsarray alloc] initwithcontentsoffile:filepath];

you either save array or dictionary contains 2 arrays want save.

nsarray *botharrays = [[nsarray alloc] initwithcontentsoffile:filepath]; nsassert(!botharrays || botharrays.count == 2, @"expecting array nil or contain 2 items"); nsarray *first = [botharrays firstobject]; nsarray *second = [botharrays lastobject];

objective-c xcode file nsarray plist

java - Google gson.toJson(List) returning response as string instead of array -



java - Google gson.toJson(List) returning response as string instead of array -

i trying utilize jsonobject convert java object string. next code using add together properties :

jsonobject jsonobject = new jsonobject(); jsonobject.addproperty("id", favoritewrapper.getid()); jsonobject.addproperty("menuitemid", favoritewrapper.getmenuitemid()); jsonobject.addproperty("displayname", favoritewrapper.getdisplayname()); jsonobject.addproperty("description", favoritewrapper.getdescription()); jsonobject.addproperty("alias", favoritewrapper.getalias()); gson gson = new gson(); jsonobject.addproperty("condiments", gson.tojson(favoritewrapper.getcondiments()));

here lastly property condiments list of long values , next response retrieved:

[ { "id": 1, "menuitemid": 1, "displayname": "ham", "description": "ham", "alias": "ham", "condiments": "[1,8,34,2,6]" } ]

expected output next different condiments:

[ { "id": 1, "menuitemid": 1, "displayname": "ham", "description": "ham", "alias": "ham", "condiments": [1,8,34,2,6] } ]

what should condiments json array rather string ?

i found reply problem. used jsonarray , jsonprimitive accomplish required response:

jsonobject jsonobject = new jsonobject(); jsonobject.addproperty("id", favoritewrapper.getid()); jsonobject.addproperty("menuitemid", favoritewrapper.getmenuitemid()); jsonobject.addproperty("displayname", favoritewrapper.getdisplayname()); jsonobject.addproperty("description", favoritewrapper.getdescription()); jsonobject.addproperty("alias", favoritewrapper.getalias()); jsonarray condiments = new jsonarray(); (long condimentid : favoritewrapper.getcondiments()) { condiments.add(new jsonprimitive(condimentid)); } jsonobject.add("condiments", condiments); jsonobjects.add(jsonobject);

java json gson arrays jsonobject

ruby on rails - Unpermitted parameter for :user when adding Devise custom fields -



ruby on rails - Unpermitted parameter for :user when adding Devise custom fields -

i have 2 types of users: normal users , pros.

pros users, have fields in separate table called :pros.

so , did separate registration form :pros, in included :users fields, , added fields_for new :pro fields.

i added new parameters application_controller, devise permits them.

when submiting registration form, user created, next error in logs:

started post "/users" 127.0.0.1 @ 2014-11-13 00:53:43 +0100 processing registrationscontroller#create html parameters: {"utf8"=>"✓", "authenticity_token"=>"zuvljfhhshohvuvnegnmcf46e4kpwainetw4o7ica7w=", "user"=>{"name"=>"asdasd", "email"=>"asdasd@sss.com", "password"=>"[filtered]", "password_confirmation"=>"[filtered]", "pros"=>{"type"=>"marca de decoración", "web"=>"asadasd", "telephone"=>"765876", "about"=>"sadasd"}, "tos_agreement"=>"1"}, "commit"=>"registrarme y aplicar para pro"} unpermitted parameters: pros

my view is:

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) |f| %> <%= f.label :name, "nombre de usuario" %> <%= f.text_field :name, :autofocus => true %> <%= f.label :email %> <%= f.email_field :email %> <%= f.label :password %> <%= f.password_field :password %> <%= f.label :password_confirmation %> <%= f.password_field :password_confirmation %> <%= f.fields_for :pro |pro| %> <%= pro.select :type,["marca de decoración","tienda de decoración","blogger"] %> <%= pro.text_field :web, placeholder: "http://www.miweb.com" %> <%= f.label :telephone, "teléfono" %> <%= pro.text_field :telephone, placeholder: "teléfono", label: "teléfono de contacto" %> <%= pro.text_field :about%> <% end %>

users controller new action

def pro_new render "devise/registrations/new-pro-registration" @user = user.create end

my model relations:

user.rb

has_one :pro accepts_nested_attributes_for :pro, allow_destroy: true

pro.rb

belongs_to :user

my application controller:

def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:name, :tos_agreement, :avatar, :avatar_cache, :email, :password, :password_confirmation, pros_attributes: [:pro_name, :pro_image, :is_active, :web, :user_id, :about, :facebook, :twitter, :linkedin, :telephone]) } end

i agree @smallbutton.com need alter pro_attributes instead of pros_attributes. can utilize params.require(:user).permit! if want take params.

ruby-on-rails devise

python - iRobot Create - Playing two songs -



python - iRobot Create - Playing two songs -

here's code:

import create robot = create.create(3) robot.tofullmode() robot.setsong(0,[(36,16),(36,16),(38,32),(36,32),(53,32),(52,32),\ (36,16),(36,16),(38,32),(36,32),(55,32),(41,32),\ (36,16),(36,16),(48,32),(33,32)]) robot.setsong(1,[(53,32),(40,32),(38,32),(34,16),(34,16),\ (33,32),(41,32),(43,32),(41,32)]) robot.playsongnumber(0) robot.playsongnumber(1)

the first song plays, sec 1 won't...any ideas why? beingness coded create.py python interface irobot create: http://www.cs.gmu.edu/~zduric/cs101/uploads/main/create.py

without seeing documentation or source code, wild guess, but…

i'll bet playsongnumber function sends robot play command, without waiting finish, , when send play command while it's playing something, ignores you.

if i'm right, api provides way wait until it's done. if doesn't provide that, provide way poll current state, can in loop (sleeping briefly between each check) until it's done. if doesn't provide that, have work out how long song take counting number of notes (or adding durations, if 1 of numbers in each of pairs duration) , sleep long.

python robotics robot mobile-robots

wordpress - Saving data from frontend into the database -



wordpress - Saving data from frontend into the database -

i in middle of creating plugin. plugin shows on frontend end user. want info user enters saved database. created custom post type.

so looking how can save info entered form record in new custom form type? @ out of box functions / hooks should look?

can give me direction example?

thanks.

you're looking wp_insert_post(). in plugin, you'll want add together form processing. example:

$post = array( 'post_name' => 'some-slug', 'post_title' => 'some title', 'post_status' => 'draft', 'post_type' => 'custom_post_type' ); wp_insert_post( $post );

wordpress

join - Add column average in output MySQL -



join - Add column average in output MySQL -

i want add together column of avg in existing output. first calculate usage of electricity , gas inner join. want add together avg of "day hour" output.

table columns

id, datum, tijd, consumed_rate1, consumed_rate2, gas

when want output of lastly 24 records usage of consumed_rate1, consumed_rate2 , gas, utilize query:

select a.datum datum, a.tijd tijd, a.daguur daguur, a.aantal aantal, a.consumed_rate1 + a.consumed_rate2 elektra, (a.consumed_rate1 + a.consumed_rate2 - b.consumed_rate1 - b.consumed_rate2) 'elektra verbruikt', a.gas gas, (a.gas - b.gas) 'gas verbruikt' smartmeter inner bring together smartmeter b on b.id = (a.id-1) order a.id desc limit 24

now want add together column avg of usage consumed_rate1 + consumed_rate2 , gas. think must work left joins, don’t know how. there body help me that?

try this:

select avg(elektra), avg(gas) from( select a.datum datum, a.tijd tijd, a.daguur daguur, a.aantal aantal, a.consumed_rate1 + a.consumed_rate2 elektra, (a.consumed_rate1 + a.consumed_rate2 - b.consumed_rate1 - b.consumed_rate2) 'elektra verbruikt', a.gas gas, (a.gas - b.gas) 'gas verbruikt', smartmeter inner bring together smartmeter b on b.id = (a.id-1) order a.id desc limit 24 )

mysql join average

termination - Proving equivalence of well-founded recursion -



termination - Proving equivalence of well-founded recursion -

in reply question assisting agda's termination checker recursion proven well-founded.

given function defined (and else in vitus's reply there):

f : â„• → â„• f n = go _ (<-wf n) go : ∀ n → acc n → â„• go 0 _ = 0 go (suc n) (acc a) = go ⌊ n /2⌋ (a _ (s≤s (/2-less _)))

i cannot see how prove f n == f ⌊ n /2⌋. (my actual problem has different function, problem seems boil downwards same thing)

my understanding go gets acc n computed in different ways. suppose, f n can shown pass acc ⌊ n /2⌋ computed a _ (s≤s (/2-less _)), , f ⌊ n /2⌋ passes acc ⌊ n /2⌋ computed <-wf ⌊ n /2⌋, cannot seen identical.

it seems me proof-irrelevance must used somehow, it's plenty have instance of acc n, no matter how computed - way seek utilize it, seems contaminate restrictions (eg pattern matching doesn't work, or irrelevant function cannot applied, etc).

termination agda

c# - asp:Login with LayoutTemplate creates persistent cookie regardless whether remember me is checked -



c# - asp:Login with LayoutTemplate creates persistent cookie regardless whether remember me is checked -

using .net 4 , asp.net login command custom layout template when sign in, regardless whether remember me checkbox checked or not, command seems create authentication cookie , maintain me signed in until explicitly sign out clicking sign out button. closing browser while still signed in not sign me out.

can help explain might causing this?

<asp:login id="login1" runat="server" onloggingin="login1_loggingin" onloggedin="login1_loggedin" onloginerror="login1_loginerror"> <layouttemplate> <asp:panel runat="server" defaultbutton="btnlogin"> <label>email</label>&nbsp;<div class="required">*</div>&nbsp; <asp:requiredfieldvalidator runat="server" controltovalidate="username" display="dynamic" errormessage="required" initialvalue="" setfocusonerror="true" validationgroup="login" /><br /> <asp:textbox runat="server" id="username" class="input" validationgroup="login" /> <label>password</label>&nbsp;<div class="required">*</div>&nbsp; <asp:requiredfieldvalidator runat="server" controltovalidate="password" display="dynamic" errormessage="required" initialvalue="" setfocusonerror="true" validationgroup="login" /><br /> <asp:textbox runat="server" id="password" textmode="password" class="input" style="margin:0 0 6px 0;" validationgroup="login" /> <asp:checkbox runat="server" id="rememberme" text="remember me" cssclass="remember-me" /> <asp:linkbutton runat="server" id="btnlogin" commandname="login" text="sign in" cssclass="login-button" validationgroup="login" /> </asp:panel> </layouttemplate> </asp:login> protected void login1_loggingin(object sender, logincanceleventargs e) { string username = login1.username.trim(); if (isvalid) { membershipuser user1 = membership.getuser(username); if (user1 != null) { if (membership.validateuser(user1.username, login1.password)) { login1.username = user1.username; } } } protected void login1_loggedin(object sender, eventargs e) { if (roles.isuserinrole(login1.username, "users")) { response.redirect("users.aspx", true); } <authentication mode="forms"> <forms timeout="129600" name=".authcookie" protection="all" slidingexpiration="true" path="/" requiressl="false" loginurl="~/login.aspx" cookieless="usecookies"/> </authentication>

got answer... geez finally!

login.aspx:

<asp:login id="login1" runat="server" onloggingin="login1_loggingin"> <layouttemplate> <asp:panel runat="server" defaultbutton="btnlogin"> <label>email</label>&nbsp;<div class="required">*</div> &nbsp; <asp:requiredfieldvalidator runat="server" controltovalidate="username" display="dynamic" errormessage="required" initialvalue="" setfocusonerror="true" validationgroup="login" /><br /> <asp:textbox runat="server" id="username" class="input" validationgroup="login" /> <label>password</label>&nbsp;<div class="required">*</div> &nbsp; <asp:requiredfieldvalidator runat="server" controltovalidate="password" display="dynamic" errormessage="required" initialvalue="" setfocusonerror="true" validationgroup="login" /><br /> <asp:textbox runat="server" id="password" textmode="password" class="input" style="margin: 0 0 6px 0;" validationgroup="login" /> <asp:checkbox runat="server" id="rememberme" text="remember me" cssclass="remember-me" /> <asp:linkbutton runat="server" id="btnlogin" commandname="login" text="sign in" cssclass="login-button" validationgroup="login" /> </asp:panel> </layouttemplate> </asp:login>

login.aspx.cs

protected void login1_loggingin(object sender, logincanceleventargs e) { if (isvalid) { if (formsauthentication.authenticate(login1.username, login1.password)) { formsauthentication.redirectfromloginpage(login1.username, false); } } }

web.config:

<authentication mode="forms"> <forms timeout="129600" name=".authcookie" protection="all" slidingexpiration="true" path="/" requiressl="false" loginurl="~/login.aspx" cookieless="usecookies"> <credentials passwordformat="clear"> <user name="test" password="test"/> </credentials> </forms> </authentication>

additional notes:

in web application, have folder called "protected" , file within called "users.aspx" , file called web.config. web.config within of "protected" folder has next not allow anonymous users , allow "test" user:

<configuration> <system.web> <authorization> <deny users="?"/> <allow users="test"/> </authorization> </system.web> </configuration>

i closed chrome instances after logging in, went users.aspx page, , certainly enough, asked log in again! know code isn't have should able modify code adopt this.

c# asp.net

In Crystal Reports I am looking to have a header footer then header footer with linked info but different Sums -



In Crystal Reports I am looking to have a header footer then header footer with linked info but different Sums -

so know not possible

header 1 detail footer 1 header 2 detail footer 2

but trying create form shows

invoices invoice#, date, status, total, balance due info debits total: credits date, reference, total, balance info credits total: balance due:

balance due beingness debits - credits. able invoices can not figure out how credits show below debits total.

edit------------------------------------------------------------------------

help below requirement aswell:

sum(case when s.[ar sale bill to] '%wilco%' isnull(d.[ar saled qty requested],d.[ar saled qty]) * d.[ar saled unit price] else 0 end) 'total'

i need have value if null grab qty [ar saled qty] ideas?

now having problem getting on same page...detail 1 prints on page 1 , detail 2 prints on page 2. amount of records vary on first record there 3 lines in first subreport , 1 in sec subreport.

your requirement possible....

use 2 sub reports in single main study can desired structure

header 1 //sub study 1 detail //sub study 1 footer 1 //sub study 1 header 2 //sub study 2 detail //sub study 2 footer 2 //sub study 2

let me know incase issue

crystal-reports

Load Hive partition from Hive view -



Load Hive partition from Hive view -

i have external hive table 4 partitions. have 4 hive views based on different hive table.

every week want hive view overwrite partitions in external hive table.

i know can create unpartitioned hive table view show below create table hive_table select * hive_view;

but there way overwrite partitions view data?

yes, there way:

insert overwrite table <table_name> partition(<partition_clause>) select <select_clause>

it required set hive.exec.dynamic.partition true before such operations. see details here: hive language manual dml - dynamic partitions

view hive partition

apache spark - EntityTooLarge error when uploading a 5G file to Amazon S3 -



apache spark - EntityTooLarge error when uploading a 5G file to Amazon S3 -

amazon s3 file size limit supposed 5t according announcement, getting next error when uploading 5g file

'/mahler%2fparquet%2fpageview%2fall-2014-2000%2f_temporary%2f_attempt_201410112050_0009_r_000221_2222%2fpart-r-222.parquet' xml error message: <?xml version="1.0" encoding="utf-8"?> <error> <code>entitytoolarge</code> <message>your proposed upload exceeds maximum allowed size</message> <proposedsize>5374138340</proposedsize> ... <maxsizeallowed>5368709120</maxsizeallowed> </error>

this makes seem s3 accepting 5g uploads. using apache spark sql write out parquet info set using schemrdd.saveasparquetfile method. total stack trace is

org.apache.hadoop.fs.s3.s3exception: org.jets3t.service.s3serviceexception: s3 set failed '/mahler%2fparquet%2fpageview%2fall-2014-2000%2f_temporary%2f_attempt_201410112050_0009_r_000221_2222%2fpart-r-222.parquet' xml error message: <?xml version="1.0" encoding="utf-8"?><error><code>entitytoolarge</code><message>your proposed upload exceeds maximum allowed size</message><proposedsize>5374138340</proposedsize><requestid>20a38b479ffed879</requestid><hostid>kxegspreq0ho7mm7dtcglin7vi7nqt3z6p2nbx1alulsezp6x5iu8kj6qm7whm56cij7udeenn4=</hostid><maxsizeallowed>5368709120</maxsizeallowed></error> org.apache.hadoop.fs.s3native.jets3tnativefilesystemstore.storefile(jets3tnativefilesystemstore.java:82) sun.reflect.nativemethodaccessorimpl.invoke0(native method) sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) java.lang.reflect.method.invoke(method.java:606) org.apache.hadoop.io.retry.retryinvocationhandler.invokemethod(retryinvocationhandler.java:82) org.apache.hadoop.io.retry.retryinvocationhandler.invoke(retryinvocationhandler.java:59) org.apache.hadoop.fs.s3native.$proxy10.storefile(unknown source) org.apache.hadoop.fs.s3native.natives3filesystem$natives3fsoutputstream.close(natives3filesystem.java:174) org.apache.hadoop.fs.fsdataoutputstream$positioncache.close(fsdataoutputstream.java:61) org.apache.hadoop.fs.fsdataoutputstream.close(fsdataoutputstream.java:86) parquet.hadoop.parquetfilewriter.end(parquetfilewriter.java:321) parquet.hadoop.internalparquetrecordwriter.close(internalparquetrecordwriter.java:111) parquet.hadoop.parquetrecordwriter.close(parquetrecordwriter.java:73) org.apache.spark.sql.parquet.insertintoparquettable.org$apache$spark$sql$parquet$insertintoparquettable$$writeshard$1(parquettableoperations.scala:305) org.apache.spark.sql.parquet.insertintoparquettable$$anonfun$saveashadoopfile$1.apply(parquettableoperations.scala:318) org.apache.spark.sql.parquet.insertintoparquettable$$anonfun$saveashadoopfile$1.apply(parquettableoperations.scala:318) org.apache.spark.scheduler.resulttask.runtask(resulttask.scala:62) org.apache.spark.scheduler.task.run(task.scala:54) org.apache.spark.executor.executor$taskrunner.run(executor.scala:177) java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) java.lang.thread.run(thread.java:745)

is upload limit still 5t? if why getting error , how prepare it?

the object size limited 5 tb. upload size still 5 gb, explained in manual:

depending on size of info uploading, amazon s3 offers next options:

upload objects in single operation—with single put operation can upload objects 5 gb in size.

upload objects in parts—using multipart upload api can upload big objects, 5 tb.

http://docs.aws.amazon.com/amazons3/latest/dev/uploadingobjects.html

once multipart upload, s3 validates , recombines parts, , have single object in s3, 5tb in size, can downloaded single entitity, single http get request... uploading potentially much faster, on files smaller 5gb, since can upload parts in parallel , retry uploads of parts didn't succeed on first attempt.

amazon-s3 apache-spark jets3t parquet apache-spark-sql

list - Sort python based on value -



list - Sort python based on value -

i wrote code fun of it

symbols = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] numbers = [] counter = 0 print("enter name") name = input(">") if name: new_name = list(name) x in range(0, len(symbols)): count_name = new_name.count(symbols[x]) numbers.append(count_name) if count_name: counter += 1 print("character amount =", counter) x in range(0, len(numbers)): if numbers[x]: print(symbols[x], "=", numbers[x]) else: print("input = null")

when come in name illustration roemer

it prints out this:

character amount = 4 e = 2 m = 1 o = 1 r = 2

but want sort based on character occurs frequently

for number, symbol in sorted(zip(numbers, symbols), reverse=true): if number: print(symbol, number)

python list sorting python-3.x

c - Anything wrong with the code? printed values are not as expected -



c - Anything wrong with the code? printed values are not as expected -

i have above code output not expected.

typedef struct { int a; }node, *nodeptr; nodeptr* createtest() { nodeptr *head = (nodeptr*)malloc(3 * sizeof(nodeptr)); node n1 = { 3 }; node n2 = { 4 }; node n3 = { 5 }; head[0] = &n1; head[1] = &n2; head[2] = &n3; homecoming head; } int main() { nodeptr *n = createtest(); nodeptr n0 = (nodeptr)(n[0]); printf("0: %d\n", n0->a); n0 = n[1]; printf("1: %d\n", n0->a); n0 = n[2]; printf("2: %d\n", n0->a); homecoming 0; }

the output should 3, 4, 5. got 3, 1, , random number. why happens?

head[0] = &n1; head[1] = &n2; head[2] = &n3;

n1, n2, n3 local variables. using address after function createtest exits undefined behavior.

c pointers

Check if multiple textfields are empty jQuery -



Check if multiple textfields are empty jQuery -

this might simple i'm having difficulties here. i'm running required attribute through fields of .um_frm , checking if fields not empty. problem instead of checking fields, passes through if single field filled. how create sure fields filled?

$('#um_ok').on( 'click', function() { $('.um_frm').attr('required','required'); var value=$.trim($(".um_frm").val()); if(value.length === 0){ //proceed... } });

i tried not suiccessful

$('#um_ok').on( 'click', function() { $('.um_frm').attr('required','required'); if($.trim($(".um_frm").val()) === ""){ //proceed... } });

use filter see if field blank (length not truthy, i.e. 0, hence !):

$('#um_ok').on( 'click', function() { $('.um_frm').attr('required','required'); var anyblank = $(".um_frm").filter(function(){ homecoming !$.trim($(this).val()).length; }).length; // if not blanks... if(!anyblank){ //proceed... } });

update: (thanks @george)

as required genuine html element property , not attribute, should utilize prop (which can take more readable boolean value on/off state):

$('.um_frm').prop('required', true);

this has advantage of creating cleaner required attribute no value (instead of required="required" etc).

jquery

arrays - PHP Transformation string -



arrays - PHP Transformation string -

let's have array structure

$array = array(array('a' => 'a', 'x' => $something));

the variable $something can that: 1-3 or 1,3 or 1-3, 2-5. transform variable $array in:

case 1. $something = 1-3

$array = array(array('a' => 'a', 'x' => array(1,2,3)));

case 2. $something = 1,3

$array = array(array('a' => 'a', 'x' => array(1,3)));

case 3.. $something = 1-3, 2-5

$array = array(array('a' => 'a', 'x' => array(1,2,3,4,5)));

i tried utilize preg_match doesn't work. can give me hint utilize else?

you looking explode split input string, range generate array contents , array_merge merge result.

something works:

<?php $something = '1-3, 2-5'; $array = array(array('a' => 'a', 'x' => array())); $result = array(); foreach (explode(', ', $something) $input) { $rangeparts = explode('-', $input); $result = array_merge($result, range($rangeparts[0], $rangeparts[1])); } // contains duplicate entries because 1-3 , 2-5 overlap - utilize array_unique remove duplicates or alter input $array[0]['x'] = $result;

in lastly assignment can either wrap $result in array_unique 1:1 match illustration or edit input ($something) reflect inclusive/exclusive-rules of range function.

php arrays string