Posts

Showing posts from June, 2015

c# - How to get coords inside a transformed sprite? -

Image
i trying x , y coordinates inside transformed sprite. have simple 200x200 sprite rotates in middle of screen - origin of (0,0) keep things simple. i have written piece of code can transform mouse coordinates specified x or y value. int ox = (int)(mousepos.x - position.x); int oy = (int)(mousepos.y - position.y); relative.x = (float)((ox - (math.sin(rotation) * y /* problem here */)) / math.cos(rotation)); relative.y = (float)((oy + (math.sin(rotation) * x /* problem here */)) / math.cos(rotation)); how can achieve this? or how can fix equation? the general way express transformation matrix. way, can add other transformation later, if find need it. for given transformation, matrix is: var mat = matrix.createrotationz(rotation) * matrix.createtranslation(position); this matrix can interpreted system transformation sprite space world space. want inverse transformation - system transformation world space sprite space. var inv = matrix.invert(mat); you can tr

bids - SQL command to find when a document was last printed? -

i have table of document names , dates when printed. say: aaa 2006-09-15 aaa 2007-09-15 abc 2013-08-12 abc 2012-08-12 after command executes need: aaa 2007-09-15 abc 2013-08-12 i got close correct output involved temporary tables. i'm trying put microsoft bids , doesn't me using #temp_table. ideas? try this: select doc_name, max(date_printed) your_table group doc_name; here's fiddle can check http://sqlfiddle.com/#!2/dd156/3

ruby - Does it make sense to include callback and errback when running inside an EM.defer? -

i'm trying integrate blocking libraries/operations inside eventmachine, , i've considered encapsulating such code inside class includes em::deferrable. make sense have such code in deferrable object: class whatever include em::deferrable def some_operation result = some_blocking_operations if result.considered_success? succeed(result) else fail(result) end end end or should stick to: op = lambda result = some_blocking_operations end cb = lambda |res| # kind of if here check if it's success or failure end em.defer(op,cb) personally, prefer first one, since me reads bit better. make sense implement deferrable in such case? your first implementation looks way more oop me. using lambdas great , flexible if things start complicated you'll endup bunch of random lambdas , no way tell doing. to answer question, yes makes sense me create class run blocking code. also, you'll have place put private methods relat

ios - Count how many times a word appears in table view row -

