Posts

Showing posts from January, 2011

angularjs - Inject constant into link function along with parent controller -

i'm using following syntax inject parent controller custom directive's link function , i'd inject constant well. angular.module('mymodule') .constant('mydefaults', { key: value }) .directive('mydirective', function () { return { require:'^myparentdirective', restrict: 'ea', scope: {}, link: function ($scope, $element, $attrs, myparentdirectivectrl, mydefaults) { ... link funciton code ... } } } unfortunately, mydefaults not defined , if swap order myparentdirectivectrl undefined. i thought order didn't matter, presumably because think can call parent controller when inject it, doesn't need called same name in actual parent directive's controller. so, have 4th parameter of link function? , why ignoring injected after it? thanks. if want inject service , factory or controller should directive not link.inject dependancies directive, work f

java - Speck algorithm not working -

i trying implement speck 64bit block / 128bit key cipher in java. i'm stuck @ encryption / decryption algorithm. decryption algorithm can't decrypt cipher text properly. my implementation: encryption: int m = 4; //key words int t = 27; //rounds int alpha = 8; //alpha int beta = 3; //beta int x,y; int[] l = new int[2*t], k = new int[t]; /* *************** key extenstion ***************** */ for(int = 0; < t-1; i++) { l[i+m-1] = (k[i] + rotateright(l[i], alpha)) ^ i; k[i+1] = rotateleft(k[i], beta) ^ l[i+m-1]; //system.out.println(k[i]); } /* *************** encryption ********************* */ for(int = 0; < t; i++) { x = (rotateleft(x, alpha) + y) ^ k[i]; y = rotateright(y, beta) ^ x; //system.out.println(y); } decryption: /* *************** key extenstion ***************** */ for(int = 0; < t-1; i++) { l[i+m-1] = (k[i] + rotateright(l[i], alpha)) ^ i; k[i+1] = rotateleft(k[i], beta) ^ l[i+m-1]; //system.out.println(k[

python - List of booleans and switching it values upon interaction -

here thing! got list 3 boolean variables , want switch between them press of button. each boolean variable represents function executed if statement. how change previous value , current value in smooth way? better way using dictionary instead of list. what tried: gesture, mouse, keyboard = false, false, false actionlist = [gesture, mouse, keyboard] if actionlist[0]: # blah elif actionlist[1]: # blah elif actionlist[2]: # blah edit: i managed put working code responses have received until now. still think there should better way of achieving this. actions = {"gesture": false, "mouse": false, "keyboard": false} currentlen = len(actions) # 3 currentact = 1 truevalue = 0 while true: actionname = actions.keys()[truevalue] actionvalue = actions.values()[truevalue] if actions.values()[(truevalue - 1 )]: # disable last disable = actions.keys()[(truevalue - 1 )] print "disable %s" % (

javascript - How to make sure only one popover is activated at each time -

