Posts

Showing posts from February, 2010

ios - UISearchDisplayController Issue -

Image
i trying implement uisearchdisplaycontroller in existing tableview whenever try search covers view. please check below screen shot more detail idea. i using xcode 7 beta , ios9 simulator. here when start searching covers screen. i search none of solution worked me. just tried similar test project on xcode 7 without auto layout , works fine me: what view hierarchy like? perhaps top bar on view preventing search bar moving up?

php - Implement a State Pattern with Doctrine ORM -

i have class using state pattern. here's simple example /** * @enitity **/ class door { protected $id; protected $state; public function __construct($id, doorstate $state) public function setstate(doorstate $state) { $this->state = $state; } public function close() { $this->setstate($this->state->close()) } ... } interface doorstate { public function close; public function open; public function lock; public function unlock; } class dooraction implements doorstate { public function close() { throw new doorerror(); } ... } then several classes define appropriate actions in states class openeddoor extends dooraction { public function close() { return new closeddoor(); } } so have thing like $door = new door('1', new openeddoor()); doctrinedoorrepository::save($door); $door->close(); doctrinedoorrepository::save($door); how implement mapping in doctrine can persist it? i'm hung o

php - Can't install laravelcollective/html in Laravel 5.1 -

i have problem when install laravelcollective/html in laravel 5.1 install laravelcollective/html document . first, install through composer: composer require illuminate/html message: using version ~5.0 illuminate/html ./composer.json has been updated loading composer repositories package information updating dependencies (including require-dev) but it's version 5.0 remove it. composer remove illuminate/html and install version 5.1 "require": { "laravelcollective/html": "5.1.*" } next, update composer terminal: composer update next, add new provider providers array of config/app.php: 'providers' => [ // ... collective\html\htmlserviceprovider::class, // ... ], finally, add 2 class aliases aliases array of config/app.php: 'aliases' => [ // ... 'form' => collective\html\formfacade::class, 'html' => collective\html\htmlfacade::class, // ...

linux - Exploring a directory using a for loop in python - does the order change? -

one of folders has json files, , i'm reading data contain classification svm. question had based on code: filename in os.listdir(os.getcwd()): if re.search('.json$',filename): try: open(filename) json_data: print filename each time pipe output, find filenames printed in same order, so: 95231464576.json 131777220274261.json 17151210249.json 122624927762214.json 159287900855286.json 155273941171682.json 5265971983.json 169635939813776.json 159429967503904.json 169114363192327.json 170797436313930.json 155963124522916.json there few text files, , python files in directory. question here is: determines order in these files printed? for loop have way of looking files? tried examining whether order based on size (max min or min max) or last modified(i had no reason these tests,i tried them since can't think of other insight). tried snippet 4 times, , order

ios - The network connection was lost when calling PHP API -

