Posts

haskell - Using Functions of `a` on `newtype a` -

haskell - Using Functions of `a` on `newtype a` - let's have next newtype : newtype foo = foo integer deriving (eq, show) is there concise way add together 2 foo 's: (foo 10) + (foo 5) == foo 15 or max: max (foo 10) (foo 5) == foo 5 ? i'm curious if it's possible utilize functions of a newtype a rather do: addfoo :: foo -> foo -> foo addfoo (foo x) (foo y) = foo $ x + y just haskell98 knows how derive eq , show instances you, can turn on generalizednewtypederiving extension ghc num , ord instances need: prelude> :set -xgeneralizednewtypederiving prelude> newtype foo = foo integer deriving (eq, show, num, ord) prelude> (foo 10) + (foo 5) == foo 15 true prelude> max (foo 10) (foo 5) == foo 5 false haskell newtype

c# - VS2010 does not show unhandled exception message in a WinForms Application on a 64-bit version of Windows -

c# - VS2010 does not show unhandled exception message in a WinForms Application on a 64-bit version of Windows - when create new project, unusual behavior unhandled exceptions. how can reproduce problem: 1) create new windows forms application (c#, .net framework 4, vs2010) 2) add together next code form1_load handler: int vara = 5, varb = 0; int varc = vara / varb; int vard = 7; i expect vs breaks , shows unhandled exception message @ sec line. however, happens 3rd line skipped without message , application keeps running. i don't have problem existing c# projects. guess new projects created unusual default settings. does have thought what's wrong project??? i tried checking boxes in debug->exceptions. executions breaks if handle exception in try-catch block; not want. if remember correctly, there column called "unhandled exceptions" or in dialog box, excatly want. in projects there 1 column ("thrown"). this nasty prob...

objective c - Images.xcassets Xcode 5.0.2: Image truncated -

objective c - Images.xcassets Xcode 5.0.2: Image truncated - my app totally ready app store except 1 issue: when testing app on iphone4 image , launch-image truncated @ bottom. in images.xcassets folder, have illustration of image in image view: the box named 1x has image size 640x960px named laddapp_blue-1.png. box named 2x has image size 640x1136px named laddapp_blue@2x.png. box named r4 has image size 640x960px named laddapp_blue-1-1.png. i have made them in photoshop , saved them png. don't know if resolution 72dpi when saved them or 300. affecting size showing? i have in 'general' set utilize images.xcassets nil wrong there. use launchimage in asset catalog. and select the right alternative in project general tab: objective-c uiimageview xcode5 xcasset

objective c - Presenting view controllers on detached ... - sometimes -

objective c - Presenting view controllers on detached ... - sometimes - like others coming ios8, i'm getting warning: presenting view controllers on detached view controllers discouraged <edititineraryviewcontroller: 0x7ca56e00>. this caused next code: - (void)editactivitydetailsforindexpath:(nsindexpath *)indexpath { nspredicate *predicatefordisplay = [[nspredicate alloc] init]; switch (indexpath.section) { case kincompleteactivitiessection: predicatefordisplay = _predincomplete; break; case kcompleteactivitiessection: predicatefordisplay = _predcomplete; break; default: break; } nsstring *theactivityname = [[nsstring alloc] init]; theactivityname = [[[_activitiesarray filteredarrayusingpredicate:predicatefordisplay] objectatindex:indexpath.row] activityname]; uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; ...

php - Counting the numbers of rows in Zend Framework -

php - Counting the numbers of rows in Zend Framework - in php can utilize function mysqli_stmt_num_rows($stmt) check how much rows there in result set. i wondering, how if using zend framework. i'm trying accomplish check if email existst in database table: customer. i have code. $db = zend_registry::get('db'); $query = "select column1,column2 ". zim_properties::gettablename('customer') ." email = '".$_post['email']."'"; $stmt = $db->query($query); i utilize zend framework 1.8 what did solve problem following. to know more info var $stmt used zend_debug::dump($stmt); it showed: object(zend_db_statement_mysqli)#14 (12) { so went folder "library/zend/db/statement" , , opened file mysqli.php . then checked every method available in class , noticed method rowcount needed one. at controller called rowcount function. $db = zend_registry::get('db'); $query = ...

node.js - Socket.io Chat Tutorial not functioning properly -

node.js - Socket.io Chat Tutorial not functioning properly - so decided give node.js shot. decided go little chat app break ice. tutorial next straight socket.io site. http://socket.io/get-started/chat/ i next tutorial word word , have tried re-create , paste code source , getting no when type in text , send it. supposed coming in command prompt, not. i had user connected , user disconnected messages appear stumped on 1 have followed tutorial step step. index.js var app = require('express')(); var http = require('http').server(app); var io = require('socket.io')(http); app.get('/', function(req, res) { res.sendfile('/chat/index.html'); }); io.on('connection', function(socket){ socket.on('chat message', function(msg){ console.log('message: ' + msg); }); }); http.listen(3000, function() { console.log('listening on *:3000'); }); index.html: <!doctype html> <...

ios - Making a private cocoapod with dependencies on other cocoapods -

ios - Making a private cocoapod with dependencies on other cocoapods - i've read tutorials (some less others), , discovered there huge focus on using pod lib create command , how new cocoapod the podspec repo , available other developers, missing middle part involving setting , developing pod, xcode illustration project, etc.. i'm trying create cocoapod internal utilize has dependencies on other pods. told pod lib create wanted illustration project , need able build , run using pods depends on. i'm not clear on how pods download. understand there podspec syntax specifying dependencies: spec.dependency 'somepod', '~> ver.0' , doesn't much illustration project. am supposed create podfile in folder illustration project? conflict podspec somehow? need include pod i'm making in podfile? should not using illustration project , developing pod in conjunction test project pulls pod in other cocoapod? also, when testing said , done...