Posts

Showing posts from June, 2013

unity3d - C# frames running twice? -

this has me utterly confused. using unity3d , c# scripts , seems if code running twice per frame. on button down have sprite change position , changes once @ least think does. i added debug in , getting results this: score 1 @ 3.569991 @ frame 168 score 2 @ 3.57414 @ frame 168 score 3 @ 3.818392 @ frame 183 score 4 @ 3.820178 @ frame 183 and forth carrying on. not updating score in other scripts. there more script printing score out on screen. is there reason why script may run this? full script: using unityengine; using system.collections; public class score : monobehaviour { public static int highscore; public static int myscore; public static bool allowscore; public guitext mytext; public static bool whichscene; //only allows score start when first object has passed player object void ontriggerenter2d(collider2d collisionobject) { allowscore = true; debug.log ("allowscore true"); } void ...

cuda - How do I pass a shared pointer to a cublas function? -

i'm trying run cublas function within kernel in following way: __device__ void dolinear(const float *w,const float *input, unsigned i, float *out, unsigned o) { unsigned idx = blockidx.x*blockdim.x+threadidx.x; const float alpha = 1.0f; const float beta = 0.0f; if(idx == 0) { cublashandle_t cnphandle; cublasstatus_t status = cublascreate(&cnphandle); cublassgemv(cnphandle, cublas_op_n, o, i, &alpha, w, 1, input, 1, &beta, out, 1); } __syncthreads(); } this function works if input pointer allocated using cudamalloc. my issue is, if input pointer points shared memory, contains data generated within kernel, error: cuda_exception_14 - warp illegal address . is not possible pass pointers shared memory cublas function being called kernel? what correct way allocate memory here? (at moment i'm doing cudamalloc , using 'shared' memory, it's making me feel bit dirty) you can't pass shar...

What java design pattern is appropriate for the situation described below? -

i working on chemistry package , have class lists elements in periodic table. ideally elements part of java enum. unfortunately need 1 more element serve wildcard : every other element should equal element. java not allow override equals() method enums otherwise have done that. able suggest reasonable design pattern situation have described? edit: thank contributions. indeed failed observe transitive property required equals() . the elements of periodic table assigned different nodes on graph structure(in mathematical sense). given graph structure embeddings of particular subgraph structure in original graph (subgraph isomorphism problem). desired property of subgraph structure have nodes wildcard assigned can map nodes node in original graph regardless of element assigned it. why looking non-transitive relation such wildcard may equal 2 different elements without implying elements equal. current algorithm makes use of generics , calls equals() check if elements in 2 nodes e...

c - Array of FILE* through functions: FILE* or FILE**? -

