Posts

Showing posts from January, 2010

javascript - Backbone: Best way to handle variable common to all models -

i'm developing first backbone single page app project , i'm facing issue. basically have menu (html select input element) implemented view. value used control pretty every other data requests since specifies kind of data show in other views. right handle dom event , trigger global event every model can catch , keep track internally of new value. that's because value needed when requesting new data. doesn't solution because a) end writing same function (event handler) in every model , b) several models same variable. var metrics = backbone.collection.extend({ url: "dummy-metrics.json", model: metricsitem, initialize: function () { this.metric = undefined; }, setmetric: function (metric) { this.metric = metric; globalevents.trigger("metric:change", this.get(metric)); } }); var globalcomplexity = backbone.collection.extend({ url: function () { var url = "http://asd/global.jso

xml - XSLT - check attribute is exist or not -

i'm new xslt. may simple question, example : xml <doc> <sec id="sec_2" sec-type="norm-refs"> </doc> i need know there <sec> node containing attribute sec-type='node-refs' , exist or not in original xml document. this simple xpath: //sec[@type="norm-refs"] the @ symbol indicates want attribute matches, not element. square brackets indicate want matches selector returns comes before square brackets.

c++ - Use Octave in msvc 2010 -

i using octave within msvc 2010. first downloaded octave latest version @ link . after installing, tried run simple code: #include <iostream> #include<octave-3.6.4\octave\oct.h> #include<octave-3.6.4\octave\config.h> #include<octave-3.6.4\octave\octave.h> using namespace std; int main (void) { std::cout << "hello octave world!\n"; system("pause"); return 0; } note added these links project well: c:\software\octave-3.6.4\include\octave-3.6.4\octave--->includ. dir., c:\software\octave-3.6.4\include--->includ. dir. c:\software\octave-3.6.4\lib--->lib. dir. c:\software\octave-3.6.4\lib\octave\3.6.4--->lib dir. i added 1 , 2 additional inc dir!! c:\software\octave-3.6.4\lib\octave\3.6.4--->additional lib. dir in linker. first, got error cannot find math.h in program files while file in program files (x86). so, changed to: c:\program files (x86)\microsoft visual studio 10.0\vc\include\math.h ,

asp.net mvc - Can an Html.Actionlink pass the selected value of a dropdownlist? -

i have mvc razor page have 2 html action links work fine separately, not together. before looking jquery option, wanted make sure wasn't missing obvious. hoping keep things simple adding second parameter relevant html.actionlink. i making transition web pages mvc, gathered have far looking @ examples on microsoft asp.net learning resources , other posts. these current (relevant) sections of cshtml page. first action (filter dropdown): @ top of page have dropdown can filter form 1 column value. itself, works great. @using (html.beginform()) { <p> filter campus: @html.dropdownlist("searchbyfilter", new selectlist(viewbag.names)) <input type="submit" value="filter" /> </p> } second action (sort column): in header row of table, have action link, when user clicks column header, controller serves table sorted appropriately. i'm showing single column out of table show how works. <th>

javascript - Joomla - how to Unset JS file from head using info given by user in template parameters -

i've unset both js , css files manually joomla template html head using usual method below. unset($this->_scripts['/media/jui/js/bootstrap.min.js']); unset($this->_stylesheets['/media/jui/js/bootstrap.min.css']); my question this. possible store file , path info variable , use variable in place of path/file in above examples? , if so, might way this? the reason? want give users of template ability enter multiple files/paths separated comma template parameters, store these various files/paths array, loop through array (unsetting/removing each 1 html head of template). the purpose? 1 needs remove js html head , bottom of page reduce page load times, page transition flickers/white blinking, etc. in case don't want use plugin. i'd rather give users fine grained control if possible built template. of course, i'll have place in template parameters user add whatever js remove header bottom. the code i'm using? // grab js file paths use

How to control master volume with c# wpf applications? -

i trying control master volume wpf applications, did research on this, , of solutions window form applications, can't apply on wpf. they're both c#, wpf don't have handle, made solution unusable. here see here know how control master volume in wpf application? -- have plan b this, if there not convenience way this. maybe achieve coding virtual key press? pressing mute key on keyboard programmatically? thank you!

java - JPA AccessType.Property failing to retrieve value from nested classes -

i'm attempting parse json @entity in order persist data in table. confirmed parsing works have run issue when attempting persist data. in order retrieve needed value in nested classes (two deep) using @access(accesstype.property) annotation on "helper" method. my best guess entity object being created prior retrieving value nested classes , when attempts retrieve "nested" value class instances null. result unable map value persistence field. below ascertain important part of exception: exception description: method [getnestedhref] on object [com.something.dotcom.bleep.parsers.hierarchyv2] triggered exception. internal exception: java.lang.reflect.invocationtargetexception target invocation exception: java.lang.nullpointerexception mapping: org.eclipse.persistence.mappings.directtofieldmapping[nestedhref-->schema.tbl_hierarchy.href] descriptor: relationaldescriptor(com.something.dotcom.bleep.parsers.hierarchyv2 --> [databasetable(schema.tbl_hiera

delphi - DWScript set TFormStyle property on external TForm instance -

i try set properties on tform instance "injected" script using tdwsrtticonnector , funcion: procedure tform1.onfunctioneval_connectform(info: tprograminfo); var c:tcomponent; begin c := application.findcomponent(info.paramasstring[0]); if not (c tform) info.resultasvariant := null else info.resultasvariant := tdwsrttivariant.fromobject(c); end; the next script works fine except line f.formstyle := 2; , error "invalid class typecast" showmessage('step1'); var f:rttivariant<vcl.forms.tform> := connectform('form1'); f.alphablendvalue := 0; f.alphablend := true; f.hide; f.color := $00ffff; showmessage('step2'); f.formstyle := 2; //f.formstyle := tformstyle(2); f.show; f.alphablend := false; showmessage('step3'); how can set enumerated properties formstyle or borderstyle thanks

java - OOP - Are constructors required? -

so watching youtube video , youtuber said: "when creating 'this' object, going need set new ' type ' of object"... the class called objectintro , constructor was: public objectintro(){ //object constructor (method) } so here's question... i tried create object tells me level of petrol in car... public class car { double petrollevel; double tanksize; public void refillpetrol(double i){ if(i>tanksize){ = tanksize; petrollevel = petrollevel + i; } else{ petrollevel = petrollevel + i; } } public void fuelconsumption(double o){ if(o>tanksize){ o=tanksize; petrollevel = petrollevel - o; } else{ petrollevel = petrollevel - o; } } public string returnpetrollevel(){ return string.format("%sl", petrollevel); } } then class in object created is... public class carobject { public static void main(string[] args){ car object1 = ne

Why doesn't "Set-Item" work on Windows 7 PowerShell? -

i trying install windows 10 iot on raspberry pi 2. powershell documentation tells me put in this: set-item wsman:\localhost\client\trustedhosts -value <minwinpc> however, when put windows 7 powershell, this comes out: at line:1 char:54 + set-item wsman:\localhost\client\trustedhosts -value <minwinpc> + ~ '<' operator reserved future use. + categoryinfo : parsererror: (:) [], parentcontainserrorrecordexception + fullyqualifiederrorid : redirectionnotsupported how fix this? you need use quotes rather < > around name of device (minwinpc) set-item wsman:\localhost\client\trustedhosts -value 'minwinpc'

python - "soup.prettify()" gives just URL -

i'm using python3, beautifulsoup4 when run code below, gives url "www.google.com" not xml. couldn't find wrong. from bs4 import beautifulsoup import urllib html = "www.google.com" soup = beautifulsoup(html) print (soup.prettify()) you need use urllib2 or similar library fetch html import urllib2 html = urllib2.urlopen("www.google.com") soup = beautifulsoup(html) print (soup.prettify()) edit: side note clarify why suggested urllib2. if read urllib documentation, you'll find "the urlopen() function has been removed in python 3 in favor of urllib2.urlopen()." given have tagged python3, urllib2 best option.

authentication - Ember simple-auth mixins deprected -

i experienced (55+ years) programmer total noob in ember , js. i'm trying simple authentication page working using ember-cli addons ember-cli-simple-auth, ember-cli-simple-auth-oauth2 , cut-and-paste simplelabs tutorial. i following in console: deprecation: logincontrollermixin deprecated. use session's authenticate method directly instead. and: deprecation: authenticationcontrollermixin deprecated. use session's authenticate method directly instead. the solution may trivial, have been chasing hours , deep javascript before reaching dead-end. code causing these errors is: import logincontrollermixin 'simple-auth/mixins/login-controller-mixin'; export default ember.controller.extend(logincontrollermixin, { authenticator: 'simple-auth-authenticator:oauth2-password-grant' }); which invokes applicationcontrollermixin somewhere in bower code. before "re-invent wheel" translating old html/ruby/pascal code js, can me "use

Adding Hyperlink with Excel VBA -

i trying add hyperlink excel cell getting error: rng.formula = "=hyperlink(cell.offset(0, 3).value,"">"")" basically hyperlink located within cell , want have text ">" appear in new hyperlink cell. try using hyperlinks collection: sheet1.hyperlinks.add sheet1.range("a1"), "http://longlinkaddresshere", , , ">"

ios - How can I capture a table row press action in Swift WatchKit? -

i have table dynamic rows. when run probject rows display on screen , have press animation xcode won't let me wire table row ibaction controller. can't use segue in instance, needs button press preferably on whole table rown i'd rather not insert button it. appreciated, thanks! you want override table:didselectrowatindex function. method on wkinterfacecontroller . override func table(table: wkinterfacetable, didselectrowatindex rowindex: int) { //handle row selection }

dimple.js - Is it possible to create series of stacked bar charts using dimplejs? -

Image
is possible create chart 2 stacked chart series side side using dimple? yeah it's here in examples: http://dimplejs.org/examples_viewer.html?id=bars_vertical_grouped_stacked

reporting services - Interactive sort on a text field having decimal numbers -

i have following text field in ssrs report: version 2.0.0.0 1.0.0.0 1.2.0.0 2.1.8.8 2.2.32.7 1.4.11.0 i want sort field interactively. how do that? once sorted ascending, report should show version 1.0.0.0 1.2.0.0 1.4.11.0 2.0.0.0 2.1.8.8 2.2.32.7 thank in advance to use interactive sorting , right-click on column header , view text box properties . click on interactive sorting tab , check enable interactive sorting box. normally use detail row can specify use group instead. put field or expression want sort in sort expression. you need same additional columns wish sort. as data, field have sorted text , not number. works data have listed may cause issues when have versions in double digits. sorted list order list like: 1.15 10.5 2.33 3.2 9.1 if potential issue, need figure out way deal it. use expression adds zeroes first number deal this: =right("000" & left(fields!version.value, instr(fields!version.value) - 1) & mid(fi

node.js - Fast folder hashing in Windows Node -

i'm building nodewebkit app keeps local directory in sync remote ftp. build initial index when app run first time download index file remote server containing hash files , folders. run through list , find matches in user's local folder. the total size of remote/local folder can on 10gb. can imagine, scanning 10gb worth of individual files can pretty slow, on normal hdd (not ssd). is there way in node efficiently hash of folder without looping through , hashing every individual file inside? way if folder hash differs can choose expensive individual file checking or not (which how once have local index compare against remote one). you iteratively walk directories, stat directory , each file contains, not following links , produce hash. here's example: 'use strict'; // npm install siphash var siphash = require('siphash'); // npm install walk var walk = require('walk'); var key = siphash.string16_to_key('0123456789abcdef');

validation - Primefaces 2 <h:form> and 2<p:message> confusion -

my login page has 2 forms, 1 login itself, , 1 create new users , in tab view(p:tabview), users never see both on page, be, 1 or another. problem everytime valitation fails on login tab, failure shown in new user tab, , vice-versa. how handle this? tried set update property in buttoncommand, did not work see code below: <p:tabview id="logintabview" orientation="right" style="margin-bottom:20px" styleclass="login_fields_panel"> <p:tab title="acesso" id="acessotab" > <h:form> <h3><h:outputtext value="#{bundle.loginhello}" escape="false"/></h3> <p:messages id="messages_login" showdetail="false" autoupdate="true" closable="true" showicon="true"/> <p:outputlabel for="email" value="#{bundle.label_email}"/>

c++ - Difference in loading times with and without namespace -

i'm new c++ hope question isn't dumb, plus i've searched around , couldn't find answer. so brings my question, there difference in loading times between calling std::cout , calling cout when using namespace std added code? imagine if there difference should unnoticeable, i'd sure before turning in project. by way, in university told using namespace std okay (i've read @ lengths on , whether practice or not not in question right now). there no difference. , performance should last of concerns when making these kinds of "micro" code decisions.

javascript - retrieve value from a slick grid table -

this how slick grid table looks like. , rows added on function. how can write function in js slick-cell l0 r0 value each class. want temp,temp2, sss , test33 values i new slick grid thing appreciated. <div class="grid-canvas" style="height: 206px; width: 390px;"> <div class="ui-widget-content slick-row even" style="top:0px"> <div class="slick-cell l0 r0">temp</div> <div class="slick-cell l1 r1">test group</div> <div class="slick-cell l2 r2 edit-column"></div> <div class="slick-cell l3 r3 delete-column"></div> </div> <div class="ui-widget-content slick-row odd" style="top:25px"> <div class="slick-cell l0 r0">temp2</div> <div class="slick-cell l1 r1">test g 2 </div> <div class="slick-cell

r - ANOVA with repeated measures factors: Error using model.table -

i following example in webpage single factor designs repeated measures . end wish compute grand mean using model.tables . everytime error message: model.tables(aov.out,"means") error in fun(x[[1l]], ...) : eff.aovlist: non-orthogonal contrasts give incorrect answer these data: subject<- c(1,2,3,4,5,6,7,8,9,10) time1 <- c(5040,3637,6384,5309,5420,3549,2385,5140,3890,3910) time2 <- c(5067, 3668, 6689, 6489, 5246, 3922, 3408, 6613, 4063, 3937) time3 <- c( 3278, 3814, 8745, 4760, 4911, 5716, 5547, 5844, 4914, 4390) time4 <- c( 0, 2971, 0, 2776, 2128, 1208, 2935, 2739, 3054, 3363) time5 <- c(4161, 3483, 6728, 5008, 5562, 4380, 4006, 7536, 3805, 3923) time6 <- c( 3604, 3411, 2523, 3264, 3578, 2941, 2939, 47, 3612, 3604) mydata <- data.frame(time1, time2, time3, time4, time5, time6) mydata2 = stack(mydata) subject = rep(subject,6) mydata2[3] = subject colnames(mydata2) = c("values"

c++ - How to parameterize the number of parameters of a constructor? -

i want accept number of parameters (this number being defined in template parameter) in template class constructor. can't use initializer_list , since can't assert size @ compile time, far know. what tried my first attempt using std::array parameter: template<size_t s> class foo { int v[s]; public: foo(std::array<int, s>) {/*...*/} }; however, forces me initialize (even when constructor not explicit ) : foo<4> a{{1,2,3,4}} // 2 brackets. i think there may template magic (variadic templates?), can't figure out proper syntax use in constructor. can't call constructor recursively... can i? i tried looking definition of constructor std::array (since doesn't allow more parameters size of array, want), find has implicit constructors. default constructors? if so, how does std::array<int, 3> = {1,2,3} work? optional bonus: why didn't standard define fixed size alternative std::initializer_list ? std::static_initialize

email - HTML image map incorrectly maps for some users but not others -

okay, have email have created images use maps redirect different links. email works fine email , 1 other's email, person has links bottom image not mapping correctly. <img src="https://example.com/images/nphomebuttons.jpg" usemap= #homebuttons border=0 width=600> <map name=homebuttons> <area shape=rect coords=0,0,120,48 href="http://www.example.com/"> <area shape=rect coords=120,0,240,48 href="http://www.example.com/inventory/new/"> <area shape=rect coords=240,0,360,48 href="http://www.example.com/inventory/used/"> <area shape=rect coords=360,0,480,48 href="http://www.example.com/get-approved/"> <area shape=rect coords=480,0,600,48 href="http://www.example.com/contact-us/"> </map> but on image, other user having issues <img src="https://example.com/images/npadgraphic.jpg" usemap= #adgraphic border=0> <map name="adgraphic" id="adgrap

Unable to parse json data written directly by python json.dump() -

i have following function: def readtable(self,reference_name): p = self.base_path + reference_name + ".txt" if os.path.exists(p): print p else: print "oops" f = open(p, "r") data = json.loads(f.read()) self.main_table = data that tells me file indeed exist, , trying read txt file contains json. the json written following call: def writetable(table,reference_name): open(reference_name + ".txt","w") text_file: json.dump(table, text_file) yet when go readtable following error: traceback (most recent call last): file "c:\program files (x86)\jetbrains\pycharm 4.0.5\helpers\pydev\pydevd_comm.py", line 1069, in doit result = pydevd_vars.evaluateexpression(self.thread_id, self.frame_id, self.expression, self.doexec) file "c:\program files (x86)\jetbrains\pycharm 4.0.5\helpers\pydev\pydevd_vars.py", line 341, in evaluateexpression exec(expr

javascript - How to rotate a chart 90 degrees including the text values? -

Image
i have following progress bar, i'd go vertically instead of horizontally. in other words, i'd flip 90 degrees , have text flipped 90 degrees well see code below, code pen here: http://codepen.io/chriscruz/pen/jpgmzw how rotate chart text value? html <!-- change below data attribute play --> <div class="progress-wrap progress" data-progress-percent="50"> <div class="progress-bar-state progress">50</div> </div> css .progress { width: 100%; height: 50px; } .progress-wrap:before { content: '66'; position: absolute; left: 5px; line-height: 50px; } .progress-wrap:after { content: '$250,000'; right: 5px; position: absolute; line-height: 50px; } .progress-wrap { background: #f80; margin: 20px 0; overflow: hidden; position: relative; } .progress-wrap .progress-bar-state { background: #ddd; left: 0; position: absolute; top: 0; line-height: 50px; } java

xamarin - Using Android Toolbar -

i'm following following tutorial implement toolbar: http://blog.xamarin.com/android-tips-hello-toolbar-goodbye-action-bar/ when write code things cannot resolved. protected override void oncreate (bundle bundle) { base.oncreate (bundle); setcontentview (resource.layout.main); var toolbar = findviewbyid<toolbar> (resource.id.toolbar); //toolbar take on default action bar characteristics setactionbar (toolbar); //you can use , reference actionbar actionbar.title = "hello toolbar"; } unresolved things are: base, setcontentview, findviewbyid, toolbar, resource. cant import them. the first letters of "setcontentview", " findviewbyid" small. findviewbyid() method takes arguments like: findviewbyid(r.id.your_view_name); and not findviewbyid(resource.id.your_view_name); basically, try changing resource.id.your_view "r.id.your_view". also, make first letters of method names small

visual studio 2015 - BrowserSync not refreshing my VS2015 with IIS Express? -

i trying use browsersync vs2015. here's have far: /// <binding beforebuild='scripts, less, css' projectopened='watch' /> "use strict"; var browsersync = require('browser-sync'); var concat = require('gulp-concat'); var del = require('del'); var gulp = require('gulp'); var gzip = require('gulp-gzip'); var less = require('gulp-less'); var minifycss = require('gulp-minify-css'); var reload = browsersync.reload; var uglify = require('gulp-uglify'); var cssconfig = { src: [ 'wwwroot/content/less/normalize.css', 'wwwroot/content/less/alert.css', 'wwwroot/content/less/auth.css', 'wwwroot/content/less/body.css', 'wwwroot/content/less/breadcrumb.css', 'wwwroot/content/less/button-groups.css', 'wwwroot/content/less/button.css', 'wwwroot/content/less/carous

php - Get Facebook Login Token from another App -

is possible facebook access token app not belong me? mean want spoof ios app's fb login. thanks. it possible if can somehow access internal of application, said rooted android or jail broke iphone allow . although doubt if of use access token expire fast.. unless know app secret too. you should register own app on facebook developers, not hard.

How do I open the Android Mail project in Android Studio? -

Image
i have cloned aosp email client , have attempted open in android studio. however, must doing wrong, because cannot build project , shows in project tree following: these packages rely heavily on system packages. hence difficult android studio. if looking open source email client, recommend k9 mail . it's open-source mail client. edit: you try using method variable success rates: aosp root run command in terminal: make idegen && development/tools/idegen/idegen.sh then open android studio > open project > select android.ipr generated. you run many dependency issues though. note: might worth giving eclipse try. read this .

vba - How to compare a list of rows to another list of rows in Excel? -

i trying figure out if there differences between list of data another. in order row of data "match" row, row must have same values in corresponding column. rows not have in particular order. in particular, dealing parts list, there part numbers, descriptions, etc. trying figure out if rows of data different rows of data list. i found compare 2 sheets using arrays , may have answer problem, having trouble figuring out how adapt code due inexperience in visual basic. i able work single column of data, comparing 1 column of data 1 sheet another, cannot compare entire rows of data. here example of want work: sheet 1 sheet 2 column 1 column 2 column 1 column 2 row 1 22a 33 11 11 row 2 22a 33a 22a 33 row 3 55 22b

Trying to run a simple php script on MediaTemple server using a Cron job -

disclaimer: have little experience of this. my script looks this: <?php file_put_contents('test_php.txt', 'hmm'); and command in cron job looks this php php_test.php nothing getting written root directory. i've used cron databases using mysqldump, i'm familiar how set cron job. i'm having trouble running php script way.

How do you append to the middle of an html file using vba? -

i have table in html document, , else after it. writing vba code make userform creates new line of table in html document. have figured out how append end of html file, not @ end of table. have tried few things, can see commented out. html variable refers string want add html document. code below: open "c:\users\tprocon\desktop\notificationtracker\table.html" append access read write #1 'dim filenum integer 'dim dataline string 'while not eof(1) 'line input #1, dataline 'if dataline = "</table>" print #1, html 'end if 'wend close #1

Javascript quiz (allows user multiple attempts) -

i trying create multiple choice quiz. if user selects correct answer shown alert saying "correct" , quiz moves on next question. if user selects incorrect answer shown alert saying "incorrect". want quiz give user 1 last attempt before moving on next question. have tried using variable "tries" keep track of how many times user has attempted question. currently, code proceeds next question if user selects correct answer, if incorrect answer chosen, "incorrect" alert pops , quiz proceeds next question anyway. i have external 2-d array stores questions , respective multiple-choices , solution. renderquestion() takes corresponding choices each question , writes html display question webpage. checkanswer() goes through each choice until finds choice user selected. if it's correct, increments correct counter , if it's incorrect want tell user "incorrect" , quiz give user 1 last attempt on question before proceeding next one.

jQuery event listeners only work in console -

i have strange problem define set of event listeners inside document.ready or window.load , nothing happens when load page , try trigger 1 of them. i first thought might dom issue, if console.log() each element i'm binding listener to, logged successfully, indicating me it's not problem dom. if bind listeners other elements on page, seem work fine. if copy/paste code below console, works fine. i've tried not wrapping them in document.ready or window.load function, makes no difference. i've tried adjusting location of script. i've placed in head, footer, , in separate file loaded through asset pipeline in rails. again, makes no difference. there no other listeners tied these elements anywhere in code. missing here? $(document).ready(function () { // console.log() statement returns correct dom element console.log($('#direct-apply-btn')); // one: console.log($('[data-toggle="popover-filter"]')); var popov