Posts

Showing posts from April, 2011

javascript - Function to return true in OnClick with SweetAlert -

hi i'm doing function in php, in ask confirmation continue using sweetalert, idea use onclick event, problem have no control, message displayed not expect confirmation in of both cases, form , link. code: <meta http-equiv="content-type" content="text/html; utf-8" /> <script src="scripts/jquery-1.4.4.min.js"></script> <script src="sweetalert/dist/sweetalert-dev.js"></script> <link rel="stylesheet" href="sweetalert/dist/sweetalert.css"> <body> <?php function showmessage($titulo,$contenido,$tipo) { if($tipo=="ok") { // } else if($tipo=="error") { // } else if($tipo=="ask") { echo " swal({ title: '$titulo', text: '$contenido', type: 'warning', showcancelbutton: true, confirmbuttoncolor: '#dd6b55', confirmbuttontext: 'yes, delete it!', cancelbuttontext:...

cmake - Building Rstudio using Qtcreator (Compile error) -

i'm trying compile rstudio following instructions given here . after opening file rstudio/src/cpp/cmakelists.txt in qtcreator , running cmake, build error /home/nesau/documents/github/rstudio/src/cpp/tests/cpp/tests/vendor/catch.hpp :1185:23:error: 'nullptr_t' not member of 'std' std::string tostring( std::nullptr_t ); ^ i've followed previous instructions such installing required dependencies (os: arch linux). words of advice managed setup rstudio in qt-creator appreciated - i'm open using different os in vm if need - i'm not sure why can't compile rstudio (the github wiki isn't detailed). you have switch c++11 mode. add -std=c++11 cmake_cxx_flags .

Why is my C bigint modexp so slow, or, why is it so fast in python? -

as learning experience decided cook own bigint routines taking modexp, in c. code below, summarize: it's repeated squaring montgomery multiplication. , takes forever run. on virtual machines has 1gb ram, bigger around 128-bit prime modulus causes program kill itself, , smaller ones still take appreciable amount of time. meanwhile, in python, did def modexp ( g, u, p ): s = 1 while u != 0: if u & 1: s = (s * g)%p u >>= 1 g = (g * g)%p; return s p = 0xffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff g = 0x02 = int(urandom(1000).encode('hex'),base=16) % p modexp(g,a,p) and it's, like, inst...

How to Disable the button while selecting the items in combobox in C# asp.net -

how disable button if there aren't selected in combobox? here code have tried if (satellitecombobox.items.count > 0) { displayproductiondatabutton.enabled = false; } i have tried not working, appreciate of suggestion first of , should set true autopostback property dropdownlist. after , in selectedindexchange event can use desired code : if (dropdownlist1.selectedindex < 0) { button1.enabled = false; } else { button1.enabled = true; } in code when user doesn't select item , button disabled. or can set first item of dropdownlist value 'choose ...' , change code this,it's better users : if (dropdownlist1.selectedindex <= 0) { button1.enabled = false; } else { button1.enabled = true; }

sql order by - How to sort results by string length on MongoDB -

i can on mysql select * table order length(field) asc how can on mongodb? mongodb 3.4 introduces $strlencp aggregation operator supports this. example: db.collection.aggregate( [ {$project: { "field": 1, "field_length": { $strlencp: "$field" } }}, {$sort: {"field_length": -1}}, {$project: {"field_length": 0}}, ] )

javascript - AngularJS: function seems to be firing multiple time -

i building employee directory , changed way contentctrl function works in attempt make angular routes more flexible. old code //the contentctrl function drives main body of app, uses active id pull relevant json file file structure //it breaks json file apart based on labled "primary", "seconday", , "tertiary" these teammates placed //arrays labled based on thier position data field, use angular populate page //so manager of program in primary, use item in primary , item.fname etc pull program manager page //we use item in secondary pull in next person (assistant manager) , use item in tertiary //pull in of teammates remaining in department $scope.contentctrl = function(id) { $scope.active = []; $scope.activetwo = []; $scope.primary = []; $scope.secondary = []; $scope.tertiary = []; $scope.credits = []; $http.get('assets/json/' + id + '.jso...

javascript - Jquery - .prop not checking my input checkbox dynamically -

