Posts

Showing posts from April, 2014

json - Server polling Angular js and get difference between the response -

i have api getdata method returns json data every minute in angularjs. function($scope, $http,$timeout, confirm) { (function tick() { $http.get('myapi.json').success(function(data) { $scope.operation = data ; $timeout(tick, 60000); }) })(); json data looks this. [{ "requests" :"200"} ....] after every minute "requests" value changes. want find difference between previous request value , current request value. tried $scope.$watch doesn't give object value change. please let me know how solve this?

c++ - When should I use pointer or reference members, and when should I pass nullptr or this as parent pointer in Qt? -

the code i've been writing c++ qt knowing works not understanding why things other "i know should doing this". this startup class initialises classes: namespace gui { startup::startup() : qobject(nullptr), m_setuptab(*new setuptab(nullptr)), m_regtab(*new cbcregisterstab(nullptr)), m_datatab(*new datatesttab(nullptr)), m_mainview(*new mainview(nullptr, m_setuptab, m_regtab, m_datatab)), m_systemcontroller(*new systemcontroller(nullptr, provider::getsettingsassingleton())), m_datatest(*new datatest(nullptr, m_systemcontroller)), m_setuptabvm(new setuptabviewmanager(this, m_setuptab, m_systemcontroller,

Ruby: get sum of nested hash value -

i have hash departments {"mechnical" => {"boys" => "25", "girls"=>"5"}, "civil"=> {"boys"=>"18", "girls"=>"12"}} i want output this, {"mechanical" => "30", "civil => "30"} do below # if in ruby 2.1 or greater your_hash.map { |k,v| [k, v.reduce(0) { |sum, (_, v)| sum + v.to_i }] }.to_h # => {"mechnical"=>30, "civil"=>30} # below ruby 2.1 hash[your_hash.map { |k,v| [k, v.reduce(0) { |sum, (_, v)| sum + v.to_i }] }] # => {"mechnical"=>30, "civil"=>30} # versions your_hash.each_with_object({}) |(k,v), h| h[k] = v.reduce(0) { |sum, (_, v)| sum + v.to_i } end # => {"mechnical"=>30, "civil"=>30}

ios - App quits unexpectedly but run smoothly when connected with xcode -

i facing strange error, app crashes @ once in start after disconnecting xcode when run app xcode connected works fine. device log is incident identifier: 1c4813 crashreporter key: c3535f303c4f4448be66e3cdefaf61a1b63074ca hardware model: ipad2,1 process: depilex [1295] path: /var/mobile/applications/22ca706f-5055-47ae-8f7c-a3a1558af6c1/depilex.app/depilex identifier: com.arr.depilex version: 1.2 (1.2) code type: arm (native) parent process: launchd [1] date/time: 2014-09-19 16:34:54.972 +0500 os version: ios 7.1 (11d167) report version: 104 exception type: 00000020 exception codes: 0x000000008badf00d highlighted thread: 0 application specific information: com.arr.depilex failed launch in time elapsed total cpu time (seconds): 4.100 (user 4.100, system 0.000), 6% cpu elapsed application cpu time (seconds): 1.121, 2% cpu thread 0: 0 libsystem_kernel.dylib 0x3953eaa8 sema

css - 'Max' Responsive Breakpoints in em -

i'm working on responsive site using media queries in em, based around bootstrap 3, using sass. the 'max' breakpoints set on basis of browser baseline of 16px. understand media queries based of browser's base font size independent of base font size set on document. i've found articles explaining this, recommending em 'min' breakpoints can't find mention 'max'. is there best practice setting max breakpoints take account scenario browser's baseline isn't 16px? i'm using following: $screen-xs: 30em !default; $screen-xs-min: $screen-xs !default; $screen-phone: $screen-xs-min !default; $screen-sm: 48em !default; $screen-sm-min: $screen-sm !default; $screen-tablet: $screen-sm-min !default; $screen-md: 62em !default; $screen-md-min: $screen-md !default; $screen-desktop: $screen-md-min !default; $scre

asp.net mvc - a default value for a Dictionary in c# -

this question has answer here: is there idictionary implementation that, on missing key, returns default value instead of throwing? 9 answers dictionary returning default value if key not exist [duplicate] 4 answers i have following pageviewmodel class: public class pageviewmodel : viewmodel<page> { public pageviewmodel () { kywords = new list<keyword>(); answserkeyworddictionary = new dictionary<string, answer>(); } public company company { get; set; } public list<keyword> kywords { get; set; } public dictionary<string, answer> answserkeyworddictionary { get; set; } } in view i'm using property answserkeyworddictionary that: @html.displayaffirmativeanswer(model.answserkeyw

android - Should developer create a different model of Login Request & Response -

i using gson library in demo android project. want know should create different model login request & login response in json . for request created below public class login { private string username; private string password; public string getusername() { return username; } public void setusername(string username) { this.username = username; } public string getpassword() { return password; } public void setpassword(string password) { this.password = password; } } creating json login request. // creating json using gson library login mlogin = new login(); mlogin.setusername(username); mlogin.setpassword(password); gson gson = new gsonbuilder().create(); string loginjson = gson.tojson(mlogin); so here above created model login request & should create new model of login response again in json or not doing following correct approach. gson helps serialize , deserialize json objects/

python - Check what tkinter OptionMenu item was selected -

how check if user has selected "other" hopoptions selection, , enable otherentry if did? , disable again if select 1 of other options. class interface(): def __init__(self, window): frame = frame(window) frame.pack() self.hoplabel = label(frame, text="hop:", anchor=e) self.hoplabel.grid(row=0, column=0, sticky=ew) hops = range(0,6) hops.append("other") self.selectedhop = stringvar(frame) self.selectedhop.set(hops[0]) self.hopoptions = optionmenu(frame, self.selectedhop, *hops) self.hopoptions.grid(row=0, column=2, sticky=ew) self.otherentry = entry(frame, state=disabled) self.otherentry.grid(row=0, column=1, sticky=ew) root = tk() app = interface(root) root.mainloop() bind option menu command , add method class. command run class method value argument anytime option cha

c# - CodedUI tests are not running on test controller / agent -

i have been unable codedui test project run. goal have run on separate machine (virtual machine). i've configured test controller , agent on vm. i've set run interactive process (details below). when run build partially succeeds , following test error reported: error calling initialization method test class xxxx.codedui: microsoft.visualstudio.testtools.uitest.extension.uitestexception: run tests interact desktop, must set test agent run interactive process. more information, see "how to: set test agent run tests interact desktop" ( http://go.microsoft.com/fwlink/?linkid=255012 ) i've performed following steps: i've installed test controller , test agent vm (separate tfs server) my test controller set "register test controller team project collection". i've removed checkbox! caused different error when running build removed checkbox. my test agent set test controller - set interactive process - screen saver disabled

Get TabbedPane tab content background color - Java Swing -

Image
after extensive search, have not been able figure out how color shown in image below pointed red arrow. reason want color value set pane background inside jtabbedpane (blue arrow) same value, there no difference between 2 colors. on windows, color white (red arrow), on mac it's 230, 230, 230 rgb, , on linux depends on gui. so, getting value programatically, wouldn't have set each os. any idea how accomplish this? i've tried searching 230, 230, 230 in uimanager.getdefaults() there isn't such value. thanks in advance consider setting opacity of contained panel false . should let background color of wrapping jtabbedpane reflect through component , achieve desired behaviour. work on platforms , , feels. something like: pane.setopaque(false);

caching - Questions on RStudio and R cache directories on Ubuntu 14.04 Trusty -

i have question regards: rstudio , r cache/working directories . rstudio sets cache directory in ~/.rstudio-desktop . and there r cache directory @ ~/r . what best way set cache directory rstudio to different location , setting environment variables or properties file, or other way? thank you.

pandas - Python: Inserting a Row into a Data Frame -

is there more pythonic way insert row data frame? feel has functionality of pandas can not find it. especially, there way 'reset' indices? thank you. data = {'state': ['ohio', 'ohio', 'ohio', 'nevada', 'nevada'], 'year': [2000, 2001, 2002, 2001, 2002], 'pop': [1.5, 1.7, 3.6, 2.4, 2.9]} frame = pd.dataframe(data) new = pd.dataframe(np.zeros(len(frame.columns)).reshape(1,len(frame.columns)),columns=frame.columns) row = 3 def insert_row(frame,new,row): top = frame[0:row] bottom = frame[row:] return pd.concat((top,new,bottom)) however, running above returns: pop state year 0 1.5 ohio 2000 1 1.7 ohio 2001 2 3.6 ohio 2002 0 0.0 0 0 3 2.4 nevada 2001 4 2.9 nevada 2002 if current function works enough you, suggest adding reset_index returned result. see below: ...: return pd.concat((top,new,bottom)).reset_index(drop=true) in [17]:

loops - JOIN SQL Query for Improved Performance -

i having performance issues , want understand joining of sql queries achieves, have read example , consider myself avid coder 1 baffles me, point did below achieve goal.... you'll see below, first auxkey staux000 webshow = 'y' these results in array implode commas use in next query! - bad know , or it... i want end of with, in end stock table auxkey set 'y' in staux000 make sense? $webshow = "select auxkey staux000 webshow = 'y' "; $wsres = odbc_exec($connectforwebshow, $webshow); while( $wsrow = odbc_fetch_array($wsres) ) { $_session[showontheweb][] = $wsrow[auxkey]; } $showondaweb = $_session[showontheweb]; $imploded_arr = implode("', '000", $showondaweb); $cfwsq = db_connect(); $wstquery = "select name, number stock "; $wstquery .= "where stock.location = 'lane' , upper(stock.name) upper('%') , number in ('000"; $wstquery .= "$imploded_arr"; $wstqu

ios - NSLog not working when "wait for executable to be launched" is set -

i exploring debugging per subject line. noting while works enough, nslog's not outputting, breaks hit. not helping ;) .. don't see obvious options in edit scheme window. this test pushes, firstly manually firing app ensure process works (with waiting app manually start etc).. thanks tips.. if let process start normally, logs hooked asl already. debugger doesn't have way reroute connection after fact. have in device console logs. in xcode 6, select windows->devices, there's little disclosure widget @ bottom of content window reveal device console.

python - Extracting result from integration (quadrature)? -

consider python snippet: >>> v=quad(lambda x:sin(x),0,.456) >>> print "v=",v; 3*v<br> v= (0.10217888319247767, 1.1344134875077312e-15) (0.10217888319247767, 1.1344134875077312e-15, 0.10217888319247767, 1.1344134875077312e-15, 0.10217888319247767, 1.1344134875077312e-15)<br>>>> how v equal 0.10217888319247767, (e.g.) 3*v=.30653664957743301 (i.e., “de-tuple” it)? you can index tuple this: 3*v[0]

javascript - Three.js world coordinates from mouse position with Orthographic camera -

i know question has been asked many times , answered, i'm having no luck of answers i've followed (mainly 1 mouse / canvas x, y three.js world x, y, z ). i've gotten object selection done , working code using follows onmousemove:function(event) { event.preventdefault(); var scope = game.gsthree, $container = $(scope.container.element), width = $container.width(), height = $container.height(), vector, ray, intersects; scope.mouse.x = (event.clientx - scope.container.padding.left) / width * 2 - 1; scope.mouse.y = - (event.clienty / height) * 2 + 1; scope.mouse.z = 0.5; vector = new three.vector3(scope.mouse.x , scope.mouse.y , scope.mouse.z); ray = scope.projector.pickingray(vector.clone() , scope.camera); intersects = ray.intersectobjects(scope.tiles.children); if(intersects.length) { var hovered = in

algorithm - Finding minimal absolute sum of a subarray -

Image
there's array a containing (positive , negative) integers. find (contiguous) subarray elements' absolute sum minimal, e.g.: a = [2, -4, 6, -3, 9] |(−4) + 6 + (−3)| = 1 <- minimal absolute sum i've started implementing brute-force algorithm o(n^2) or o(n^3) , though produced correct results. task specifies: complexity: - expected worst-case time complexity o(n*log(n)) - expected worst-case space complexity o(n) after searching thought maybe kadane's algorithm can modified fit problem failed it. my question - kadane's algorithm right way go? if not, point me in right direction (or name algorithm me here)? don't want ready-made code, need in finding right algorithm. if compute partial sums such as 2, 2 +(-4), 2 + (-4) + 6, 2 + (-4) + 6 + (-3)... then sum of contiguous subarray difference of 2 of partial sums. find contiguous subarray absolute value minimal, suggest sort partial sums , find 2 values closest together, , use positions

geometry - matlab: calculate the degree given two points in an image -

Image
the goal rotate image bounding boxes including hand instances axis aligned. please see following examples. first image original 1 , second image rotated version left hand (it's left in image) axis aligned , third image rotated version right hand axis aligned. now given 4 points indicating hand bounding box, have calculate rotated degree. let me take left hand (it's left in original image) example. assuming 4 points [p1_x, p1_y], [p2_x, p2_y], [p3_x, p3_y], [p4_x, p4_y]. line formed by[p1_x, p1_y] , [p2_x, p2_y] indicates wrist , p1, p2, p3, p4 clockwise. yellow line formed p1_x, p1_y] , [p4_x, p4_y]. my idea calculate degree between yellow line , horizontal axis. left hand, degree -10 , right hand degree -110. my problem how calculate these degrees? use atan2d calculate 4-quadrant inverse arctangent. line segment joining [p1_x, p1_y] , [p4_x, p4_y] , do: atan2d(p4_y-p1_y,p4_x-p1_x)

javascript - keeping checkbox status in rails -

i have check-boxes in rails application code below <%= check_box_tag "audio_ids[]",audio.id ,nil,class: "song"%> <%= check_box_tag "audio_ids[]",audio.id ,nil,class: "song"%> <%= check_box_tag "audio_ids[]",audio.id ,nil,class: "song"%> <button class="btn btn-warning">play all</button> <script> function handlebuttonclick(button){ if ($(button).text().match("check all")){ $(":checkbox").prop("checked", true) } else { $(":checkbox").prop("checked", false) }; updatebuttonstatus(); } function updatebuttonstatus(){ var allchecked = $(":checkbox").length === $(":checkbox:checked").length; $("button").text(allchecked? "uncheck all" : "check all"); } function updatecookie(){ var elementvalues = {}; $(":checkbox").each(function(){ elementvalues[this.id] = this.checked; });

vb.net - Wrongly inserted values to MySQL table -

Image
when executed query: "insert search_option(filename, file_path, keywords)" & _ "values('csharp_tutorial.pdf','d:\pdf_record\csharp_tutorial.pdf','c sharp tutorial')" the value inserted table. when select value table select * search_option s; will give result as filename | file_path | keywords | | csharp_tutorial.pdf | d:pdf_recordcsharp_tutorial.pdf | c sharp tutorial the problem d:\pdf_record\csharp_tutorial.pdf inserted d:pdf_recordcsharp_tutorial.pdf why \ disappears...? please suggest me solutions the problem \ if want insert \ database need add \\ in code same in case of double quotes if want double quotes means need add \" , other examples escape sequence available here hence code be: "insert search_option(filename, file_path, keywords)" & _ "values('csharp_tutorial.pdf&

Checkout bitbucket pull requests locally -

i found gist: https://gist.github.com/kennethreitz/3709868 im using bitbucket , i'm looking similar function. can me? thank you i found this answer , thought possible fetch refs pull request on bitbucket. but it's not. the answer op's question it not possible : there's been open feature request issue it has been unanswered , unattended four 5 years. the workaround? you can pr downloadable .patch file can download , apply new branch create manually. won't able apply updates. i figured way out, i've implemented in git-repo , can use it. i'm doing use api pr's remote , branch, , automatically create new upstream , branch locally. way can updates pr poster. downside clutter of git remotes.

c# - Regex.replace will not replace multiline text rows with beginning chars to html block -

ich have problem regex replacing function in c# explicit in multiline text. in text have different rows special chars (eg: & , &&) in beginning rows have convert in e.g. html. similar markdown conversion... an example text following: this normal demo text. &here other demo text. , 1 more demo text. &&here continue text. bla bla blaaa... the text should after replacing following text beginning , end html tag: this normal demo text. <b>here other demo text.</b> , 1 more demo text. <em>here continue text...</em> bla bla blaaa... for replacing & , && have created following c# code: private string startconvert(str text) { text = regex.replace(text, "^[&]{1}((?![&]).+)$", "<b>$1</b>", regexoptions.multiline); text = regex.replace(text, "^[&]{2}((?![&]).+)$", "<em>$1</em>", regexoptions.multiline); } after running wrong followings: th

qt - Qwt: Axis Border Dist? -

Image
i have 2 plots has created using qwt. couldn't sync axis(xbottom) each other. they both have (30,30) borderdist plot1->axiswidget(qwtplot::xbottom)->setminborderdist(30,30) //distance between axis , border but upper plot apply function , there difference between axises. how can solve this? regards. i solved problem. axis numbers cause problem. Ä°f give enough space(border) bewtween label , canvas side, great. like this: const int margin = 30; plot1->plotlayout()->setcanvasmargin( margin, qwtplot::yleft ); plot1->plotlayout()->setcanvasmargin( margin, qwtplot::yright ); plot2->plotlayout()->setcanvasmargin( margin, qwtplot::yleft ); plot2->plotlayout()->setcanvasmargin( margin, qwtplot::yright ); thanks uwe help.

sql - Create custom defined unique identifier -

i have table uniqueidentifier column. insert script looks : insert [users] ([userid], [name], [surname]) values (newid(), 'somename', 'somesurname') newid() creates new guid, inserted table. create data defined id column, not automatically generated. e.g. 'a0000000-0000-0000-0000-000000000000'. code doesn't work because throws error 'string or binary data truncated.' : insert [users] ([userid], [name], [surname]) values ('a0000000-0000-0000-0000-000000000000', 'somename', 'somesurname') i tried cast custom guid, not successful well. insert [users] ([userid], [name], [surname]) values (cast('a0000000-0000-0000-0000-000000000000' uniqueidentifier), 'somename', 'somesurname') do have clue how can solve inserting data custom defined id? you don't have cast it. sql server you. this code works well: create table x ( uniqueidentifier ); insert x values ('a0000000-0000-0000

Swift Closures - Capturing self as weak -

i trying resolve closure based strong reference cycle in swift. in code below, object retained owning view controller. progresshud uiview that's retained owning view controller. progresshud leaked every time completion handler called. when using new closure capture feature, declaring self weak or unowned not resolve memory leak. object.setcompletionhandler { [weak self] (error) -> void in if(!error){ self?.tableview.reloaddata() } self?.progresshud?.hide(false) } however, if declare weak var self outside of closure, fixes memory leak, this: weak var weakself = self object.setcompletionhandler { (error) -> void in if(!error){ weakself?.tableview.reloaddata() } weakself?.progresshud?.hide(false) } any ideas why not working swift capturing? if assign closure property of class instance, , closure captures instance referring instance or members, create strong reference cycle between closure , instance. swift uses cap

parsing - How to resolve ambiguity in the definition of an LR(1) grammar? -

i writing golang compiler in ocaml, , argument lists causing me bit of headache. in go, can group consecutive parameter names of same type in following way: func f(a, b, c int) === func f(a int, b int, c int) you can have list of types, without parameter names: func g(int, string, int) the 2 styles cannot mix-and-matched; either parameters named or none are. my issue when parser sees comma, doesn't know do. in first example, a name of type or name of variable more variables coming up? comma has dual role , not sure how fix this. i using menhir parser generator tool ocaml. edit: @ moment, menhir grammar follows rules specified @ http://golang.org/ref/spec#function_types as written, go grammar not lalr(1) . in fact, not lr(k) k . is, however, unambiguous, parse glr parser, if can find 1 (i'm pretty sure there several glr parser generators ocaml, don't know enough of them recommend one). if don't want (or can't) use glr parser, ca

class - How can I remove all custom methods and classes from an R workspace? -

i've been experimenting lot s4 classes lately, , pain restart r in order clear class definitions , custom methods workspace. rm(list=ls(all.names=true)) of no use. manually remove classes , methods individually writing lines one-by-one, i'm sure there's got easier way. an example showcasing problem: .myclass <- setclass("myclass", representation=representation(myslot="numeric")) myslot <- function(x) x@myslot setmethod("[", signature=c("myclass", "numeric", "missing"), function(x, i, j, ...) { initialize(x, myslot=myslot(x)[i]) }) try remove rm() : rm(list=ls(all.names=true)) however, class definition , custom method still present: > x <- new("myclass", myslot=1:4) > x[1] error in x[1] : not find function "myslot" since myslot() object removed rm , method referencing myslot() remained. i'd know how remove all classes , all custom methods in 1 fell swoo

Excel VBA Macro from MS Access - object variable or with block variable not set -

answer: set xlbook = xl.workbooks.open(mysheetpath) i trying troubleshoot else's macro. have macros in access db effect excel workbook. there 2 segments of code in question. xlbook.sheets("item detail frozen").select set xlsheet = xlbook.worksheets("item detail frozen") xlsheet xlsheet.cells.select xlsheet.range("a1").activate selection.delete shift:=xlup end xlbook.sheets("item detail").select set xlsheet = xlbook.worksheets("item detail") xlsheet xl.windowstate = xlminimized activeworkbook.refreshall .range("a1:d1").select .range(selection, activecell.specialcells(xllastcell)).select selection.copy end i "object variable or block variable not set" on "selection.delete shift:=xlup" and if comment out on "activeworkbook.refreshall" i got around 1 actively setting active book, on ".range(selection, activecell.specialcells(xllastcell)).selec

Applescript with terminal find and remove folders -

so want try , make script find , delete multiple folders in folder applescript: tell application "terminal" activate script "find (path folder) -type d *-name "foldername*" -exec rm -rf {} \;*" end tell applescript wont run after -type d because of "syntaxerror expected end of row" dont understand why because works if run find (path folder) -type d *-name "foldername*" -exec rm -rf {} \;* in terminal you use command do shell script same thing running in terminal. , don't need tell block run this. also here 2 points @ in script. if want use " quotes in quoted shell script need escape them using \ . i.e. "some script \"some name\" more script" . otherwise, use single quotes in double quoted script. if want \ run in script need escape in applescript. i.e. rm -rf {} \\;*" final script more this: do shell script "find (path folder) -type d *-name &

Switching control in tabs in Selenium -

while doing automation web page through selenium,when try click on button called "learn more" opens page in new tab , automatically closes old tab.(this specific case ie). main problem not able click on link present in new tab, control not getting switched new tab. i tried possibilities of switching windows , switching tabs , both has not helped me. and result end "no such window exception." please help.

html5 - why isn't html form post data getting correctly parsed in node.js app? -

i making blog learning exercise - see github project - scratch in node.js. have html form looks input , textarea fields. on submit, each supposed parsed title , content , respectively. <!doctype html> <html> <head> <title> post form </title> <link href="/css/master.css" rel="stylesheet" type="text/css" /> </head> <body> <h1> new post </h1> <form method="post" action="/posts" id="new_post" class="new_post"> <div class="field"> <label for="post_title">title</label><br> <input type="text" name="title" id="post_title" size="30" /> </div> <div class="field"> <label

excel - Using a macro, how do you script to delete 2 columns (T & U) based on Column "N" value? -

i need assistance using vba program macro delete values in columns "t & u" based on column "n" equal "closed". so simplify this: if column "n" = closed, columns "t" , "u" should have no value. thanks! try this: sub clearer() dim long dim w worksheet dim r range dim r1 long set w = sheet1 'set (name) of sheet. set r = w.usedrange r1 = r.row = r1 r1 + r.rows.count - 1 if w.cells(i, 14) = "closed" w.range(w.cells(i, 20), w.cells(i, 21)).clearcontents next msgbox "done!" end sub

c# - Unknown Failure to Send Email when using Async -

i have website needs send email on particular action. var mail = new mailmessage("donotreply@mycompany.com", "myself@mycompany.com", "generic subject title", string.format("some body content"); using (var eserver = new smtpclient("mailsrv.mycompany.com")) { eserver.send(mail); } the above code works fine, though send function takes between 8-15 seconds complete, receive email few seconds later. remove delay in page response @ least. using (var eserver = new smtpclient("mailsrv.mycompany.com")) { eserver.sendmailasync(mail); } when using above page loads , finishes other processes never receive email. does have idea why wouldn't receive email because i'm using async version? because of using block, dispose 'eserver' variable before has chance send mail. if use sendmailasyn

JavaScript mobile device detection -

i using following javascript codes detect either user devices phones or tablets (i have detect either device in portrait mode or in landscape mode): function getdevicetype() { if(window.innerwidth>=320 && window.innerheight <=650) { return true; } else { return false; } } it working fine until got new nexus 7 device , not working. preventing sniff user-agent , want device resolutions. how can detect if user using "smart phone" (should detect whether phone in landscape or in portrait mode) , same tablets well. please advice. i don't know why question down-voted. got solution problem: function getdevicetype() { return (window.innerwidth>=320 && window.innerwidth<959) && (window.innerheight>=212 && window.innerheight<799) ? true : false; } this resolved issues nexus well.

Change row color on a ListView using JScript.net -

i'm trying change color of row on listview jscript.net. i'm scripting againts application dont have access code, can add scripts modify listview. what i'm trying this: this.listview = controller.renderengine.listcontrol.listview; this.listview.items[0].useitemstyleforsubitems = false; this.listview.items[0].subitems[1].forecolor = new system.windows.media.solidcolorbrush(colors.yellow); or this.rows = ilist(listview.itemssource); // use itemssource data rows[1].forecolor = new system.windows.media.solidcolorbrush(colors.yellow); this.listview.items(0).fonttweight = system.windows.controls.fontweights.ultrabold; anything of working. i can make work instructions like: listviewitem = listview.itemcontainergenerator.containerfromindex(i); listviewitem.background = color; but solution if there scroll or change of focus on listview changes on painted rows disapear. any ideas?. thanks time.

Find a row in a table if the value is known in R -

i analyzing table of thousands of genes in r . every gene row , has corresponding mrna expression values. within these values, asked find max expression values out of entries, did using max() function. returned maximum expression value, not corresponding row (gene name). does know how find unknown row known value in table? to find location of maximum value, can use which.max() function. more generally, if want location of element meets criteria, can use extract operator [ , perform equality test. e.g. data.frame dat : which(dat == max(dat), arr.ind = true) this return array index in maximum value resides. can change condition anything, same effect. for more info on subsetting data using extract , refer files ?'[' .

ruby on rails - How to retrieve error messages when using Mongoid's #valid? -

this short , simple question. i'm validating mongoid documents in memory (without persisting them) using mongoid 's #valid? method. i want retrieve error messages when validation unsuccessful. how can retrieve them?, because @target.errors.full_messages throwing empty array. thanks, closed question the @target.errors.full_messages indeed contains error messages. me making mistake. best,

c# - Calling method from MVC view does not work -

i familiar c# / .net, pretty new .net mvc , razor things, trying is, want call method in controller view render string path binary, in view : <img src="@url.action("readfile", "flk", new { path = model.pict })" /> and in controller : public void readfile(string path) { response.contenttype = "image"; response.binarywrite(system.io.file.readallbytes(path)); } but when put debug point in controller, debug point never trigerred, clue? need advice thank you. your readfile() method in controller should - public actionresult readfile(string path) { byte[] imgbytes = system.io.file.readallbytes(path); return file(imgbytes, "image/png"); } here, action method reads image file byte array , uses file() method of actionresult base class send contents caller. so can use in view - <img src='@url.action("readfile", new { path = model.pict }))'/>

templates - Extends Form Data in scout eclipse -

Image
i have abstract form : @formdata(value = abstractmyformdata.class, sdkcommand = formdata.sdkcommand.create) public abstract class abstractmyform extends abstractform { ... @order(10.0) @classid("myform.mytable") public class mytable extends abstractmytablefield { ... } } this form data has table (mytable class template) inside : public abstract class abstractmyformdata extends abstractformdata { private static final long serialversionuid = 1l; public abstractmyformdata() {} public mytable getmytable() { return getfieldbyclass(mytable.class); } public static class mytable extends abstractmytabledata { private static final long serialversionuid = 1l; public mytable() {} } } my real form extends abstractmyform : @formdata(value = myformdata.class, sdkcommand = formdata.sdkcommand.create) public class myform extends abstractmyform { ... @order(10.0) @classid("myform.

How to configure cortana in window lumia 630? -

i use window lumia 630 how configure cortana in window lumia 630? i trying trying lots of time not start i find solution working cortana's settings one advantage of digital personal assistant won't take if want adjust settings , how works. can cortana's settings on windows phone in 2 ways: press search search icon button go cortana, tap cortana's notebookcortana's notebook icon > settings. in app list, tap settings settings tile, swipe on applications, tap cortana. here's can in cortana's settings. for more... see link http://www.windowsphone.com/en-in/how-to/wp8/cortana/cortanas-settings

orm - NHibernate SaveOrUpdate without primary key -

the situation i've got database table mapped via nhibernate (3.3.3-sp1). application running on .net4.0 , mapping done via fluentnhibernate (1.4.0). create table movies (id int primary key, yearpublished datetime not null, name nvarchar(500) not null, description ntext not null) the data this: id | yearpublished | name | description ---+---------------+------------------------+-------------------------------------------- 1 | 1968 | 2001: space oddyssey | epic drama of adventure , exploration the problem i'm creating new entities of table , want avoid adding more 1 entity same real world thing. know there session.saveorupdate , there way make work composite , natural ids that's not want since entities have primary key , need composite key making sure no duplicates in db. var movie = new movies { yearpublished = 1968, name = "2001: space oddyssey", description = "an awesome journey jupiter" }

smack - ConnectionException when trying to connect to XMPP server from aSmack Android client -

i have been trying connect (locally hosted) openfire xmpp server asmack android client hours now, , it's still not working. i org.jivesoftware.smack.smackexception$connectionexception , that's it. code: public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); smackandroid.init(getapplicationcontext()); connect(); } private boolean connect(){ xmppconnection connection = new xmpptcpconnection(host); try{ connection.connect(); connection.login("user", "user"); }catch (exception e){ e.printstacktrace(); } return true; } server , running. host server name, tried host name too, tried different ports... tried launch connect() method thread. tried use login or anonymous connection, exception thrown before that, @ line: connection.connect(); any highly appreciated.

java - TRying to creat a stack class whare on class can handle diffrent data types -

i created class simulate stack. right type fixed float. i'v seen in java util class have stack class ware can define type. i not find on how creat class type 1 of verbols can define when object created. tried googling java template totiol, think in c called templates. so have classpublic class cstack { float data[]; int size=0; int pes=0; cstack(int size) { data=new float[size]; pes=0; } now data def float, when create class can set type. can hold floats, or integers or strings. this generic linkedstack implementation bruce eckel's " thinking in java ": public class linkedstack<t> { private static class node<u> { u item; node<u> next; node() { item = null; next = null; } node(u item, node<u> next) { this.item = item; this.next = next; } boolean end(

asp.net - Dynamically create multiple ImageButton controls and wire-up Click event -

i'm pretty new asp.net. please forgive me knowledge :) assuming want create 4 imagebuttons. if click on imagebutton, move me page different stt (<- name). here's code: (int i= 0; i< 4; i++) { imagebutton image = new imagebutton(); image.click += (s, args) => { response.redirect("~/showroom.aspx?stt=" + (i)); }; //other things } now problem when click on imagebutton. i'll redirected showroom.aspx stt = 4 (which after loop). how can redirected page desired stt. edit: clarify. want clicking on imagebutton 1 move me showroom.aspx stt = 0. imagebutton 2 move me page stt=1 , on. problem "~/showroom.aspx?stt=" + (i) means captures variable i rather value @ time of delegates creation. solution create url outside of delegate. for (int = 0; < 3; i++) { string url = string.format(&qu

android - Custom View does not move with gestures -

i implemented dragging , scaling code offered on android developer website found here the problem running in regards ability move view once has been added layout. image scalable through gesture not movable. this view being added framelayout within fragment if helps @ all. has ran similar problem implementing android example in custom view? or can tell me missing cannot move views adding. public class customimageview extends view { private static final int invalid_pointer_id = 0; drawable _drawable; // private static readonly int invalidpointerid = -1; // private int _activepointerid = invalidpointerid; private float _posx; private float _posy; private float mscalefactor = 1.0f; private int mactivepointerid = invalid_pointer_id; // gesture listeners private scalegesturedetector mscaledetector; private float mlasttouchx; private float mlasttouchy; private float mposy; private float mposx; public customimageview(context context, int resourceid) { super(context, null, 0