Posts

Showing posts from July, 2012

c# - How to print variable into empty space without pushing the next text on same line further to the right? -

so im working on school assignment im supposed make console version of old game jeopardy(using visual studio) ive come across issue im not sure how fix. thing im have array categories , 5 variables(kat1+2+3+4+5) select these categories @ random. problem name of categories differ in length , supreme designed category table doesn't fit anymore. have tips how print variable "empty" spaces without pushing | right? ------------------------------------------------------------------"); console.writeline("| "+kat1+" | "+kat2+" | "+kat3+" | "+kat4+" | "+kat5+" |"); console.writeline("--------------------------------------------------"); console.writeline("| | | | | |"); console.writeline("--------------------------------------------------"); console.writeline("| | | | ...

css - Rotate a cube around it's diagonal -

i have cube rotate trough it's diagonal. how rotate cube around particular diagonal? tried different rotations nothing seems fit me. looking css solution/explenation. .container { width: 200px; height: 200px; position: absolute; perspective: 10000px; left: 50vw; top: 50vh; transform: translatex(-50%) translatey(-50%); } .cube { width: 100%; height: 100%; position: absolute; transform-style: preserve-3d; } .cube figure { margin: 0; width: 100%; height: 100%; display: block; position: absolute; border: 2px solid black; box-sizing: border-box; } .cube .front { transform: rotatey(0deg) translatez(100px); } .cube .back { transform: rotatex(180deg) translatez(100px); } .cube .right { transform: rotatey(90deg) translatez(100px); } .cube .left { transform: rotatey(-90deg) translatez(100px); } .cube .top { transform: rotatex(90deg) translatez(100px); } .cube .bottom { transform: rotatex(-90deg)...

windows phone 8 - Encoding string issue reading a CSV file in C# -

i developing windows phone 8 application in 1 have download csv file web-service , convert data c# business object (i not use library part). download file , convert data c# business object not issue using restsharp.portable, streamreader class , memorystream class. the issue face bad encoding of string fields. with library restsharp.portable, retrieve csv file content byte array , convert data string following code (where response byte array) : using (var streamreader = new streamreader(new memorystream(response))) { while (streamreader.peek() >= 0) { var csvline = streamreader.readline(); } } but instead of "jérome", csvline variable contains j�rome . tried several things obtain jérome without success : using (var streamreader = new streamreader(new memorystream(response), true)) or using (var streamreader = new streamreader(new memorystream(response), encoding.utf8)) when open csv file simple notepad software notepad++ obtain jérome ...

mongodb - What is mongoose actually opening here? -

i in beginning stages of learning mean stack. i've created first node app, using mongoose , mongodb. in node.js code, have following: mongoose.connect('mongodb://localhost/meantest1'); i can create documents , find them fine, however, i'm not entirely sure it's storing data? app.get('/api/test', function (req, res) { test.create({ name: "joe schmo" }, function() { test.find(function (err, tests) { res.json(tests); }) }); }) in mongo shell, if execute use meantest1 db.test.find() it returns data entered in shell, nothing app. can explain going on here? also, there better app querying mongo shell?? mongoose automatically pluralizes collection names when register model. in case model name of test converted collection name of tests . if want prevent pluralization, or need attach model existing collection that's not pluralized, may pass collection name third argument...

html - Right Align an Element in CSS While Maintaining Document Flow -

is possible right align element in css without removing document flow? for instance, position:absolute; right:0; would right align element, element removed document flow. likewise, float:right; mess layout. possible right align element position:relative ? or there other way of right aligning elements easily? i'm asking because need use right: set position of element on javascript events, need take space elements underneath don't need manually positioned hand. apply display: inline-block; , wrap element text-align: right; on it. .right-container { text-align: right; } .align-right { display: inline-block; width: 50px; height: 50px; background-color: green; } <div class="right-container"><div class="align-right"></div></div> <div class="some-text">some text text text text text text text text</div>

c++ - Is it guaranteed that size_t, vector::size_type, etc typedefs won't bind to a char type? -

it possible cstdint typedefs bind char variables. example, uint_least8_t binds unsigned char , , int_least8_t binds signed char . does standard guarantee similar thing won't happen size_t or similar types? or there @ least purely theoretical chance such types bind char types, unsigned char or maybe wchar_t ? all know std::size_t is: the type size_t implementation-defined unsigned integer type large enough contain size in bytes of object. if unsigned char fulfills condition, may used std::size_t . however, concern purely theoretical there not single real platform (that know of) unsigned char wide enough (alright, wrong) char type used std::size_t or like. if super paranoid, can promote value @ least int unary + : std::cout << +vector.size(); this print number if size type character type. for reading can use variables of type std::common_type<unsigned int, std::size_t>::type (probably through typedef ) , bounds check in case ...

