Posts

Showing posts from May, 2014

c# - System.OverflowException while Editing large size images(A0,A1,A2) -

i have draw lozenge & text inside lozenge in image specific coordinates given user. have succeeded using graphics class below- var memorystream = new memorystream(); using (var bmp = new bitmap(filepath, false)) { using (var grp = graphics.fromimage(bmp)) { // measure text size //sizef textsize = grp.measurestring(inputtext1, font); var count = 0; var maxcount = (printpositions.count < inputtexts.count) ? printpositions.count : inputtexts.count; (var = 0; < maxcount; i++) { var printposition = printpositions.elementat(i); // calculating font size per dpi. printposition.fontsize = (printposition.fontsize * 300) / 74; var cornerradius = commonhelper.getcornerradius(size); //convert.toint32(pr

javascript - does service worker request, response from server continuously? -

i'm using server send event display notification.i have created service worker , used eventsource connect server (in case used servlet. ) once run project. working fine. but contents inside event execute countiously. want know why? other question is once close tab. stops sending notification. service worker nunning , server running. why stops? this service worker code. var eventsource = new eventsource("helloserv"); //mydiv1 custom event eventsource.addeventlistener("mydiv1",function(event){ console.log("data down" , event.data); var title = event.data; //below notification displaying continuously. why ? var notification = new notification(title, { icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png', body: event.data, }); notification.onclick = function () { window.open("http://ageofthecustomer.com/wp-content/uploads/2014/03/success.jpg"); }; console.log("down"); }

sqlite-net for UWP -

i testing sqlite.net uwp 10 app. have added sqlite extension universal windows platform(i.e required .vsix) project reference. nuget have installed sqlite-net nuget package. yet unable add refernce sqlite -net functions in project. cant see additional sqlite.cs or sqliteasync.cs added project. need additional configurations? also sqlite.net-pcl better sqlite-net.if yes in terms? nuget packages uwp apps not allow add code files project. either need sqlite.net-pcl or entity framework 7 rc (soon enityframework core 1.0)

php - What is $previous in Exception class? -

what $previous in exception constructor argument denote? how use it? class myexception extends \exception { private $message; private $code; public function __construct($message,$code,\exception $previous=null){ $this->message = $message; $this->code = isset($code) ? $code : 0; parent::__construct($message,$code,$previous); } } i didn't find in api doc if throw exception because caught exception, can add original exception $previous . means can "nest" exceptions: try { throw new fooexception('foo exception'); } catch (fooexception $e) { $code = 1; throw new barexception('bar exception', $code, $e); } you can loop on exception "stack" instead of exception caught, providing more context. while($e instanceof \exception) { echo $e->getmessage(); $e = $e->getprevious(); } now, use if you're implementing library can throw exception

unable to overwrite kendo treeview 'Loading' messages in Asp.net MVC -

how update default "loading..." message in kendo treeview inside razor cshtml. using kendo api 2014.1.416 @(html.kendo().treeview().name("producttree") .datasource(d => d .model(m => m .id("productid") .haschildren("categories")) .read(r => r.action("_producttree", "home"))) .datatextfield("productname")) there .messages(...) configurator: @(html.kendo().treeview().name("producttree") .messages(p => p.loading("...")) ....

typescript - How to raise event for buttons which are created dynamically in DCL.loadintolocation()? -

hi trying load component using dcl loadintolocation().the component loading want raise event buttons created dynamically.i made demo here http://plnkr.co/edit/pfofyd9xn5xmzwk9q0fp?p=preview > want raise event button name "destroy". please me how bind event buttons created dynamically. add(){ this.rendertemplate(` <div id="evnt"> <button (click)="raiseevent()">destroy</button> <some-component></some-component> </div> `, [somecomponent]); } raiseevent(){ alert('hi'); } in fact, raiseevent method called should in component dynamically added. in case it's in component creates it. if this, raiseevent method called: function tocomponent(template, directives) { @component({ selector: 'fake-component', template,directives }) class fakecomponent { a:any; dom:browserdomadapter; public fakeform: controlgroup; public items: querylist<some

php - how to get single array of comma seperate value from array -

this array want process. array ( [0] => array ( [checklist_id] => 3 [order_id] => [id] => 1 ) [1] => array ( [checklist_id] => 4 [order_id] => [id] => 2 ) [2] => array ( [checklist_id] => 7 [order_id] => 8,9,10,11,12 [id] => 4 ) ); after trying array_push $alreadyassingorder=array(); foreach ($collection $checklistorder) { if($checklistorder['order_id']) { $order=explode(',', $checklistorder['order_id']); array_push($alreadyassingorder,$order); } } the output is array ( [0] => array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 ) [1] => array ( [0] => 8 [1] => 9 [2] => 10 [3] => 11 [4] => 12 ) ) the output want array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 ) [7] => 8 [8] => 9 [9] => 10 [10] =