var submitdic = nsmutabledictionary () submitdic.setobject (loginmerged, forkey: "module" ) submitdic.setobject (kedahe-tutorapp, forkey: "wskey" ) submitdic.setobject (112211, forkey: "passwd" ) submitdic.setobject (form04, forkey: "username" ) var request : nsmutableurlrequest = nsmutableurlrequest() request.url = nsurl(string: http://kedah-etutor.com/component/module/ws_function2.php) request.httpmethod = "post" request.httpbody = nsjsonserialization.datawithjsonobject(submitdic, options: nsjsonwritingoptions() , error: nil) println(nsjsonserialization.datawithjsonobject(submitdic, options: nsjsonwritingoptions() , error: nil)?.description) request.setvalue("application/json; charset=utf-8", forhttpheaderfield: "content-type") nsurlconnection.sendasynchronousrequest(request, queue: nsoperationqueue.mainqueue(), completionhandler:{ (response:nsurlresponse!, data

rest - Firefox Add-on RESTClient - How to send data-binary file in the request? -

i trying use restclient firefox add on post equivalent this: curl -s -s -x post -h "content-type: application/zip" \ --data-binary @./cluster-config.zip \ http://${joining_host}:8001/admin/v1/cluster-config the idea using firefox addon (restclient) debug stuff until works. stuck because don't find way add file request (equivalent --data-binary parameter of curl) how can include file in request in restclient firefox add-on?

How to write trigger in oracle to check for one specific condiition -

i have 1 table name user_count_details. there total 3 columns in table. msisdn=which uniquely defines row 1 specific user user_count= stores count of user. last_txn_id= stores last transfer id of txn user has performed. the user_count column of table user_count_details gets updated every transaction performed user. but here logic of system select sum(user_count ) user_count_details will gives 0 , considered system in stable state , fine. now want write trigger check first when new request update user_count come ,will hamper sum(user_count )=0 or not , if hampers msisdn details captured in separate update table. based on last comments, check if works. replace other_table_name per scenario. create trigger trgcheck_user_sum before insert on user_count_details each row begin if (select sum(user_count) user_count_details) > 0 insert other_table_name(msisdn) values(new.msisdn) end if end

php - Yii Framework: Pagation Callback Method -

i have clistview on page , every time navigate page 2 or other page want call method formats view. not seem work every time navigate page. the javascript method want call called updatedivs() here list view widget $this->widget('zii.widgets.clistview', array( 'dataprovider' => $dataprovider, 'itemview' => '_customview', 'id' => 'bannerslist', 'ajaxupdate' => true, 'afterajaxupdate' => ' updatedivs()', 'enablepagination' => true, 'itemscssclass' => 'row banners-list', 'summarytext' => 'total ' . $pages->itemcount . ' results found',

linux - Apply shell script to strings inside a file and replace string inside quotes -

suppose have file greeting.txt (double quotes inside file, 1 line): "hello world!" and file names.txt (no double quotes, many lines, show 2 here example): tom mary then want create bash script create files greeting_to_tom.txt : "hello tom!" and greeting_to_mary.txt : "hello mary!" i'm quite newbie in shell script, after piece searched, tried: greetingtoall.sh : #!/bin/bash filename="greeting_to_"$1".txt" cp greeting.txt $filename sed -i 's/world/$1/' $filename and @ command line type: cat names.txt | xargs ./greetingtoall.sh but tom recognized , it's wrongly replaced $1 . can me task? if create greetingtoall below: greeting=$(cat greeting.txt) while read -r name; echo "$greeting" | sed "s/world/$name/" > "greeting_to_$name.txt" done < "$1" you can call as: ./greetingtoall names.txt depending on you're doing, might better

c# - GroupPrincipal throws argument exception -

Image
i have static method validate, if user in adgroup or not. method looks like: public static bool isuserinadgroup(string groupname, string name) { if (string.isnullorempty(groupname) || string.isnullorempty(name)) { return false; } // create domain context var ctx = new principalcontext(contexttype.domain, configuration.getvalue("ad")); // find group in question var group = groupprincipal.findbyidentity(ctx, groupname); // find user var user = userprincipal.findbyidentity(ctx, name); if (user != null && group != null) { if (user.ismemberof(group)) { return true; } return false; } return false; } i wrote unittest method , works fine. when call method wpf application, i've got excep

sql server 2008 - SQL query with distinct records -

i want distinct records below query. mean if uncomment commented lines. please help. select cs1.nm categorytype, cs2.nm category --, cs2.nm sub_category cat_struct cs inner join cntrct_cat cc on cc.cat_struct_id = cs.cat_struct_id inner join cat_struct cs1 on cs1.cat_cd = cs.cat_cd , cs1.mkt_cd not null inner join cat_struct cs2 on cs2.cat_cd = cs.cat_cd , cs2.mkt_cd null --join cat_struct cs3 --on cs3.cat_cd = cs.cat_cd , cs3.mkt_cd null --and cs3.sub_cat_cd not null cs.lob_cd ='p' , cc.cntrct_vers_id = 781439637 , cs2.nm = 'adult books' use keyword distinct in select statement. yow records not repeated. thanks

sql - Speed Up Text Search Query Large Data Set -

hi i'm hoping has tip me. have query below filters detail field in #templogins table. details field text field contains many types of text strings, containing urls have parts "resultid=5" contained in resultidsearch , resultsetidsearch fields. records entries "resultid=5" ones i'm trying filter for. the problem have query takes way long run. templogin table has around 200 k records , tempsearch table has around 80 k records. any tips on how rewrite or speed query appreciated. enter code here: select * #templogins exists (select 1 #tempsearch t1 a.detail '%' + t1.resultidsearch + '%' or a.detail '%' + t1.resultsetidsearch + '%') this join version problem % going table scan index on #templogins.detail may doubt it select distinct a.* #templogins join #tempsearch t1 on a.de

How to pass a 2 dimensional array as a function argument in Go? -

so want able pass matrix function in argument in golang. different size each time - e.g., 4x4 matrix, 3x2 matrix, etc. if try running test code below against source code error message like: how pass 2 dimensional array function? i'm new go , come dynamic language background (python, ruby). cannot use mat[:][:] (type [][3]int) type [][]int in argument zeroreplacematrix source code func replacematrix(mat [][]int, rows, cols, a, b int) { } test code func testreplacematrix(t *testing.t) { var mat [3][3]int //some code got := replacematrix(mat[:][:], 3, 3, 0, 1) } the easiest way use slices. unlike arrays passed reference,not value. example: package main import "fmt" type matrix [][]float64 func main() { onematrix := matrix{{1, 2}, {2, 3}} twomatrix := matrix{{1, 2,3}, {2, 3,4}, {5, 6,7}} print (onematrix) print (twomatrix) } func print(x matrix) { _, := range x { _, j := range { fmt.printf(&

css - Why are my link texts different colors? -

my web page has css: html.light .auth .authinput .authlink { color: #007fff; } and html: <a class="authlink" .... ></a> what notice in 1 place link blue , in place link purple. can tell me why different color? because purple 1 stands visited . make go away add :visited pseudo selector this: html.light .auth .authinput .authlink:visited { color: #007fff; } this ensure link same color after you've visited it. , visited mean clicked on it. generally want cover entire "love hate" of links: html.light .auth .authinput .authlink:link { color: #007fff; } html.light .auth .authinput .authlink:visited { color: #007fff; } html.light .auth .authinput .authlink:hover { // color } html.light .auth .authinput .authlink:active { // color } "love hate" means should define :link , :visited , :hover , :active in correct order. it's helper reminding order specify them in. (lvha)

c# - The use of CommandLineArgs in visual studio -

this question has answer here: how access command line parameters outside of main in c# 5 answers so im trying use commandlineargs.count , commandlineargs.toarray if searched on internet , use my.application.commandlineargs not work me. this error im getting error 1 name 'my' not exist in current context c:\users\nighel\documents\visual studio 2013\projects\sof_script\sof_script\gui.cs 119 17 sof_script if (my.application.commandlineargs.count > 0) { string[] strarray = my.application.commandlineargs.toarray<string>(); s = strarray[0]; if ((strarray.length == 3) | (strarray.length == 4)) { } } use environment.getcommandlineargs() : returns string array containing command-line arguments current process. they available parameters i

tfs - How to set specifict users to be reviewers -

Image
i using visual studio 2015 , git. have branch policy pull requests have approved @ least 1 user (reviewer) before merge. but don't want every user reviewer, set group of users or specific ones can reviewers. there way this? there's option require specific reviewers portions of code. should specify paths , add reviewers each path. in simplest form, can require minimum 1 reviewer, , add him/her repo root path. might this: looks powerful mechanism. example, can specify /source part of code reviewed team lead, /buildscript part reviewed build guy, , /tests examined qa people! :-)

data structures - insert into vantage-point tree -

given large collection of 64 bit integers, goal find integer smallest hamming distance new integer, after new integer inserted in collection. practice, plan on using vantage-point tree , uses small amount of storage lookup performance provides. however, having problems figuring out how insert in(and possibly delete from) such tree. after looking around not sure anymore if datastructure suitible operation, question follows: is possible insert vantage-point tree without rebuilding whole tree? if yes, ask time complexity of operation is, , directions on how it. i have used following references tree: https://en.wikipedia.org/wiki/vantage-point_tree http://stevehanov.ca/blog/index.php?id=130 http://www.huyng.com/posts/similarity-search-101-with-vantage-point-trees/ the paper introduced structure not provide algorithm insertion. sounds should possible, though. yianilos, peter n. "data structures , algorithms nearest neighbor search in general metric spaces

actionscript 3 - AFEFontManager in Adobe AIR. How to embed fonts now? -

i have been building games using flashdevelop flex sdk compiler time, need asc 2.0 adobe air. have migrated it. 1 problem came out, can't find solution for. need embed ttf fonts, used add additional compiler option -managers=flash.fonts.afefontmanager for. in new air sdk next warning: command line warning: 'compiler.fonts.managers' not supported. and of course fonts not embed. there solution it? here's how embed them [embed(source = "verdana.ttf", fontname = "verdana")] private static var verdana: class; well, answer adobe (for unknown reason) have cut font pretranscoding out of asc 2.0, fonts must pretranscoded able embedded code. easiest way use adobe flash pro, embed font , pack swc. attach project somewhow, , register font via font.registerfont(arial); (or other class have attached it). bingo! can use it. second, more complicated, cheaper way use fontswf utility adobe details can found here http://www.bytearray.org/

angularjs - Why isn't my spline chart showing when using combo charts? -

so i'm using highcharts-ng angular create combination chart of spline chart , column chart formatted histogram show trends. the way works on load of page, see histogram, , not spline. changing order nothing. it looks though if have spline chart data hard-coded shows, using program add in data after service called in not work. (function() { 'use strict'; angular .module('app.widgets') .directive('trends', trends); trends.$inject = ['resultsservice']; /* @nginject */ function trends() { var ddo = { restrict: 'ea', templateurl: 'app/widgets/trends/trends.directive.html', link: link, scope: { data: '=', config: '=' }, controller: controller, controlleras: 'vm', bindtocontroller: true }; return ddo; function link(scope, element, attrs) { } function controller($scope, resultsserv

Rails make all routes default to format: :json -

can make routes default json ? i have following api scope wondering if can same global scope? scope :api, defaults: {format: :json} "/search(/:query)(/:location)" => "search#index" end for example user resources default json resources :users use constraints constraints format: :json resources :users end or resources :users, :defaults => { :format => 'json' }

c# - Expression.Assign returns Func instead of Action -

i'm building small expression based property assigner. the idea pretty simple, create action gets property object , assigns object property. so if process expression: public static action propertyassign(object sourceobject, object destobject, propertyinfo sourceproperty, propertyinfo destproperty) { expression source = expression.propertyorfield( expression.constant(sourceobject), sourceproperty.name); expression dest = expression.propertyorfield( expression.constant(destobject), destproperty.name); expression assign = expression.assign(dest, source); return (action)expression.lambda(assign).compile(); } and try call it, exception telling expression.lambda of type func (where t property type) since call assign expect have no remaining value on stack (so not returning property itself). now if assign property using setmethod, : public static action propertyassign(object sourceobject, object destobject, propertyinfo sourceproper

java - My Android App Keeps Crashing When Opening A New Activity From My Navigation Drawer -

i new coding in android studio , have been trying make application school. have made navigation drawer launches few new activities. right now, launches 2 activities settings activity (which has nothing in yet) , basketball tutorial home page activity. whenever launch settings activity, activity shows , application not crash. however, when click on basketball tutorial home page activity, app crashes reason. activity contains beginning of youtube structure, once click on buttons, sends video. have splash screen launches main activity. please in anyway can. not letting me add imports java file onto forum, have let them out, public class....extends....as not working. whole file comes no errors. android manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.jehan.sportstutorials" > <application android:allowbackup="true"

c# - WPF - Knowing which control will end up with focus -

i've been playing around events in wpf , have far i've got mileage out of 'source' , 'originalsource' properties of event args using sending control , focusmanager. here's thing, when chain of events starts firing, there way know control ending focus @ end barring intervening logic throughout chain of events? i'm afraid reliable way of doing letting focus change , handling in previewgotkeyboardfocus handler @ top view level. you can know control going focus, , cancel change e.handled = true . pd. there's function in uielements called predictfocus , works positional traverse changes, not tab-based changes (or custom focusing).

Display scene at lower resolution in three.js -

i looking way display three.js viewport @ half resolution (or double size depending on how @ it). three.js documentation states [y]ou can give setsize smaller values, window.innerwidth/2 , window.innerheight/2, half resolution. not mean game fill half window, rather bit blurry , scaled up. the actual result, however, viewport sclaed half size. this jsfiddle shows non-expected behaviour. looking @ api there setsize , setviewport method, neither allows me have scaled viewport. there question , answer here on gives 1 way of doing css, looking non-css related way if possible. 2pha's answer correct , has been implemented in threejs setpixelratio() method, can write fewer lines. main interest method is consistent window property window.devicepixelratio recalled in comment. this important feature add boilerplate if care mobile / tablet devices. in html header should have meta tag : <meta name='viewport' content='width=device-width'

python - Colission testing with numpy -

let's have cell-matrix , coordinates x , y denote top-left cell of tetronimo , matrix b corresponding tetris well: t = [[2,2,2], [2,0,0], [0,0,0]] y,x = (1,0) b = [[0,0,0,0,0], [0,0,0,0,0], [1,0,0,0,0],] currently i'm using simple comparison find collision: def testcollision(x,y, t, b): dx in xrange(3): dy in xrange(3): if t[dy][dx] == 0: continue else: if b[y+dy][x + dx] != 0: return false return true can speed use of numpy? if not mistaken, of form should work return (b[x:x+3,y:y+3] * t).sum() == 0 you should test correctness; in case algorithmically optimal, within numpy paradigm. note however, operations on small arrays such these not terribly efficient either. still lot better c-style iteration, overhead of array abstraction noticeable. is, insofar performance issue in first place, when comes tetris. ;) return (b[x:,y:][:3,:3] * t)

c# - mkbundle cannot find gtk-sharp assembly on ubuntu -

i'm trying create bundle app made monodevelop on ubuntu 14. when execute mkbundle myapp.exe --deps -o myapp error thrown unhandled exception: system.io.filenotfoundexception: not load file or assembly 'gtk-sharp' or 1 of dependencies. system cannot find file specified. file name: 'gtk-sharp' @ system.appdomain.load (system.string assemblystring, system.security.policy.evidence assemblysecurity, boolean refonly) [0x00000] in <filename unknown>:0 @ (wrapper remoting-invoke-with-check) system.appdomain:load (string,system.security.policy.evidence,bool) @ system.reflection.assembly.reflectiononlyload (system.string assemblystring) [0x00000] in <filename unknown>:0 i have found solution windows here how make "mkbundle --deps" option working mono 3.2.3 nothing ubuntu. can please?

php - Rename image on upload -

i rename image when uploaded. the url of upload page upload.php?clientid=123456 , save image 123456.jpg here upload code if (move_uploaded_file($_files["filetoupload"]["tmp_name"], $target_file)) { echo "the file ". basename( $_files["filetoupload"]["name"]). " has been uploaded."; } else { echo "sorry, there error uploading file."; } is possible? (newbie) you're saving file: move_uploaded_file($_files["filetoupload"]["tmp_name"], $target_file) just first set $target_file whatever want name of file be. $target_file = "/some/path/to/a/file.jpg"; or $target_file = "/some/path/with/a/$variable.jpg"; the move_uploaded_file() function going save (or @ least try to) file whatever name in second function parameter. provide name want file have.

c# - MimeKit: How to embed images? -

i using mailkit/mimekit 1.2.7 (latest nuget version). i tried embed image in html body of email following sample api documentation (section "using bodybuilder"). my current code looks this: var builder = new bodybuilder(); builder.htmlbody = @"<p>hey!</p><img src=""image.png"">"; var pathimage = path.combine(misc.getpathofexecutingassembly(), "image.png"); builder.linkedresources.add(pathlogofile); message.body = builder.tomessagebody(); i can send email , in fact image is attached email. not embedded. am missing something? or apple mail's fault (this email client using receiving emails)? i grateful idea (and jeffrey stedfast providing such great toolset!!). ingmar try bit more this: var builder = new bodybuilder (); var pathimage = path.combine (misc.getpathofexecutingassembly (), "image.png"); var image = builder.linkedresources.add (pathlogofile); image.contentid

c# - Cannot open backup device - Operating system error 3 -

i have section in project webmaster can create , download occasional database backups. here code [httppost] public actionresult backup(databasebackupviewmodel model) { var constr = system.web.configuration.webconfigurationmanager.appsettings["constr"]; var backupfolder = system.web.httpcontext.current.server.mappath("\\content\\db-backup\\"); var backupfilename = string.format("bkp-{0}-{1}.bak", datetime.now.tostring("yyyy-mm-dd"), datetime.now.ticks.tostring(cultureinfo.invariantculture)); using (var connection = new sqlconnection(constr)) { var query = string.format("backup database dbname disk='{0}'", backupfolder + backupfilename); using (var command = new sqlcommand(query, connection)) { connection.open(); command.executenonquery(); //save database. var bkp = new databasebackuplog { backupid = guid.newguid(), backuptitle = model.title, back

ruby on rails - Routing issues with High Voltage and locale -

my routes.rb rails.application.routes.draw scope "(:locale)", locale: /fr-fr|de-de|es-es|zh-cn/ ":id" => "high_voltage/pages#show", as: :page, format: false ... which works fine things on top level /pricing pages nested inside folders (e.g. /pricing/products ) routes /zh-cn/pricing%2fproducts (which routes correctly, looks ugly) , /zh-cn/pricing/products not route correctly get "*id" => "high_voltage/pages#show", as: :page, format: false in routes file fixes issue

javascript - Not able to render the fusion charts in angularjs -

i trying use angular fusion charts , below code <div class="col-md-8"> <fc-chart fc-chart-type="bar2d" fc-data="{{mydatasource}}"></fc-chart> </div> and in controller $scope.mydatasource = { chart: { caption: "harry's supermart", subcaption: "top 5 stores in last month revenue", numberprefix: "$", theme: "fint" }, data: [{ label: "bakersfield central", value: "880000" }, { label: "garden groove harbour", value: "730000" }, { label: "los angeles topanga", value: "590000" }, { label: "compton-rancho dom", value: "520000" }, { label: "daly city serramonte", valu

jquery - Using custom knockoutjs select binding with standard select bindings as well -

i trying combine custom knockoutjs binding standard binding. although have been able find related solution ko.bindinghandlers.parentareacombobox = { initialised: false, init: function (element, valueaccessor, allbindingsaccessor, viewmodel, context) { viewmodel.parentareas.subscribe(function (newparentareas) { if (newparentareas && newparentareas.length > 0) { if (ko.bindinghandlers.parentareacombobox.initialised) { return; } ko.applybindingstonode(element, { options: viewmodel.parentareas, optionscaption: 'choose...', optionstext: 'label', value: viewmodel.selectedparentarea }); $(element).chosen({}); ko.bindinghandlers.parentareacombobox.initialised = true; } }); } }; but not able make work on mine . doing wrong here? use debugging console in browser (press f12

fortran - rank values passed in subroutines -

i having issues using multi-dimensional array in fortran code writing. basically, define 2-dimensional array, passed membrane , have pass 1-dimensional version of set . case (1) call membrane ("set", scv(i,:), sty) here routine takes 1-d array. subroutine membrane (tsk, scv, sty) implicit none character (len=*), intent (in) :: tsk logical, intent (in), optional :: scv(:,:) character (len=*), intent (in), optional :: sty select case (tsk) case ("set") call set (tsk, scv(1,:), sty) ... here set subroutine subroutine set (tsk, scv, sty) implicit none character (len=*), intent (in) :: tsk logical, intent (in), optional :: scv(:) character (len=*), intent (in), optional :: sty i error when try compile code sct/btun/membrane.f:185:35: call membrane ("set", scv(i,:), sty) 1 error: rank mismatch in argument 'scv' @ (1) (rank-2 , rank-1) you calling routine membrane using one-dime

python - How can i correctly pass arguments to classbasedviews testing Django Rest Framework? -

i want test views in drf project. the problem comes when try check views have arguments in urls. urls.py url(r'^(?pcompany_hash>[\d\w]+)/(?ptimestamp>[\.\d]*)/employees/$', employeelist.as_view(), name='employeelist'), [edit: "<" in url has been deleted in purpose, isnt considered tag , not shown] views.py class employeelist(listcreateapiview): serializer_class = employeedirectoryserializer def inner_company(self): company_hash = self.kwargs['company_hash'] return get_company(company_hash) def get_queryset(self): return employee.objects.filter(company=self.inner_company()) test.py class apitests(apitestcase): def setup(self): self.factory = apirequestfactory() self.staff = mommy.make('directory.employee', user__is_staff=true) self.employee = mommy.make('directory.employee') self.hash = sel

r - Difference between tmpList["colName"=="value"] and tmpList["colName"=="value",] -

i had big list of data in r, , used following line: subsetlist <- tmplist[tmplist$colname=="value"] where colname name of column in list , 'value' text wanted subset 'tmplist' on. the result received complete replication of 'tmplist' in new list. after experimenting, used following instead: subsetlist <- tmplist[tmplist$colname=="value" , ] (note comma inserted.) now 'subsetlist' contains rows content of column given 'colname' matching "value". why first attempt return rows? , why second attempt return rows matching equivalence criteria?

php - Generate a csv and send to email -

i want generate csv file , send email, tried : function create_csv_string($data) { // open temp file pointer if (!$fp = fopen('php://temp', 'w+')) return false; fputcsv($fp, array('jour', 'nombre 1', 'nombre 2', 'total')); // loop data , write file pointer foreach ($data $line){ fputcsv($fp, $line); } // place stream pointer @ beginning rewind($fp); // return data return stream_get_contents($fp); } function send_csv_mail($csvdata, $body, $to = 'myemail@gmail.com', $subject = 'stats', $from = 'noreply@my.com') { // provide plenty adequate entropy $multipartsep = '-----'.md5(time()).'-----'; $headers = array( "from: $from", "reply-to: $from", "content-type: multipart/mixed; boundary=\"$multipartsep\"" ); // make attachment $attachment = chunk_split(base64_encode(create_csv_string($csvdata))); // make body of message $body = "--$multip

Cannot build apktool on Ubuntu 14.04 -

i'm trying build apktool (tool decompiling android apk files). instructions how build @ http://ibotpeaches.github.io/apktool/build/ problem command ./gradlew build fatjar errors receive are: brut.androlib.sharedlibrarytest > issharedresourcedecodingandrebuildingworking failed brut.androlib.androlibexception: brut.androlib.androlibexception: brut.common.brutexception: not exec command: [/tmp/brut_util_jar_9054478823788249311.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 21, --version-code, 21, --version-name, 5.0-eng.ibotpeaches.20141225.072308, -f, /tmp/apktool134713816630716118.tmp, -0, arsc, -i, /tmp/brut4423679278565619004.tmp/1.apk, -i, /tmp/brut4423679278565619004.tmp/2-shared.apk, -s, /tmp/brut4423679278565619004.tmp/client.apk.out/res, -m, /tmp/brut4423679278565619004.tmp/client.apk.out/androidmanifest.xml] @ brut.androlib.androlib.buildresourcesfull(androlib.java:459) @ brut.androlib.androlib.buildresources(a