c# - Why would an AutoMapperExtension behave differently from a direct implementation? -

i have defined following mapping within registermappings() of automapperconfig : automapper.mapper.createmap<member, photoviewmodel>() .formember(dest => dest.show, opt => opt.mapfrom(src => src.showphoto)) .formember(dest => dest.value, opt => opt.mapfrom(src => automapper.mapper.map<photovalueviewmodel>(src)); automapper.mapper.createmap<member, photovalueviewmodel>(); this mapping maps 2 properties of photoviewmodel . first maps show property based off of src.showphoto , , maps photovalueviewmodel value property. the mapping works! unfortunately, have many objects require similar mapping. so, tried abstracting of implementation automapperextension method. method looks this: public static imappingexpression<tsource, tdestination> applypropertymapping<tsource, tdestination> (this imappingexpression<tsource, tdestination> imappingexpression, expression<func<tsource, bool?>>...

excel - Java.lang.OutOfMemoryError:Java heap space org.apache.poi.ss.formula.FormulaCellCacheEntrySet.add(FormulaCellCacheEntrySet.java:63) -

i using " switch(evaluator.evaluateincell(cellin).getcelltype()) " in java program evaluate formula in excel. have arount 15,000 rows in excel. here code: cell celldb_acctnumber = row1.createcell(lastcell1); celldb_acctnumber.setcelltype(cell.cell_type_formula); celldb_acctnumber.setcellformula("vlookup($e"+k+",'sql_ams_data'!$c$2:$f$"+lastrowdb+",2,false)"); cell celldb_routnumber = (hssfcell) row1.createcell(lastcell1+1); celldb_routnumber.setcelltype(xssfcell.cell_type_formula); celldb_routnumber.setcellformula("vlookup($e"+k+",'sql_ams_data'!$c$2:$f$"+lastrowdb+",3,false)"); cell celldb_accttype = (hssfcell) row1.createcell(lastcell1+2); celldb_accttype.setcelltype(xssfcell.cell_type_formula); celldb_accttype.setcellformula("vlookup($e"+k+",'sql_ams_data'!$c$2:$f$"+la...

Java -- MongoDB collection.find() by _id -

i trying element collection using unique _id, can not find how. this code mongoclient mongoclient = new mongoclient("localhost", 27017); mongodatabase database = mongoclient.getdatabase("db"); mongocollection<document> collection = database.getcollection("coll"); if query db basicdbobject query=new basicdbobject("info.i0","0"); document mydoc = collection.find(query).first(); system.out.println(mydoc.tojson()); i output { "_id" : { "$oid" : "560ea3f205240f065a3e9d19" }, "name" : "mongodb", "type" : "database", "count" : 1, "info" : { "i0" : "0", "i1" : "1", "i2" : "2", "i3" : "3", "i4" : "4", "i5" : "5", "i6" : "6", "i7" : "7", "i8" : "8", "i9...

c - segmentation fault because of character changement -

i'm writing board game detailed information . segmentation fault changing problem_ch ' ' (space) '.' . when play moves , ' ' , don't when play moves , '.' i get. , don't understand happening. solved: because of negative index, segmentation fault. handling, solved. following moves: 3d 2d 5f 2e 1e 4b 4c 4a 3b @ 4b segmentation fault code: void make_move(char board[][size], size_t row, size_t col, char player) { int rowdelta = 0; // row increment int coldelta = 0; // column increment size_t x = 0; // row index searching size_t y = 0; // column index searching // identify opponent char opponent = (player == player_ch) ? computer_ch : player_ch; board[row][col] = player; // place player counter // check squares around square opponents counter for(rowdelta = -1 ; rowdelta <= 1 ; ++rowdel...

m2eclipse - eclipse m2e default plugins settings -

env: eclipse (mars) jdk 8 wildfly 8.2.0 final issue: everytime create maven project it uses jdk 5 (war , jar) complains web.xml missing (in case of war). so, everytime have open pom.xml , include plugin configuration in pom.xml <build> <pluginmanagement> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-war-plugin</artifactid> <version>2.6</version> <configuration> <failonmissingwebxml>false</failonmissingwebxml> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.3</version> <configuration> <source>1.8</source> <target...

javascript - Issue With Replacing RegExp Terms In String -

var teststring = "this string has bad word in test"; function findbadwords(string) { var badword = /\bbad\b | \bword\b | \btest\b/gi var isbadword = string.match(badword); if (isbadword) { newstring = string.replace(badword," *** "); } document.write(newstring); } findbadwords(teststring); so i'm practicing regexp's , have run problem don't understand. in code above, have set regexp find "bad words" in string. can tell, have set find word "bad", "word", , "test" long there word boundary before , after word. issue i'm having "word" isn't being replaced. if put non-badword before "word" gets replaced, not otherwise. have tried taking off of word boundaries or adding non-word boundaries no luck. mind explaining why code working way , how fix it? thanks! also, know using document.write poor choice it's testing swear! the issue here \b alongside " ...

sql server - inserting primary key of tbl1 into foreign key of tbl2 and primary key of tbl1, tbl2 into foreign key of tbl3 -

create table tbl1 [departments] ( deptid int identity primary key, deptname nvarchar(40) ) create table tbl2 [teachers] ( teacherid int identity primary key, teachername nvarchar(40), deptid int references departments ) create table tbl3 [departmentchiefs] ( deptid int references departments, teacherid int references teachers, chiefdate date ) i want insert primary key of (departments) table foreign key of (teachers) table inserting primary key of (departments , teachers) foreign key of departmentchiefs try this: declare @deptid int, @teacherid int; insert departments (deptname) values ('my department'); select @deptid = scope_identity(); insert teachers (teachername, deptid) values ('joe smith', @deptid); select @teacherid = scope_identity(); insert departmentchiefs (deptid, teacherid, chiefdate) values (@deptid, @teacherid, getdate()); scope_identity returns recent identity value inserted in current scope, , result c...

How to increase the quotas on the Google speech API -

i use google's speech api but, have 50 request per days, want know if it's possible increase quotas? i developing application uses google speech api , knowledge , research, google never give option increase quota. speech api ment development chromium web , experimental other applications. also, from read , if development chromium web wont have wall of 50 quota day. again haven't verified maybe digging that? so if limit cannot take creative coding or go speech api. example, developing verbal flash card application language class , since know wont have totally "random" accesses api (meaning reuse resources google sends me), save audio files storage later retrieval if call upon again. built own client-server application result handle of this. keep doing research on subject (possibly find api use doesn't restrict you), in honestly, find creative approach using 50 quota efficiently. you'd surprised on can think of!

xna - 360 FOV depth buffer by topology and 2D shadows with multiple lights -

just implemented idea multiple lights (idea without multiple lights here 360 fov depth buffer topology , 2d shadows ), i'm not sure if correctly rendered http://www.youtube.com/watch?v=bfhdizihlyq , render each scene screen graphicsdevice.blendstate = blendstate.additive; respect light, scenes added each other. and question - seemed correct or not ? to answer question. sorry no, have been corrupted, let me explain. the human eye logarithmic. perceive twice bright need square amount of light coming our eyes. same goes sound. yet rgb values of screen linear rgb 128,128,128 twice bright 64,64,64. has linear or our shading algorithms not work. fall of quick. well no our calculations wrong people manufacture our screens know , correct best can.. rather me explaining watch youtube computer color broken so correct mix need create correct mix between 2 renders.there not blend state solve have create custom pixel shader job. output.color = sqrt( pow ( input1.color ...

javascript - Changing An Elements Content -

i change content of element button click , have return original message. how preferable toggle class if possible. <doctype html> <html> <head> <meta charset=utf-8> <title>day practice</title> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"> </script> </head> <body> <h1> hotdogs</h1> <input type=button id=button value=button> <script> $("#button").click(function(){ $("h1").html("change this"); }); </script> this changes header button, don't know how revert when click on button again. maybe toggle class, don't know. this should solve: $( "#button" ).toggle(function() { $("h1").html("change here"); }, function() { $("h1").html("revert here"); });

laravel 5 - How to perform only javascript onClick and not PHP action on submitting a form -

i making form through laravel in want accept future dates.i validating date via javascript , popping alert when past date entered problem after alert going form action url (that form submitted) if past date entered. want remain page itself. please help. <html> <script type="text/javascript"> function func() { var aa = document.getelementbyid('in').value; var bb=new date(); var y=aa.slice(0,4); var m=aa.slice(5,7); var d=aa.slice(8,10); if((y>=bb.getfullyear() && m>=(bb.getmonth()+1) && d>=bb.getdate())!=1) { alert('enter future date'); } } </script> <body> <form action="/submitted" method="post"> <input id="in" type="date" name="sdate"> <input type="submit" onclick="func()"></form> </body> </html> use "return false;" after "alert();" command. if((...

visual studio 2015 - upgrade AjaxControlToolkit to verson 15 get an error -

hi update ajaxcontroltoolkit version 3.5 15.1 , upgrade .net framework form 2.1 4.6. after update ajaxcontroltoolkit, got error. tell me how fixe it? in advance. there error: extender control 'deletemsg' cannot extend 'deleteconfirm'. extender controls of type 'ajaxcontroltoolkit.dynamicpopulateextender' cannot extend controls of type 'system.web.ui.htmlcontrols.htmlgenericcontrol'. there code control. <div id="deleteconfirm" runat="server"> <asp:dynamicpopulateextender id="deletemsg" targetcontrolid="deleteconfirm" populatetriggercontrolid="deletebutton" runat="server" customscript='<%# string.format("populatedynamic(""{0}"", ""{1}"")", eval("title"), eval("announcementdate")) %>'> </asp:dynamicpopulateextender> this h...

c# - Can't Set variable value in Static Field -

in simple example why stra in sample() function can't set "hi world" string ? string stra { get; set; } private void button1(object sender, eventargs e) { stra = "hi world"; //=======> stra value } public static string sample() { myclass myclass1 = new myclass(); string = myclass1.stra; //==========> can't set stra value "hi world" string ??? return (messagebox.show(a).tostring()); } make stra static field, right it's local property of instance, when create new instance myclass1 = new myclass(); the stra property empty (null) , if set value, after create new instance new instance have srta empty...

Drools DRL: Fewer larger rules vs many smaller rules -

i have many rule constraints can logically grouped "or". example: 3 rules "r1", "r2" , "r3". can construct single lhs as: (r1 || r2 || r3) or can make each of them separate rule. have no critical functional requirement doing either way since can detect grouping independently outside of drools. i wonder if 1 way more advantageous other runtime execution perspective (performance, memory, etc.). a disjunction @ pattern level handled 2 different rules, there's not gained or lost either way. but maintenance , development point of view, 2 separate rules require 2 copies of right hand side, using disjunction in single rule appears preferable. establishing binding variables used little tricky think recent versions (6.x) of drools handle satisfactorily. note disjunctions @ constraint level should not split separate rules.

button - Replacing a View in Android onClick -

i'm still kind of new android. i'm writing tic tac toe game bit of practice. i'm trying figure out how replace views when click button. have 9 buttons in gridview. when user clicks one, want change non-clickable textview , button when user click's reset button @ bottom of screen.. use flag keep track of player's turn it'll know whether or not place x or o. possible or stretching here? you'll find there not many things stretching android. this possible. each grid in gridview , put in 2 elements - button , , textview . change visibility of each. in other words, don't replace 1 other - hide one, , show other. so you'd have 2 items this: <button ... android:visibility="invisible"/> <textview ... android:visibility="visibile"/> and have both of these match_parent , fill each grid , both on top of each other. to change visibility in code: button1.setvisibility(view.invisible); textview1.setvisibility...

c++ - No dangling reference for std::min in libc++ -

it known (or should be) binding result of std::min const reference bad idea, whenever 1 of arguments of std::min rvalue, since const reference binding not propagated through function return. following code #include <iostream> #include <algorithm> int main() { int n = 42; const int& r = std::min(n - 1, n + 1); // r dangling after line std::cout << r; } should produce undefined behaviour since r dangling. , indeed, when compiling gcc5.2 -wall -o3 compiler spits warning: <anonymous> used uninitialized in function [-wuninitialized] however, compiling clang (llvm 7.0.0) using same flags (even including -wextra ) not emit warning, , program seems "work", i.e. displays 41 . question: clang using "safe" version of std::min ? version uses sfinae return value whenever 1 of arguments rvalue? or not required emit diagnostic , program "happens" produce "right" result in ub scenario? i...

c++ - Cannot save processed fingerprint image with VeriFinger -

Image
i'm trying use sdk called verifinger process .bmp file containing fingerprint capture (for enhancement), , save new .bmp file. verifinger comes few tutorials , samples, main 1 being called fingerssamplewx . here's screenshot of it, completeness: following application's source code guide, able assemble piece of code should want, or believe: #include <iostream> #include <nlicensing.hpp> #include <nmedia.hpp> #include <nbiometrics.hpp> using namespace neurotec::biometrics; using namespace neurotec::images; using namespace neurotec::licensing; int main() { if (nlicense::obtaincomponents("/local", "5000", "biometrics.fingerextraction")) std::wcout << l"license ok\n"; else std::wcout << l"license fail\n"; nfinger finger; finger.setfilename("f:\\input\\000001\\mdt1.bmp"); finger.setposition(nfpunknown); finger.setimpressiontype(nfitn...

.htaccess - Remove the profile.php?name=Username from url and replace with profile/Username -

this question has answer here: reference: mod_rewrite, url rewriting , “pretty links” explained 4 answers i have problem php file. want make site , have url this domain.com/players/username i have folders set this: domain.com/players/players.php?username=johndoe inside main folder (domain.com/players/index.php) have search form posts players.php file want make able search player username so -> remove /players.php?username=johndoe , change /players/johndoe user can view profile @ domain.com/players/johndoe thank , sorry if bad question something should trick, <ifmodule mod_rewrite.c> # turn on engine: rewriteengine on # set base directory: rewritebase /username/ # redirect paths player.php: rewriterule ^(username)/?$ players.php?username=$1 </ifmodule> this htaccess file, have make sure mod_rewrite enabled on server's ...

q lang - Is there a way to replay a gzip-compressed log file in kdb+ without uncompressing it first? -

streaming execute , -11! , not work on named pipes, obvious solution of redirecting gzip -cd output named pipe , passing -11! not work. -11! accepts compressed file , streams long compressed -19! (using 2 compression algorithm parameter, gzip). the difference between normal gzipped file , kdb compressed 1 few bytes @ beginning of file. edit (see comment) thanks, isn't true - bytes different @ end of file so possible solution prepend gzipped files (if weren't produced -19! ) appropriate byte array first.

python 3.x - Having trouble ending up with negative or no discount -

https://gist.github.com/socialery/bf0f39375150dcfefd3b for example if enter 0, -47, 8 total comes out correct gives me discount of 0 , final total of 0. you're not recalculating "total" if invalid input. input mentioned "total" set 0 , never set again. use num * price in print statement.

javascript - Understanding variable mistakes within closures? -

i learning closures. example given common mistake made when making closure: function assigntorpedo(name, passengerarray) { var torpedoassignment; (var = 0; i<passengerarray.length; i++) { if (passengerarray[i] == name) { torpedoassignment = function() { alert("ahoy, " + name + "!\n" + "man post @ torpedo #" + (i+1) + "!"); }; } } return torpedoassignment; } since loop completes before closure returned, value not match name. so, understand loop continues on before return happens. my question comes this, example of correct way things: function maketorpedoassigner(passengerarray) { return function (name) { (var = 0; i<passengerarray.length; i++) { if (passengerarray[i] == name) { alert("ahoy, " + name + "!\n" + "man post @ torpedo #" + (i+1) + "!"); ...

Redis exception StackExchange.Redis.RedisConnectionException -

i getting exception. clue stackexchange.redis.redisconnectionexception: not possible connect redis server(s); create disconnected multiplexer, disable abortonconnectfail. possible reasons: is redis , running? try connect using redis-cli . is connection settings redis right in code (i.e. you're connecting right host , port...)? the exception quite expressive: connectionmultiplexer couldn't reach target redis server.

xml - android: Which practice is better for using CoordinatorLayout -

i new material design aspect of android. so, please bear me. tried implementing fab home activity, , implemented snackbar. naturally, came above fab. researched on coordinatorlayout , what's bothering me 1 better practice using coordinatorlayout? for example, here's xml of activity. <relativelayout android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/primary_color"></android.support.v7.widget.toolbar> <android.support.design.widget.floatingactionbutton android:id="@+id/searchfab" android:layout_width="wrap_content" android:layout_height=...

drop down menu - Angularjs dropdown link with multiple sub items -

i want display dropdown mutiple sub items please see picture example in below picture customer table right side displayed items columns want display in angularjs example customer->name city address order->name quanttity

iOS Framework With Swift and Objective-C Where the Objective-C Uses Swift C -

Image
i have framework building combines both objective-c , swift. issue of objective-c code within framework needs use of swift classes in framework. in order this, do: #import "frameworkname-swift.h" in objective-c code in framework. , here first problem arises. -swift.h header not located xcode way. digging around in derived data, turns out -swift.h file located in framework/headers folder, in of seems odd. should -swift.h file exposed header framework? -swift.h file intermediary .h file, right? to work around issue of not locating -swift.h, tried: #import <frameworkname/frameworkname-swift.h> but, while locating -swift.h file, causes severe , compilation-fatal rash of cyclic dependencies in xcode, messages like: cyclic dependency in module 'frameworkname' not build module 'uikit' here's in-situ: thoughts? i have incomplete answer this, more of partial explanation , workaround works me. here's think causing issue. w...

rest - Apigility: How to render embedded objects? -

how render embedded objects in apigility? example, if have 'user' object , composes 'country' object, should rendering 'country' object embedded object? , how should this? i using zend\stdlib\hydrator\arrayserializable . getarraycopy() method returns array of properties want exposed. array keys property names. array values property values. in case of user->country , value object, not scalar. when return user object userresource->fetch() , here's how rendered: { "id": "1", "firstname": "joe", "lastname": "bloggs", "status": "active", "email": "test@example.com", "country": { "code": "au", "name": "australia" }, "settings": "0", "_links": { "self": { "href": "http://api.mydomain.local/users/1" ...

trading - How to access the second if statement -

i totally drain out second if statement couldn't executed. my original idea when volatility in range of 90 - 110, program send one , one order. , wait , see till volatility reaches in range of 111 - 150, , send the second order . if don't use bool function here, program send countless order when range reached. could please me? if ( todaymaxvolatilitypercentage >= 90.0 && ( daytrend == 1 ) && orderopened == false ) { print( "entered if clause" ); // print( "today volatility percentage is: ", todaymaxvolatilitypercentage + "%" ); // ticket: returns number of ticket assigned order trade server or -1 if fails. ticket = ordersend( symbol(), op_sell, 0.3, bid, 3, 0 * mypoint, 30 * mypoint, ...

jquery - Accessing javascript object's properties in the method -

for below code snippet expecting answer "number" getting "undefined". can please me here find out why returning "undefined" ? var foo = { bar: function () { return this.baz; }, baz: 1 }; (function () { return typeof arguments[0](); //this return "undefined" })(foo.bar); if typeof foo.bar(), give me expected answer "number". thanks in advance. that's because this normal functions set how function called , not it's defined. (ecmascript2015's "arrow" functions different, inherit this they're created, not how they're called.) you have couple of options: 1) use function#bind create new function that, when called, call original function correct this : var foo = { bar: function() { return this.baz; }, baz: 1 }; (function() { snippet.log(typeof arguments[0]()); })(foo.bar.bind(foo)); <!-- script provides `snippet` object, see http://m...

javascript - Angular variable not binding to view -

i have angular/onsen app has image put html5 canvas tag , , picking color of pixel on on hover . the view pretty simple: <ons-template id="live.html"> <ons-page ng-controller="livecontroller"> <ons-toolbar> <div class="left"> <ons-toolbar-button ng-click="menu.toggle()"> <ons-icon icon="ion-navicon" size="28px" fixed-width="false"></ons-icon> </ons-toolbar-button> </div> <div class="center">live camera</div> </ons-toolbar> <canvas id="canvas" width="100" height="100"></canvas> <p>#{{hex}}</p> </ons-page> </ons-template> you can see there <p> tag should displaying value of $scope.hex (the calculated hex value of pixels rgb channels) not. though correct value l...

php - Twitter card on Wordpress -

step # 1 : added meta tags in header.php <?php if (is_single()){ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->id ) ); ?> <meta name="twitter:card" content="summary" /> <meta name="twitter:url" content="<?php echo get_permalink() ?>" /> <meta name="twitter:title" content="<?php echo get_the_title() ?>" /> <meta name="twitter:description" content="<?php echo get_the_excerpt() ?>" /> <meta name="twitter:image" content="<?php echo $image[0] ?>" /> <?php } ?> step # 2 : on twitter click added <?php $link = empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username; ?> ...

java - implementing HttpRequestHandler in LWUIT -

i'm trying implement httprequesthandler on j2me application. when try execute ,is giving me error cannot find symbol httprequesthandler handler = new httprequesthandler(); httprequesthandler handler = new httprequesthandler(); htmlcomponent htmlc = new htmlcomponent(handler); htmlc.setpage("http://m.facebook.com"); form form = new form("html test"); form.setlayout(new borderlayout()); form.addcomponent(borderlayout.center,htmlc); form.show(); i'm new j2me , please .

na - shell script to remove folder from sub directories with different names -

i want remove particular directory named "classes" web applications different names inside webapps folder. for example, want remove folder name "classes" /tomcat6/webapps/abc, /tomcat6/webapps/xyz, /tomcat6/webapps/xxxx etc. can 1 please me make shell script accomplish this? this may not efficient 1 work. first verify directories. find /tomcat6/webapps | grep "classes$" if list seems ok, delete it. find /tomcat6/webapps | grep "classes$" | xargs rm -rf please careful deletion not undoable once done.

Python 3 : How to create commands in loop for buttons grid? -

i began learning python me create little ui manage windows clients on renderfarm. here example of problem : import tkinter tk #my variable : number of clients specified user numclients = 10 class app(tk.tk): def __init__(self): tk.tk.__init__(self) in range (0,numclients): = i+1 #name buttons, commands , texts button = ("b",i,"_01") cmd = ("command"+str(i)) rn = ("rn0"+str(i)) #create buttons on grid text self.button = tk.button(self, text= rn, command = self.cmd) self.button.grid(row=i, column=0, sticky="s, n, e, w") #the command want duplicate each button def cmd (self): #print button name print (rn) app = app() app.mainloop() i need create many rows have clients (specified in variable "numclients") , associate specific command each 1 of them, : button1 pressed ...

android - Switch button is not checked by default -

i have switch in action bar , working fine wanted checked default setting in xml android:checked="true" , in code switch switchbutton=new switch(getactivity()); switchbutton.setenabled(true); when app launched unchecked default. here code switch public void oncreateoptionsmenu(menu menu, menuinflater inflater) { super.oncreateoptionsmenu(menu, inflater); menu.clear(); inflater.inflate(r.menu.switch_menu,menu); menuitem switchitem=menu.finditem(r.id.toggle_loc); switch switchbutton=new switch(getactivity()); switchbutton.setenabled(true); menuitemcompat.setactionview(switchitem,switchbutton); switchbutton.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() { @override public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { if (ischecked){ log.d(tag,"switch button checked"); } else { log.d(tag,...

Where does BasiEgaXorz write its compiled Sega Genesis binary (basic.bin) to? -

Image
basiegaxorz old win32 program allows write basic programs , compile them sega genesis cartridge or sega cd roms. i screen: but rom? in installed version on windows 10, basic.bin written c:\users\%username%\appdata\local\virtualstore\program files (x86)\basiegaxorz\basic.bin . basic.bin can used genesis emulator, , used on real genesis. for reason, path cannot changed in options, , not listed anywhere in documentation.

Trying to save information from datagridview back to original database -

so i'm trying save information datagridview database populated it. i've looked @ tutorials, , looks straight forward, reason cant work. i've set database , table, put in basic test data - can populate datagridview information, can call information datagridview , use - whenever try save information database, not appear work. whilst program running 'new' entries in datagridview can seen, if close program , re-open - 'new' entries gone. according tutorials ive looked at, need following code private void islandmapbindingnavigatorsaveitem_click(object sender, eventargs e) { this.validate(); this.islandmapbindingsource.endedit(); this.tableadaptermanager.updateall(this.starterislanddataset); } unfortunately button not carry out desired effect. i've tried making own button same code, still no effect. am missing code? wrong approach? there property need set allow data saved original database? need implement sort...

ios - How to continue spotlight search and show content ViewController -

Image
i had spotlight search sorted out, problem i'm facing how show content view based on item has been press in spotlight. my app's structure uitabvc > uinavigationvc > uicollectionvc > uivc spotlight , code shown below // continue spotlight search func application(_ application: uiapplication, continue useractivity: nsuseractivity, restorationhandler: @escaping ([any]?) -> void) -> bool { if useractivity.activitytype == cssearchableitemactiontype { let uniqueidentifier = useractivity.userinfo?[cssearchableitemactivityidentifier] as! string let id = uniqueidentifier.components(separatedby: "_") let roottabvc = uistoryboard(name: "main", bundle: nil).instantiateviewcontroller(withidentifier: "roottabvc") as! roottabvc print(id[0], id[1], separator: " - ", terminator: "\n") // printed "craft - shovel" switch id[0] { case "craft...

get and post from ibm bluemix using python script -

i want add 2 numbers , show result(it may sound joke) thing want python script take first value , python script take second value inputs me , these 2 values have sent cloud (i have trial account in ibm bluemix) , python script should these 2 values cloud , third python script should add , show me result. doing knowledge cloud , python please suggest me solution

linux - chmod 777 not work in Ubuntu 14.04.5 -

Image
i want change mode of executable file (vicnl) in order use it. command used is: chmod 777 -c -r vicnl it seems worked information displayed below: mode of "vicnl" changed 0600 (rw-------) 0777 (rwxrwxrwx) but strangely, when check result, mode not changed. ll vicnl -rw------- 1 xt xt 1053768 9月 2 21:17 vicnl how happen?

nltk - Dictionary not sorting correctly in python -

my code should output top 10 words highest frequency in corpus. however, giving output of 10 random words. from nltk.corpus import brown import operator brown_tagged_sentences = brown.tagged_sents(categories='news') fd=nltk.freqdist(brown.words(categories='news')) sorted_fd = dict(sorted(fd.items(), key=operator.itemgetter(1), reverse=true)) print(sorted_fd) most_freq_words=list(sorted_fd)[:10] word in most_freq_words: print(word,':',sorted_fd[word]) the output coming below wrong: rae : 1 discharge : 1 ignition : 1 contendere : 1 done : 24 meaning : 4 ashore : 1 francesca : 1 vietnamese : 1 data : 4 kindly help the nltk's freqdist() class can directly give contents in descending order of frequency, using method most_common() : fd=nltk.freqdist(brown.words(categories='news')) w, f in fd.most_common(10): print(w+":", f)

Using Template Haskell to derive classes -

so, found myself doing this: newtype t x = t x deriving (eq, ord, ...) and thought annoying, i'm thinking making package, using template haskell, adds instances in base. perhaps more flexible dealing what's above. firstly, seems template haskell can spit out declarations, think want use standalone deriving. in general, think want produce declarations this: deriving instance (f x1, f x2, ... , f xn) => t x1 x2 x3 where f replaced eq , ord , etc. but right hand side bit more complex, example: deriving instance (f x1, f x2, ... , f xn) => t x1 (maybe x2) x3 or maybe even deriving instance (f x1, f x2, ... , f xn) => t x1 (t2 x2 x3) you have repeats: deriving instance f x => t x x lets simplify things moment here, , assume there 1 parameter on left. we're looking @ instances this: deriving instance f x => t (some stuff involving x) i figure need function following: (name -> type) -> q [dec] then keep each class in bas...

c++ - Global variable dll export/import -

i got usual macros below: #ifdef platform_windows #ifdef build_shared #define api __declspec(dllexport) #else #define api __declspec(dllimport) #endif #else #define api #endif (the lib compiles /dbuild_shared ) then have global union object want export/import: header file: #ifdef __cplusplus extern "c" { #endif //definition of union type api extern union u global; #ifdef __cplusplus } #endif source file: // include header api union u global; the lib compiles fine, while linking executable linker error unresolved external symbol _global . i'm using msvc (vs 2015). not sure if c linkage has it. i'm not sure if uses c linkage because intellisense shows __cplusplus not defined in header file quoted above.

java - move object towards or away centre until collision -

i working in javafx trying centre objects around point without overlapping. trying make word cloud programme. at first trying place them in spiral if collision occurred (i have method detecting collisions in class) if (collisiondetected){ text.translatexproperty().asobject().setvalue((double)80); } but couldn't work out how set path in spiral so thought generate rand.int x y values , move towards centre point until collision detected , place object , move onto next object in list. not sure how set path , increment until collision detected. or better start middle , decide rand.int within 360 degrees , create path bounds of scene , increment along until collisiondetected = false as in integer randproperty = rand.nextint(0, 360); while(collisiondetected){ path path = new path(); moveto moveto = new moveto(); moveto.setx(randproperty); moveto.sety(randproperty); path.getelements().add(moveto); i dont know how move across path until collisiondete...

vue.js - How to separate opening and closing tag by conditional template in vue without getting compiling error? -

i trying conditional templating have separated opening , closing tags of elements. can't work until in same conditional template tag. put opening tag 1 conditional template , closing tag conditional template error. example: <template> <div> <template v-if="show"> <ul> <li> 1 </li> </template> // other conditional stuff in between <template v-if="show"> <li> 2 </li> </ul> </template> </div> </template> <script> export default { data() { return { show: false } } } </script> here error because opening <ul> tag , closing </ul> tag in discrete <template v-if=".."> tags. error: (emitted value instead of instance of error...