Posts

Showing posts from April, 2013

How to sort values that has different position of the fields in bash -

i discovered looking @ logs; commits git may have or not have name , last name; means if sort using -k, position of fields may not correct. for example, if file commits various repository standard format have is commit - name - surname - date - repo name i sort them sort -k 4, them ordered date (that's need)/ problem is, committer name replaced generic name (not sure why, not managing repository); ends jumping 1 field, , date on 3rd position, not 4th. this results in majority of commits ordered correctly, ones has date on 3rd position, end being @ bottom, don't have them ordered chronologically. since cannot control repo throw @ me, there way tell sort, order date, without specify 1 field has date? or should use different sort? can not check number of fields on line? i.e. counting last element instead of first? granted sort may not have sufficient capabilities specify keys end of line, may have resort small awk script find the right sort key based

regex - SQL/Oracle: INSTR or REGEXP? -

i'm studying exam , don't one: i want find cities in table ends ville, in charlottesville. which 1 correct? ... instr(city,'ville') > 0; or ... regexp_substr(b,'ville$') = 'ville' which of these 2 it? , wrong other one? regards jop

php - mPDF $_POST from another page not working -

i generate beautiful looking html based pdf reason, sending html form mpdf generator works outside of $html = ''... i send data html form (form.html) mpdf php page receives post variables. when use simple php tag $_post['preparedby'] in $html='' doesnt work. here's snippet: $html= ' <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="12"><img src="logo/xxtrasmsw.png"></td> </tr> <tr> <td colspan="12">eval form</td> </tr> <tr > <td width="11%">prepared by</td> <td colspan="7" class="bb">'.$preby.'</td> <td width="11%">date prepared</td> <td colspan="3" class="bb">'.$_post['dateprepared'].'</td> </tr> <tr>

java - How to round double to nearest whole number and return it as Integer -

let suppose have double x . return nearest whole number of x . example: if x = 6.001 return 6 if x = 5.999 return 6 i suppose should use math.ceil , math.floor functions. don't know how return nearest whole number... for example, seems want use math.rint() . return closest integer value given double . int valuex = (int) math.rint(x); int valuey = (int) math.rint(y);

javascript - Cannot read "path" property of undefined Nodejs -

here jade file form(method="post", action="/upload", enctype="multipart/form-data") input(type="file", name="logname") button(type="submit") upload and index.js file /* home page. */ router.get('/', function (req, res) { res.render('fileupload', { title: 'building log file viewer' }); }); var formidable = require('formidable'), fs = require('fs'), util = require('util'); /* post file upload */ router.post('/upload', function (req, res) { var form = new formidable.incomingform(); form.parse(req, function (err, fields, files) { fs.readfilesync(files.upload.path, function (err, data) { if (err) throw err; console.log("test"); }) }); }); i keep getting typeerror property property "path" undefined; however, when sumbit code under http.createserver, instead of rou

wordpress - Icons to insert new page disappeared -

Image
someone tell me how can icons of wordpress? currently i'm like: i want return normal, thus: does know css can move? according chris herbert , try disabling plugins 1 one. solve problem. if you've edited core wordpress file, consider reinstalling wordpress wp-admin.

assign a variable with the value from a command + bash -

this question has answer here: assign command output variable , if branch on return value 1 answer how assign variable value command? this basic example of variable assignment: $ line_count=2 $ echo $line_count 2 this command(the value 3) assign variable: $ wc -l < file1.csv 3 but have tried not work: $ line_count2=wc -l file1.csv -sh: -l: command not found how can done? one way is: $ line_count2=$(wc -l < file1.csv) $ echo $line_count2

Plugin with id 'android' not found (Android Studio) -

Image
i switched android studio 0.6.1 app dev , ran issue gradle. i "error:(1, 0) plugin id 'android' not found. quite new appreciated. here build.gradle file: apply plugin: 'android' android { compilesdkversion 19 buildtoolsversion "19.1.0" defaultconfig { applicationid "com.b3dog.helloagain" minsdkversion 15 targetsdkversion 19 versioncode 1 versionname "1.0" } buildtypes { release { runproguard false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) } this issue appears in android studio 0.6.1 canary build after week struggling found whats wrong new studio version . not gradle far see . , happen people , know why ? because people specially junior developer accidentally p

unity3d - Changing the compression format of multiple textures -

Image
i'm using following method compress bunch of textures: public void onpostprocesstexture (texture2d t) { editorutility.compresstexture(t, textureformat.dxt5, 2); } the idea try compress texture when importing it. have project many textures not using optimal format. the problem these changes not saved anywhere, if check editor you'll see format remains same. can leave script there , reimport in build server, i'd way save these changes. the way can think of create texture using format want , copying/replace texture. there better way this? edit doing more tests, noticed strange: editorutility.compresstexture somehow compressing npot textures. before running script: and after running editorutility.compresstexture : how work? while sergey's answer helps me change format, won't compress npot textures , need save these bytes. you have 2 problems here. problem 1 you trying inside onpostprocesstexture method, late. need insid

php - Sort Multi Dimensional Array efficiently -

here content of array: array( 'june 01, 2014' => array( (int) 722107 => array( 'date' => 'june 01, 2014', 'start_time' => '2:00 am', 'end_time' => '03:00 am' ), (int) 117646 => array( 'date' => 'june 01, 2014', 'start_time' => '12:30 am', 'end_time' => '03:30 am' ) ), 'may 31, 2014' => array( (int) 769349 => array( 'date' => 'may 31, 2014', 'start_time' => '12:30 am', 'end_time' => '03:30 am' ) ) ) and output want should sorted first keys (date in asc), sort again values of each keys start time in asc. based on example above should output: array( 'may 31, 2014' => array( (int) 769349 => array( 'date' => 'may 31, 2014',

hdfs - why does my hadoop command does not work? -

i have hadoop cluster set 1 master , 2 slaves. when type hadoop fs -ls ls: cannot access .: no such file or directory. but when type following: hadoop fs -ls / found 1 items drwxr-xr-x - mike supergroup 0 2014-06-24 00:24 /usr i same output both on master , slaves. why hadoop fs -ls not work? thanks! hadoop fs -ls this tries list current user's home directory on hdfs. since think /user/{username} directory doesn't exist in case hence error, hadoop fs -ls / you telling list root directory exist.

node.js - Error installing node-postgres on Amazon Linux. Missing pg_config.h file -

this error seems common on windows boxes, amazon linux ec2 instance throwing error when npm install pg : ../src/binding.cc:1:23: fatal error: pg_config.h: no such file or directory #include <pg_config.h> ^ compilation terminated. make: *** [release/obj.target/binding/src/binding.o] error 1 make: leaving directory `/home/ec2-user/macros/test/statehash/node_modules/pg/build' gyp err! build error gyp err! stack error: `make` failed exit code: 2 gyp err! stack @ childprocess.onexit (/usr/lib/node_modules/node-gyp/lib/build.js:267:23) gyp err! stack @ childprocess.eventemitter.emit (events.js:98:17) gyp err! stack @ process.childprocess._handle.onexit (child_process.js:807:12) gyp err! system linux 3.4.82-69.112.amzn1.x86_64 gyp err! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp err! cwd /home/ec2-user/macros/test/statehash/node_modules/pg gyp err! node -v v0.1

asp.net mvc - Using C# Entity Framework how I can display "Select ALL" option in my combobox -

i working on mvc 4.0 entity framework. please consider following action method , me how can display "select all" text in combobox. [httppost] public actionresult loadcustomer() { userpersistence user = ((userpersistence)session["ultuser"]); ilist customer = dbcontext.customergroups.select ( e => new { id = e.customergroupcode, name = e.customergroupcode + "-" + e.name, cty_iso = e.cty_iso } ).where(e => e.cty_iso == user.cty_iso).tolist(); return new jsonresult { data = new selectlist(customer,"id", "name") }; } i attached jsonresult combobox working fine problem how can display "select all" text in combobox. in view i'm using telerik mvc combobox show list: @(html.telerik().combobox() .name("customerc

c++ - Can you find the iterator for a list element given a pointer to the element? -

the question pretty self-explanatory, if have std::list<t> object, there standard method iterator element, given t* value points element? if t user-defined type, seems dereferencing pointer , using find_if job, seems inefficient me. if you're trying find element in container value, makes sense you'd need iterate through container until find something. if have pointer, intuitively feels there should method that's more direct. basic understanding makes me think there should 1-to-1 relationship between list item's iterator , pointer since lists doubly-linked in stl, don't have up. i'm not familiar with c++ iterators, if explain why there or isn't way this, helpful. edit: potatoswatter provided c++11 solution i'd still interested if c++03-compatible solutions available. there's no standard algorithm find iterator in range satisfies condition. find uses value of element, that's not same thing. find_if lambda compares ad

c# - iText sharp SimpleTextExtractionStrategy(); -

i using itextsharp travers through pdf file. not find text imbedded within table. public bool readpdffilespecial(string filename ) { var found = false; if (file.exists(filename)) { pdfreader pdfreader = new pdfreader(filename); (int page = 1; page <= pdfreader.numberofpages; page++) { itextextractionstrategy strategy = new simpletextextractionstrategy(); string currentpagetext = pdftextextractor.gettextfrompage(pdfreader, page, strategy); if (currentpagetext.contains("is on 18 years old. children must less 19 years old qualify medikids. however, ")) found = true; ; } pdfreader.close(); } return found; }

javascript - Having trouble clearing canvas element -

the problem i'm having lines not clearing canvas. not quite sure why. i've looked issue quite awhile. here's of code: function handles creation of line segments var ui= { clear:function() { gsx.clearrect(0,0,window.gsw,window.gsh); }, drawcharacterrays:function() { for(z=0;z<walljoints.length;z++) { originx=(gsw/2); originy=(gsh/2); gsx.strokestyle='#ff0000'; gsx.beginpath(); gsx.moveto(originx,originy); gsx.lineto(walljoints[z][0],walljoints[z][1]); gsx.closepath(); gsx.stroke(); } } } and code show order @ functions called: function engine() { ui.clear(); gsx.fillstyle="#ffffff"; gsx.fillrect((gsw-characterw)-window.x,(gsh-characterh)-window.y,mapw,maph); ui.drawmap(curlevel, [1,1,0,0,0,0,0,1,0,1], [1,1,0,0,0,0,0,1,0,1]); ui.drawcharacterrays(); ui.

ios - How to have UIScrollView animate off screen when dragged -

Image
so have uiviewcontroller , have uiscrollview inside of it, has ui elements. i want user able drag uiscrollview , down, when drags past threshold, want animate off screen. there needs springiness though. tried using -(void)scrollviewdidscroll: couldn't seem right. thoughts? in scroll view delegate method -(void)scrollviewdidscroll:(uiscrollview *)scrollview; observe scrollview.contentoffset.y , trigger animation when reaches expected y position. for example: cgfloat ytranslation = -200.f; // value want shift [uiview animatewithduration:0.35 animations:^{ scrollview.transform = cgaffinetransformmaketranslation(0, ytranslation); } completion:^(bool finished) { // code after completion }];

python - Can I use Animation with Matplotlib widget for pyqt4? -

i found cool animation matlibplot , want add plot widget in pyqt program. method shows regular plots in program def plot(self): ax = self.ui.figure.add_subplot(111) ax.hold(false) ax.plot([1,2,3],[4,5,6]) self.ui.canvas.draw() i thought add single def animation code form , call animation same above, alas no. here animation code: import numpy np import matplotlib.pyplot plt import matplotlib.animation animation n = 100 on = 255 off = 0 vals = [on, off] # populate grid random on/off - more off on grid = np.random.choice(vals, n*n, p=[0.2, 0.8]).reshape(n, n) def update(data): global grid # copy grid since require 8 neighbors calculation # , go line line newgrid = grid.copy() in range(n): j in range(n): # compute 8-neghbor sum # using toroidal boundary conditions - x , y wrap around # simulaton takes place on toroidal surface. total = (grid[i, (j-1)%n]

C#: Replacing the first plain character in HTML string -

what trying replace first character within html string own custom style new tag. unfortunately unable in general way work of examples. consider next possible html strings: string str1 = "hello world"; string str2 = "<p><div>hello</div> world <div>some text</div></p>"; string str3 = "<p>hello <span>world</span></p>"; string str4 = "<p><a href="#">h</a>hello world</p>"; string str5 = "<p>hello world <div>some text</div></p>"; the results should be: str1 = "<span class=\"my-style\">h</span>ello world"; str2 = "<p><div><span class=\"my-style\">h</span>ello</div> world <div>some text</div></p>"; str3 = "<p><span class=\"my-style\">h</span>ello <span>world</span></p>

nawk/awk: How to present an error message while there is no string match? -

i'll start saying forum excellent source of knowledge. need in presenting no match error message. printf "some\nwhere\nonly\nwe\nknow\n" > test.txt i'm looking 'only' string , if there match, presented nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(nr-c+1)%b];print;c=a}b{r[nr%b]=$0}' b=0 a=0 s="only" test.txt | awk '{if ($0 ~ /only/) print; else print "no match"}' output: only if i'm looking 'only' string , checking if there apple on line, i'll no match message nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(nr-c+1)%b];print;c=a}b{r[nr%b]=$0}' b=0 a=0 s="only" test.txt | awk '{if ($0 ~ /apple/) print; else print "no match"}' output: no match but if i'm looking 'apple' string (there no such) , check if it's there, don't 'no match' message. nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(nr-c+1)%b

Android Wear Development preview Confirmation Email -

i have register android wear development,but not got confirmation mail android team. need android wear developer i believe there's review period. release date today , haven't seen updates since 3:00am est. i'm guessing might not answers until 12:00pm est, maybe 1:00pm est. paul's right, isn't software related doubt know. try reddit.com. there's more diversity there fyi-type questions. i understand have question , that's why posting asking question in incorrect place can ineffective not asking @ all. not trying rude, rather attempting prevent wasting time , effort in future. in hopes make little worthwhile, check out links below: https://support.google.com/googleplay/android-developer/#topic=3450769 https://support.google.com/googleplay/?rd=1#contact=1 support.google.com/googleplay/android-developer/troubleshooter/3049653#contact=1 plus.google.com/+androiddevelopers/posts groups.google.com/forum/#!forum/android-developers p

c# - how to pass dynamically created xml in XsltArgumentList msxsl -

i in fix here have pass dynamically created xml in c# code passed xslt param , values it. following sample xslt <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0"> <xsl:param name="keys"></xsl:param> <xsl:template match="/"> <mykey>mynode</mykey> <xsl:value-of select="msxsl:node-set($keys)/keys/item/header"/> </xsl:template> </xsl:stylesheet> then code in c# call transform method xslcompiledtransform proc = new xslcompiledtransform(); proc.load("sheet.xslt"); xsltargumentlist xsltargs = new xsltargumentlist(); xmldocument doc1 = new xmldocument(); // populate needed e.g. doc1.loadxml("<keys><item><header>fooheader</header></item></keys>"); xsltargs.addparam("keys", "", doc1.innerxml.tostrin

php - Radio button $_POST -

how know value of clicked button <input type="radio" name="radio">yes<br> <input type="radio" name="radio">no php part $option1= $_post['radio']; when echo it say's "on". you need give value attribute: <input type="radio" name="radio" value="yes">yes<br> <input type="radio" name="radio" value="no">no

php - Creating a PDF from a form -

i'm having issues creating .pdf form, validated php.. i insert table row - or form , attempt create .pdf having grabbed primary key row in order identify it. i have this... print loadlist pdf file in pdfload_lists file: $this->printpdf = "c:\\inetpub\\pdf\\0110\\wkhtmltopdf " . " --dpi 100 --background --images --disable-smart-shrinking --print-media-type " . "--page-size a4 --margin-left 0 --margin-right 0 --margin-top 0 --margin-bottom 0 " . "\"link?id=".$this->id."\" " . "link".$this->id.".pdf"; die($this->printpdf); system($this->printpdf); sql query: if($_get['id']) { $query = " select* db.table id '".$_get['id']."' limit 1 "; } this then, should post if in class id being posted , print row. am doing wrong?. i've had remove company code sorry if makes more difficult answer. many

c# - Can client credentials be read from within service implementation? -

i hosting soap webservice via instance ihost of servicehost ; authentication configured as httpbinding.security.transport.clientcredentialtype = httpclientcredentialtype.basic; ihost.credentials.usernameauthentication.usernamepasswordvalidationmode = usernamepasswordvalidationmode.custom; ihost.credentials.usernameauthentication.customusernamepasswordvalidator = new customvalidator(); the hosting works desired, access client credentials within hosted service itself. can achieved current authentication settings or impossible? found answer of coworker. username can accessed via operationcontext.current.servicesecuritycontext.primaryidentity.name ; question can seen duplicate of this question .

javascript - Angularjs - unexpected order of execution -

i have strange problem causes problem in ie (any version) not chrome. i have array called "items" within object called "doc" - users can edit items deletes item adds content text box users can add again after making changes. the code edit function is: $scope.edititem = function(index) { console.log($scope.doc); //debugging item = $scope.doc.items[index]; $scope.content = item.data $scope.doc.items.splice(index,1); }; starting out 3 items, during debugging i've noticed console.log($scope.doc) (line 2) outputs doc 2 items in it. before array has been spliced. expect there 3 items. i've checked index passed correctly view isn't problem area. why happening? it can console.log prints object not immediately(possibly saves reference , prints bit later). try replace console.log($scope.doc); console.log($scope.doc.length); or console.log(json.stringify($scope.doc));

c# - Entity Framework Class Generation Naming Scheme -

is there way configure code generation naming conventions. have db several different schemes. classes being generated table names, several postfixed assending numbers. have table1, table2, ... tablex. schemename1_table, schemeblabla_table, ... schemewhatever_table. is possible reasonable effort? i'm using c# in vs2012. edit: should mention that: the database exists , may not modified. the tables being postfixed names exist in other schemes. you cannot this. can use codefirst approach create mapping of classes database tables. in case have whole control on names of classes , properties

python - What's the difference between numpy.take and numpy.choose? -

it seems numpy.take(array, indices) , numpy.choose(indices, array) return same thing: subset of array indexed indices . are there subtle differences between two, or missing more important? , there reason prefer 1 on other? numpy.take(array, indices) , numpy.choose(indices, array) behave on 1-d arrays, coincidence. pointed out jonrsharpe, behave differently on higher-dimensional arrays. numpy.take numpy.take(array, indices) picks out elements flattened version of array . (the resulting elements of course not same row.) for example, numpy.take([[1, 2], [3, 4]], [0, 3]) returns array([1, 4]) numpy.choose numpy.choose(indices, set_of_arrays) plucks out element 0 array indices[0] , element 1 array indices[1] , element 2 array indices[2] , , on. (here, array set of arrays.) for example numpy.choose([0, 1, 0, 0], [[1, 2, 3, 4], [4, 5, 6, 7]]) returns array([1, 5, 3, 4]) because element 0 comes array 0, element 1 comes array 1, element 2 comes a

asp.net mvc - Adding ASP MVC authentication after initial creation of project -

i have created lot of ground work ( views , viewmodels, controllers, models ) add authentication. did not add in initial creation process , wondering if there way add standard authentication created if 1 did select authentication type. is possible load authentication based on project created without laborious task of having change every namespace , using, , have required references pulled down. thanks

Inserting text into Excel with Python creates Bubbles -

Image
using python enter text excel file, have little problem occurs excel 2010. working excel 2013. i've tested on 2 different pc's. on 1 pc excel 2010, excel crashes, on other, enters these kind of bubbles (they behave images - can resize them): the code works this: create string, indicating line changes \r\n , , pasting excel.dispatch and pastespecial . what can reason not inserting correctly? def pastetoexcel(excelfile, sheet, data, startcell): if type(data) == list: rows = 1 cols = len(data) elif type(data) == pd.dataframe: rows = data.shape[0] cols = data.shape[1] elif type(data) == int or float: rows = 1 cols = 1 elif type(data) == str: rows = 1 cols = 1 cellrange = startcell text = "" cellrange = calculatecellrange(startcell,rowcount=rows,colcount=cols) if type(data) == pd.dataframe: print " erkannter datentyp vom input: pd.dataframe"

symfony - Get ORM Column name in a controller -

/** * @var integer * * @orm\column(name="anio_detalle", type="integer") */ private $detalle; is there way column name "anio_detalle" controller. i know can table name using $em->getclassmetadata('storebundle:user')->gettablename(); but there way column name? $em->getclassmetadata('acme\myentity')->getfieldname('detalle');

c# - How to Enable-Migrations In Code Camper Project -

i have been working way through building apps angular , breeze - part 1 on pluralsight john papa. shortly after getting basic pieces of application wanted make sure ef migrations work, cannot figure out best way start. the solution has 3 separate projects: cc.dataaccess -- dbcontext in here. cc.model - poco classes cc.web - actual database is what best way enable-migrations? you should try following steps: run enable-migrations command on dataaccess project run add-migration command connectionstringname parameter specified run update-database command the following ef migrations command reference: http://coding.abel.nu/2012/03/ef-migrations-command-reference/#enable-migrations

sorting - What is the relative running time of this bubble sort derivative? -

public class sort { public static void sort(int[] arr) { (int = 0; < arr.length - 1; i++) { if (arr[i] > arr[i + 1]) { /* swap */ int temp = arr[i]; arr[i] = arr[i + 1]; arr[i + 1] = temp; /* make == -1 because @ end of loop, increments go 0 */ = -1; } } } } this different traditional bubble sort. have worse running time? i believe still o(n^2), not see how worse... funny beast. lets take worst case, anti-sorted input: 9 8 7 6 5 4 3 2 1 how many comparisons needed move 9 first last position? 1+2+3+4+5+6+7+8 = (n-1)*(n-2)/2 what sending 8 second last position? 1+2+3+4+5+6+7 = (n-2)*(n-3)/2 so, algorithm cubic in comparisons performed! still, there's light @ end of tunnel: still quadratic in number of swaps performed, standard bubble-sort.

How to return the vaue of a specified hash key in an array in ruby? -

i have method attempts search array locating each record matching specified key , value. def search(key, query) some_stuff = [{"title"=>"awesome book", "author"=>"john doe", "qty"=>"5"}, {"title"=>"another book", "author"=>"jane doe", "qty"=>"2"}, {"title"=>"ruby book", "author"=>"john hancock", "qty"=>"4"}] # if put following in block return has records #however how substitute key , query? some_stuff.select {|b| b[].include? "jo" } if matches.any? # has records else # has no records end end # if call object.search(author, jo) # want return 2 records containing authors names "jo" in them # if call object.search(title, rub) # want query return 1 record also, how sort specified field currently i'm thinking

android - save values sms more than one -

i have code this, how add 1 value. adding key value,this not work. //val.put("key", key); contentvalues val=new contentvalues(); val.put("address", no); val.put("body", pesan); getcontentresolver().insert(uri.parse("content://sms/sent"), val);

asp.net mvc - MVC return View(model) Cannot perform runtime binding on a null reference -

this unclear me. code looks this public actionresult viewdevice(string id) { fooobject model = new fooobject(); if (id == null) return view(model); model = somemethodthatreturnsfooobject(id); return view(model); } on view, check if model null, i'm assuming work. when id not null, model variable filled fooobject.fill , displays on view. when id null ...the controller gets error @ runtime: "cannot perform runtime binding on null reference". any reason why??? you don't need return empty model object this: public actionresult viewdevice(string id) { if (id == null) return view(); fooobject model = somemethodthatreturnsfooobject(id); return view(model); }

c++ - ADO Recordset object returning 80004003 Error -

i trying open recordset, returning me error.. here part of code: void myfunction(_connectionptr connptr) { _recordsetptr recptr; std::string command = "select * mytable"; recptr.createinstance(__uuidof(_recordset)); recptr->open(command.c_str(), connptr.getinterfaceptr(), adopenstatic, adlockoptimistic, adcmdtext); //error!!!!!!! } int main(int argc, char** argv) { coinitializeex(null, coinit_multithreaded) _connectionptr connptr; connptr.createinstance("adodb.connection"); connptr->open(....my connection string, userid, , password....); myfunction(connptr); ::couninitialize(); connptr->close(); } the error message: code = 80004003 code meaning = source = <null> description = <null> dd (the description says nothing.. , have no idea "i" means or why "dd" printed out @ end,,) there nothing wrong connection string, userid, , password, since o

java - How to set the overwrite option in Mahout? -

in many cases output directory needs overwritten, while converting sequence files sparse vectors . know how set overwrite option. p.s.: have been able same via cli need make use apis. the api call used in sparse vectors sequence files follows: string[] vectorizingparameters = {"-i", seqdirectory, "-o", vectorsdirectory, "-ow"}; sparsevectorsfromsequencefiles thissparsevectorizer = new sparsevectorsfromsequencefiles(); thissparsevectorizer.run(vectorizingparameters); it's -ow in end of string[] vectorizingparameters gets parsed overwrite option.

google apps script - how to obtain the original array out of cacheService using GAS -

Image
i'm experimenting cache. i noticed if store array of strings strings separated komma . couldn't find method allows retrieve array array, string seems possible. retrieval of array splitting string obtained cause problem if array elements contain komma's. can happen if storing titles of books or newspaper articles etc. function test() { var delimiter = '\r\n'; var xx = ''; (var i=0; i<10; i++) xx = xx + '_' + i; var nummax = 1024; var = ','; var string = []; var total = ''; (var i=0; i<nummax; i++) { string[i] = 'string[' + + ']=' + + + xx; total = total + string[i] + delimiter; } total = total.substr(0, total.length - delimiter.length); // remove delimiter @ end of string cachescript.put('test_total', total); cachescript.put('test_string', string); var test_total = cachescript.get('test_total'); logger.log('tes

How to write a Dart 'worker' server -

i want write dart server reads firebase queue , sends emails. what not clear me how write server listens other http requests, in case firebase queue e.g. this project . it not "listen" http connections in original client <-> server sense. takes job queue , executes it, returns result , goes on next job. you'd need dart wrapper firebase queue implementation.

ruby on rails - Install rmagick on macosx is not working, duplicate references and references are not founded -

i'm trying install rmagick on macosx, reason, have lot of problems installation. found like: this trhead , this other thread , doesnt work, looks if have 2 references rmagick , file wand/magickwand.h not founded gem. my env variable is: $ echo "$pkg_config_path" /usr/local/cellar/imagemagick/6.8.9-1/include/imagemagick-6/ the log when try install gem is: $ gem install rmagick building native extensions. take while... error: error installing rmagick: error: failed build gem native extension. /users/jarvis/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb checking ruby version >= 1.8.5... yes checking /usr/bin/clang... yes checking magick-config... yes warning: found more 1 imagemagick installation. cause problems @ runtime. /usr/local/bin/magick-config reports version 6.8.9 q16 installed in @@homebrew_cellar@@/imagemagick/6.8.9-1 /opt/imagemagick/bin/magick-config reports version 6.8.8 q16 installed in /opt/imagemagick using 6.8.

angularjs - pass parameter to Angular directive template function post-post-link, using $scope, GET or whatever -

i trying write directive format content modal display (using bootstrap classes) if given parameter, , standard view if not. have working view loaded directly, toggling on url param ( ?modal ) available $routeparams and/or $location . i want use toggle-able template "pipe" other templates. however, intended content url never visible url when used modal. can't working when loading view $modal.open or nginclude , because $routeparams / $location has data including page, not included one. i put in plunker , because plunker doesn't provide url param, modal view isn't available. does angular provide means change template or templateurl later in process? example, use $scope , either controller or on directive, itself? clarification : goal here have one template/partial each component, template used either standalone or modal, based on switch. _modal , _alone partials in plunker convert component template desired state. $modal.open takes sing

javascript - Meteor - collection find after global keydown? -

i have searched on , meteor not seem able these 2 things @ same time. what want simple: when button pressed (globally), collection.find(...) called. not doable in template.events since meteor not support global keydown's, , can't in template.rendered because, reason, collection.find return nothing. any ideas? the following works, requires element in page have focus, guess problem in case. ui.body.events({ 'keydown': function(event, template){ console.log('a key down!') } }) i guess have without meteor. following should work in modern browsers: function keydownlistener(event){ console.log('a key down!') } template.templatename.created = function(){ document.body.addeventlistener('keydown', keydownlistener) } template.templatename.destroyed = function(){ document.body.removeeventlistener('keydown', keydownlistener) }

asp.net - ReWrite rule for IIS 7+ -

i have site generates following url structure rewrite. current url domain.com/store/catid/20/prodid/50/pair-of-socks.aspx desired url domain.com/pair-of-socks.aspx it depends on how many edge cases need cater for. simple solution be: match url (\w+/)+(\w+.\w{3,4}) rewrite url {r:2}

c# - .NET winforms bug (savefiledialog)? -

the following example shows , savefiledialog on toolstripbutton click event. if pre-make savefiledialog , double-click toolstripbutton, application stackoverflows. seems bug in winforms me. not optimistic on getting fix or response ms (even couple years ago responded "no more bug fixes winforms" when reported bug), i'd opinions on whether bug or i'm doing wrong. using system; using system.windows.forms; namespace toolstripdoubleclicksavedialog { public partial class form1 : form { savefiledialog sfd = new savefiledialog(); public form1() { initializecomponent(); } private void toolstripbutton1_click(object sender, eventargs e) { sfd.showdialog(this); } private void initializecomponent() { this.toolstrip1 = new system.windows.forms.toolstrip(); this.toolstripbutton1 = new system.windows.forms.toolstripbutton(); this.toolstrip1.suspendlayout(); thi

java - Android Empty Activity and Blank Activity -

Image
i trying make android project , there many types of activities, there see blank activity , empty activity. does know difference between two? blank activity not creating main_activity.xml created empty activity. in empty activity, unable add edittext field, know why not able add it? error says : exception raised during rendering: java.lang.system.arraycopy([ci[cii)v exception details logged in window > show view > error log and when open error log, there no error check api level you're using rendering view. in case api 20 (for android wear). changed api 19 , error gone.

google spreadsheet - Arrayformula If And -

i'm trying apply array formula 1 of sheets , not working - formula works isnt being applied cells (the continue bit) this formula. if(h2-f2<14,1,if(and(h2-f2>14,h2-f2<168),14,if(h2-f2>168,42,""))) when add array formula =arrayformula( if(h2-f2<14,1, if(and(h2-f2>14,h2-f2<168),14, if(h2-f2>168,42,"") ) ) ) it works doesn't apply cells, why , how go making work? edit: new formula cell ranges =arrayformula( if(h2:h-f2:f<14,1, if(and(h2:h-f2:f>14,h2:h-f2:f<168),14, if(h2:h-f2:f>168,42,"") ) ) ) i'm not sure why doesn't work either, work around break each of conditions in 'and' statement separate nested 'if' statements. if have 3 conditions, end 3 if statements 1 nested inside other: if(condition_1, if(condition_2, if(condition_3,then x,else y),else y),else y) it's equivalent if + , statement

How to insert Java ArrayList into a MySQL table? -

could kindly tell me how can insert values of arraylist mysql table single string? e.g, insert "crime, drama, action" column "genres" of table "featuredfilms_info". this part of code: int = 0; list<string> genre = new arraylist<string>(); . . . elements elms1 = doc.select("div.infobar"); elements links1 = elms1.select("a[href]"); (element link1 : links1){ if (link1.attr("href").contains("/genre/")) { genre.add(links1.get(i).text()); i++; } } system.out.println("movie genres:" + genre); . . try { string query = "insert featuredfilms_info (movieid, genres)" + "values (?, ?)"; preparedstatement preparedstmt = conn.preparestatement(query); preparedstmt.setstring (1, id); preparedstmt.setstring (2, genre); . . . } my problem cannot use setstring genre since not of type string. i'm bit confused since @ beginni

eclipse - Maven dependency seemingly coming from nowhere -

i have jar bumped version number on. 0.0.2-snapshot, bumped 0.0.3-snapshot since then, when building 1 of projects, still looking old one. have gone through dependency hierarchy , cannot find present anywhere. maven, debug switch on doesn't display jar anywhere, complain jar missing. i've gone through of other projects , ensured 0.0.2-snapshot not in of poms, still gives me problems. idea do? can included transient dependency? run 'mvn dependency:tree' , see how version 0.0.2-snapshot brought project.

javascript - Center Zoom out with canvas -

i'm iplementing zoom out effect of image. after it's scaled , zoom out, image isn't on center of canvas. this code: var canvas = document.getelementbyid('canvas'); var image = document.getelementbyid('image'); var ctx = canvas.getcontext("2d"); var zoomdelta = 0.025; // 10 steps in 10s, scale 5 1 var currentscale = 5; var img = new image(); img.src = image.src; img.onload = function() { ctx.canvas.width = img.width; ctx.canvas.height = img.height; } $("#start").on("click", function () { ctx.translate(canvas.width / 2, canvas.height / 2); drawimage(); var zoom1 = window.setinterval( function() { if(currentscale < 1) window.clearinterval(zoom1); else redraw(); }, 50 ); }); function redraw() { currentscale -= zoomdelta; drawimage(); } function drawimage() { clear(); ctx.save(); ctx.s

ember.js - Handlebars - Decompile handlebars compiled code to handlebars template -

is possible decompile handlebars precompiled code handlebars template? possibly convert this: function program2(depth0, data) { var buffer = '', stack1; data.buffer.push('<div '); ...... data.buffer.push('</div></div>'); return buffer; } to <div>{{name}}</div> unfortunately, there no built-in way so. one solution write function traverses compiled code, html being pushed , put html (reverse engineer function, essentially). there's 1 drawback: compiled templates use depth0 variable store passed in model/object. can see , other objects being passed in parameters each compiled template being instantiated, ie:: app.templates = function (handlebars, depth0, helpers, partials, data) { ... } so have follow how each piece of html rendered , find variable names correspond expressions pushed in stack variables. you'd need name of variable us

c - malloc(sizeof(struct xxxx)) isn't allocating any memory -

i'm learning c using learn c hard way online book, on exercise 17, , i've come across confusing error. in exercise, i'm told allocate memory connection , database using malloc(sizeof(struct xxxx)), so: struct connection *conn = malloc(sizeof(struct connection)); if(!conn) die("memory error"); conn->db = malloc(sizeof(struct database)); if(!conn->db) die("memory error"); when run program, segmentation fault, after running under valgrind, error: ==5770== command: ./ex17 db.dat c ==5770== ==5770== invalid read of size 1 ==5770== @ 0x40c4130: _io_file_fopen@@glibc_2.1 (fileops.c:267) ==5770== 0x40b88ca: __fopen_internal (iofopen.c:90) ==5770== 0x40b893a: fopen@@glibc_2.1 (iofopen.c:103) ==5770== 0x8048861: database_open (ex17.c:58) ==5770== 0x8048c4c: main (ex17.c:156) ==5770== address 0x77 not stack'd, malloc'd or (recently) free'd line 156 in main creating new connection struct through function struct connec

namespaces - Perl: prototype in anonymous subroutine -

i learning perls system of typeglobs , namespaces. wrote module takes 2 arguments value , name of constant , exports constant caller. $package variable equal caller[2]. *{"$package::$name"} = sub () { return $value; }; this code above job of exporting anonymous subroutine callers symboltable. because goal build own constant-implementation subroutine has empty prototype means read-only subroutine. but problem: prototype not work. so print &testconst; #works print testconst(); #works print testconst; #name "main::testconst" used once: possible typo @ testscript.pl line 7. is there wrong in thoughts? there way of doing it? you can define symbols want during runtime, prototypes affect code compiled afterwards since prototypes affect how calls sub parsed , compiled. example: use strict; use warnings; package foo; begin { *foo::bar = sub () { 42 }; } *foo::baz = sub () { 43 }; $bar = bar; $baz = baz; print "bar = [$bar], baz = [$

SQL Server : select only one row based on a field when there are several rows -

i have table 3 columns: name , surname , email . data in columns not unique. i need result matches following criteria: select 3 columns email records should unique there should 1 record per email that means select distinct isn't applicable because retrieve multiple email records. any ideas? you didn't specify dbms, systems support "windowed aggregate functions": with cte ( select email, name, surname, row_number() on (partition email order name) rn tab ) select email, name, surname tab rn = 1 this assigns ranking each email , returns first.

ide - Plug-in "org.tizen.web.zimlaunch" was unable to instantiate class -

i usin tizen ide wearable. during build had power failure , pc went down. since ide not work. whatever action performed error occurs: plug-in "org.tizen.web.zimlaunch" unable instantiate class > "org.tizen.web.zimlaunch.deployer.zimlaunchdelegate". org/tizen/web/project/configuration/configurationexception i tried uninstal ide , install again, deleted files knew connected ide nothing helped. do know can do? finally found it. remove metadata folder workspace. doing demand reimport of projects fixes problem. \workspace\.metadata

Does using migrations with Rails/Mongoid/MongoDB make sense? -

should create ar migrations i'm changing models? using mongoid , mongodb not see benefits. benefit can think of renaming field - can small script. work? gut telling me not need migrations, i'd hear more experience. what best practice? should use migrations mongodb? since mongodb not (as @ 2.6) provide server-side schema enforcement, data migration scripts not strictly required. can particularly helpful speed of development. however, may still make sense create migrations production data if want practice "data hygiene" , ensure consistency across different deployments. for example: removing unused fields adding new required fields setting default values renaming fields loading required data/fixtures ensuring required indexes you have choice of doing of above one-off scripts or handling exception cases in application code. example, can lazily add missing fields or defaults documents loaded database editing. for mongoid in particular may w

java - Communication between several classes -

whenever make program tend divide different sections in different files, think looks more neat way. make problem more concrete have dummy code consisting of 4 classes, public class dummy { public static void main(string[] args){ alpha = new alpha(); beta b = new beta(); gamma g = new gamma(); int x,y,z,j,k,l,o,p,q; x = a.getgammax(); y = b.getgammax(); z = g.getx(); a.setgammax(1); j = a.getgammax(); k = b.getgammax(); l = g.getx(); b.setgammax(2); o = a.getgammax(); p = b.getgammax(); q = g.getx(); } } class alpha{ gamma g = new gamma(); public int getgammax(){ return g.getx(); } public void setgammax(int x){ g.setx(x); } } class beta{ gamma g = new gamma(); public int getgammax(){ return g.getx(); } public void setgammax(int x){ g.setx(x); } } class gamma{ i

javascript - Highcharts label formatter return inside and outside if statement? Is this correct? -

using highcharts label formatter http://api.highcharts.com/highcharts#yaxis.labels.formatter i'm using code below customize first label, , return values others. how should use return twice within formatter? while works i'm checking there isn't better way write function. i'm little new js , wondering if returned data combined how? thanks jsfiddle here $(function () { $('#container').highcharts({ chart: { marginbottom: 80 }, xaxis: { categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] }, yaxis: { labels: { //align: 'left', //x: 0, //y: -2, usehtml: true, formatter:function(){ if(this.isfirst){ return &

c# - How are the assemblies installed by MonoGame different from those in the MonoGame.Binaries NuGet package? -

there few ways monogame's assemblies monogame project far can tell: you can reference assemblies installed monogame installer you can use monogame.binaries nuget package, must reference dlls package. ... or can use monogame.portable nuget package. what difference between these 3 options? how related 1 another? how should used in project? a example of confusion in terms of libraries can found in example of monogame.binaries vs. assemblies installed installer. monogame.binaries doesn't seem provide same level of granularity installer does, @ least far can tell; instance: from monogame installer have assemblies divided platform: android , ios , linux , windows , windowsgl , etc. from monogame.binaries nuget package have only: monoandroid , monomac , monotouch , net40 , netcore , , wp8 . to me, looks monogame.binaries package out of date, if isn't , wanted set proper linux , windowsgl , and/or directx windows project using convenience of nuget packag

java - The GUI is perfect, but the calculator code does not work -

the gui of code perfect, calculator not working, i.e. when click on 1 button not getting displayed in text filed. code:- import java.awt.*; import javax.swing.*; import java.awt.event.*; class calc extends frame implements actionlistener { int resulta=0; int resultb=1; jtextfield tf; int result; private jbutton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b16; calc() { tf=new jtextfield(); tf.setbounds(60,50,200,20); jbutton b1=new jbutton("0"); b1.setbounds(60,100,30,30); jbutton b2=new jbutton("1"); b2.setbounds(100,100,30,30); jbutton b3=new jbutton("2"); b3.setbounds(140,100,30,30); jbutton b4=new jbutton("3"); b4.setbounds(60,150,30,30); jbutton b5=new jbutton("4"); b5.setbounds(100,150,30,30); jbutton b6=new jbutton("5"); b6.setbounds(140,150,30,30); jbutton b7=new jbutton("6"); b7.setbounds(60,200,30,30); jbutton b8=new jbutton("7"); b8.setbounds(100,200,30,30); jbutton b9=new jbutt