javascript - I want to integrate pubnub with zendesk -

is possible integrate zendesk pubnub? want create pubnub channel each zendesk ticket, , when respond ticket message want send pubnub api request record message @ pubnub server. basically, want user interface handle customer queries, , chat between user , me want save @ pubnub servers. idea? zendesk custom app using pubnub you don't need zendesk's source code (and can't anyway). right thing create zendesk app using their rest api . within custom app, use pubnub's rest api or pubnub sdk compatible whatever zendesk offers languages use add-ons (ruby, node, whatever offer). this cool use case (zendesk, desk freshdesk, etc) add-ons because can things within zendesk use pubnub react actions , trigger other things happen or notify other agents in zendesk. you can create standalone app (web, server or mobile) can subscribe channels zendesk publishing , can go other way around. standalone app can publish on channel zendesk add-on subscribed , react message

php - Project folder structure with CakePHP inclusion -

i making project has following folder structure: contents css js img fonts php currently using core php files furnish sign-up, log-in, feedback tasks. planning replace core php files framework, such cakephp. but, want put cakephp or php framework's files in php directory only, is. i want know if possible cakephp, or other framework may use php backend? note: cannot change folder structure cake or other framework! you can modify cakephp folder structure, should have clean mvc structure. without changing single folder in structure, not possible. if can't change folder structure, should, can't take framework is. there several ways "build" framework based on existing packages, such zend framework or symfony, require lot of reading. http://framework.zend.com/downloads/composer or this: http://fabien.potencier.org/create-your-own-framework-on-top-of-the-symfony2-components-part-1.html

Is it safe to call a C++ function that expects independent arguments with a struct? -

basically, safe following: we have simple function call accepting arbitrary number of arguments: void simplecall(int x, int y, int z, int a, int l, int p, int k) { printf("%i %i %i %i %i %i %i\n", x, y, z, a, l, p, k); } we create struct maps arguments: struct simpleargs { int x; int y; int z; int a; int l; int p; int k; }; we initialize structure arguments want pass, cast function compile, , pass structure in place of arguments: int main() { simpleargs a; a.x = 1; a.y = 2; a.z = 3; a.a = 4; a.l = 5; a.p = 6; a.k = 7; ((void(*)(simpleargs))simplecall)(a); return 0; } program prints: 1 2 3 4 5 6 7 this particular example serves no purpose (we call function normally) it's written illustrate concept. because struct passed value, compile down identically passing each argument value? standard call places arguments on stack group should same we're seeing here? under conditions ar

ruby - Prepending `bundle exec` to your command may solve this rails -

i having issue while deploying site aws . gem::loaderror: have activated rake 10.4.2, gemfile requires rake 10.5.0. prepending `bundle exec` command may solve this. /var/app/ondeck/config/boot.rb:3:in `<top (required)>' /var/app/ondeck/config/application.rb:1:in `<top (required)>' /var/app/ondeck/rakefile:4:in `<top (required)>' loaderror: cannot load such file -- bundler/setup /var/app/ondeck/config/boot.rb:3:in `<top (required)>' /var/app/ondeck/config/application.rb:1:in `<top (required)>' /var/app/ondeck/rakefile:4:in `<top (required)>' (see full trace running task --trace) (elasticbeanstalk::externalinvocationerror) while when gem list rake gives me *** local gems *** airbrake (4.3.1) rake (10.5.0, 10.4.2) i want have 1 version when bundle exec gem uninstall rake -v 10.4.2 gives me error: while executing gem ... (gem::installerror) gem "rake" cannot uninstalled because de

javascript - AngularJS: can I use filter, defined in another module? -

i've angular project, structured using by-module-type principle: ├── directives ├── services ├── filters │   └── filters.js └── states    └── home       ├── home.html       └── home.module.js i've created custom filter in filters.js import angular "angular"; export default angular.module("app.filters", []) .filter("removestartingwithdollar", function(items) { var filtereditems = []; angular.foreach(items, function(item) { if (!item.startswith('$')) { filtereditems.push(item); } }); return filtereditems; }); i want use removestartingwithdollar filter in home.html template. how inject dependency , should @ all? just inject app.filters module in anywhere need use provider of it. angular.module("mysecondmodule", [app.filters])

r - Loop linear regrssion model -

i have data amount dependent variable , len,age, quantity , pos explanotry variables. trying make regression of amount on age, quantity , pos using stepwise. id sym month amount len age quantity pos 11 10 1 500 5 17 0 12 22 10 1 300 6 11 0 11 33 10 1 200 2 10 0 10 44 10 1 100 2 11 0 11 55 10 1 150 4 15 0 12 66 10 1 250 4 16 0 14 11 20 1 500 5 17 0 12 22 20 1 300 6 11 0 11 33 20 1 200 2 10 0 10 44 20 1 100 2 11 0 11 55 20 1 150 4 15 0 12 66 20 1 250 4 16 0 14 77 20 1 700 4 17 0 11 88 20 1 100 2 16 0 12 11 30 1 500 5 17 0 12 22 30 1 300 6 11 0 11 33 30 1 200 2 10 0 10 44 30 1 100

sql - Managing images (upload, description and order) - webmatrix/razor -

i creating site users upload pictures of houses. i'm guessing best way achieve this, have database table, , when users upload photo's, saves destination , href in database right? what if uses wanted change around order of how photo's appear, best way achieve this, there api it, or pre-written code? thanks, gavin you have table in database store preferred order of images each user. contain user id, image id , order columns. or if image associated user record, add order column users table.

android - Gridview populating issue with asynctask -

i'm trying populate gridview thumbnail images i'm having issues decoding images within asynctask. when start app, images loaded 1 1 , images not displayed correctly ( once scroll shows top image , loads original later). here code : public class imageadapter extends baseadapter { private context mcontext; private list<string> mlist; private int mheight; private int mwidth; private inputstream is; public imageadapter(context context, list<string> list, int height, int width) { mcontext = context; mlist = list; mheight = height; mwidth = width; } @override public int getcount() { return mlist.size(); } @override public object getitem(int position) { return mlist.get(position).tostring(); } @override public long getitemid(int position) { return 0; } @override public view getview(int position, view convertview, viewgroup parent) {

java - How to match a string to another string in an array list and print the match? -

ok, here question have. i'm trying allow user search contact list matching contact "lastname, email, , zipcode" i've tried using "matches" , "equals" function, boolean if have match, print out string/contact match. however, doesn't print out anything. using wrong function match contacts? match function found in contactlist.java below under method searchemail. mainactions.java case 3: // read in last name here string userstringlastname; system.out.println("enter last name search for: "); userstringlastname = reader.next(); list.searchlastname(userstringlastname); break; contactlist.java /** * * @param userstringlastname */ public void searchlastname(string userstringlastname) { // search last name (int = 0; < contacts.size(); i++) { contact c = contacts.get(i); boolean b = userstringlastname.matches(c.getlastname()); if (b == true) {

php - Regex: How to consider double quotes -

i have following regex in php: '/\|*([\w\s]*' . $searchterm . '[\w\s]*)\|*/iu' let's assume following searchterm: stories how achieve regex match string has double quotes, such as: stories "neverland" my current regex matches until double quotes start. how can cover whole string regex, taking double quotes account? use '/\|*([\w\s\'"]*' . preg_quote($searchterm, "/") . '[\w\s\'"]*)\|*/iu' just add double quote , escaped single quote (since using single quoted literal declare regex) character classes [...] , , not forget escape $searchterm contents preg_quote may contain characters ? or + have special meaning in regex pattern. second argument in preg_quote escape / symbol used regex delimiter in code.

ios - Call a public method of a WKInterfaceController from ExtensionDelegate class- WatchKit -

i calling the `[[wcsession defaultsession] updateapplicationcontext:message error:error]` method triggered in my `-(void)session:(wcsession *)session didreceiveapplicationcontext:(nsdictionary<nsstring *,id> *)applicationcontext` method in extensiondelegate . here want call public method in wkinterfacecontroller update ui. don't want reload root controllers particular controller not root controller. possible call public method extensiondelegate . can call -(void)session:(wcsession *)session didreceiveapplicationcontext:(nsdictionary<nsstring *,id> *)applicationcontext from somewhere within interface controller instead of extensiondelegate ? you can use wcsession 's public func sendmessage(message: [string : anyobject], replyhandler: (([string : anyobject]) -> void)?, errorhandler: ((nserror) -> void)?) this invoke wcsessiondelegate 's public func session(session: wcsession, didreceivemessage message: [string : anyobject],

qt - how to determine what is the QNetworkRequest Method (get or post)? -

when use qwebview browse websites , monitor requests using qwevview.page().networkaccessmanager().finished signal, how can detemine taht request method (post or get)? this code: def __init__() self.web=qwebview() self.web.seturl(myurl) self.web.page().networkaccessmanager().finished.connect(self.checkmethod) self.web.show() def checkmethod(self,reply): req=reply.request() print(req.method())# can this?

Setting default values and using error input with Laravel 4 forms? -

i'm using laravel 4 , built-in form component. i'm trying set can give form set of default values, if user submits , validator fails, use values previous input. code below, however, fails. session value 'threw_error' true reason, when form throws errors. it seems done sessions, why i'm setting __old_input, internal key form uses. doing wrong? should using __old_input this, or there better way achieve goal? i'm using resourceful controllers, index() below /, , store() post /. class admin_detailscontroller extends admin_basecontroller { public function index() { $details = detail::all(); // true reason? if(!session::get('threw_error', false)) { session::put('__old_input', $details); } $data['message'] = session::get('message'); $this->layout->nest('content', 'admin.details.index', $data); } pub

What is the most appropriate distance measure for e-commerce data (explained in details below) to apply nearest neighbour algorithm? -

i have dataset of e-commerce website. data arranged in matrix number of rows same number of transactions (set of products bought) , number of columns same total number of products available on website. each [i, j] cell of matrix either 1 if product j bought in transaction i or 0 otherwise. when new transaction comes, want find k nearest neighbours transaction. appropriate measure such data? e.g. if data binary (1/0) , hamming distance won't make sense.

python - psql cast parse error during cursor.fetchall() -

i have python code queries psql , returns batch of results using cursor.fetchall() . throws exception , fails process if casting fails, due bad data in db. exception: file "/usr/local/lib/python2.7/site-packages/psycopg2cffi/_impl/cursor.py", line 377, in fetchall return [self._build_row() _ in xrange(size)] file "/usr/local/lib/python2.7/site-packages/psycopg2cffi/_impl/cursor.py", line 891, in _build_row self._casts[i], val, length, self) file "/usr/local/lib/python2.7/site-packages/psycopg2cffi/_impl/typecasts.py", line 71, in typecast return caster.cast(value, cursor, length) file "/usr/local/lib/python2.7/site-packages/psycopg2cffi/_impl/typecasts.py", line 39, in cast return self.caster(value, length, cursor) file "/usr/local/lib/python2.7/site-packages/psycopg2cffi/_impl/typecasts.py", line 311, in parse_date raise dataerror("bad datetime: '%s'" % bytes_to_ascii(value)) dataerro

php - URL Redirection for virtual sub domain -

i have given facility user create there own page , can give url page. for example have created 1 page namely "jkailash" , given url "jkailash.extrathing". page final url " http://jkailash.extrathing.maindomain.com " so in front end side displaying page name "jkailash" , on click of link " http://jkailash.extrathing.maindomain.com " redirected. my problem while doing got "server not found error", i have tried given below redirect rules no success. #rewritecond %{http_host} ^(.+)\.maindomain\.com$ [nc] #rewritecond %{http_host} !^www\.maindomain\.com$ [nc] #rewriterule ^ http://www.maindomain.com [l,r] if you've got server not found error means dns not matching new subdomain. you should add wildcard dns record in configuration directing *.extrathing.maindomain.com server.

java - Send BASIC auth credentials using cxf client -

i sending auth credentials using cxf webservice client , says: javax.xml.ws.webserviceexception: not send message. caused by: org.apache.cxf.transport.http.httpexception: http response '401: unauthorized' when communicating http://localhost:8080/accountfacadeservice/accountservice my client is: qname service_name = new qname("http://webservice.account.com/", "accountfacadeservice"); url wsdl_location = http://localhost:8080/accountfacadeservice/accountservice?wsdl; accountfacadeservice stub = new accountfacadeservice(wsdl_location, service_name); accountservice port = stub.getaccountserviceport(); ((bindingprovider) port).getrequestcontext().put(bindingprovider.username_property, "user"); ((bindingprovider) port).getrequestcontext().put(bindingprovider.password_property, "pass"); is there more headers i'm missing? alright, after many hours of digging issue found answer question. make sure role

oracle - database connection by an applicaiton -

how to know how many connection established application database(oracle). have java web application connection oracle database. want know how may connections open db when application running. you can see number of active sessions through querying v$session table: select * v$session you filter specific users/programs check how many parallel connections have been openend, i.e. statement stmt = con.createstatement(); resultset rs = stmt.executequery("select count(*) cnt v$session program = 'executablename.exe';"); rs.next(); count = rs.getint("cnt");

Could'nt expire SignedURL of google cloud storage object created using node.js -

am creating signedurl of google cloud storage object using node.js. this code var crypto = require("crypto"); var fs = require("fs"); var expiry = new date().gettime() + 3600; var key = 'the_target_file'; var bucketname = 'bucket_name'; var accessid = 'my_access_id'; var stringpolicy = "get\n" + "\n" + "\n" + expiry + "\n" + '/' + bucketname + '/' + key; var base64policy = buffer(stringpolicy, "utf-8").tostring("base64"); var privatekey = fs.readfilesync("gcs.pem","utf8"); var signature = encodeuricomponent(crypto.createsign('sha256').update(stringpolicy).sign(privatekey,"base64")); var signedurl = "https://" + bucketname + ".commondatastorage.googleapis.com/" + key +"?googleaccessid=" + accessid + "&expires=" + expiry + "&signature=" + signature; console.lo

css - C# WebBrowser: draw circle? -

i'm writing 1 simple visualisation app , have 1 little problem: webbrowser.version returns build: 9600 major: 11 , despite can't use modern css3 features draw circle. below html code , output get. tried various methods found on google , nothing seems work. deleted unnecessary code, left part not working in webbrowser. oh, btw, works when opened in standalone ie. tried `border-radius: 50% here image of get <!doctype html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title>main window</title> <style> .circle { border-radius: 10px; width: 20px; height: 20px; background: blue; } </style> </head> <body> <div class="circle"></div> </body> </html> this because webbrowser class emulates ie , therefore have hkey setting

objective c - Problems with CocoaPods GoogleCloudMessaging (Xcode 7.2) -

i added googlecloudmessaging cocoapods project. file "pods" contains following code: source 'https://github.com/cocoapods/specs.git' platform :ios, '8.1' dependency 'libpusher', '1.1' pod 'google/cloudmessaging' after install had problems library -lpods, problem solved removing content of build settings -> linkers -> other linkers flags . as result got next error: ld: library not found -lcocoaasyncsocket clang: error: linker command failed exit code 1 (use -v see invocation) i have solved problem: necessary use $ pod update from terminal

android - Dagger 2 presenter injection returning null -

i attempting add dagger 2 android project. application have following screen login extends base activity navigation activity extends base activity mw activity extents navigation activity presenter injection working fine in login , navigation activity in mw activity return null butter knife not working in mw activity working fine in other activities following classes application class public class abcapplication extends application { applicationcomponent mapplicationcomponent; @override public void oncreate() { super.oncreate(); mapplicationcomponent = daggerapplicationcomponent.builder() .applicationmodule(new applicationmodule(this)) .build(); mapplicationcomponent.inject(this); } public static abcapplication get(context context) { return (abcapplication) context.getapplicationcontext(); } public applicationcomponent getcomponent() { return mapplicationcompone

Visual Studio 2012 Search Scope -

Image
visual studio 2012 quick find dialog is there shortcut, or way make one, changing search scope in visual studio 2012? the new quick search dialog redesigned, , clunky search scope via tab key, initial keyboard focus in first textbox , scope dropdown moved relatively far away. in visual studio 2010, simple hitting tab key once , you're there. visual studio 2012 quick find dialog mr. president, can use ctrl + shift + f bring old search dialog. can tab .

twitter bootstrap - Use an array or object in edit.php in Grocery CRUD -

i have code: public function render() { // apply filters if $this->applyfilters(); // define columns , fields $columns = array('code', 'name', 'fname', 'family', 'status' ); if ( $this->ci->uri->segment(3)=='edit' ){ $fields = array('name', 'surname', 'fname', 'gender', 'birth', 'address', 'zip', 'city', 'region', 'section', 'district', 'citizenship', 'phone', 'email', 'identity', 'afm', 'amka', 'family', 'education', 'education_reason', 'marital', 'protected_members', 'occupation', 'unemployment_card', 'social_security', 'income', 'income_from', 'allowances', 'profile_info', 'vulnerable', 'guardianship', &

php - Larabook Auth::check() not working -

hi guys have problem codeception, isn't working correctly , i'm using same code there videos larabook scratch code in signupcept.php $i = new functionaltester($scenario); $i->am('a guest'); $i->wantto('sign larabook account'); $i->amonpage('/'); $i->click('sign up!'); $i->seecurrenturlequals('/register'); $i->fillfield('username:', 'johndoe'); $i->fillfield('email:', 'john@example.com'); $i->fillfield('password:', 'demo'); $i->fillfield('password confirmation:', 'demo'); $i->click('sign up'); $i->seecurrenturlequals(''); $i->see('welcome larabook!'); $i->seerecord('users',[ 'username' => 'johndoe', 'email' => 'john@example.com', 'password' => 'demo' ]); $i->asserttrue(auth::check()); this registrationcontroller.php c

How to ignore an output of a multi-output function in Python? -

this question has answer here: ignore python multiple return value 8 answers suppose have function: def f(): ... ... ... return a,b,c and want b in output of function. assignment have use? thanks. you can unpack returned tuple dummy variables: _, keep_this, _ = f() it doesn't have _ , unused. (don't use _ dummy name in interactive interpreter, there used holding last result.)   alternatively, index returned tuple: keep_this = f()[1]

ios - read a file from iPhone local storage -

edit: want create app can following: - user put file in iphone - user open app , set path of file - user send app via network using app. the problem: how can access file in iphone local storage? there other solution other using local storage? there no way access file system in ios through application unless put file in application resources or other app provides public api access files photos app, contacts etc.

html - ng-click access child controller function from parent controller -

its ng-repeat limiting or slicing , slice value changing on ng-click html structure it work if moving 'next, prev' buttons hometeamctrl html structure different, 'next, prev' buttons standing outside of hometeamctrl <ul ng-controller="hometeamctrl hometeam"> <li ng-repeat="team in hometeam.teammembers.slice(hometeam.start, hometeam.end)"> </li> </ul> <div class="prev" ng-click="hometeam.prev(hometeam.start, hometeam.end)">prev</div> <div class="next" ng-click="hometeam.next(hometeam.start, hometeam.end)">next</div> </div> question how can access ng-click (next, prev) parent controller controller app.controller('hometeamctrl', ['designappfactory', function(designappfactory){ vm.start = 0; vm.end = 4; vm.next = function(start, end){ vm.start = start + 4; v

php - Change Mailing Transport in Laravel 4 -

it appears l4 hardcoded use smtp swiftmailer. how can change transport type sendmail? it's not easy swapping out transport another. said, transport hardcoded in illuminate\mail\mailserviceprovider. you extend l4 mail implementation own, swapping out in config/app.php providers array: replace provider array mail provider: config/app.php ... 'providers' => array( 'sendmailserviceprovider', add sendmail path binary: config/mail.php 'sendmail_path' => '/usr/bin/sendmail -bs', make sure composer.json file autoload "classmap app/libraries:" composer.json: .... "autoload": { "classmap": [ "app/libraries", .... add sendmail service provider: app/libraries/sendmailserviceprovider.php <?php use \swift_mailer; use illuminate\support\serviceprovider; use illuminate\mail\mailer mailer; use swift_sendmailtransport sendmailtransport; class sendmailservi

linux - Unable to initialize a window and wait for a process to end in Python 3 + GTK+ 3 -

i'm new object-oriented programming, python , gtk+3, though have decent knowledge of procedural programming (mainly c). i'm trying build simple python + gtk+ 3 script run pkexec apt-get update under linux. i have mainwindow class (based on gtk.window class) contains button object named button (based on gtk.button class) triggers new_update_window() method defined in mainwindow upon clicked event; the new_update_window() method initializes updatewindow object updatewindow class (based on gtk.window class) contains label object named label (based on gtk.label class) , calls methods show_all() , update() defined in updatewindow ; the update() method supposed change label , run pkexec apt-get update , change label again. the problem no matter 1 of following occurs: if run subprocess.popen(["/usr/bin/pkexec", "/usr/bin/apt-get", "update"]) directly, update.window shown label set value should set after pkexec apt-ge

validation - Create form for multiple/two NOT related models in CakePHP -

i have 2 models: modela, modelb. booth have id, name, ..., done(bool) fields. modela not relate way modelb! i created 1 form, have booth models fields in modela/add.ctp echo $this->form->create('modela', [ ... ]); echo $this->form->input('modela.name'); ... echo $this->form->input('modela.done', [ 'default' => true ]); echo $this->form->input('modelb.name'); ... echo $this->form->input('modelb.done', [ 'default' => true ]); my problem, cake not create checkbox modelb.done instead simple input field. not validates modelb. (because not know these fields relates modelb.) i can manually validation, loading modelb in modela controller , like: $this->modelb->validate(...) my question is: possible set form has 2 not related model? i don't think there's way set 2 unrelated models , validate them without calling validate function. however, checkbox issu

debugging - Visual Studio / Properties / Debug / Working Directory want it permanent but don't want to check in the *.user file -

the project setting debugging / working directory in visual studio 20015 saved default in *.user file wich don't check in in repo because it's user specific. still i'd have else $(projectdir) standing there when clean checkout of project. there other place store working directory besides *.user file? thanks edit: original idea have solution multiple projects , binaries (dlls , exes) created end in folder called bin. , if want debug don't want edit working direktory again after clean checkout. edit2: make more clear. in post build step of every project within solution copy binaries in bin folder. if start 1 of executeables within vs starts them $(projectdir) folder , of corse not bin folder , why not find dlls , why want set working directory. of corse change output directory of projects lot of files ending in bin folder don't want there. ... try anyway maybe missed ... continued edit3: expected if change output directory bin folder works fine. except fil

performance - How to get te running time of the diameter of a graph? -

if have simple undirected graph g(v, e), how can find diameter of graph in o((|v|+|e|) * lg |v|) running time? i think best known algorithm unweighted undirected graphs takes Õ(n^ω), n = |v| , ω < 2.376 exponent of fast matrix multiplication. , o((|v|+|e|) * lg |v|) give Õ(n^2), better best known algorithm. @ introduction section of http://arxiv.org/abs/1011.6181 brief survey , references.

java - Android - ViewPager doesn't work correctly -

Image
i want achieve this i made this problem : i made fragment include 3 tabs i want put 2 tabs in bottom tripadvisor xml code : <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.design.widget.tablayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/material_blue_grey_800" app:tabgravity="fill" app:tabindicatorcolor="@color/orange" app:tabmode="fixed" app:tabselectedtextcolor="@color/orange" app:tabtextcolo

sql - What would be the result of the following query? -

Image
the following query tried... select d.deptid, max(tt.total) dept d, (select d.deptid, d.deptname, sum(days) total vacation v, employee e, dept d v.empid = e.empid , d.deptid = e.deptid group d.deptid, d.deptname) tt d.deptid = tt.deptid group d.deptname; --having max(tt.total); try using limit since inner query calculation. select top 1 * ( select d.deptid, d.deptname, sum(days) total vacation v, employee e, dept d v.empid = e.empid , d.deptid = e.deptid group d.deptid, d.deptname) order total desc; depends on dbms you're using.. mysql in oracle use rownum = 1 in sql server use select top 1 *

c# - How can I use SelectMany on my IQueryable of classes? -

i've been struggling on whole day now. so class looks follows: public class suppliersummaryreport { public string suppliername { get; set; } public decimal turnovervalues { get; set; } } the linq far looks this: var data = (from in _ctx.invoices i.turnover == true last5years.contains(i.invoicedate.year) select new { year = i.invoicedate.year, accountname = i.accountname, value = i.netamount_home ?? 0 }); var y = data.groupby(r => new { r.year, r.accountname }) .select(g => new apdata.audit.models.reportmodels.suppliersummaryreport { suppliername = g.key.accountname, turnovervalues = new list<decimal>{ g.sum(r => r.value) } }); this gives me data looks

go - TimeZone to Offset? -

i want offset in seconds specified time zone. tz_offset() in perl's time::zone does: "determines offset gmt in seconds of specified timezone". is there way of doing in go? input string has time zone name and that's it , know go has loadlocation() in time package, string => offset or location => offset should fine. input: "mst" output: -25200 here code, calculates current offset between local , specified timezones. agree ainar-g's comment offset makes sense relation specified moment in time: package main import ( "fmt" "time" ) func main() { loc, err := time.loadlocation("mst") if err != nil { fmt.println(err) } := time.now() _, destoffset := now.in(loc).zone() _, localoffset := now.zone() fmt.println("offset:", destoffset-localoffset) }

angularjs - ODataAngularResources not parse OData 4 response -

i try call odata v4 service odataangularresources typescript. for test purpose use northwind products odata service here code wich call service: var results = this.$odataresource("http://services.odata.org/v4/northwind/northwind.svc/products") .odata() .filter("unitprice", ">", 10) .filter("discontinued", true) .take(2) .query(); request url : http://services.odata.org/v4/northwind/northwind.svc/products ?$filter=(unitprice%20gt%2010)%20and%20(discontinued%20eq%20true)&$top=2 response : { "@odata.context":"http://services.odata.org/v4/northwind/northwind.svc/$metadata#products", "value":[ { "productid":5, "productname":"chef anton's gumbo mix", "supplierid":2,

c - Can't wrap my head around Preprocessing Macros -

i'm still struggling macros in c. so 1 should return -2: #define #define c int main() { int = #ifdef #ifdef b // if , b defined -1 #else // defined , b not defined -2 #endif #else // not defined -3 #endif ; printf("%d \n", i); } why isthis returning -3 then: #define b #define c int main() { int = #ifdef #ifdef c -1 #else -2 #endif #else -3 #endif ; printf("%d \n", i); } it seems me if macros have own logic. #include <stdio.h> #include <stdlib.h> #define #define c int main() { int = #ifdef #ifdef b // if , b defined -1 #else // defined , b not defined -2 #endif #else // not defined -3 #endif ; printf("%d \n", i); } in case -2, since defined b not defined

javascript - Using three.js and tween.js to change the position of an object -

i making first steps coding javascript , playing three.js too. as can see here http://codepen.io/gnazoa/pen/bjobzz , if make click in box, change z position. the problem when tween starts, , make click in box again, animation stops , starts again. there not way avoid make click event again when tween has started? have suggestion? this piece of made: function ondocumentmousedown(event) { event.preventdefault(); mouse.x = (event.clientx / renderer.domelement.clientwidth) * 2 - 1; mouse.y = -(event.clienty / renderer.domelement.clientheight) * 2 + 1; raycaster.setfromcamera(mouse, camera); var intersects = raycaster.intersectobjects(scene.children); if (intersects.length > 0) { new tween.tween(intersects[0].object.position).to({ x: 0, y: 0, z: 1000 }, 50000) .easing(tween.easing.elastic.out).start();

c++ - Makefile with Bison and Lex -

i doing simple interpreter using bison , lex. make file content. # # makefile ccalc # objs += mylang.o sm.o lex.o parse.o # rules %.c: %.y bison -o $(@:%.o=%.d) $< %.c: %.l flex -o$(@:%.o=%.d) -i $< # dependencies mylang: mylang.yy.tab.c lex.c $(objs) @echo g++ -os -std=c++0x -omylang $(objs) @g++ -os -std=c++0x -omylang $(objs) @echo ' ' # source mylang.o: mylang.cpp sm.o: sm.cpp sm.h lex.o: lex.c parse.o: mylang.yy.tab.c mylang.yy.tab.c: mylang.yy lex.c: mylang.ll when run make file, command running g++ -c -o sm.o sm.cpp but want run as, g++ -os -std=c++0x -c -o sm.o sm.cpp what should change in make file run c++0x compiler version. set cxxflags flags accordingly: cxxflags="-os -std=c++0" make uses internal defaults rule compile c++ files .o files. can display them make -p . the rules in case are compile.cc = $(cxx) $(cxxflags) $(cppflags) $(target_arch) -c compile.cpp = $(compile.cc) %.o: %.c

.bat opening diffrent file than command -

sooo have little program that, select starts server. when choose "1" sends ffa: lookst this: :ffa cls color 0f echo startuje se ffa! start %~dp0\servers\ffa\bstart.bat pause soo..it should start bstart.bat wich in same directory, , go folder servers, go folder ffa , open file... buuutt! doesn't open bstart.bat starts this: c:\users\aleksej\desktop\agarioservers can explain me whats problem? thanks! <3 answer: the folder there server directory had special character( think - or that), cmd started agario not agario-servers. soo...yea..thanks tried me.

It's possible to use Environment functions in gulp-nunjucks-render? -

i want use nunjucks render , function. example addglobal . is possible? the typical other way add variables use nunjucks enviorment's , use addglobal. gulp nunjucks render built handles it's own environments (as default nunjucks behavior), , stated can pass variables object on render call. that being said, give ability control own environment looks like. after tinkering able create own environemnt using: var nunjucksrender = require('gulp-nunjucks-render'); var nunenv = new nunjucksrender.nunjucks.environment([loaders], [opts]); at point can handle manually per enviroment doc listed above, , use addglobal desire. bit more work though default usage described here, https://github.com/carlosl/gulp-nunjucks-render

vb.net - Have to make a program that makes a pyramid -

i have gotten basics how input number of spaces in each row? this ive done far: sub main() dim var char dim numberofsymbols integer console.writeline("what variable want use form pyramid?") var = console.readline console.writeline("what number of symbols want start with? (odd number)") numberofsymbols = console.readline() 'taking numberofsymbols 5 console.write(" ") console.write(var) console.writeline() console.write(" ") x = 1 numberofsymbols - 2 console.write(var) next console.writeline() console.write(" ") x = 1 numberofsymbols console.write(var) next console.readkey() end sub the output im getting aaa aaaaa im not checking in program see if odd number/one character , how should go making program if user chooses random odd number? i know ill have use repeat until loop how input number of spaces in lo