in table view adding rows dynamically via button press. the detailtextlabel.text varies depending on pass or fail result obtained in view im trying figure out how best check how many rows contain word "fail" i thought maybe add bool , count how many times flag raised? not sure how count how many times bool == yes? if(cell.textlabel.text && [cell.detailtextlabel.text rangeofstring:@"fail"].location != nsnotfound){ //count total amount of rows detailtextlabel.text == failed, need count here? } or can check rows self.circuits.count word fail perhaps? well, opposed iterating on objects track ones contain "fail" , don't, why not check condition when add row. then, if contain "fail" can increment number (which can store ever want) , can keep track of total "fails". self.somenumbertoremember ++ ;

java - Check if its a character -

after getting action keylistener, using event.getkeycode() , later on keyevent.getkeytext(keycode), how check if outcome of .getkeytext(keycode) single character 'a' , not whole word "space" ? how this: keyevent.getkeytext(keycode).length == 1

autoscroll - how to ensure visible a node into a TitlePane which is into a scrollpane in javafx -

i have scrollpane has various titledpane this, each titledpane has various textfield's children. when navigate throughout textfield's using tab key, scrollpane not autoscroll ensure visible control gaining focus. program demonstrating problem. import java.util.random; import javafx.application.application; import javafx.scene.scene; import javafx.scene.control.scrollpane; import javafx.scene.control.textfield; import javafx.scene.control.titledpane; import javafx.scene.layout.anchorpane; import javafx.scene.layout.pane; import javafx.scene.layout.vbox; import javafx.stage.stage; public class scrollpaneensurevisible extends application { private static final random random = new random(); @override public void start(stage primarystage) { vbox root = new vbox(); scrollpane scrollpane = new scrollpane(); pane content = new pane(); scrollpane.setcontent(content); (int = 0; < 3; i++) { titledpane pane =

node.js - How to call $addToSet if an array exists if it doesnt then call $set in one query? -

hey trying set new array not exist in mongodb docs, want able throw additional documents array without replacing values. for example: users { id: 'value1', name: {value2}, friends: [ {friendid: 'value x', type: 'valuey', tags: [tag1, tag2]} ] basically tags not exist , want create , add tag1, , if exist want add tag2 array... this make sense of variables in sample above have in db: friendstatus = friends, fuid = friendid, labels = tags here attempt: friend.findoneandupdate({userid: mongoose.types.objectid(req.signedcookies.userid), 'friendstatus.fuid': mongoose.types.objectid(req.body.user)}, {$addtoset: {'friendstatus.$.labels': req.body.labelnew}} , function(err, userx) { } currently there no way want mongodb update syntax. here feature allow that: https://jira.mongodb.org/browse/server-6566

Getting android:entries and android:entryValue from SharedPreferences -

i have 2 array lists in xml: <string-array name="usstates"> <item>view latest updates&#8230;</item> <item>alabama</item> <item>alaska</item> <item>arizona</item> <item>arkansas</item> <item>california</item> <item>colorado</item> <item>connecticut</item> <item>delaware</item> <item>district of columbia</item> <item>florida</item> <item>georgia</item> <item>hawaii</item> <item>idaho</item> <item>illinois</item> <item>indiana</item> <item>iowa</item> <item>kansas</item> <item>kentucky</item> <item>louisiana</item> <item>maine</item> <item&

excel - Next without For Error - What is wrong with this code? -

i assume there wrong code below, because giving me following error: compile error: next without for what wrong code? thanks! :) sub createcharts() dim integer = 3 5 col = columns(i).select dim xaxis range dim yaxis range set yaxis = range("$" & col & "$152", "$" & col & "$156") set xaxis = range("$a$152", "$a$156") dim c chart set c = activeworkbook.charts.add set c = c.location(where:=xllocationasobject, name:="sheet1") c.charttype = xlcolumnclustered dim s series set s = c.seriescollection.newseries s .values = yaxis .xvalues = xaxis next end sub you missing end with : s .values = yaxis .xvalues = xaxis end ' <====== here next

javascript - XML data file has been changed, but changes don't appear on html page in gmaps -

i inherited site uses google maps api, wasn't part of set up. had change dealer information in xml files, once changed, changes did not appear in dealer search. appreciated. page here: http://basalite.com/dealers_contractors.html?hleadtype=dealer most caching issue. if don't tell browser file has changed, won't update until refresh page (or in browsers clear out cache), loading updated xml in browser work.

javascript - In AngularJS, how do I define a route which calls a specific method on a controller? -

i'm making crud page using angularjs, have add/edit/delete function. so, routes this: /items (show list of items) /items/add (show add item form) /items/edit/:itemid (show edit item form) /items/del/:itemid (delete item) it seems have define different controller each of these 4 routes. e.g, additemctrl , edititemctrl , etc. however, doesn't seem optimal since additemctrl , edititemctrl going share deal of code. rather additemctrl , edititemctrl , etc, rather have 1 controller: itemctrl , , within route, i'd rather specify if want call itemctrl.add() , itemctrl.edit() , etc. is there way accomplish or close it? for angularjs, remember client side, url resource doesn't have directly related crud operation. recommend thinking of url route view, not operation. for example, use these: /items (show list of items) /items/edit/:itemid (show edit item form) i not use these: /items/add (show add item form) /items/del/:itemid (delete item) the r

ios - Animating rotated UIView causes it to disappear -

i have uiview 10 10, rotated 45 degrees create diamond shape. here code rotates view: triangle = [[uiview alloc] initwithframe:cgrectmake(35, kuserviewheight - 5, 10, 10)]; triangle.backgroundcolor = [uicolor coolblue]; //triangle.center = cgpointmake(5.0, 5.0); triangle.transform = cgaffinetransformmakerotation(m_pi_2 / 2); i have purposely commented out center value because messes setting location of view. aware issue. the view shows perfectly, when animate, view moves supposed on way, disappears. when rid of triangle.transform property, view animates , not disappear, square instead of diamond. here animation code: [uiview animatewithduration:kanimationinterval animations:^{ triangle.frame = cgrectmake(115, kuserviewheight - 5, 10, 10); }]; because plan on moving diamond shape around, setting center becomes problematic. how can both rotate view , animate across screen without disappearing? there kind of special way calculate center point need be? thanks!

gcc - Convert c calling function in assembly codes to assembly as well -

i working on c file mathematical functions such log , exp . compile c file gcc generate assembly codes. inside assembly codes, whenever pow function used, find call c function. instance, movsd xmm0, qword ptr 16[rbp] call log addsd xmm0, xmm0 call exp movsd qword ptr -8[rbp], xmm0 i wondering if possible tell gcc instead of calling c function, generate assembly code log , exp ? in other words, possible tell gcc generate assembly codes not require external function calling? thanks, you load program in gdb or debugger, , set breakpoint on call, , step log or exp function , when there, dump disassembly of (or copy & paste if you're running appropriate debugger). can if don't have source library functions.

python - When trying to display a chart using ChartIt, Error saying template does not exist arises -

i using chartit , keep receiving "template not exist" when trying view chart @ url. tutorial being followed properly, may have made mistake somewhere. new django, appreciated. request load chart working def being called. def in views.py file. def linechart(request): commitdata = \ datapool( series= [{'options': { 'source': testcommit.objects.all()[:200]}, 'terms': ['author', 'author_time']}]) linechart = chart( datasource=commitdata, series_options= [{'options': { 'type': 'line', 'stacking': false}, 'terms': { 'author_time': [ 'author_time'] }}], chart_options= {'title': { 'text': 'yays'}, 'xaxis': { 'title': { &#

C++ macro string concatenation -

this macro seems replace snmpwritefunc(w,x,y,z,q) function returning static type snmpwriteobject, perhaps instead overload of snmpwriteobject method? quite obscure me, grateful of 1 more experienced in area! #define snmpwritefunc(w,x,y,z,q) static snmpwriteobject r##w(x,y,z,q); it's convenience macro generating number of similar function prototypes, if write e.g. snmpwritefunc(foo,int,int,int,int) snmpwritefunc(bar,char,float,char,float) snmpwritefunc(blech,int,char,float,int) it expanded to: static snmpwriteobject rfoo(int,int,int,int); static snmpwriteobject rbar(char,float,char,float); static snmpwriteobject rblech(int,char,float,int); note ## commonly known token pasting operator . note macro , examples above not c++-specific - c code.

firefox - JavaScript event timestamps not consistent -

i notice when click 1 element on site e.timestamp reported firebug in event handler 9-digit number, 866523917, , when click different element e.timestamp reported in handler firebug 16-digit number, 1376344365954000. why difference? thanks as defined in standard timestamp returns number of milliseconds since epoch: used specify time (in milliseconds relative epoch) @ event created. due fact systems may not provide information value of timestamp may not available events. when not available, value of 0 returned. however, there no strict definition epoch: examples of epoch time time of system start or 0:0:0 utc 1st january 1970. some events using first variant (system start) while others use time since 1970. hence difference. side note it's possible timestamp not provided @ events, value 0 .

c - Casting the void pointer and printing with format specifiers -

okay school project question has nothing regarding specific implementation , nor asking regarding project itself. giving warning because want give context doing, rather general question regarding casting of void pointers, framed within context of project... function i'm writing isn't project, it's wrote testing mechanism see if generation of data structure working... , lead me problem involving printf(), format specifiers, , casting.... have implement linked-list (called 'queue' not queue @ all), , wrote function test it. there struct called "chunk" variables ( first index within larger array first element of given "chunk", , arr larger_array[c->first], it's void pointer such: void *arr c pointer chunk) indicate position in larger array. if have array = {5,7,3,4,6,9,1,2}, , given chunk size of two, have 4 chunks each of whom have "arr" void pointer variable point respectively 5, 3, 6, 1. anyways, wrote "print_queu

javascript - Data missing after page refresh -

route: app.router.map(function() { this.resource("login", { path: "/login"}); this.resource("contacts", { path: "/contacts"}, function () { this.resource("contact", { path: ":contact_id"}, function() { this.route("new"); this.route("edit"); }); }); }); app.contactsindexroute = app.authenticatedroute.extend( { model: function() { return app.contact.find(); } }); app.contactindexroute = app.authenticatedroute.extend( { model: function() { return this.modelfor("contact"); }, setupcontroller: function(controller, model) { controller.set("content", model); } }); controller: app.contactsindexcontroller = ember.arraycontroller.extend( { setproperties: ['full_name'] }); app.contacteditcontrollerr = ember.objectcontroller.extend( { }); app.c

asp.net mvc 4 - You must call “WebSecurity.InitializeDatabaseConnection” exception when I already have -

so i'm trying seed database following initializer public class dbinitializer : dropcreatedatabasealways<iamcontext> { protected override void seed(iamcontext context) { websecurity.initializedatabaseconnection("iamcontext", "userprofile", "userid", "username", autocreatetables: true); var roles = roles.provider; var membership = membership.provider; if (!roles.roleexists("admin")) { roles.createrole("admin"); } if (!websecurity.userexists("test")) { websecurity.createuserandaccount("test", "password"); } if (!roles.getrolesforuser("test").contains("admin")) { roles.adduserstoroles(new[] { "test" }, new[] { "admin" }); } context.products.add(new product { id = 1,

c# - Why should i use implicit/explicit operator? -

check code bellow: class money { public money(decimal amount) { amount = amount; } public decimal amount { get; set; } public static implicit operator decimal(money money) { return money.amount; } public static explicit operator int(money money) { return (int)money.amount; } } i dont understand how useful in code, couldnt method like: public static int returnintvaluefrom(money money) { return (int)money.amount; } would not easier , clearer implement? this done allow money added other money. without piece of code, cause compiler error, "operator '+' cannot applied operands of type 'money' , 'int'" money money = new money(5.35m); decimal net = money + 6; with casting operator present allows these types of conversions made without throwing exception. can assist in readability , allow polymorphism different currencies implement own types of casts example.

fortran - Linking C++ with BLAS and LAPACK -

to call fortran routine c++ have been using: extern "c" void routinename_(...) appended underscore making compatible fortran subroutine name "routinename". when link c++ blas or lapack works without underscore. difference between linking c++ these libraries, written in fortran, makes underscore unnecessary? i might wrong, given there's little information go on, but... from here : first f77 compilers appended _ names of functions in abi. behavior unlike c, takes function name , uses name in abi. some f77 compilers behaved differently, instead upper-casing entire subroutine name, foo() became foo() when seen c. unix fortran compilers mimicked c behavior , copy-pasta'd name foo() foo() in abi too. if @ blas bindings c reference implementation here , though, you'll see they're handling trailing underscores when dealing f77. i'd wager underscores far more common feature of f77 abi in past not having them. later on, fortran

python - Extracting unrecognized information from many CSV files -

i new programming , have many csv files need processed. each csv file has 8 line header. after header, there rows of names , data. second column has bunch of names products concerned right now. each product has set of names recognized our computers. example shoe recognized as: shoe, sneaker, heel, loafer, etc. on time, other names have sneaked csv files computers cannot recognize. want these names csv files , populate text file can go through, sort, , add computers. there information @ bottom of csvs separated information empty line. i know should use glob module numpy , or pandas don't know how incorporate need sort of working program. here initial attempt @ code. import csv import glob import os import numpy np stringio import stringio fns = glob.glob('*.csv') fn in fns: data = np.genfromtxt(fns, delimiter=',') if 'shoe' or 'heel' or 'loafer' or 'sneaker': elif 'shirt' or 'tee' or 'tank&#

routing - How to get external IP without relying on third party servers? -

is there way can retrieve external ip address without making connection outside network? maybe asking router somehow? does os know ip have if behind router? all methods on stackoverflow recommend kind of third party provider, want application independent of other servers. edit: best solution ive found yet this: http://code.google.com/p/csharp-upnp-portmapper/ which rely on upnp. if router have webinterface, can fetch status page in webinterface of router, , parse ip-adress out of html. php exemple telenor 4g router <?php $url = "http://192.168.0.1/platform.cgi?page=home.htm"; $page = file_get_contents($url); preg_match("/ip address: [^0-9]+(?<ip>[0-9]+(\.[0-9]+){3})</", $page, $matches); $ip = $matches['ip']; echo $ip ?> as routers require username , passwords, proberly want use curl post thouse , fetch page after logged in.

mac OSX Lion Homebrew install curl (77) -

curl: (77) error setting certificate verify locations: cafile: /usr/share/ssl/certs/ca-bubdle.crt capath: none when tried download homebrew, got error. have looked @ posts similar errors this, none of fixes them solved issue , have not seen else issue on mac osx lion. please me? unfortunately curl-ca-bundle not exist anymore in homebrew. i followed suggest @ https://gist.github.com/1stvamp/2158128 does: mkdir /tmp/curl-ca-bundle cd /tmp/curl-ca-bundle wget http://curl.haxx.se/download/curl-7.22.0.tar.bz2 tar xzf curl-7.22.0.tar.bz2 cd curl-7.22.0/lib/ check if directory /usr/share/curl exists. if so, make backup of existing ca-bundle.crt file sudo mv /usr/share/curl/ca-bundle.crt /usr/share/curl/ca-bundle.crt.original if not, create via: mkdir /usr/share/curl . after, move ca-bundle.crt file directory: sudo mv ca-bundle.crt /usr/share/curl/ca-bundle.crt

javascript - Google Search Bar on website -

Image
i have search bar on website allows user type search , go google search engine. it works fine. my question how can make have google auto recommendations come up. example, if types "bas..." regular search in google.com... basketball come along other reccommendations. how can add little search bar on site? http://jsfiddle.net/eergp/ <form method="get" action="https://www.google.com/search"> google "provides" auto-complete jsonp api: $.ajax({ url: "http://suggestqueries.google.com/complete/search", datatype: "jsonp", data: { client: "chrome", q: "query" } }).done(function(data){ console.log(data); }); data auto complete data. http://jsfiddle.net/derekl/mwvjx/ a complete working demo: http://jsfiddle.net/derekl/8ftcg/ seems can use mini calculator. :) this api returns info further text. contains type of every item, title (if l

java - JavaFX components inside HTML? -

is possible put javafx components inside html ? for example, have file .html, , div put javafx button , know it's not logical possible know. yes possible. take @ "deployment in browser": http://docs.oracle.com/javafx/2/deployment/deployment_toolkit.htm

ruby on rails 3 - Getting uninitialized constant (NameError) inside decorators when running rspec tests via rake -

in app use engine (blogit) want add changes / behaviours. i followed guides on how override engine controllers/models , added following: the code in config/initializer/blogit.rb # requires extension ruby files in lib/blogit. dir[rails.root.join("lib/blogit/*.rb")].each {|f| require f} in lib/blogit/engine.rb module blogit class engine < ::rails::engine isolate_namespace blogit config.to_prepare dir.glob(rails.root + "app/decorators/**/blogit/*_decorator*.rb").each |c| require_dependency(c) end end end end in app/decorators/controllers/blogit/comments_controller_decorator.rb blogit::commentscontroller.class_eval def create rails.logger.info "decorated controller action" # ... overridden stripped ... end end in app/decorators/models/blogit/comment_decorator.rb blogit::comment.class_eval belongs_to :user end to mentioned: i have created migration add user reference comments mod

php - Doctrine with association and inheritance -

i have problem doctrine, inheritance, , mapping. it's web game, based on city management. won't copy code not because it's secret, because have fit in here. the general design goes follow : each town have multiple structure relatively similar, decided mappedsuperclass go follow /** * @orm\mappedsuperclass */ class structuressuperclass{ /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue */ private $id; /** * @orm\manytoone(targetentity="buildingtype") * @orm\joincolumn(ondelete="cascade") */ private $type; /** * @orm\manytoone(targetentity="town", cascade={"persist"}) * @orm\joincolumn(ondelete="cascade") */ private $town; in structures there routes, buildings , in buildings there special on towncenter have it's own entity go follow : routes: use spagi\gamebundle\entity\structuressuperclass ssc; /** * @orm\entity * @orm\table(name="route") */ class route extends s

VBA not setting cell text in excel spreadsheet -

i have following line of code in vba code use automatically set text of cell in excel worksheet. sheets(checkout_sheet_name).cells(row_index, checkout_tool_observation_column).value = status this same logic used execute in old spreadsheet fine, i've transferred module on new spreadsheet , no longer works. line executes proper values variables. have idea why line of code execute without setting value of cell text see displayed in debugger? thx. since not know comes before line of code, may want debug.print address of cell , status support did execute no values set. debug.print now() & vbtab & sheets(checkout_sheet_name).cells(row_index, checkout_tool_observation_column).address & " -> " & status

java - how to display contacts in a listview in Android for Android api 11+ -

i'm sorry if looks same question million times...but google search provides no results, bunch of outdated tutorials using managedquery , other deprecated solutions... i went through android developer training retrieving contact list , tutorial incomplete , downloading sample code doesn't because sample code more advanced contact list manipulation (search, etc.) in case, there no reason why there should not simple solution i'm hoping can answer here because i'm sure has been done million times , i'm sure dozens of other beginning android developers appreciate this. i have followed tutorial best of knowledge no contacts show up. think biggest thing to_ids integer array points android.r.id.text1 . i'm confused how supposed somehow pull array of contact names. also, i'm confused why textview needed when end goal display listview...in tutorial, have mcontactslist list view...but populate list view adapter pointing r.layout.contact_list_item textvie

javascript - Three js, get the vector3 that pointerlockcontrolsi s facing -

wondering if it's possible way yaw object in pointer lock controls facing , use direction raycaster. i've been toying around code, trying add basic shooter stuff it. i've been trying few things i've found on stack overflow x & y values yaw object pointer controls provides, no luck. here's have far: setuptarget: function() { //var vector = new three.vector3(game.mouse.x, game.mouse.y, 0); var yaw = game.controls.getobject(); var pitch = game.controls.pitchobject; var vector = new three.vector3( yaw.position.x * math.cos(pitch.rotation.x), yaw.position.y * math.sin(yaw.rotation.y), 0 ); var dir = vector.sub(yaw.position).normalize(); this.ray = new three.raycaster(yaw.position.clone(), dir); } i know that's wrong aside it's not working. confusing math calculating x & y translation based on rotation, doesnt work target obviously. add following copy of pointerlockcontrols ( or wait few days next release): thi

Django "with" template tag renders empty for ForeignKey relationship -

i using count method on queryset context variable more once in template, decided store in reusable variable: {% album.photograph_set.count numphotos %} <title>my title {{ numphotos }} in it</title> <span>i use {{ numphotos }} here, too</span> {% endwith %} the numphotos variable seems blank, though replacing album.photograph_set.count inline still returns appropriate value. tried using {% numphotos=album.photograph_set.count %} syntax exhibits same behavior. use {% ... ... %} syntax elsewhere in code , works expected. any appreciated. if photograph_set reverse relationship of foreignkeyfield or if it's manytomanyfield, you'll need {% album.photograph_set.all.count numphotos %}

asp.net - No messages from my code is getting displayed. Am I doing this incorrectly? -

i have markup on formview control. formview has control id of scoregrid: <asp:label id="percentlabel" runat="server" text='<%# eval("percentcorrect","{0:0.00}%" ) %>' all values calculations stored in percentlabel control percentages 83.33% example. then on codebhind, on pageload() event, have this: dim myrow formviewrow = scoregrid.row dim lbscore label = directcast(myrow.findcontrol("percentlabel"), label) if lbscore.text < "75" message.text = "your score not meet minimum requirement" elseif lbscore.text > "75" message.text = "congratulations; have passed test" end if based on user's scores, show user either passed test or not. i not getting errors. however, no message getting displayed. what doing wrong? thank you you comparing strings greater , less logic when need use numeric types comparison, this: dim number single if singl

python - Function variables: Whats the range of scope of a function -

recently have been working on word game in python, nonetheless having problems little detail.the idea of game create words letters in hand given randomly. function coordinates game asks user input letter , according it, lets him/her play new hand, play same hand again or exit game. problem cannot make game return previous hand , let user play again. instead code returns modified version of previous hand, if inputted word correctly letters in word won't in it. thought not possible since function "updates hand" lies on different scope. working in python 3.2.1 i posted entire code test , see does. problem, however, lies in functions: play_game, play_hand , update_hand. import random import string vowels = 'aeiou' consonants = 'bcdfghjklmnpqrstvwxyz' hand_size = 7 scrabble_letter_values = { 'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j'

MVVMCross Code Snippets for Visual Studio? -

where can download snippets visual studio, likes pf pmvx, cmvx , others? though available on github projects, can't find them... i've created own. please remember these resharper's template. mvxcom -> command #region $region$ command private mvxcommand _$name$command; public icommand $pname$command { { _$name$command = _$name$command ?? new mvxcommand(do$pname$command); return _$name$command; } } private void do$pname$command() { $end$ } #endregion mvxprop -> properties #region $region$ private $type$ _$name$; public $type$ $pname$ { { return _$name$; } set { _$name$ = value; raisepropertychanged(() => $pname$); } } #endregion $end$ mvxset -> binding set var set = this.createbindingset<$view$, $view$model>(); set.bind($element$).to(vm => vm$end$); set.apply(); you can add them resharper using resharper>template explorer>live templates>new template. please feel free change the

c# - How do I get the assigned fixed length of the field from FileHelpers library? -

i using filehelpers library write output files. here sample code snippet: public class myfilelayout { [fieldfixedlength(2)] private string prefix; [fieldfixedlength(12)] private string customername; } in code flow, know each of fields assigned length @ run time, eg: 12 customername. is there way values above filehelpers library? i don't think need library te read fieldattribute properties. public class myfilelayout { [fieldfixedlength(2)] public string prefix; [fieldfixedlength(12)] public string customername; } type type = typeof(myfilelayout); fieldinfo fieldinfo = type.getfield("prefix"); object[] attributes = fieldinfo.getcustomattributes(false); fieldfixedlengthattribute attribute = (fieldfixedlengthattribute)attributes.firstordefault(item => item fieldfixedlengthattribute); if (attribute != null) {

Error when reading in a .txt file and splitting it into columns in R -

Image
i read in .txt file r, , have done numerous times. @ moment however, not getting desired output. i have .txt file contains data x want, , other data not, in front , after data x. here printscreen of .txt file i able read in txt file followed: read.delim("c:/users/toxicologie/cobalt/wb1", header=true,skip=88, nrows=266) this gives me dataframe 266 obs of 1 variable. but want these 266 observations in 4 columns (id, species, endpoint, blm noec). so tried following script: read.delim("c:/users/toxicologie/cobalt/wb1", header=true,skip=88, nrows=266, sep = " ") but error error in read.table(file = file, header = header, sep = sep, quote = quote, : more columns column names using sep = "\t" gives same error. and not sure how can fix this. any appreciated! try read.fwf , specify widths of each column. start reading @ aelososoma sp. row , add column names afterwards something like: df <- read.fwf("

to read file and compare column in python -

for example: consider contents of file1.txt: 1 0 9227 1152 34 2 2 111 7622 1120 34 2 3 68486 710 1024 14 2 6 265065 3389 800 22 2 7 393152 48438 64 132 3 8 412251 46744 64 132 3 9 430593 50866 256 95 4 10 430730 10770 256 95 4 11 433750 12701 256 14 3 12 437926 2794 64 34 2 13 440070 43 32 96 3 14 440102 44 32 96 3 15 440357 43 32 96 3 16 440545 43 32 96 3 17 440599 43 32 96 3 18 440625 43 32 96 3 19 440999 84 32 96 0 20 441574 44 32 96 3 ````````````````````````````````````````` ````````````````````````````````````````` ````````````````````````````````````````` ````````````````````````````````````````` ````````````````````````````````````````` ````````````````````````````````````````` which contains n jobs 6 fields(i,e column(0-5)) now, example, take first 19 jobs history. need start reading 20th , on comparing columns 3,4,5 matches above jobs in history. if in ex

android - Titanium studio cannot run "titanium" command in terminal -

i tried run "titanium" command in terminal of titanium studio gives following error $ titanium titanium command-line interface, cli version 3.1.1, titanium sdk version 3.1.1.ga copyright (c) 2012-2013, appcelerator, inc. rights reserved. please report bugs http://jira.appcelerator.org/ [error] "c:\users\grant\appdata\roaming\npm\node_modules\titanium\bin\titanium" unrecognized command. run node.exe available commands. i'm running titanium studio on windows 7. can run "titanium" command on windows cmd , gives expected output. i'm new titanium studio , according knowledge paths configured correctly. can create , run titanium projects on android emulator. can caused error please me. thank in advance! i ran same situation here today. after google search, found out it's bug in titanium studio. see this ticket . in comments, can find a fix in github pull . can apply fix manually , should work(worked me on windows7). btw, file

JSF and HTML input fields -

i have situation haven't found questions on yet. basically, had use twitter-bootstrap typeahead on input field. however, input field jsf inputtext field this: <h:inputtext id="arrivalairport" value="#{searchflightsbean.arrivalairport}" styleclass="input-block-level blue-highlight" placeholder="enter arrival city"> </h:inputtext> unfortunately, twitter-bootstrap typeahead doesn't work jsf inputtext fields - @ least, wasn't able working(if there is way that, please let me know in comment!). i had use normal input field inside jsf form, this: <input data-provide="typeahead" value="#{searchflightsbean.departureairport}" class="input-override input-block-level blue-highlight airportsearch" placeholder="enter departure city"> </input> i got working typeahead code. one problem: bean doesn't normal input field's value - that's reason using jsf in

linux - Connect to a VPN Connection in Ubunut in bash -

how can connect vpn connection when can use bash (terminal)? i create connection want connect or disconnect using remote ssh connection you can use nmcli that. program use network management. nmcli con id <name_of_connection> you need save password of connection before use command. more information, try man nmcli any on how create vpn_connection in bash , how manage them appreciate

iphone - Set maximum value of NSInteger -

* sorry if has been posted before have been looking 30 mins , cant find anything * hi, have nsinteger called currentcoins , want coins maximum value 999. have tried including #undef nsintegermax #define nsintegermax 999 but nsinteger isn't taking notice of this. has got solutions? (i'm doing ios) thanks in advance. you should never ever redefine system define nsintegermax . set type of system building app (32 or 64 bit). just define own max like: #define kmaxcoins 999

android - Get text of TextView from a row of ListView -

i have layout row of listview items this: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_gravity="right" android:descendantfocusability="afterdescendants" android:gravity="right" android:orientation="vertical" > <textview android:id="@+id/label" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="right" android:gravity="right" android:textsize="40sp" android:focusableintouchmode="false" android:clickable="false" android:focusable="false" /> <relativelayout android:layout_width="match_parent" android:layout_height="wra

javascript - How to increase the height of iframe of container page from the page shown inside it -

i have application shown inside iframe. <iframe src="http://localhost/xxxxx.aspx"></iframe> the height , width of container 900px , 600px . want app in full screen, possible change height , width of container iframe?? p.s iframe not in same project, so $("iframe").css("height","1000px") won't work different file. specify context in selector should applied: $("iframe", window.parent.document).css("height","1000px"); here example different files: http://www.css-arts.com/iframe_test/iframe_test.html browsers blocks access iframes parent when iframe content page domain parent page. if case have no chance.

How to get a handle to an overriden built-in function? -

this question has answer here: how unhide overriden function? 1 answer on matlab path there's custom zeros function. want store handle built-in zeros in variable. how can that? thought @(varargin)builtin('zeros',varargin{:}) , slow down operation due string comparison. also, i've noticed it's possible refer diag @numel\diag , doesn't seem work other built-in functions ( zeros in particular). well, doesn't give exact answer question, solve problem: i think seems solution: matlabcentral: how call shadowed function withn last post: just stumbled upon problem , found following solution: example, have matlab svmtrain shadowed libsvm toolbox: which svmtrain -all c:\projects\ichilov\misc\mvpa\libsvm-mat-3.0-1\svmtrain.mexw64 c:\program files\matlab\r2009b\toolbox\bioinfo\

ios - implement own smileys icons for sending and receiving (i have my own designed images ) for iPhone chat application -

how implement own smileys icons sending , receiving (i have own designed images ) in iphone chat application ,i need process follow that? step step implementation of smileys icons sending in app. put smileys icons in project resources specific unique name. now pen & paper decide unique code every smileys icon. careful code should such not used in chatting generally. when user select icon in chat before sending message side scan & replace via code(via identifing it's unique name ). and @ receiver side before showing message user repalce code image. so there no need send images on communication , increase load on message size. from user prespective , user feel icons sends on communication local resoures. hope helps you. thing want ask, free ask in comments.

php - Routing with codeigniter - ID not passed -

i've picked codeigniter fun little side project, i'm trying make routes follows; http://localhost/c/show/id should translate into http://localhost/c/id i in routes in config so; $route['c/:any'] = "c/show/$1"; however, id passed plaintext, means id passed show() function $1, , not whatever id set to. am going wrong? i've looked around in documentation , tried copy&replace make sure it's not typed wrong. now fear might have missunderstood cannot phatom be. really grateful , help! ":any" should in brackets, this: $route['c/(:any)'] = "c/show/$1"; btw if id numeric, it's better use: $route['c/(:num)'] = "c/show/$1";

i18next and JQuery doesn't work in form's drop down list -

Image
i using jquery mobile mobile website, , localization using i18next. have issue in form, here : <form id="form" method="post" action="webservices/action.php"> <select id="subject"> <option value='0' data-i18n="contact.email" selected></option> <option value='1' data-i18n="contact.name"></option> <option value='2' data-i18n="contact.object"></option> </select> </form> the localization works fine, have desired text displayed. however, first option not displayed , not possible select (it possible select other options). when looking @ select object in javascript, seems correct index selected., therfore ui problem. i don't have problem when not using i18next. anyone have idea how fix issue ? i found workaround. noticed when sent form , reset it, dropdown list correclty displayed. a

javascript - XMLHttpRequest is not working in QML Blackberry 10 -

in given code have used 1 label , 1 button . want when click on button request must sent json given link , print on label . code printing "ok" inside label upon success the issue facing not getting if statement. on button clicked nothing happens. know there network manager in qt can use in situation want parse inside qml // default empty project template import bb.cascades 1.0 // creates 1 page label page { container { layout: stacklayout {} label { id: msglabel text: qstr("hello world") textstyle.base: systemdefaults.textstyles.bigtext verticalalignment: verticalalignment.center horizontalalignment: horizontalalignment.center } button { id: requestxml objectname: "requestxml" onclicked: { var doc = new xmlhttprequest(); doc.onreadystatechange = function() { if (doc

wpf - In ListBox cannot add Items after ItemSource is set to null -

i have assigned itemssource property of first listbox 'listbox1' itemssource of listbox namely 'listbox2' . if set listbox2's itemssource null, unable add items further listbox1's itemssource. below xaml snippet, <listbox verticalalignment="top" horizontalalignment="center" width="150" margin="0 25 0 0" x:name="listbox1" itemssource="{binding coll,mode=twoway}"> <listbox.itemtemplate> <datatemplate> <textblock text="{binding _name}"/> </datatemplate> </listbox.itemtemplate> </listbox> <listbox verticalalignment="top" horizontalalignment="center" width="150" margin="0 25 0 0" x:name="listbox2" itemssource="{binding path=itemssource,elementname=listbox1,mo