i have simple data table added checkboxes can select. have edit button show details of data. have set everytime hit edit pull data ajax , fill it's fields , checkboxes accordingly. the issue have checkboxes. @ moment saving functionality working great. use below code determine if checkboxes checked or not , returns true or false in database. candidat_gestion_de_problème: $("#candidat_gestion_de_problème").prop( "checked" ) the issue following code, when hit edit button pulls data database: $("#candidat_gestion_de_problème").prop( "checked", incident.candidat_gestion_de_problème ); note: incident.candidat_gestion_de_problème returns true or false . had them tested in console , spitting out. in cases if database returns false, .prop seems ignore , leaves checkbox checked. when perform same code manually in console works fine: $("#candidat_gestion_de_problème").prop( "checked", false ); would understan...

c# - Exchange Service FindItems API does not always find all matching messages -

i have program once every few hours synchronizes office 365 online mailbox database collection. in order pull down latest messages, i'm using exchangeservice c# api however, every once in while, newest messages contacts not come thru. when search messages via outlook, shows them no problem. but, c# code searches messages email id not find them. am missing criteria in search strings? or perhaps there caching going on - how disable it? i have 10-20 messages per search result (this not thousands) here's relevant code: foreach (var item in customer.contacts) { search.add(new searchfilter.containssubstring(emailmessageschema.torecipients, item.email)); search.add(new searchfilter.containssubstring(emailmessageschema.ccrecipients, item.email)); search.add(new searchfilter.containssubstring(emailmessageschema.from, item.email)); search.add(new searchfilter.containssubstring(emailmessageschema.sender, it...

Bootstrap datatable is not resizing and fitting with the container when i view the page in mobile -

i using bootstrap datatable in web application. when view same web page within mobile, datatable goes outside bootstrap container. in desktop, if reduce size of browser window beyond point see same behaviour <div class="container"> <form id="myform" class="form-horizontal" action=/testurl method="post" role="form"> <div class="form-group"> <div class="col-sm-11"> <table id="myhist" class="table table-striped table-bordered"> <thead> <tr> <th scope="col">id</th> <th scope="col">name</th> <th scope="col">age</th> ...

Jquery validation with dynamic error message -

this question has answer here: dynamic jquery validate error messages addmethod based on element 4 answers i need validate field multiple conditions different error messages. how fix this? $.validator.addmethod("custommethod", function(value, element) { var msg; if(cond1){ msg = "msg1"; } else if(cond2){ msg = "msg2"; } else if(cond3){ msg = "msg3"; } }, msg); you have pass in anonymous function in message parameter, because cannot pass msg result of previous anonymous function next parameter (as msg , in context, exists within particular anonymous function scope). $.validator.addmethod("custommethod", function(value, element) { // usual stuff here. }, function (params, element) { var msg; if(cond1){ msg = "msg1"; } el...

numpy - get all unique value from a sparse matrix[python/scipy] -

i trying make machine learning lib work scipy sparse matrix. below code detect if there more 1 class in y or not.because doesn't make sense if there 1 class when doing classification. import numpy np y = np.array([0,1,0,1,0,1]) uniques = set(y) # {0, 1} if len(uniques) == 1: raise runtimeerror("only 1 class detected, aborting...") but set(y) not work if y scipy sparse matrix. how efficiently unique value if y scipy sparse matrix? ps: know set(y.todense()) may work, cost memory update: >>> y = sp.csr_matrix(np.array([0,1,0,1,0,1])) >>> set(y.data) {1} >>> y.data array([1, 1, 1]) sparse matrices store values in different ways, there .data attribute contains nonzero values. set(y.data) might need. should work coo , csr , csc . others many need convert matrix format (e.g. y.tocoo ). if not work, give more details on matrix format , problems.

reactjs - How to pass variable to react component -

for example, create react component this var hellomessage = react.createclass({ render: function() { return <div>hello {this.props.name}</div>; } }); reactdom.render(<hellomessage name="john" />, mountnode); so can pass message variable server? this reactdom.render(<hellomessage name="{{ message }}" />, mountnode); what you're trying should work. can instantiate javascript variable showed, have reactdom.render call rendered in view server-side. no need render react component server-side, have render call rendered on page. for example, in javascript file, have component ( hellomessage ) showed. then, render second snippet of code (server-side) on page: <script type="text/javascript"> reactdom.render(<hellomessage name="{{ message }}" />, mountnode); </script>

Offset issues with jQuery Draggable into an iFrame based Sortable -

i'm having quite bit of trouble resolving problems offsets related draggable elements being dropped sortable area within iframe. the following leaned-down example demonstrates problem here . make sure keep window narrow, otherwise it's difficult drop elements iframe @ all. should pretty obvious cannot drag item , drop in designated place, instead must drag 350 pixels right of leftmost border, after sortable accept draggable. i've tried quite few things here already, far have been unable narrow down problem. i'm not entirely sure understand source of problem, knowing allow me possibly write plugin correct issue. there have been few people who've asked question before, solutions offered not production-ready, simplistic workarounds. need more comprehensive here, entirely eliminate offset issue, , allow draggables received sortables similar how existing sortable elements received other sortables. it's sadly not supported. see https://bugs.jquery...

php - How can I test the type of something generated in my phpspec test? -

for example: test code function it_records_last_checked() { $this->getwrappedobject()->setservicelocator( $this->getservicelocator() ); $this->isavailable( 'google.com' )->shouldreturn( false ); /** @var url $last */ $last = $this->getlastchecked(); $last->shoudhavetype( url::class ); $last->host->registrabledomain->shouldbelike('google.com'); } the spec wraps object code this: namespace application\service; use application\exception\domaininvalidexception; use application\model\whois; use pdp\uri\url; use zend\servicemanager\servicelocatorawareinterface; use zend\servicemanager\servicelocatorawaretrait; use application\exception\domainrequiredexception; class domainservice implements servicelocatorawareinterface{ use servicelocatorawaretrait; /** @var url */ protected $last_checked; /** * @return url */ public function getlastchecked() { return $this->l...

Speed html5 canvas -

we have mobile web application. application people fill out forms , towards end, able sign form electronically planning use html5 canvas based sketch pads. apart drawing need additional parameters acceleration or velocity know how find out velocity/speed of movement. is can calculate finding distance divided time? i.e. distance start (x,y) end (x,y) divided time taken?

database - MYSQL: UNDECLARED VARIABLE NEW -

is there wrong code? think it's alright, error "undeclared variable new". once again i'm converting oracle mysql in project need few on language , syntax create trigger `customer_before_insert` before insert on `customer` each row begin select concat('c', substr(new.name,1,1),substr(new.name,instr(new.name,' ')+1,1), lpad(coalesce(max (substr(customer_id, 5, 5))+1, 1 ), 5, 0)) customer new.customer_id new.customer_id concat('c', substr(new.name,1,1), substr(new.name,instr(new.name,' ')+1,1), '%'); end if name : robert william code should "crw00001" 13.2.9.1 select ... syntax ... the clause can name list of 1 or more variables, can user-defined variables, stored procedure or function parameters, or stored program local variables. ... ......

cordova - Geolocation plugin permission alert on iPhone with PhoneGap -

two time alert show first alert correct second alert generate string use current location. how change string on alert saying: /var/mobile/applications/157eb70d-4aa7-826e-690f0cbe0f/appname.app/www/index.html someone having idea? try use following code on device ready: document.addeventlistener('deviceready', ondeviceready, false); function ondeviceready() { navigator.geolocation.getcurrentposition(onsuccess, onerror); } function onsuccess(position) { //retrieve latitude as: alert(position.coords.latitude); //retrieve longitude as: alert(position.coords.longitude); } function onerror(error) { console.log('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); }

c# - OLEDB extract Excel date format cell but result in incorrect outcome -

i trying extract data in excel while got unexpected result. i publishing project in iis7.5 , use ace engine extract excel information, connection string: connstring = "provider=microsoft.ace.oledb.12.0;data source=" + strnewpath + ";extended properties=\"excel 12.0 xml;hdr=no;imex=1\"" my excel has date fields below: excel image when use below code extract data: query = "select * [roster$]"; cmd = new oledbcommand(query, conn); da = new oledbdataadapter(cmd); da.fill(ds); showmessage(ds.tables[0].rows[10][0].tostring()); i got interesting result below: 1-¤q¤@¤ë while expecting this: 1-nov do have idea on happening engine? tried kind of browsers got negative result. meanwhile, gives want if not publish iis, access through debug mode in visual studio. will thank helping me! use connstring, connstring = "provider=microsoft.ace.oledb.12.0;data source=" + strnewpath +...

c# - Fast union of two big lists -

i m using union on 2 big lists (over 1 million entries) , s quite slow (a few minutes) need feature remove duplicates cannot use concat , lists not sorted. there faster way? maybe using plinq ? you not saying items in list, 1 option use proper data structure task - want keep unique items - definition of set, use hashset. var hashset = new hashset<int>(list1); hashset.unionwith(list2); also measured time code above vs linq.union: var list3 = list1.union(list2).distinct(); and here timing ( hashset.unionwith works twice faster): hashset.unionwith real 0m4.111s user 0m3.890s sys 0m0.132s real 0m4.562s user 0m4.074s sys 0m0.170s real 0m4.052s user 0m3.851s sys 0m0.129s real 0m4.003s user 0m3.814s sys 0m0.125s real 0m4.058s user 0m3.858s sys 0m0.126s linq.union.distinct real 0m7.579s user 0m7.014s sys 0m0.428s real 0m7.498s user 0m6.965s sys 0m0.419s real 0m7.596s user 0m6.994s sys 0m0.412s real 0m7.446...

c# - Call Javascript method from code behind -

i have function in javascript makes label invisible. want call function code behind. not able make invisible. here both lines of code. c# code behind: page.clientscript.registerstartupscript(gettype(), "myfunction", "myfunction();", true); javascript: <script type ="text/javascript" language="javascript"> function myfunction() { document.getelementbyid("label8").style.display = 'none'; } </script> pls let me know if there mistake. looks control not going method definition only. thank you use clientid of server control (label) in getelementbyid or set clientidmode static label , make sure availability of html elements script, can put script tag before closing tag of body <script type ="text/javascript" language="javascript"> function myfunction() { document.getelem...

xcode - Device compabilities issue in iOS -

we uploaded app in first version added device capabilities “telephony” restrict iphone devices in info plist. in second version forgot add “telephony” , submitted app store. third version planning upload device capabilities “telephony” while submitting app store shows warning: this bundle invalid. key uirequireddevicecapabilities in info.plist may not contain values prevent application running on devices supported previous versions. how can resolve issue, if require device capability “telephony” application lifetime, due mistake on second version forgot add required device capabilities? solution it? thanks in advance. unfortunately doesn't seem possible fix error. according apple's technical q&a : depending on how narrow devices app supports, 1 of 2 error messages xcode when uploading update app store. "this bundle invalid. key uirequireddevicecapabilities in info.plist may not contain values prevent application running o...

asp.net - How to change submit button to update button -

i guys have 2 page on fist page have form , on second report page form values store in grid. have submit button on form page when click on edit link redirect form page can make change , update details. want when click on edit link , move form page make editing submit button change update button how can that... here code first page:     select travelong onetravel .uk-bsp .ca-yyz .ca-yvr partial mco refund     <div id="firstform" style="margin-left: 80px" runat="server"> <table class="style1"> <tr> <td class="style13"> <asp:label id="lbltid" runat="server" text="tid"></asp:label> </td> <td class="style5"> <asp:textbox id="tbtid" runat="server"></asp:...

Previous realm data is lost when Realm migration is done in android -

previously using 0.82.0 realm version , using 0.87.0 version.according project requirements attempting add 2 new tables existing realm schema. for added below code.. public class unitdetails extends realmobject { private int unituid; private double noofrooms; private int unitarea; private int fid; private int fnum; private int maxavailablity; // , setters , getter methods } public class quote extends realmobject { private string qname; private string qlocation; // , setters , getter methods } and migration code follows,creating realmconfiguration instance using appication context, , calling getrealminstance() method wherever realm instance needed. public class realmutils { private static realmconfiguration config; public static void createrealmconfig(context context) { config = new realmconfiguration.builder(context) .name("default.realm1") .schemaversion(1) ...

java - How to identify maven archtype? -

i have existing maven project java services ,is there way identify archetype pom.xml file or there way? the folder structure project ; src/test/java src/main/java src/main/resource and has " referenced libraries " not " maven dependencies ". can please let me know archetype selected list maven archetypes? i reference stack overflow question , answer: how know archetype existing maven project built on? unfortunately, appears cannot find archetype after creating maven project.

python 3.x - count the number of words in a string separated by spaces and/or punctuation marks -

can please . want create program can count number of words in string separated spaces and/or punctuation marks. should count words vowels , consonants alternating. word can not have 2 consecutive vowels or consonants. single letter words not counted. ignore in file not vowel or constant. replace not in alphabet single space. case sensitivity of each letter not matter. alphabet use vowels -- e o u y consonants -- b c d f g h j k l m n p q r s t v w x z input: string eg "hello there great new world" output: number of desired words found in input string above. eg 1 sample: "welcome radix!!!" == 2 (to radix) "everybody, trying out." == 2 (everybody for) "hello there great new world" == 1 (new) "mary,had,a,little,lamb" == 2 (mary had) this homework, isn't it? try regular expression: \b[aeiouy]?([bcdfghjklmnpqrstvwxz][aeiouy])*[bcdfghjklmnpqrstvwxz]?\b it find words alternating vowels/consonants. beware,...

google analytics - Canonical link redirect not working -

i have added canonical link redirect www non-www version instead of working in htaccess file when type www.example.com not redirect example.com. in google webmaster tools have set preferred domain non-www , in google analytics website domain non-www. any ideas missing?

javascript - Jquery document.body.background -

i'm having trouble jquery script supposed change body element's background image when link pressed. works great, problem have page has have no background set in css, , blank before link pressed, wich changes background. jquery uses old, tried newer versions nothing works except one. also, i've tried document.body.style.backgroundimage , still no success, maybe because of old version script uses. figure out what's wrong here ? <script language="javascript"> <!-- // copyright 2001 www.codebelly.com // please *not* remove notice. var backimage = new array(); // don't change // enter image filenames wish use. // follow pattern use more images. // number in brackets [] number // use in function call pick each // image. // note how backimage[3] = "" -- // set page *no* background image. backimage[0] = "img/1.jpg"; backimage[1] = "img/2.jpg"; backimage[...

RegEx match before string or all / Remove string from match -

i tried search not find case. need match before string "part 1" or "part 2" etc. in case there not "part x" string match all. example: any words here part 1 any words here part 2 any words here it should return "any words here". have tried (.+)(?=\spart\s\d|\spart\s\d) but not match when "part x" missing. other solution remove "part x" string match. thank help! ^.+?(?=part\s*1|part\s*2|$) use anchors ored part 1 , part 2 .see demo. https://regex101.com/r/cz0sd2/5 or ^.+?(?=part\s*\d+|$)

angular - What is angular2 typescript and angular2 ecma script -

i'm learning angular2. difference between angular2 typescript , angular2 ecmascript? ecmascript standard. javascript implementation. when people ecmascript mean javascript... javascript browsers understand. typescript "typed superset of javascript compiles/transpiles javascript." today, means you'll compile/transpile typescript code ecmascript 5/es5, since browsers support version . in future, browser support grows ecmascript 6/es6/es2015, compile typescript es2015 instead of es5. typescript's primary purpose not add features javascript – purpose of es2015 – make easier , safer developers write , maintain large javascript applications. primary benefit of typescript shows before application runs – when you're writing or maintaining code. intellisense, code completion, ability use es2015 features today, etc. angular 2 written in typescript. if write angular 2 applications, recommend use typescript.

How to print a Django Forms many times with different id -

i have created form, multiple input option, populated queryset: class testform(forms.modelform): field = modelchoicefield(queryset=testtable.objects.all().order_by('desc1')) class meta(object): model = blockvalue fields = () whithin same html form, want print testform many times. in views.py possible create array of testform , print in template using loop? you create formset , pass template: testformset = formset_factory(testform, extra=3,) then in view: def test_form_view(request): context = requestcontext(request) if request.method == 'get': formset = testformset() return render_to_response('yourapp/test_form_template.html', {'formset': formset}, context) and in template: {% form in formset %} {{form.as_table}} {% endfor %} take @ docs more information

jqgrid - Get page number of a specific record -

i'm trying find way page number of specific record. this problem, after add new line reload grid, sorting on, new line can end on page. need able find page number of specific record, can navigate page , select it. how can that, without having load every page until find it. as see to accomplish add new record, reload grid , have displayed page page new record found in sorted grid. solution think need set reloadaftersubmit: false , , generate own reload pass in (via postdata) value tell controller change page of data return jqgrid. when controller receive value in field have write code find page of data record belong , pass page jqgrid. as grid sorted, find where record in sorted dataset , grab page. if didn't have large dataset iterate through every page till found page contain result, method depend on how large of dataset have. (ex 5 pages of records, acceptable iterate through them all, dataset becomes larger have fetching proper page of data.)

javascript - Add Link to X-Label Chart.js -

i'm looking able link x-labels in chart.js bar chart. i've searched pretty thoroughly, , ended trying come own solution: because labels correspond bars directly above them , chart.js has built in getbarsatevent(evt) method, tried creating event if user didn't click on chart - new event had pagex , pagey directly above initial click such if user had clicked on label, new event simulate click on bar graph. however, calling getbarsatevent(createdclickevent) repeatedly gives me uncaught typeerror ("cannot read property 'getboundingclientrect' of null"), must mean getbarsatevent method, when called on simulated click, isn't returning anything. any suggestions or alternate approaches appreciated, in advance. an alternative approach determine point user clicked , based on calculate label clicked. need information chart created , have calculations. below way of doing that, , here fiddle code/approach. hope helps. $("#canvas...

javascript - Use a var from mousedown() in the mouseup() event -

so looked @ my previous question , im building chess board in complete js , jquery (or @ least). so pieces effectivly restricted in amount of squares allowed move need know position. (starting , ending position) i wrote code below log starting row (integer) , starting column (integer) , on both mousedown() , mouseup() var piece; $('div').mousedown(function(e) { e.preventdefault(); var selectedrow = this.getattribute("data-row"); var selectedcolumn = this.getattribute("data-column"); console.log(selectedrow, selectedcolumn); piece = $(this).find('.pawn'); }) .mouseup(function() { var selectedrow = this.getattribute("data-row"); var selectedcolumn = this.getattribute("data-column"); console.log(selectedrow, selectedcolumn); if (selectedrow === selectedrow++ || selectedcolumn === selectedcolum...

c# - jqGrid ASP.NET WebForms cellurl doesn't work -

i edit data in grid. can edit in table , see don't go c# method. tried ajax doesn't work too...serialization doesn't work too. wrong? [webmethod] public static string loaddata() { sqlconnection cn = new sqlconnection(configurationmanager.connectionstrings["conn"].connectionstring); sqldataadapter da = new sqldataadapter("select * employees", cn); dataset ds = new dataset(); da.fill(ds); return jsonconvert.serializeobject(ds.tables[0]); } [webmethod] public void updategrid() { //code update database sqlconnection cn = new sqlconnection(configurationmanager.connectionstrings["conn"].connectionstring); sqldataadapter da = new sqldataadapter("select * employees", cn); } } and js: $(document).ready(function () { $("#btnemployee").click(function () { var service = "default.aspx/loaddata"; ...

Update row record with predefined value using PHP and MySQL -

i'm trying update specific record within row predefined valued using php , mysql. not want use "input" new value defined in code. table students id name grade 1 dave b update< hyperlink update.php 2 mark c update 3 john e update 4 thomas d update upon click on "update" want grade value of specific row change constant value"a", in every case. lets clicked on update within rows id "1" , "2". desired result: id name grade 1 dave update 2 mark update 3 john e update 4 thomas d update i know how using input fields insert data myself , submit. need change data upon click on update. this how display data: while ($row=mysql_fetch_array($result)){ echo ("<tr><td>$row[id]</td>"); echo ("<td>$row[name]</td>"); ...

yacc - Types of conflicts in Bison -

%token<val>num %left '+' '-' example shift/reduce conflict: expr:num {$$=$1}; |expr '+' expr;{}; |expr '-' expr;{}; i want recognize reduce/reduce conflict. occurs when 2 or more rules apply same sequence of input (token) for example: prod: proda|prodb proda :'x' prodb : 'x' could give ideas how recognise reduce/reduce conflict easily? easiest way create y.output file. use command yacc -v parser_name.y . create output how yacc works. find state yacc says conflict is, , important understand point sign . in file means. if output file says this: 4 |expr. '+' expr;{}; point sign after expression saying you: "i've read expr , on input have '+'. reduce-reduce conflicts appear when have situation this: non_terminal1: expr. non_terminal2: expr. in situation, have expr. @ end of rule yacc doesn't know reduce , reduce-reduce conflict.

html - Cross domain ajax request -

i want html respond page cross domain url. for using ajax request as, $.ajax({ type: 'get', url: "http://wcidevapps.com/salescentral/idisk/0001000383/idisk", datatype: "jsonp", success: function (response) { $(response).find('li a').each(function () { listhref.push($(this).attr('href')); }); } }); but after requesting doesn't respond result back. <script src="scripts/jquery-1.4.1.js" type="text/javascript"></script> <script type="text/javascript"> function nameafunctionname() { $.ajax({ url: 'http://wcidevapps.com/salescentral/idisk/0001000383/idisk', type: 'get', datatype: 'json', headers: { //write if have header request or data }, crossdomain...

javascript - Can Angular 2 be used with Laravel 5.2? -

i trying find concrete example on how use laravel angular 2. tried using google, no luck. please me 1 example. thanks. i have found tutorial in spanish, can have @ github repo. tutorial: http://uno-de-piera.com/angular-2-y-laravel-5/ github: https://github.com/uno-de-piera/angular-2-laravel-5 if of interested , have problem understanding/translating tutorial, please let me know , try find time translation. i hope helps!

java - Object not created locally -

i have in method snippet below: jsonparser jsonparser = new jsonparser(); try { object obj = jsonparser.parse(new inputstreamreader(is)); jsonobject jsonobj = (jsonobject) obj; jsonarray jsonarray = (jsonarray) jsonobj.get("json_node"); string jsonstr = jsonarray.tojsonstring(); return (jsonobject)jsonparser.parse(jsonstr); } in sonarqube getting issue "object not created locally" on string jsonstr = jsonarray.tojsonstring(); i trying understand why getting this. help? why violation? this violation relates fact method called on object not created within method , rather, retrieved return object result of method invocation on 1 of local objects. your jsonarray object satisfies above condition. how fix , see 1 sample listed here , code can fixed on similar lines. according law of demeter, method m of object o should call following types of methods : 1.methods of object o 2.methods of object passed ...

visual studio - Check if PropertyGroup item is set to a value in .csproj -

i using .targets files include common functionality in .csproj files. in target file, want check if property set before, , if yes, not set again. i need because using specific target file in many solutions, , want include custum property if wasn't set before. the property talking <propertygroup> <codeanalysisruleset>$(solutiondir)customizedallrules.ruleset</codeanalysisruleset> </propertygroup> if ruleset specified before importing target file, don't want include again in .targets file. how check in .csproj if <codeanalysisruleset>...</codeanalysisruleset> set before? the pattern i've seen set conditionally based on comparing empty value: <propertygroup> <codeanalysisruleset condition="'$(codeanalysisruleset)' == ''">$(solutiondir)customizedallrules.ruleset</codeanalysisruleset> </propertygroup> [edit: responding comment code example] here'...

php - is_logged_in function always return false for http://domain.com/wordpress -

is_logged_in() function return false i believe because wordpress hosted in sub domain due cookies not correct path. so tried using define('cookie_domain', './wordpress'); in wp-config.php it not working. am setting cookie right? please !! try this <?php if ( is_user_logged_in() ) { echo 'welcome, registered user!'; } else { echo 'welcome, visitor!'; } ?>

android - Marshmallow message application is not opening -

i trying open message application application getting activitynotfoundexception in marshmallow. used below code: intent n = new intent(intent.action_view); n.settype("vnd.android-dir/mms-sms"); n.putextra("address", phone); n.putextra("sms_body", " "); startactivity(n); i use code on android m , works: intent n = new intent(intent.action_view); n.setdata(uri.parse("sms:")); n.putextra("address", phone); n.putextra("sms_body", " "); startactivity(n);

ruby - Delete file from path value stored in array method fails if file is not present -

i have dynamically generated array of file paths may this: paths = ["/lib/my_folder/foo", "/lib/my_folder/bar", "/lib/my_folder/baz", ...] so want do: for path in paths |path| file.delete(path) #if file exists end this failing element in array points file no longer there. i tried: for path in paths if !path.blank? file.delete(path) end end but still fails no such file or directory... error msg. how can go writing loop dele element(s) left in array without failing? paths.each { |path| file.delete(path) if file.exists?(path) }

xml - gender-dependent locale String resources Android -

i'm implementing app in hebrew, , user-friendly in such way @ first time user logs on, there question "are male or female?". after answering question, want of strings gender-dependent (e.g. in hebrew question "would coffee?" be תרצה לשתות קפה? for male, , - תרצי לשתות קפה? for female) meanwhile app supports english , unisex-hebrew locales, i'm using string resources (like r.string.somevalue) , know how handle values-he , values-en. let's can ask is_male() , is_locale_hebrew() @ anytime, saw this answer won't case since there hell lot of strings in working-already app , want solution add xml files (hopefully) less needed change in "activity"s code. thought maybe overloading parser looks xml files magic, have no clue start from. my question divides 2 parts: a. how can implement gender-dependnt string-resources ? b. (opt) of string-resources unisex right now, there option avoid copying resources 2 new gender-dependent ...