i'm trying make program can work several different files @ same time. idea make array of 20 file* in order to, if ever arrive limit, able of closing 1 of them , open new file requested. purpose i've thought in function selects option , calls makes job of saving (writing), closing , opening. after half week of searching through web , making proves, i've made 2 versions seem work: 1 file* , file**. my question is: if of them has mistake can't detect or bad use of pointers when passing through these 2 functions. (the code display have 2 versions of 2 functions 1 after another.) myprogram() { #include<stdio.h> #include<stdlib.h> #include<string.h> /* contents of myfile1a.dat, myfile2b.dat,... 5 ints. */ /* version without pointer pointer. */ void freadfile(file* pffile[]) { int = 0, j = 0; int inums[15] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int inums2[15] = {5001, 5002, 5003, 5004, 5005, 2033, 2066, 2099, 2133,...

python - Reading data from non-CSV files -

i have data in text file looks this: 2,20 12,40 13,100 14,300 15,440 16,10 24,50 25,350 26,2322 27,3323 28,9999 29,2152 30,2622 31,50 i read data 2 different lists in python. however, not csv file. data read this: mass1,intensity1 mass2,intensity2 mass3,intensity3... how should go reading masses , intensities 2 different lists? trying avoid writing file make data neater and/or in csv format. it looks line.split() each line isolate individual pairs, use pair.split(",") separate mass , intensity in each pair.

ssl - Connection reset by peer on Java 8, but not on Java 7 -

i'm having problem that's similar mel3kings' question , but, in case, connection works ok java 7 update 79, not java 8 update 51; ideas on causing this? i'm trying connect secure webservice, using sunmscapi keystore. truststore up-to-date. connection works on java 7, on java 8, gives error: *** *** clientkeyexchange, rsa premastersecret, tlsv1 execução de comandos de nfe, write: tlsv1 handshake, length = 7648 session keygen: premaster secret: 0000: 03 01 2d 6c 21 6d d6 ee 68 9f 27 10 60 99 eb 82 ..-l!m..h.'.`... 0010: 85 4d 41 b8 0c 38 b7 2d 98 72 fb 51 07 bc 9a d7 .ma..8.-.r.q.... 0020: 60 76 98 d6 c8 8e 0b 1c 86 db a0 98 68 cc 35 73 `v..........h.5s connection keygen: client nonce: 0000: 55 af df 74 ae 34 06 95 82 44 92 2b bd 0a 65 2c u..t.4...d.+..e, 0010: ed 77 4e e8 49 32 06 8a f6 69 49 34 d9 68 a9 .wn.i2....ii4.h. server nonce: 0000: 55 af df 74 a3 84 c6 57 43 14 f2 13 f4 7e bf 77 u..t...wc......w 0010: c6 cd a6 b5 8e 01 4e 01 f9 42...

javascript - HTML5 Canvas; Image clipping and multiple images -

i'm new canvas , i'm having issues. i'm trying accomplish 1 end goal: display 2 images in single canvas; 1 image background, other image clipped png , appears on top. i'm part way there i've hit wall , don't know how past it. i've create jsfiddle @ http://jsfiddle.net/jhp79yg9/ function loadimages(sources, callback) { var images = {}; var loadedimages = 0; var numimages = 0; // num of sources for(var src in sources) { numimages++; } for(var src in sources) { images[src] = new image(); images[src].onload = function() { if(++loadedimages >= numimages) { callback(images); } }; images[src].src = sources[src]; } } var canvas = document.getelementbyid('canvas'); var context = canvas.getcontext('2d'); var sources = { img1...

When should I use array columns v.s. associations in rails -

since rails 4 , postgres 9, array column introduced. tried using array column store tags or categories , don't change , used reference / facets searching. asked question querying array column , , 1 of answers mentioned never use array store data. confused why array column created if suggested never use it. question is when considered better use array column v.s. model associations in rails? from experience, retrieving , manipulating data array columns slower. prefer associations. having array columns not flexible querying db. pulling data db faster associations. what if store book's categories in db array , decide change name of 1 of categories? having association it's change of category 's instance name, because it's connected other instances (books example) id . array you'll have iterate on whole collection of books update category's name. i go using array , json or jsonb column storing metadata if association overkill. ...

phonegap build - Cordova move "mouse"/"last touched" position -

in cordova app use :hover pseudo-class give styling, when user clicks it, want remove :hover have move spot of last touch, possible? :hover not available mobile devices. not clear trying accomplish.

c++ - How to manually create a boost ptree with XML attributes? -

i've been using boost libraries parse xml files , have create ptree manually. need add xml attribute ptree. boost documentation suggests: ptree pt; pt.push_back(ptree::value_type("pi", ptree("3.14159"))); that adds element content, need add attribute element. the code above produces: <pi>3.14</pi> i need add this: <pi id="pi_0">3.14</pi> what need change, add attribute id="pi_0" ? you use "fake" node <xmlattr> : http://www.boost.org/doc/libs/1_46_1/doc/html/boost_propertytree/parsers.html#boost_propertytree.parsers.xml_parser live on coliru #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/xml_parser.hpp> #include <iostream> using boost::property_tree::ptree; int main() { ptree pt; pt.push_back(ptree::value_type("pi", ptree("3.14159"))); pt.put("pi.<xmlattr>.id", "pi_0");...

c# - Unable to identify WinEdit control in CodedUI test -

i'm trying hand-code simple codedui test in vs 2013. have simple windows forms app 3 textboxes (txta, txtb , txtc) , button (btnadd) on form. on clicking button, app add numbers entered in txta , txtb , show result in txtc below: var = convert.toint32(txta.text); var b = convert.toint32(txtb.text); txtc.text = (a + b).tostring(); and coded ui test follows : [testmethod] public void codeduitestmethod1() { applicationundertest app = applicationundertest.launch(@"c:\users\dileep\documents\visual studio 2013\projects\codeduidemo\simplecalculator\bin\debug\simplecalculator.exe"); winedit txta = new winedit(app); winedit txtb = new winedit(app); winedit txtc = new winedit(app); winbutton btnadd = new winbutton(app); txta.searchproperties.add(winedit.propertynames.name, "txta"); txtb.searchproperties.add(winedit.propertynames.name, "txtb"); txtc.searchp...

java - Can I use a loop in my XML output method? -

the method below supposed take stored students , generate xml file data. xml structured correctly both entries same. instead of getting data student1 , student2 student2 twice in row. missin here? public void exportstudentxml(arraylist <student> studentlistin ){ arraylist <student> studentlist = studentlistin; documentbuilderfactory mydocbuilderfactory = documentbuilderfactory.newinstance(); try{ documentbuilder mydocbuilder = mydocbuilderfactory.newdocumentbuilder(); document documentmodel = mydocbuilder.newdocument(); element root = documentmodel.createelement("studentlist"); documentmodel.appendchild(root); (student thisstudent : studentlist){ element listelement = documentmodel.createelement("student"); root.appendchild(listelement); element nameelement = documentmodel.createelement("name"); text nametext = documentmodel.createtext...

excel - How to build a dynamic cell range output function using VBA -

Image
i building function, when select cell, output cell range selection last filled cell row on same column. here code, works perfectly. ''get cell range selection last cell function cellrange(cella range) cellrange = cella.address + ":" + cella.end(xldown).address end function question: want update code, when used dates, user can filter 3 options: ytd (year date), (all time - i.e. getting data), year (i.e. 2015 / 2014 / 2013 etc.) my end goal user select cell in range column of dates , input ytd or all or given year (i.e. 2014 ) , range filter. example: user writes =cellrange(a2,2014) , should yield $a$2:$a$23 , if user changes =cellrange(a2,2014) should yield $a$24:$a$40 seen on image. i tried various loops or counts feel quite lost none of tries apparently made sense. i looking help: guidance or solution problem preferably, want build on after tackle 1 (hence why doing on vba). here shorter solution works 3 scenarios, , not requ...

java - findBy with custom filter in PagingAndSortingRepository -

i have interface extending pagingandsortingrepository i have custom find : findjobbynamebysystemidusercompanyid(companyid, pageable) this works fine, want introduce filtering, want search (like) string in list. how can achieve that? search term on field ? please have here: http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.query-creation example: findbyfirstnamelike(...), findbyfirstnamenotlike(...)

python - Cython function returning pointer without GIL error -

i dont understand why not compile. _svd returns double*, , assigning double*. error message: coercion python not allowed without gil cpdef svd(a_f, m, n): cdef double *s_p nogil: s_p = _svd(a_f, m, n) return <double[:min(m, n)]> s_p cdef double* _svd(double[:] a_f, int m, int n) nogil: #code removed bc long edit: works gil, want call without gil. try this cpdef svd(a_f, int m, int n): cdef double *s_p cdef double[:] abc = a_f nogil: s_p = _svd(abc , m, n)

webstorm - TypeScript 1.5 ES6 modules & .d.ts files from DefinitelyTyped seem incompatible -

i'm using webstorm web-development & have upgraded built-in typescript 1.4 compiler 1.5.3. however, not went wanted compiler began yield errors prompting me drop --module commonjs parameter & switch es6 modules instead (i'm using --target es6 ). having done that, started getting errors saying import assignments cannot used when targeting es6 & should use new module syntax instead (error 1202). converted files, apparently wasn't enough .d.ts files installed via tsd definitelytyped repo use old syntax making compiler keep giving same errors. i wrote small converter .d.ts files, works although makes me fix errors manually here & there. i'm wondering if there better workaround this? perhaps, i'm missing something? p.s. changing --target es5 not option compiler otherwise complain absence of things promises heavily use in project. changing --target es5 not option compiler otherwise complain absence of things promises heavily use i...

amazon web services - Multiple Cloudfront Origins with Behavior Path Redirection -

i have 2 s3 buckets serving cloudfront origin servers: example-bucket-1 example-bucket-2 the contents of both buckets live in root of buckets. trying configure cloudfront distribution route or rewrite based on url pattern. example, these files example-bucket-1/something.jpg example-bucket-2/something-else.jpg i make these urls point respective files http://example.cloudfront.net/path1/something.jpg http://example.cloudfront.net/path2/something-else.jpg i tried setting cache behaviors match path1 , path2 patterns, doesn't work. patterns have exist in s3 bucket? yes, patterns have exist @ origin. cloudfront can prepend path given origin, not have capability of removing elements of path. if files in /secret/files/ @ origin, have path pattern /files/* transformed before sending request origin setting "origin path." the opposite isn't true. if files in /files @ origin, there not built-in way serve files path pattern /download/files/* ...

Unable to set cookie on Internet Explorer via Javascript -

i have seen alot of questions regarding , alot of different answers, none of them can see either apply me or have tried , have failed. so, have below code: date.prototype.addmins = function(minutes) { this.settime(this.gettime() + minutes*60000); return this; } function readcookie(name) { var nameeq = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charat(0)==' ') c = c.substring(1,c.length); return c.substring(nameeq.length,c.length); if (c.indexof(nameeq) == 0) return c; } return null; } var timer_expiry = new date().addmins(1); var expiry = new date().setfullyear(2030); document.cookie = 'my_signup_clock='+timer_expiry+';expires='+expiry+';path=/;'; var asc = readcookie('my_signup_clock') if (asc) { alert("exists"); } else{ alert("does not"); } i've tested on browsers , cookies se...

php - MySQL InnoDB auto increment column based on combination of other columns -

i making system users can upload file want, , not use execute kind of code. part of that, rename every file, , store original name in mysql table. table contains id of user uploaded it, , unique id of upload. doing this: create table `uploads` ( `user_id` int(11) not null, `upload_id` int(11) not null auto_increment, `original_name` varchar(30) not null, `mime_type` varchar(30) not null, `name` varchar(50) not null, primary key (`user_id`, `upload_id`) ) engine=myisam; this means have unique combination of user_id , upload_id, , every users first upload has id of 1. heard myisam old, , should rather use innodb. there way can achieve in innodb? the biggest problem myisam tables not transactional. say, creating records , reading them (possibly deleting them later) there little or no editing. situation myisam designed for, fast read records. see no advantage converting innodb.

django - local files missing from docker-machine container -

so have simple containerised django project, container sass css compilation. i use docker-compose docker-machine, when fire up, web container doesn't have of local files (manage.py etc) in, dies file not found: manage.py error. let me explain more: docker-compose.yml web: build: . volumes: - .:/app ports: - "8001:5000" sass: image: ubuntudesign/sass command: sass --debug-info --watch /app/static/css -e "utf-8" volumes: - .:/app dockerfile from ubuntu:14.04 # install apt dependencies run apt-get update && apt-get install -y python-dev python-pip git bzr libpq-dev pkg-config ubuntu:14.04 # install apt dependencies run apt-get update && apt-get install -y python-dev python-pip git bzr libpq-dev pkg-config # pip requirements files copy requirements /requirements # install pip requirements run pip install -r /requirements/dev.txt copy . /app workdir /app cmd ["python", "manage.py", ...

ruby on rails 3 - Query using condition within an array -

i have 2 models, user , centre, have many many relationship. class user < activerecord::base attr_accessible :name has_and_belongs_to_many :centres end class centre < activerecord::base attr_accessible :name, :centre_id, :city_id, :state_id has_and_belongs_to_many :users end now have user multiple centres, , want retrieve centres have same "state_id" user. this doing now state_id_array = [] user.centres.each |centre| state_id_array << centre.state_id end return centre.where("state_id in (?)", state_id_array).uniq it works, it's ugly. there better way achieving this? ideally 1 line query. update now have centre.where('centres.state_id in (?)', centre.select('state_id').joins(:user).where('users.id=(?)', user)) the subquery work itself, when tried execute entire query, null inner query. centre.select('state_id').joins(:user).where('users.id=(?)', user) will generate ...

Generate identical files from log4net -

similar question here different like attached link trying log4net output multiple (x2) files. opposed link looking have same information sent both files. reason first log file being generated (logs.log) , not second (logstest.log) can shine light on me please? <log4net> <appender name="rollingfileappender" type="log4net.appender.rollingfileappender"> <file value="logs.log" /> <appendtofile value="true" /> <rollingstyle value="size" /> <threshold value="info" /> <filter type="log4net.filter.levelrangefilter"> <levelmin value="info" /> <levelmax value="off" /> </filter> <maxsizerollbackups value="30" /> <maximumfilesize value="50mb" /> <staticlogfilename value="true" /> ...

php - INSERT unless exist in other table -

i have users table on wesite , want write function take email column , insert diffrent table, mailing_list , if email isn't exist in there. for question can assume each table have columns: id , username , email . this current code: $get_mails = $db->query("select `username`,`email`,`email_approved`,`ver` `users` ver='yes' && email_approved='1'"); while ($mails = $get_mails->fetch_assoc()) { if ($db->query("select `email` `mailing_list` email='".$mails['email']."'")->num_rows == 0) { $db->query("insert `mailing_list` values('','".$mails['email']."','".$mails['username']."')"); } } as can see it's not efficient. there way in insert query itself? thank you. one (kinda dirty) solution put unique index on email field in mailing list , prevent double entries won't have selec...

Primefaces and Spring Security: Ajax listener not triggered -

i'm working primefaces 5.2 , spring-security 4.0.1 , use netbeans ide (so glassfish 4.1) , try make dashboard , dynamically add wiget. in order deploy on server, i've added security spring security. moment, it's someting basic, using authentication , default filter. so, when launch (the project), i'm correctly redirected default login page (i've configured spring use 8181 port, glassfish https default port), , log in normally. but, on, when drag widget library zone , drop on dashboard (which datagrid inside outputpanel inside fieldset) zone, nothing happens. there's same animation usual (it disappeared , didn't go library zone), there's no widget on dashboard, if refresh page. if comment filter , filter-mapping sections on web.xml, of course, there's no redirection login page , https protocol, widget drop works normally. it might problem between ajax , spring (the function inside p:ajax not called). have idea fix that? here's diff...

pattern matching - PHP - How to find a specific number in a string? -

i run sneakers affiliate site , trying match imported product names existing sneaker models keyword. many formats around have use number sometimes, , numbers don't matched code use. tried different php str- functions none of them seem both numbers , strings. $models = array( '106' => 'vans 106 vulcanized', 'alomar' => 'vans alomar', 'atwood' => 'vans atwood', 'authentic' => 'vans authentic', // list goes on... ); foreach ( $models $model_keyword => $model_name ) { if ( stristr( $product_name, $model_keyword ) !== false ) { return $model_name; } } as can see checking product name each of keywords , when it's found return model name. works every string contains letters or letters , numbers not numbers first item in array. any ideas on how properly? use strpos instead. <?php $models = array( '106' => 'vans 106 v...

c# - How to remove duplicate records from datatable based on condition -

i have c# datatable following data name marks month lmn 22 current xyz 55 previous abcd 100 previous abcd 50 current i want remove duplicate names data if month column 'previous'. example, here abcd having duplicate enteries want remove abcd having month 'previous' so result datatable should like- name marks month lmn 22 current xyz 55 previous abcd 50 current the approach thinking follow deplicate rows , check 'previous' column value , delete it. seems long cut way. or datarow.delete can suggest simpler way this?

ios - Why is there functional difference between Swipe to pop view controller and poping view controller Programmatically? -

when swipe right pop view controller/click button on navigation bar viewwillappear code called ,but , when programmatically call [self.navigationcontroller popviewcontrolleranimated:yes]; , behaves differently , first viewdidload called , viewwillappear called . how can achieve behaviour in 1st case using code ?

performance - convert memcpy() code from x86 to x64 platform -

this code memcpy() on x86 platforms . need memcpy() on x64 platform . _asm { mov esi, src mov edi, dest mov ecx, nbytes shr ecx, 6 // 64 bytes per iteration loop1: movq mm1, 0[esi] // read in source data movq mm2, 8[esi] movq mm3, 16[esi] movq mm4, 24[esi] movq mm5, 32[esi] movq mm6, 40[esi] movq mm7, 48[esi] movq mm0, 56[esi] movq 0[edi], mm1 // write destination movq 8[edi], mm2 movq 16[edi], mm3 movq 24[edi], mm4 movq 32[edi], mm5 movq 40[edi], mm6 movq 48[edi], mm7 movq 56[edi], mm0 add esi, 64 add edi, 64 dec ecx jnz loop1 emms } i have no knowledge of x64 assembly language . how convert code x86 x64 ? i suppose replacing esi , edi rsi , rdi should trick. although not become faster (or fast). other pointers, x64 backwards compatible x86. in general better make c loop or use default memcpy. generate better code. ...

How to Modify string Inside character, Javascript Regex -

how modify: var = ' z ok z '; = a.replace(/z(.*)z/, function(match){ return match.trim().touppercase();}); console.log(a); // output: " z ok z " i expect " zthis okz "; the uppercase work, trim function ignored you matching spaces (*) . change to: var = ' z ok z '; // here, you'll notice added spaces next "z" character. = a.replace(/z (.*?) z/, " z$1z ").touppercase(); console.log(a); // output: " zthis okz " what match between "z", , rewrites "z" directly next it.

php - Printing dimensional array to table -

i have question array. i've got type array: array ( [0] => array ( [0] => project [1] => time ) [1] => array ( [0] => google [1] => 29,92 ) [2] => array ( [0] => mozzila [1] => 5,96 ) [3] => array ( [0] => firefox [1] => 215,3 ) how print table: <td style="border: 1px solid #000000; width: 50%;">'.$project.'</td> <td style="border: 1px solid #000000; width: 50%;">'.$time.'</td> i thankful if me, solve script. because stuck. like: project | time google | 29,92 mozzila | 5,96 you may try this: <table> <?php foreach($data $key => $line) { $project = $line[0]; $time = $line[1]; ?> <tr> <td style="border: 1px solid #00...

node.js - N:M eager loading (include) using sequelizejs -

so found myself troubles trying use include eager loading feature in m:n relations the user model relation: user.belongstomany(models.rol, { through: { model: models['usuario_rol'] }, as: { plural: 'roles', singular: 'rol' }, foreignkey: 'idusuario' }); the rol model relation: rol.belongstomany(models.usuario, { through: { model: models['usuario_rol'] }, foreignkey: 'idrol' }); finally query: db.usuario.findone({ where: { id: insert.id }, include: [ { model: db.rol } ] }); if try crashes error: rol not associated usuario! the curious instance of sequelize user object can fetch roles using user.getroles() do have idea of why happening? when specify alias in association function (in case roles ) have pass include well: return user.findone({ where: { id: 52 }, include: [ { ...

ruby - Formatting console output from Test::Unit -

require "json" require "selenium-webdriver" gem "test-unit" require "test/unit" class tests < test::unit::testcase $out_file = file.new('log.txt', 'w') def $stdout.write string $out_file.write string super end when use above code output in console looks great when it's finished dumps log file (like expect) format in log file comes out strange characters @ end. first 2 lines below expected third ??? first run - main: 1.998 first run - drill through: 16.527 [32;1m.[0m i've been fishing around options , i've tried configure test-unit.yml file fiddling format options below no matter try there nothing changes format of output. runner: console console_options: output_level: 1 format: documentation show_detail_immediately: true [32;1m , in general [((\d+);?)m color escape sequence. highlight output in console. [32;1m.[0m literally green dot , denoting successful test execution. t...

ibm mobilefirst - Mobile First Platform Server - Changing WAS Liberty Path -

i had installed mfp 6.3 now, possible change liberty install path (by editing config files) ? please let me know whether there anyway task mentioned above thanks sathish kumar your question not clear @ all. if mean want move websphere liberty installation folder elsewhere, @ least on mac stand-alone install , can copy-paste folder anywhere else want. if mean want use different websphere liberty installation, go ahead , install instance using ibm installation manager. copy usr folder original instance new one. if not you're asking, please put effort , write coherent , detailed questions, , not assume anything. mention everything.

ios - UITabViewController in UISplitViewController -

Image
i create project master-detail application,but want replace master tab bar controller。just this: how realize this? you can add uitabbarcontroller storyboard, , set 'master view controller' relationship between uisplitviewcontroller , uitabbarcontroller :

visual studio 2015 - Upgrading from ASP.NET 5 Beta 4 to Beta 5 - project.lock.json has old values -

Image
i have followed steps upgrade beta 4 beta 5: installed visual studio 2015 rtm from powershell run: $env:dnx_feed="https://www.nuget.org/api/v2" from powershell run: dnvm upgrade changed global.json file: { "projects": [ "src", "test" ], "sdk": { "version": "1.0.0-beta5", "runtime": "coreclr", "architecture": "x86" } } updated packages in project.json beta 5: "dependencies": { "entityframework.sqlserver": "7.0.0-beta5", "entityframework.commands": "7.0.0-beta5", "microsoft.aspnet.mvc": "6.0.0-beta5", "microsoft.aspnet.mvc.taghelpers": "6.0.0-beta5", "microsoft.aspnet.authentication.cookies": "1.0.0-beta5", "microsoft.aspnet.authentication.facebook": "1.0....

utf 8 - how to use shell to count Chinese characters in file encoded in UTF-8 -

cat doc.txt , following characters show: 你好 hello! 这是中文。this chinese doc. i can use command wc -w doc.txt but show: 8 doc.txt this command take characters 你好 , 这是中文 both single word, while in fact 你好 2 chinese words , 这是中文 four. what want these chinese words counting right(there 12 words in example), out? you can use -m or --chars option: $ echo -n "你好" | wc -m output: 2

Get Unicode Text from SQLite DB -

i have sqlite database contains values strange characters ü, é, etc. sqlite utf8 default , values in database tool. now need fill option menu in livecode these values. when put uniencode ("krüger", "utf8") tdata set text of button "option" tdata i correct value in option button looking strange big spacings "k r ü g e r" instead of "krüger" edit: appears text displayed in "full width". using tahoma changing font not make difference. if don't uniencode "krüger" . i tried set unicodetext of button "option" tdata gave me 1 line of chinese or japanse chars or so. where mistake? i using livecode 7.0.6. put textdecode(myvariable,”utf8”) newvariable

c# - WPF - Treeview selected item index -

i have treeview panel. in panel, there several child nodes. of them header. the way create treeview: treeviewpanel.items.add(art); art.items.add(prt); if statement.... treeviewitem cldhdr = new treeviewitem() { header = "childnodes:" }; prt.items.add(cldhdr); treeviewitem cld = new treeviewitem() ....... ........ ..... cldhdr.items.add(cld); treeview: node1 childnodes: (this header only. appears if child node exists) childnode1 childnode2 childnode3 node2 node3 childnodes: childnode1 childnode2 childnode3 node4 node5 in treeview there images in front of nodes. it's code driven treeview. in xaml part have only: <treeview x:name="treeviewpanel" selecteditemchanged="treeviewpanel_selecteditemchanged" > </treeview> what want when click on of treeview items, need index number. my code is: private void treeviewpanel_selecteditemchanged(object sender, routedp...

regex - EditPad: how use Replace with RegExp strings and Carriage Returns -

i have next text: hola este es un test. test de regexp. super man es un héroe de comic. test nueva linea and result expected if there dot (.), carriage return , word (a-za-z), put inside carriage returns. example: hola este es un test. test de regexp. super man es un héroe de comic. test nueva linea how do in editpad pro replace panel? think need use backreferences. regex: (\.\r?\n)([a-za-z]) or (\.[\r\n]+)([a-za-z]) replace with: \1\n\2 if \1 or \2 won't work use $1 , $2 instead.

Do SOLr index size decrease after deleting documents? -

i have solr instance index large number of documents client users can search them in web application. because have large number of files , need search recent ones (90 days or so) have scheduled job remove old documents index. the problem is, disk space increasing 2gb day, deletions. is normal behavior or should more keep index in stable size? we using java application add , remove files index. deletions mark documents deleted - they're still present in index. since removing them require rewriting index files, actual removal not performed before issue optimize command . there's option expungedeletes when issue commit, far can see, it's better issue optimize outside of normal operating hours. if remove documents nightly, can issue optimize after removal, or more infrequent, such every second or third day. optimizing requires same amount in free disk space index takes (since worst case whole index being written again).

node.js - Converting to synchronous-style a callback hell required by an API -

i trying integrate kurento meteor. facing problems in converting nested callbacks of node.js proper meteor server code. below code trying convert using meteor.wrapasync : kurento(args.ws_uri, function(error, client) { if ( error ) return onerror(error); client.create('mediapipeline', function(error, pipeline) { if ( error ) return onerror(error); console.log("got mediapipeline"); pipeline.create('recorderendpoint', { uri : file_uri }, function(error, recorder) { if ( error ) return onerror(error); console.log("got recorderendpoint"); pipeline.create('webrtcendpoint', function(error, webrtc) { if ( error ) return onerror(error); console.log("got webrtcendpoint"); webrtc.connect(recorder, function(error) { if ( error ) return onerror(error); console.log("connected"); recorder.record(function(error) { if ( err...

performance - Linux memory usage: Can we consider memory full when swap is unused? -

i checking available free memory after deploying our applications. using below command , finding free memory less 20%: free | grep mem | awk '{print "free memory :"100*($4+$6+$7)/$2"%"}' but when check top command, see swap memory not used @ all. above command doesn't include swap memory space. have several questions in mind snapshot1: top - 10:01:07 305 days, 11:23, 1 user, load average: 0.35, 0.22, 0.12 tasks: 244 total, 1 running, 242 sleeping, 0 stopped, 1 zombie cpu(s): 13.4%us, 14.5%sy, 0.0%ni, 69.3%id, 0.8%wa, 0.4%hi, 1.6%si, 0.0%st mem: 15952m total, 15817m used, 135m free, 531m buffers swap: 16378m total, 0m used, 16378m free, 2567m cached pid user pr ni virt res shr s %cpu %mem time+ command 19983 user1 20 0 3410m 2.9g 4420 s 23 18.9 56733:33 x1 28390 user2 20 0 621m 216m 1300 s 12 1.4 40201:39 p2 24781 user1...

rspec-puppet does not support file_line resource -

i have below manifests file_line resource class login { if $::operatingsystemmajrelease < 7 { file {'/etc/loginfile': ensure => present, } file_line { 'testfile': path => '/etc/loginfile', line => 'abc 022', match => '^abc.*$', } } } below rspec file require 'spec_helper' describe 'login' { should contain_class('login')} let(:facts) {{:operatingsystemmajrelease => 6}} if (6 < 7) { should contain_file('/etc/loginfile').with_ensure('present')} { should contain_file_line('testfile').with( :path => '/etc/loginfile', :line => 'abc 022', :match => '^abc.*$' )} end end when run rake-spec command getting below error login failure/error: { should contain_class('login')} puppet::error: puppet::parser::ast::resource fai...

python - QListWidget: connect function when QListWidgetItem changed -

i have qlistwidget qlistwidgetitems carry checkboxes .i want call function when either checkbox checked/unchecked or new qlistwidgetitem added. to try call qabstractitemmodel of qlistwidget self.flist implement datachanged signal. program crashes on following line: self.flist.model().datachanged.connect(self.plot_paths) here relevant code. hope can me connect plot_paths function event of qlistwidgetitems changes. self.flist = qtgui.qlistwidget() self.file_list.addwidget(self.flist, 1, 0, 1, 3) self.flist.model().datachanged.connect(self.plot_paths) def plot_paths(self, topleft, bottomright): model = self.flist.model() index in range(model.rowcount()): item = self.flist.item(index) if item.checkstate() == qtcore.qt.unchecked: self.on_adjust()