Image
i have following code shows ajax content each element page. function details_in_popup(link, div_id){ $.ajax({ url: link, success: function(response){ $('#'+div_id).empty().html(response); } }); return '<div id="'+ div_id +'">loading...</div>'; } $(function () { $('[data-toggle="popover"]').popover({ "html": true, "title": '<span class="text-info"><strong>quick view</strong></span>' + '<button type="button" id="close" class="close" >&times;</button>', "content": function () { var div_id = $(this).data('id'); return details_in_popup($(this).data('url'), div_id); } }).on('shown.bs.popover', function (e) { var popover = jquery(this); $

migration - Migrating a SQL Anywhere database using triggers -

i trying create trigger using sql anywhere export database can transferred database. query following: select * estudante ; output 'c:\users\xuserx\desktop\file.xml' quote '"' format xml ; when running shows error on line output 'c:\users\xuserx\desktop\file.xml' the output to syntax available in dbisql utility, not in stored procedures or triggers. @ unload statement in docs . disclosure: work sap in sql anywhere engineering.

logging - Bluemix Monitoring and Analytics service - where did the message column go? -

in bluemix monitoring , analytics service, on log analysis tab, in grid view of results, there used message column contained text of logged messages. column gone , has been replaced logrecord column contains datetime of message. including date , time of message in column , no longer including message-only column, can no longer plot meaningful chart of message frequency. checked grid view configuration link see if maybe message-only column still available, no longer shown default, not listed option there. can message-only column back? as services evolve in bluemix ui's change , add or remove features. natural in progression of project. can share feedback monitoring , analytics team.

java - Implementing hashCode for a BST -

in java compare 2 objections equality, must implement both equals method , hashcode method. need compare 2 bsts equality. how implement hashcode method in such case? now, implementing hashcode on node class simple enough: imagine data int . cannot add values of node check if trees equal. how do it? has done successfully? i thinking of many different things can do, not sure how scalable be. example use level order , each level multiply large prime number, can't sure work. maybe understands better can me. thanks. i cannot add values of node check if trees equal. sure can. hashcode s not have unique, , if 2 bsts have same contents, summing node contents give same results in each case, satisfies hashcode contract. remember -- return 0 always valid implementation of hashcode() ; uniqueness not required. (summing hashcodes of node contents is, in fact, how treeset.hashcode() implemented.) on other hand, if care structure, simple implementing node.hashc

hadoop - Apache PIG - How can I display the execution time of a script? -

is there possibility show whole execution time of pig script? best thing generate separate file contains total time (e.g. hh:mm:s) taken execute script. please give me pig code example realize this. timing udfs the first step improving performance , efficiency measuring time going. pig provides light-weight method approximately measuring how time spent in different user-defined functions (udfs) , loaders. set pig.udf.profile property true. cause new counters tracked map-reduce jobs generated script: approx_microsecs measures approximate amount of time spent in udf, , approx_invocations measures approximate number of times udf invoked. note may produce large number of counters (two per udf). excessive amounts of counters can lead poor jobtracker performance, use feature carefully, , preferably on test cluster. you can view job counters in resource manager web ui. from - https://pig.apache.org/docs/r0.11.1/perf.html

c++ - Recursive pointer function -

i struggling implement method called find_set within class blob. recursive function returns pointer blob object. blob class linked list , function supposed passed blob , recursively traverse blob's parents until arriving @ head of blob list. @ work having recreate components. not copy , pasted version of code, want know how time home. class blob{ public: int size; int index[2]; char value; blob *parent; blob *find_set(blob* &in_question); }; the necessary elements of blob class understand conundrum. blob* blob::find_set(blob* &in_question){ if(in_question!=nullptr) in_question.parent= find_set(&in_question.parent); return in_question; } i hope have been explicit enough. so, i'm guessing problem here: blob* blob::find_set(blob* &in_question){ if(in_question!=nullptr) in_question.parent= find_set(&in_question.parent); return in_question; } i'm not quite sure why you're taking reference pointer, here's working vers

types - how to set value float in C#? -

i want set 20770897 c# float type changed 20770896 ! why? for example: float test = 20770897; value automatic changed 20770896 ? please. getting id web service . these return float value not true value web service method! the issue 1 of rounding error - because of precise way values stored under hood, noninteger types incapable of string values, , instead above or below actual value. can result in apparent errors when rounding versus truncating , , should determine use - presumably, code producing 20770896.99999... , truncating 20770896 when print it. note errors become more frequent higher value gets. if need more accuracy, consider turning double or decimal types.

android show notification with a popup on top of any application -

Image
with below code notification added notification bar, no popup style message displayed if receive whatsapp message when you're in application. makes happen notification? private void sendnotification(int distance, viewobject viewobject) { intent notificationintent = new intent(getapplicationcontext(), mainactivity.class); notificationintent.addflags(intent.flag_activity_new_task | intent.flag_activity_single_top); notificationintent.putextra("path", viewobject.getpath()); taskstackbuilder stackbuilder = taskstackbuilder.create(this); stackbuilder.addparentstack(mainactivity.class); stackbuilder.addnextintent(notificationintent); pendingintent notificationpendingintent = stackbuilder.getpendingintent(integer.parseint(viewobject.getrefid()), pendingintent.flag_update_current); notificationcompat.bigtextstyle bigtext = new notificationcompat.bigtextstyle(); bigtext.bigtext(string.format(getstring(r.string.notification), viewobject.ge

I have a table on the Lua stack. How can I push a function on the stack that returns this table? -

using c api, have pushed table on lua stack. how can push function on stack returns table? the closest can find lua_pushcclosure , pushes lua_cfunction on stack, not real lua function, , not acceptable in case because want use setfenv later, works real lua functions. regards well, obvious. since must "real lua function", must create real lua function returns table. something this: local tbl = ... return function() return tbl end this lua chunk that, when executed, return function returns first parameter original chunk called with. so use lual_loadstring load string. call resulting chuck table; return value function desire. that being said, question makes no sense. setfenv not accomplish of value here. setting environment of function returns local table not affect stored within table.

aem - AEM6 CQ how to handle Component Development and Content Authoring happening at the same time? -

i started @ new job , found myself right in middle of big project using adobe aem cq, i've never used before. there developers creating , tweaking components while content authors busy authoring 65 pages of content using components. obviously, every time component changes needs update authored content new component changes. huge time-waster seems way through custom made script looks nodes in xml files , tries convert them new component specs. not possible , authors need re-author tons of stuff , lose lots of time. can aem experience please let me know if: 1) there more painless way migrate authored content new components? 2) there better way have developers , authors work simultaneously? i know ideal way develop components first, , author on top of seems unrealistic big client project things change time. thanks firstly, sounds business process problem. components should developed , tested before content being added authors. if edits components different you&#

javascript - Error displaying info on Tooltip with AngularStrap -

Image
i trying display info in tooltip , getting title and here html call it <button class="btn btn-primary" type="button" ng-click="moreinfoslip(slip)" data-trigger="click" data-type="success" data-title="{{tooltip.title}}" bs-tooltip> click me </button> and here js $scope.moreinfoslip = function(slip) { console.log(slip); $scope.tooltip = { title: '<strong>pick info</strong>', content: '<div class="selection-info"><p><strong>game</strong> ' + slip.gamelineobj.name + '</p>' + '<p><strong>league</strong> ' + slip.leagueobj.name + '</p>

Google Spreadsheet to Calendar issue -

here script. appears run when go press push calendar cannot seem work. have tried number of things , have failed far. appreciated. please , thank you. function onopen() { var ss = spreadsheetapp.getactivespreadsheet(); var menuentries = [ {name: "add calendar", functionname: "pushtocalendar"} ]; ss.addmenu("autocalendar", menuentries); } //push new events calendar function pushtocalendar() { //spreadsheet variables var sheet = spreadsheetapp.getactivesheet(); var calendar = calendarapp.getcalendarbyid('athomas12033@gmail.com')[0]; var numrows = sheet.getlastrow() var updaterange = sheet.getrange('l1'); var cell = spreadsheetapp.getactiverange(); var cellcol = cell.getcolumn(); var cellrow = cell.getrow(); var numrows = sheet.getlastrow(); var datarange = sheet.getrange(1, 1,sheet.getlastrow(), 13); var data = datarange.getvalues(); (i in data) { var row = data

javascript - How to use predicates on expanded entities in breeze -

lets have entity called foo , has list of bars . bars contains field called isdeleted indicates particular bar has been soft deleted. want able query specific foo , filter out bars soft deleted inside of javascript file using breeze. thought work... var query = breeze.entityquery.from('foo') .where('id', '==', id).and('bars.isdeleted', '==', false) .expand('bars'); however not, can tell me how in breeze? if solution code method in breezecontroller , use standard linq syntax fine want see if work @ in breeze first. multiple .where() chains on query will automatically "and" together . if want explicity, need use breeze.predicate object parameter so: var query = breeze.entityquery.from('foo').expand('bars') .where(new breeze.predicate('id', 'eq', id) .and('bars.isdeleted', 'eq', false)); you can choose use .or or

html - Can an :after background-image be used to overlap the next element? -

i have image i'd add :after element nav bar. point being :after cover top portion of next section (this part of design). the :after set position: absolute top: 100% , seems disappear under next element , z-index hasn't helped. when top set less 100%, can see :after element above nav. the markup: <nav>contents</nav> <div>contents</div> the css: nav { width: 100%; position: relative; } nav:after { content: ''; width: 100%; height: 66px; background-image: url('image.png'); background-repeat: repeat-x; position: absolute; left: 0; top: 100%; } no css div yet... thanks in advance! all need set z-index on content div lower of pseudo-element note content div must have position setting on other static...position:relative sufficient. alternatively, set z-index of pseudo-element higher of div (which default 1). nav { width: 100%; position: relative; height: 50px;

Creating a real-time delay in Vhdl -

i want write design in , process gets activated after 1 minute. i have created 1 more process create delay using counter incrementation, , toggling signal , , giving signal in sensitivity list of process has delayed. signal delay_over : std_logic; process ( delay_over ) begin if clk'event , clk '1' --design end if; end process; delay:process ( clk ) variable counter : integer := 0; begin --design create delay end process; what value or , type of counter should use create delay of exact 1 minute. equating real time delay in synchronous design (any design clock) is simple counting clocks , or counting enables of time base generated counting clocks. for example, smallest unit of real time need deal 1 second (that is, never need deal tenths, milliseconds, etc). timebase can seconds. so need figure out how convert period (duration) of single clock second. let's assume have 25mhz clock. means there 25e6 clocks in second. means n

Finding a VB6 control using TestStack.White -

Image
i'm using teststack.white read list old app written in vb6. i'm able find reference list teststack.white doesn't see values in list. when use spy++ or visual ui automation verify pane ids 15, 14, 16, 12, 11, 10, 8, etc columns highlighted , not actual textbox. can see app screenshot. anyone have suggestions on how can values list? thanks in advance. teststack.white.uiitems.panel grid = searchform.get<teststack.white.uiitems.panel>( teststack.white.uiitems.finders.searchcriteria.byautomationid( "7" ) ); foreach ( teststack.white.uiitems.groupbox item in grid.items ) { foreach ( var itemgroupbox in item.items ) // item.items empty { var tmp = itemgroupbox; } } this screenshot of app. screenshot of spy++ screenshot of visual ui automation verify try use item.automationelement.getcurrentpropertyvalue(valuepattern.valuepr

php - Getting URL including parameters passed in an URL as a parameter -

in website have mechanism when session has expired save current location , redirect login page log on, url follow localhost/mytest/admin/login-admin.html?current=localhost/mytest/admin/manage-customer.php?action=update&id_annonceur=2 once logged in, redirect user url stored in current parameter. problem when use following code if(isset($_get['current'])) header('location: http://'.$_get['current']); else header('location: ../admin/dashboard.php'); i url without parameters included in url http://localhost/mytest/admin/gestion-annonceur.php?action is there way retrieve complete url including parameters? make sure url-encode original url when put current parameter. should be: localhost/mytest/admin/login-admin.html?current=localhost%2fmytest%2fadmin%2fmanage-customer.php%3faction%3dupdate%26id_annonceur%3d2 use urlencode() php function generate encoding.

objective c - extracting a string from a text field I get "Thread 1: signal SIGABRIT" if the character before the extract is a number -

i using tesseract scan driving license, , want pre-populate fields using extracted information. the format of license goes: wills matthew david ... etc my code (which add @ bottom) works if looking "david" , start search "matthew" ending "\n" however, if start "1. " trying find "wills" after scan app crashes. for record, "4a." works well, it's more can't "end" number, or "only" have number, either way, number consistent character have use key search, can change in code, work above example. it works this: nsregularexpression *regexp = [nsregularexpression regularexpressionwithpattern:@"1(.*?)\n" options:nsregularexpressioncaseinsensitive error:nil]; [regexp enumeratematchesinstring:tesseracttext.text options:0 range:nsmakerange(0, tesseracttext.text.length) usingblock:^(nstextcheckingresult *match,

html - PHP mail function doesn't complete sending of e-mail -

<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'customer inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } ?> i've tried creating simple mail form. form on index.html page, submits separate "thank submission" page, thankyou.php , above php code embedded. code submits perfectly, never sends email. please help. there variety of reasons script appears not sending emails. it's difficult diagnose these things unless there obvious syntax error. without 1 need

c# - Add users to Asp.Net MVC 5 standard user management from external app -

i want make simple web service internal company use use standard authentication without open registration. users added manually external application. i connected asp.net application sql database , in aspnetusers table can see users far understand can't add users directly since password hashed and, salted(?) guess, need somehow generate hash. plus there called securitystamp guess need generate somehow well. so there way add users of asp.net mvc 5 app directly database or somehow else external tool? why don't try thinktecture's identitymanager project? it's created purpose. creater brock allen shot videos in order use on different authorization systems. have @ these videos. setting asp.net identity security , identitymanager

java - Split a string by a byte -

i have string has ascii control characters in (namely rs (0x1e) , us (0x1f)). have defined them in code such: static public final byte rs = 0x1e; static public final byte = 0x1f; later in code, want split string using these characters: string[] records = content.split(string.valueof(rs)); but, doesn't work correctly. after fiddling found this string[] records = content.split("\u001e"); does work, in case, have remember codes. use rs static byte in other parts, changing not real option. of course create rs_string or something, means double work. any clean solution this? declaring character char rather byte fixed me - following works fine: char rs = 0x1e; string s = new string(new char[]{'d', rs, 'e'}); system.out.println(s.split(string.valueof(rs)).length); //prints 2 however, using byte type causes fail: byte rs = 0x1e; string s = new string(new char[]{'d', (char)rs, 'e'}); system.out.println(s.sp

database - SQLite query not work on Android rawQuery -

Image
edit: problem solved, query correct. problem is; work local database. , i'm not reach database directly assets folder. code copy database assets folder sd card when database not exits on sd card. therefore database changes effect database in asset folder. , tried right query on old database. sorry question. i tried sqlite query on db browser sqlite , it's worked. but on android same query not worked. string[] = new string[1]; a[0] = yazilankelime + '%'; cursor friendcursor = db.rawquery( "select * kelimeler kelime ? order sayi desc limit 10", a); if remove "order sayi desc" part, it's work. doing wrong? update: return exception: android.database.sqlite.sqliteexception: no such column: sayi (code 1): , while compiling: select * kelimeler kelime ? order sayi desc limit 10 db schema: as exception says, no such column: sayi means column sayi not exists in table kelimeler . check first.

amazon web services - Cloudfront traffic cheaper than S3? -

i checking pricing on aws page , noticed us-east-1 region, outgoing traffic $ 0.09/gb , transferring cloudfront free. pricing delivering content cloudfront us/eu $ 0.085. there other fees (except request fees) missing out, or transfer cheaper? http://aws.amazon.com/s3/pricing/ http://aws.amazon.com/cloudfront/pricing/ there charges number of requests. far serving out content goes (and east), in s3 it's $0.004 per 10,000 requests, while cloudfront $0.0075 per 10,000 http requests , $0.0100 per 10,000 https requests. info listed under request pricing sections on pages linked. so, yes, cloudfront cheaper in terms of data transfer, pay bit more each request.

jquery Ajax not working with Spring 3.2.3 -

i trying learn spring mvc + jquery ajax getting error on ajax success, following code configuration jquery ajax. $.ajax({ type:"get", url:"" +attr.url +"", contenttype: "application/json", success:function(response){ console.log("response length",response.length); }, error:function(e){ } }); spring controller @requestmapping(value ="/getlist.htm", method= requestmethod.get) public @responsebody list<someclass> _givelist(httpservletresponse response) throws daexception{ list<someclass>someclass = isomeclass.getdata(); return someclass; } this method executing , can see size of someclass. jackobjectmapper configuration in applicationcontext.xml <bean id="jacksonobjectmapper" class="org.codehaus.jackson.map.obje

Spring MVC + Hibernate + one to one mapping : null pointer exception while session.save -

problem definition: user_table , user_detail_table onetoone mapped userid field. facing 2 problems! encounter nullpointer exception while saving userdetailtable. first setting usertable , saving userdetailtable. userid value generated 0, though use nullable=false. -also sometime see userid value user_table 1 , userid user_detail_table 0. specially when have inserted 1 row 'admin' while creating tables. i want have default 'admin' userid inserted while creating database. i using layout given following site http://websystique.com/springmvc/spring-4-mvc-and-hibernate4-integration-example-using-annotations/ using appinitializer, appconfig , hibernate configuration above example. i update appconfig include tiles, , jsp pages, 2 viewresolvers 1 , 2 ordering respectively. to keep things short, giving code snippets user.class @entity @table(name="user_table") public class user{ @id @generatedvalue(strate

ios - CoreBluetooth discover pheriperal advertisementData format -

i'm using corebluetooth discover ble device. in - (void)centralmanager:(cbcentralmanager *)central diddiscoverperipheral:(cbperipheral *)peripheral advertisementdata:(nsdictionary *)advertisementdata rssi:(nsnumber *)rssi i receive advertisementdata dictionary { kcbadvdataisconnectable = 1; kcbadvdatalocalname = "gate_02"; kcbadvdatamanufacturerdata = <00ff0102 0303>; } if try read advertisementdata[@"kcbadvdatamanufacturerdata"] class obtain _nsinlinedata . how can convert nsstring or nsdata object ? nsinlinedata is nsdata . more specifically, (private) subclass of nsdata - common pattern in cocoa, called class cluster . so can use methods of nsdata on instance of nsinlinedata . i'm not sure mean "converting nsdata nsstring". value of kcbadvdatamanufacturerdata not nsstring (as first byte 0x00 , used terminate string). if want convert hexadecimal data decimal, there

sql - Populating a Datetime Column -

i want populate datetime column on fly within stored procedure. below query have same slows down query performance. create table #taxval ( id int , paiddate datetime , custid int , compid int ) insert #taxval(id, paiddate, custid, compid) values(01, '20150201',12, 100) , (03,'20150301', 18,101) , (10,'20150401',19,22) , (17,'20150401',02,11) , (11,'20150411',18,201) , (78,'20150421',18,299) , (133,'20150407',18,101) -- select * #taxval declare @startdate datetime = '20150101' , @enddate datetime = '20150501' declare @tab table ( compid int , datefield datetime ) declare @t int set @t = 0 while @enddate >= @startdate + @t begin insert @tab select compid , @startdate + @t datefield #taxval custid = 18 , compid = 101 order datefield desc set @t = @t + 1 end select distinct * @tab drop

c# - Class to store data -

i'm writing program in c# , have little problem passing variable between 2 forms. example in form1 have got textbox put data , need show in textbox in form2. tried make additional class properties "get,set" doesn't work, don't know why. code form1 private void button1_click(object sender, eventargs e) { danedelegacja dane = new danedelegacja(); dane.miejscedocelowe = textbox1.text; // create new instance of form2 class form2 settingsform = new form2(); // show settings form settingsform.show(); this.hide(); } and code form2: public form2() { initializecomponent(); danedelegacja dane = new danedelegacja(); textbox1.text = dane.miejscedocelowe; } class store data: class danedelegacja { public string miejscedocelowe { get; set; } } that's not working because creating

regex - Regular Expression re.sub not detecting all matches -

i've been trying retrieve percentages text using regular expressions. sadly, using .sub not retrieve matches. data = "tho grades of 2 students improved 5.2% , 6.2%." re_1 = re.compile(r"\b(\d+\.)?\d+(%|(\spercent))") data = re.sub(re_1, "__percentage__", data, re.i) i'm trying retrieve things such as: "5%","20.2%","5 percent","5.2 percent". word percent , percentage symbol being part of match fine suspect trouble comes overlap. when inputting above data current output is: "the grades of 2 students improved __percentage__ , 6.2%." any tips on how make sure both percentages turn matches? lot. ps: might relevant, i'm using python 3 the problem might having related way u handled in different python 3 versions. also, passing compiled regex object re.sub , while string pattern should passed first parameter. import re p = re.compile(r'(\b\d+(?:\.\d+)?(?:\spercent|\%))'

ios - Placing two sections next to each other in a UICollectionView -

i have collectionview 6 sections. the first sections organised rows . section 2 & 3 things difficult. i need place 2 sections right next each other . [................section 1..............] // 1 section couple of rows [... section 2...][...section 3...] // 2 sections beneath first i can't divide second section in 2 columns because different populated different cells. knowing flow layout fills 1 section bounds bounds, fake such effect placing 2 cells next each other, fine add cells , can place 1 beneath other integer increments each time create new cell in cellforitematindexpath: , use multiply cell's height. the problem face when reuse cells integer variable hack doesn't work anymore. so there better way to, besides custom layout, might not trick either, place 2 sections next each other? thanks in advance

c# - ASP .Net MVC get value from layout -

i'm pretty new mvc although familiar webforms, quite shift , i'm still learning, there 1 problem have come across having difficulty finding answer for. suppose in layout have dropdown box selecting country. have view displays product details such stock, item price, distributor etc... of dependent on country have selected. there other views display information dependent on country keep dropdown in layout , have selected value persist. is best way persist selected country , use value in controllers through storing in session, or there better approach may missing? the approach web-forms quite bit different. however, model view controller designed mimic stateless nature of hypertext transfer protocol. creates incredible amount of flexibility, each view embody exact state create. you have several options: hidden session viewbag temporary data the approach take vary based on context, sadly missing. each have severe draw back, 1 hindrance life cycle. w

AngularJS $http custom header for all requests -

i wondering if there way configure $http requests header adding custom info. config : var config = {headers: { 'authorization': 'basic d2vudhdvcnrobwfuoknoyw5nzv9tzq==', 'accept': 'application/json;odata=verbose' } }; but $http calls make in different services. i'm sure there solution :d.thanks you can create $http interceptor extend header: myapp.factory('httprequestinterceptor', function () { return { request: function (config) { config.headers['authorization'] = 'basic d2vudhdvcnrobwfuoknoyw5nzv9tzq=='; config.headers['accept'] = 'application/json;odata=verbose'; return config; } }; }); myapp.config(function ($httpprovider) { $httpprovider.interceptors.push('httprequestinterceptor'); });

count rows in excel with multiple matched criteria -

i have following data in excel sheet , count number of rows match specific criteria. b c 1 name status version 2 joe open 1.0 3 bob open 1.0 4 joe closed 1.0 5 open 1.0 6 joe open 2.0 i count rows where; name not empty, and status not "closed", and version not "2.0" based on sample data above count 2 (row 2 , 3 on sheet) how achieve this? thanks in advance. another possibility: advanced use of sumproduct() function: =sumproduct(--(a1:a5<>""),--(b1:b5<>"closed"),--(c1:c5<>"2.0"))

google chrome - Can I get the address bar url from the javascript console when the page has failed to load? -

Image
just typed in bad hostname in address bar. for example, wasn't running local web server, , load: http://localhost/callback_url in chrome, give me "this webpage not available" message. is there anyway can find out url in address bar javascript console, though page failed load? i know can use window.location.href this, returns "data:text/html,chromewebdata" in instance. so in example, i'd know if there's javascript returns http://localohost/callback_url edit: main reason i'd know if server side redirect failed when using chromedriver selenium. i'd prefer avoid using extensions if possible, , open chrome , chromedriver specific solutions if applicable! callback_url may have info in it, added server, , i'd see info is. i'd avoid running server data if possible. the loadtimedata object included in err_connection_refused page has failed url: > loadtimedata.data_.summary.failedurl "http://localhost/foo

c++ - QInputDialog and QMessageBox -

i'm doing preparation exam using qt framework , know how use qinputdialog , qmessagebox in basic way (my exams hand written coding) the qt api confusing understand when comes using , fine projects because accomplish wanted in "hacky" way set book on subject poorly laid out... let me point, clean way of using qinputdialog , qmessagebox in scenario: #include <qapplication> #include <qinputdialog> #include <qdate> #include <qmessagebox> int computeage(qdate id) { int years = qdate::currentdate().year() - id.year(); int days = qdate::currentdate().daysto(qdate (qdate::currentdate().year(), id.month(), id.day())); if(days > 0) years--; return years } int main(int argc, char *argv[]) { qapplication a(argc, argv); /* want qinputdialog , messagebox in here somewhere */ return a.exec(); } for qinputdialog want user give birth date (don't worry input validation) want use qmessagebox show user's age

angularjs - Implementation of Hybrid flow for Angular JS -

i need implementation guidance, have angularjs client asp.net web api on server-side. here questions: 1. have implemented implicit flow i'm able id_token , access_token identityserver. know if can implement hybrid flow allows refresh-tokens? 2) what's right way handle session management on javascript client? implicit flow dows not support refresh tokens. authorization flow does, should not used on javascript clients in websites. can used native apps on mobile devices. here article on why shouldn't use implicit flow on mobile devices.

Visual Studio 2008 stopped processing "find all" -

Image
this question has answer here: visual studio “find” results in “no files found in. find stopped progress.” 12 answers suddenly, visual studio 2008 doesn't execute "find all" ( ctrl + alt + f ) solution correctly. happened 2 days ago in office , on computer @ home. i'm looking method, declared in code, visual studio 2008 outputs in find results window: find "wloutfile", subfolders, find results 2, "entire solution", "*.*" no files found in. find stopped in progress. the options looks this: this known problem in visual studio 2008, , unfortunately (from know) has not been resolved. check other stack overflow question: visual studio "find" results in "no files found in. find stopped progress."

ios - How to use NSManagedObject without adding it to db? -

i'm having class inherits nsmanagedobject generated using db model: // .h @interface sketch : nsmanagedobject @property (nonatomic, retain) nsdate * added; @property (nonatomic, retain) nsstring * board; @property (nonatomic, retain) nsstring * filepath; @property (nonatomic, retain) nsstring * title; @property (nonatomic, retain) nsstring * filename; @end // .m @implementation sketch @dynamic added; @dynamic board; @dynamic filepath; @dynamic title; @dynamic filename; @end i'm using class instances in uitableview . need add instances not stored in db (just show them in list): sketch sketch = [[sketch alloc] init]; but when trying set instance properties sketch.title = @"test title"; i'm getting exception: -[sketch settitle:]: unrecognized selector sent instance 0x7ff112c13e30 does mean have to create instance adding them managed context (even if i'm not going store them)? [nsentitydescription insertnewobjectforentityforname:sketch

java - Method getRowCount() return error when tring to sort Jtable -

i'm novice in java swing , please me this. have simple app receives data 2 jtextfileds (name , occupation) , introduce them in jtable after button pressed. data stored in list<person> person(string name, string occupation) . app works fine till i'm tring sort table using tablerowsorter . i'll give tablepanel , persontablemodel code . tablepanel class import model.person; public class tablepanel extends jpanel { private jtable table; private persontablemodel tablemodel; private tablelistener tablelistener; private rowsorter<persontablemodel> sorter; public tablepanel(){ tablemodel = new persontablemodel(); table = new jtable(tablemodel); //addsorter(); --- > comment see problem setlayout(new borderlayout()); add(new jscrollpane(table),borderlayout.center); } private void addsorter() { if (tablemodel.getrowcount() != 0){ sorter = new tablerowsorter<pers

numpy - Install the right python version for Spark -

i use python 2.7.6 on machine $ python --version python 2.7.6 i have on machine spark 1.1.0 depended python 2.7.6. if execute: user@user:~/bin/spark-1.1.0$ ./bin/pyspark i python 2.7.6 (default, mar 22 2014, 22:59:56) [gcc 4.8.2] on linux2 type "help", "copyright", "credits" or "license" more information. . . . today install new pre-built version of spark 1.3.1 (i don't know why, depended python 2.7.5). if execute same command new version: user@user:~/bin/spark-1.3.1-bin-hadoop2.6$ ./bin/pyspark i older python version python 2.7.5 (default, jun 18 2014, 09:37:37) [gcc 4.6.3] on linux2 type "help", "copyright", "credits" or "license" more information. . . . the main difference in older spark version can execute import numpy , in new 1 not. i created next path python in .bashrc file: export pythonpath=$pythonpath:usr/lib/python2.7 i don't find way distinguish between v

javascript - OBLMTLLoader name of the mesh empty -

i have sort of bug can't explain when use objmtlloader instead of objloader. obj file contains groups load both loaders in different children mesh. i have in 2 case children of scene three.object3d same number of children: 1837. however, when display object in js console , inspect it: for 1 loads objloader first children has got id 12 , id increases of 1 each new mesh , finish id 1848. makes sense. with same object loads objmtlloader, id missing, in fact first children has 13 id , last children has id equals 5521. , instance here id of 5 first children : 13 16 19 22 25 this may not problem here tricky par of story, aim of project use raycaster in order change color of selected mesh (by clicking on it). display name of selected mesh: with objloader when use raycaster modify color of mesh , display name without problem. but objmtlloader change color of selected mesh without trouble, name of mesh nothing (without character). the funny think every mesh has name impo

java - Are generic type parameters converted to Object for raw types? -

consider piece of code: public class main { public static void main(string[] args) { cat<integer> cat = new cat(); integer i= cat.meow(); cat.var = 6; } } public class cat<e> { public e var; public e meow() { return null; } } as per understanding since i've not specified type parameter on lhs, taken object . , cat should become cat<object> because variable declaration make sense t must translate class/interface reference. correct understanding of how works? how type parameter t handled in case of raw types? i've discussed on chat , got following explanation way on head: generics works because types erased. consider t erasure of #0-capture-of-object. when t isn't specified (rawtyped), #0-capture-of-(nothing) what #0-capture-of-(nothing) mean? side note: since generic types implemented compile time transformations easier understand them if 1 see final translated code. know way see

C libraries for socat Linux -

i want establish connection between linux pc (ubuntu 12.04) , tty-device. want implement in c , searching libraries socat. couldn't find any. do know, can find some? thanks lot, florian you cannot find socat libraries because there none. socat implemented monolithic executable (it link standard system libraries though). can download socat sources , copy-paste required functionality.