Posts

Showing posts from January, 2015

jquery - javascript - Push function to array, loop through and remove after executed -

i trying create array holds pending error messages shows on dom (using jquery that) , loop through array see if there error messages call, , if remove them after executing them. my problem can't figure out how push function array , execute it. have far: var dialogqueue = [] dialogqueue.push(errorcall("test", "test", "test", "test")); (var queuenum = 1, 1 < dialogqueue.length, 1++) { alert(dialogqueue[1]) } and if helps, code showing error messages: function dialogshow() { $(".dialog-con").css("display", "block").css("background", "rgba(0,0,0,.8)") $(".body-wrapper").addclass("errorfilter"); $(".dialog-anim").animate({ opacity: 1, margintop: "-=20px" }) settimeout(function () { $(".errorfilter").addclass("blur"); }, 100); } function dialoghide() { $(".dialo

java - error on uploading to google play: android:label attribute: attribute is not a string value -

i have tried upload new apk google play services , says current error message: your apk cannot analyzed using aapt. error output: failed run aapt dump badging: error getting 'android:label' attribute:attribute not string value i have tried search error on web, , tutorial( error getting 'android:label' attribute: attribute not string value ) recomended use "aapt dump badging apkpath" command see what's error. here's got: http://postimg.org/image/u8d0unohv/ i don´t know how read this. can me identify error? game has values-jp folder japanese strings , here manifest file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="br.ufrn.dimap.pairg.karutakanji.android" android:versioncode="7" android:versionname="0.1.12-beta" > <supports-screens android:largescreens="true"

jquery - Multiple Selector like statement -

i know multiple selector does $( "p , #test" ) it gives combined results of specified selectors , can find documentation it. but found piece of syntax somewhere , dont know how called , cant find way explain it. can tell me name , can find documentaion $( "p" , "#test" ) it seems p elements within element id=test the $ selector's second parameter context. a dom element, document, or jquery use context. accepts string containing css selector used match set of elements. have @ docs .

java - How to Read one file and generating multiple text output file -

i hava 1 text file below. question want read txt file upto each 1 paragraph , generating separate new text file each 1 on java >t0646 or188, , 93 residues mqeerkklleklekildevtdgapdearerieklakdvkdeleegdaknmiekfrdemeq mykdapnavmeqlleeiekllkkagslvprgsy >t0647 hr5514a, , 157 residues mterlsaeqikeykgvfemfdeegngevktgelewlmsllginptkselasmakdvdrdn kgfffncdgflalmgvyhekaqnqeselraafrvfdkegkgyidwntlkyvlmnagepln eveaeqmmkeadkdgdrtidyeefvammtgesfkliq >t0648 cpn10, , 102 residues magqafrkflplfdrvlversaaetvtkggimlpeksqgkvlqatvvavgsgskgkggei qpvsvkvgdkvllpeyggtkvvlddkdyflfrdgdilgkyvd public class test{ public static void main (string[] args){ bufferedreader br=null; bufferedwriter bw= null; file file = new file("...desktop\\new folder\\out.txt"); try { string s; string text = ""; br = new bufferedreader(new filereader( "....desktop\\new folder\\casp10

swift - VK iOS sdk authorize -

i'm trying setup vk ios sdk in swift 2.0 project. i'm getting error , don't have idea why occurs. appdelegate.swift : // // appdelegate.swift // iosvkmusic // // created nick on 25.06.15. // copyright © 2015 funtrum. rights reserved. // import uikit @uiapplicationmain class appdelegate: uiresponder, uiapplicationdelegate { var window: uiwindow? func application(application: uiapplication, openurl url: nsurl, sourceapplication: string?, annotation: anyobject) -> bool { let ret:bool = vksdk.processopenurl(url, fromapplication: sourceapplication) return ret } } viewcontroller.swift : // // viewcontroller.swift // iosvkmusic // // created nick on 25.06.15. // copyright © 2015 funtrum. rights reserved. // import uikit extension viewcontroller: vksdkdelegate { func vksdkneedcaptchaenter(captchaerror: vkerror) { } func vksdktokenhasexpired(expiredtoken: vkaccesstoken) { } func vksdkuserdeniedaccess(authorization

javascript - How can I make Sublime Text's "Improved Native for-loop" increment like a normal for-loop? -

premise in sublime text 3, when writing javascript, typing "for" triggers insertion of 1 of 2 possible code snippets: for (... {... (improved native for-loop) for (var = things.length - 1; >= 0; i--) { things[i] }; and for (...) {...} for (var = 0; < things.length; i++) { things[i] }; because reasons it has been known while reverse iteration through loops has better performance . doing means every array-based action has done backwards, , causes code become less readable. of hassle minimal performance improvements in cases. unfortunately, " improved native for-loop " first suggestion , can result in annoying situations when accidentally chosen instead of normal, readable loop not mess typical conventions of array iteration. questions so, how 1 change behavior of sublime text not automatically add these weird loops? i.e., how can remove snippet suggestion? is there way keep slight performance gains while using more traditional

Django meta permissions -

i adding custom permissions via use of 'meta' in django models. see below simple example. models.py class meta: permissions = ( ("can_do_stuff", "can stuff"), ) this works great, add above code model , make migrations , migrate them. permission gets created , available use. however, when remove (or modify) permission 'meta' section of model , again makemigrations , migrate permission (that removed/modified) not removed django system. this wouldn't problem if had figured out permissions system 100% have been fine tuning things learn , result permissions list gets messy 'legacy' permissions. i developing , releasing new versions production use on frequent basis, , permissions getting messy in production can't wipe db in dev. is there recommended way of doing this? i delete legacy permissions manually directly database (it seems 1 entry need delete , seems not cause problems). seems bad way of doing i

polymer - How to implement lazy loading on pages with Dart -

i'm developing dart application implement lazy loading on libraries , pages . for instance, have 3 pages/views: login, main_view , new_item. far know, of application's code being loaded @ same time if no lazy loading implemented. what want load pages (or elements) used application @ time and, when other page/view called, "loading" message appears @ center of screen, pretty happens on google music (turning dice). edit: i'm using bwu_polymer_routing routing. you can use deferred loading of libraries http://news.dartlang.org/2014/08/dart-16-adds-support-for-deferred.html?m=1

node.js - Is a Socket.IO socket ID sensitive/private data? -

when new connection handled socket.io, creates socket object, , 1 of object's properties id . "unguessable" (according documentation) string used identify connection. when building applications, considered safe, secure , practice broadcast id other clients? inclination hashing id , broadcasting digest may better idea. the id not sensitive data unless own code somehow makes sensitive. there no socket.io client operations take socket id, if client has socket id, there nothing can unless code implements message operate on it. it unguessable can use id share other clients while not allowing client know who's id might have been given (like anonymous id). so, using identifier refer other user's socket intended , not cause security or privacy issue unless own client operations cause such.

c# - Best way to parse AlphaNumeric string, parts of which will be converted to Int, Bool, String -

i have schema according alphanumeric string of specific length interpreted. example, index 0-12 interpret string , 13-20 interpreted int , 21-22 bool , on. far, have linked list formed @ runtime, each element( struct ) has 2 fields: length , type( enum ). iterating through list , checking type element belongs to, correct conversion performed. seems method inefficient , error prone task. there better way ? assuming stuck fixed-width data source (which should avoid if @ possible extremely non human-readable), use attributes directly decorate class data deserialized. like: class somedto { [position(0,12)] public string somestring { get; set; } [position(13, 20)] public int someint { get; set; } [position(21-25)] public bool somebool { get; set; } } and write deserializer picks type property directly , column position attribute. way, information deserializing kept in 1 place, reducing risks of typo errors.

ruby - Passing parameters to Rails partial -

Image
in rails 4.2.1 app have posts , comments (which nested within posts ): # config/routes.rb resources :posts resources :comments end i have following comments partial: # app/views/comments/_comment.html.erb <%= comment.body %> i'm trying render partial within posts view: # app/views/posts/show.html.erb <% @comments.each |comment| %> <%= render 'comments/comment', :locals => { :comment => comment } %> <% end %> the problem i'm getting undefined local variable or method "comment" error when trying render partial. i'm pretty new rails looks me passing comment variable partial correctly. missing obvious? thanks update i looking in wrong spot in documentation. see http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials either add in partial <%= render partial: 'comments/comment', :locals => { :comment => comment } %>

javascript - Run a function after DOM is updated from a helper function -

edit: this precisely want do: template.frameitems.helpers({ frames: function() { var trialid = session.get('trialid'); return frames.find({trialid: trialid}); // when new frames rendered, want call positionelements() } }); template.frameitems.onrendered(function() { this.autorun(function() { var trialid = session.get("trialid"); positionelements(); // problem: positionelements() called before dom updated `frames` helper function }) }); edit2: this second attempt doesn't work. var framedep = new tracker.dependency; template.frameitems.helpers({ frames: function() { var trialid = session.get('trialid'); framedep.changed(); return frames.find({trialid: trialid}); // when new frames rendered, want call positionelements() } }); template.frameitems.onrendered(function() { this.autorun(function() { framedep.depend(); positionelements

choosing from only one drop down box in php -

i have 2 list boxes , click on both of them create select query.i placed $post variable variable , placed these select query.this seems work fine,but problem arises when want select 1 of boxes example of ken davis's books or books adventure genre.it seems have chhose both boxes before result.can suggest way round this <html> <head> <title>my page</title> </head> <body> <br> <form name="myform" action="dropdown2.php" method="post"> <select name="author" size="4"> <option value="ken davies">ken davies</option> <option value= "arthur smith">arthur smith</option> <option value="gill rafferty">gill rafferty</option><br /> <option value="molly brown">molly brown</option><br /> <option value="gilbert riley">gilbert riley</option><br /> <input type = &

c++ - Why does this cpp program fail? -

note: while debugging, found until last line, program run normally, when going last bracket, mistake window pop up. i'm not quite familiar c++ couldn't locate problem. please help! #include <iostream> #include <fstream> #include <vector> using namespace std; class test { public: int x; void add_list(int); void display(); private: vector<int> list; }; void test::add_list(int op) { list.push_back(op); } void test::display() { cout << x << endl; (unsigned int i=0;i<list.size(); i++) cout << "->" << list[i]; cout << endl; } int main (void) { test test1; test1.x = 3; test1.add_list(2); test1.add_list(4); int size = sizeof (test1); ofstream fout ("data.dat", ios_base::binary); fout.write((char *)&test1, size); fout.close(); ifstream fin ("data.dat", ios_base::binary); test test2; fin

javascript - How can I assign a delegated jQuery event listener based on values in jQuery's data API? -

jquery treats data-attributes in interesting way , wherein retrieves values once , not observe changes or removals after point. modification of data achieved using jquery's various functions – $element.data('key', 'val') etc. such, muddies code things $element.prop('data-key', 'val') , $element.removeprop('data-key', 'val') because does not touch jquery data api, though reasonably appear these calls intended that. however, means of altering dom seems way use data-attributes delegated event listeners "the jquery way:" $element.on('click', '[data-key=val]', function(e) { // triggers on children of $element have dom attribute // data-attribute data-key, value of val }); data-attributes don't clog classnames etc , seem reasonable place put element attributes javascript usage. if write $element.find('div').data('key', 'val') , these elements not meet criteria when cli

javascript - Polymer 1.0- bind a event handler without having to make a custom element -

i have <div id="play-button-png" on-click="open-video"></div> in index.html. without making custom element, how can make event listener , bind in separate file? similar angular's controller, can bind element without having create directive. you use 'dom-bind'template (also known 'auto binding template') https://www.polymer-project.org/1.0/docs/devguide/templates.html#dom-bind <template is="dom-bind" id="app"> //document body <div id="play-button-png" on-click="openvideo"></div> </template> then add function templates scope var app = document.queryselector('#app'); app.openvideo = function () { // when clicked }; edit: need wait template bound before manipulating anything. wait 'dom-change' event app.addeventlistener('dom-change', function() { // auto-binding template ready. });

python - Output List Duplicating Values -

my function same_num takes values common both sorted lists , appends them onto 'result'. it's using recursion , 2 offsets, pos1 , pos2 set 0, compare values in list. when running function, works fine first time, if run function second time, original result appended answer got running initially. going wrong? result=[] def same_num(list1,list2,pos1,pos2): list1=sorted(list1) list2=sorted(list2) if pos1==len(list1) or pos2==len(list2): return result if list1[pos1]==list2[pos2]: result.append(list1[pos1]) return same_num(list1,list2,pos1+1,pos2+1) if list1[pos1]>list2[pos2]: return same_num(list1,list2,pos1,pos2+1) if list1[pos1]<list2[pos2]: return same_num(list1,list2,pos1+1,pos2) for example: same_num([3,1,2,4],[3,1,2,4,5,6],0,0)=>[1,2,3,4] rerunning previous example in shell produces: same_num([3,1,2,4],[3,1,2,4,5,6],0,0)=>[1, 2, 3, 4, 1, 2, 3, 4] when should still produce: [

php - Mysql - Many tables to come up with only 1 table for Login purposes -

example tables: employee, customer , contractor contractor table works same way employee , customer different field exclusive table purpose: create user table base logging-in. proposed user table user_id password user_type -------------------------------------------------------------------- employee1 123*89 employee employee2 0123 employee customer1 12378 customer customer2 1234 customer contractor1 45678 contractor employee table: id firstname lastname address -------------------------------------------------------------------- employee1 bon smith 123 north street ny employee2 john doe 245 south street ny customer table: id firstname lastname address -------------------------------------------------------------------- customer1 ron price 123 north street ny customer2 peter

python - AppleScript to process incoming emails in Mac Mail.app -

actually problem same this one , answer brought me forward. (summary: want python script running on every incoming email subject , extract data content.) anyways i'm complete newby applescript , cannot find solution giving content of triggering email parameter python script. and need pass html content of email. can point me right direction or bring light dark? thank much. my applescript looks @ moment , nothing happens although script should print email content now: using terms application "mail" on perform mail action messages themessages rule therule tell application "mail" repeat eachmessage in themessages set thecontent source of eachmessage shell script "python completepathtopyscript.py" & thecontent end repeat end tell end perform mail action messages end using terms then python script following testing: import sys email_data = str(sys.argv[1])

ruby - Is while loop a good practice for cronjob alternative -

i want run following task daemon (infinite loop) restart docker containers , tasks every 6:00 , 12:00 while true docker-compose docker exec ezuser_star_1 ruby star/star.rb& docker exec ezuser_tiger_1 ruby tiger/tiger.rb& busy_waiting_here except if 6:00 or 12:00 keep going docker-compose down end is there suggestion gurantte above job can run months or years ? i don't want cron i need application level cronjob-like library is there ruby dsl or library can let me kind_of job easier or robust. if looking ruby scheduler, rufus scheduler best 1 know about. https://github.com/jmettraux/rufus-scheduler

javascript - Update data using AJAX and codeigniter failed -

i want update data using codeigniter , ajax submit response.. this view <form id="form_update" action="<?php echo base_url() ?>admin/update_derap_info" method="post" role="form"> <textarea cols="80" id="editor1" name="isi" rows="10" class="form-control" > </textarea> <input type="submit" value="simpan" class="btn btn-sm btn-primary" name="update_info_pemesanan"> </form> my controller $data = array ( 'isi'=> ltrim(rtrim($this->input->post('isi'))) ); $this->info_derap->update($this->input->post('id_info'),$data); echo'<div class="alert alert-success">terimakasih, pesan anda sudah kami terima. pemberitahuan selanjutnya kami beritahunak lewat email.</div>'; exit; my model function upd

asp.net mvc - Ajax request with list of javascript objects failing -

Image
this question asked lot, none of answers worked me. i'm trying send list of objects controller in asp mvc 5. i'm josn.stringify 'ing list, , trying receive list. i sure hope it's not stupid typo i'm missing... well did find typo (funny how writing things down helps), isn't problem. ajax calling "sale" controller "sales". fixed it, still same problem. (added picture @ end). edit i changed ajax to: $('#complete-sale').on('click', function () { alert("in complete sale"); var itemsincart = json.stringify(shoppingcart.getitemsincart()); alert("itemsincart: " + itemsincart); $.ajax({ type: "get", url: "/sales/completesale", // method calling contenttype: "application/json; charset=utf-8", data: { 'itemsincart': itemsincart }, datatype: "json", success: function (result) { aler

c# - DNN TabController.GetPortalTabs returns different results when initial request comes from a browser or a standalone program -

i'm creating api access content dnn externally based on dnnapicontroller. 1 of endpoints supposed return pages user has access to. list of pages populated dotnetnuke.entities.tabs.tabcontroller.getportaltabs(portalsettings.portalid, -1, true, string.empty, true, false, true, true, false) this works fine when request originates browser or postman client, when callers standalone application (in case a test wpf application) results wrong. when called browser/postman, 10 tabs returned 5 when called wpf. any ideas whats going on? my guess inside getportaltabs function overload doing processing based on current user: usercontroller.instance.getcurrentuserinfo(). method looking @ httpcontext current user. uses current user filter out tabs user has no permission to. if calling external service, httpcontext.current null. therefore tabs may filtered tabs available user permission.

python - raise ConnectionError in python2.7 -

i want raise connectionerror ( a python 3 subclass ) when program fails connect local service. i'm using python2.7. testing out though, looks have import module working: >>> raise connectionerror("test") traceback (most recent call last): file "<stdin>", line 1, in <module> nameerror: name 'connectionerror' not defined how can raise type of exception? connectionerror not exist in python 2, can see the python 2 documentation . can of course create own subclass of oserror (and call connectionerror if want), no such thing built in.

ruby - Add Nokogiri parse result to variable -

i have xml document: <cred> <login>tove</login> <pass>jani</pass> </cred> my code is: require 'nokogiri' require 'selwet' context "parse xml" doc = nokogiri::xml(file.open("test.xml")) doc.xpath("cred/login").each |char_element| puts char_element.text end should "check" unit.go_to "http://www.ya.ru/" unit.click '.b-inline' unit.fill '[name="login"]', @login end when run test get: tove 0 but want insert parse result @login . how can variables parsing result? need insert login , pass values xml fields in web page? i'd use values: require 'nokogiri' doc = nokogiri::xml(<<eot) <cred> <login>tove</login> <pass>jani</pass> </cred> eot login = doc.at('login').text # => "tove" pass = doc.at('pass').text # => "jani" nokogiri makes easy

c++ - How to properly use IOpenServiceManager::InstallService -

im trying define new ie search engine, getting trouble whenever try install service. i walked through following example , changed name of files upload.xml: <opensearchdescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <shortname>web search</shortname> <description>use example.com search web.</description> <tags>example web</tags> <contact>admin@example.com</contact> <url type="application/rss+xml" template="http://example.com/?q={searchterms}&amp;pw={startpage?}&amp;format=rss"/> </opensearchdescription> home.html <html> <header> <link rel="search" type="application/opensearchdescription+xml" href="http://somesite.com/upload.xml" title="content search" /> </header> </html> links valid , work. c++: atl

java - Can't handle a SearchView on android -

i trying add , handle searchview in toolbar according second asnwer of topic how add search button on toolbar in material design however, have such mistake: error:(8) no resource identifier found attribute 'actionviewclass' in package 'com.example.user.mobinfouz' error:execution failed task ':app:processdebugresources'. com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\program files (x86)\android\android-sdk\build-tools\21.1.2\aapt.exe'' finished non-zero exit value 1 here's code of menu_main xml: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".mainactivity"> <item android:id="@+id/action_search" android:icon="@drawable/search_icon" android:title="@st

How to bold legend and axis in 3d scatter plot in Matlab -

i have 1 question. how bold legend , axis in 3d scatter plot in matlab? can me. thank you run after figure created, sets text elements of current figure bold: set(findall(gcf,'type','text'), 'fontweight','bold') it not 3d scatter specific , answered here well: changing fonts in matlab plots

c# convert image to byte array -

i loooking faster solution convert image byte array using regular method: public byte[] imagetobytearray(system.drawing.image imagein) { memorystream ms = new memorystream(); imagein.save(ms,system.drawing.imaging.imageformat.gif); return ms.toarray(); } so searched , found one public static byte[] bitmaptobytearray(bitmap bitmap) { bitmapdata bmpdata = bitmap.lockbits(new rectangle(0, 0, bitmap.width, bitmap.height), imagelockmode.readonly, bitmap.pixelformat); int numbytes = bmpdata.stride * bitmap.height; numbytes = math.abs(numbytes); byte[] bytedata = new byte[numbytes]; intptr ptr = bmpdata.scan0; marshal.copy(ptr, bytedata, 0, numbytes); bitmap.unlockbits(bmpdata); return bytedata; } this call: ` private void form1_load(object sender, eventargs e) { bitmap curr = getdesktopimage(); byte[] buff = bitmaptobytearray(curr); } than got expcetion

c# - Web Forms send text from textbox to method onChange event -

i'm new in web forms. need send text aspx page server method using onchange in textbox : email: <asp:textbox id="filteraccountstextbox" runat="server"/> may me? here are. after type on textbox2 , leave it. textbox2.text post server (based on autopostback attribute) update label1. aspx: <asp:textbox id="textbox2" runat="server" autopostback="true" ontextchanged="textbox2_textchanged"></asp:textbox> <asp:label id="label1" runat="server" text="you type: "></asp:label> cs: protected void textbox2_textchanged(object sender, eventargs e) { label1.text = "you type:" + textbox2.text; } hope help.

php - magento not reading JS directory -

i have added js files in /skin/frontend/default/mytheme/js and local.xml file in /app/design/frontend/default/mytheme/layout the code add js <reference name="head"> <!--css--> <action method="additem"><type>skin_css</type><name>css/slicknav.css</name><params/></action> <action method="additem"><type>skin_css</type><name>css/bootstrap.css</name><params/></action> <action method="additem"><type>skin_css</type><name>css/bootstrap-responsive.css</name><params/></action> <action method="additem"><type>skin_css</type><name>css/product-slider.css</name><params/></action> <action method="additem"><type>skin_css</type><name>css/fb_style.css</name><params/

hapijs - chaining request filters through plugins in hapi.js -

i need validate client-key jsonwebtoken header in requests hapi.js rest api. i using hapi-auth-jwt plugin handle json web tokens - , i'd put in handler checks valid client key in api header upstream - before of web token checks , else - can return 401 if valid client-api-key not included. should plugin in hapi? if how set order of plugins run - order register plugins? how set plugin intercept http requests - should make auth scheme? exports.register = function (server, options, next) { // somehow set default request handler here somehow? } you can register extension function available extension points in hapi request lifecycle. in case, since want request validated valid client-api-key before being authenticated, extension function can registered onrequest or onpreauth events. exports.register = function (server, options, next) { server.ext('onrequest', function (request, reply){ //validate request object here. if (vali

How to concatenate two arrays in Fortran 90 -

i have original array called pres_lev3d , size defined pres_lev3d(im*jm, levsi) , im*jm 72960 , levsi 64. corresponds global atmospheric data, size. array allocatable: real (kind=kind_io8), allocatable :: pres_lev3d(:, :) . have second array, press_1d , size defined in similar fashion pres_1d(im*jm, levsi) , in array levsi 1. i need concatenate both arrays (technically 2d , 1d array) array of shape (/72960, 65/) . in matlab seems simple process, however, can't seem find easy way go around in fortran 90. i have tried create third array pres_lev=(/pres_lev3d, pres_1d/) and tried use merge , none of these approaches seem work out. i new fortran. if i've followed explanation correctly work real(kind_io8), dimension(72960,65) :: out_array ... out_array(:,1:64) = pres_lev3d out_array(:,65) = pres_1d if that's not easy enough, or if i've misunderstood question, explain further. allocate out_array conform input arrays, try like

vba - Excel: If the above statement is true, then skip the next x number of lines (or go to that specific one) -

strong text good afternoon, i have spent few months on pretty lengthy macro project @ work , close end keep encountering errors, because macro has run on reports lot of data gaps (grrrr). so have list of if conditions. , macro runs them on each cell of column, before going next row. problem creates error (please see code below) dim degreecol integer degreecol = ws.rows(1).find("degree").column dim graddatecol integer graddatecol = ws.rows(1).find("graduation date (mm/dd/yyyy)").column dim bsgraddatecol integer bsgraddatecol = ws.rows(1).find("b.s. graduation date").column row = 2 endrow if ws.cells(row, graddatecol).value = "" ws.cells(row, bsgraddatecol).value = "no data" end if if ws.cells(row, degreecol).value = "" , ws.cells(row, graddatecol).value <> "" ws.cells(row, bsgraddatecol).value = ws.cells(row, graddatecol).value end if if ws.cells(row, degreec

javascript - How can I share data between controllers in an Angular app? -

Image
i have angular app using ui router nested ui-view containers. here, left sidebar part of parent ui-view, , right content area nested inside parent ui-view: i'm looking elegant solution sharing data between parent , child views. here considerations : i want avoid data becoming stale within cached angular app; $scope allegedly going away angular 2.0 in favor of controlleras. i'd reusable pattern minimize copy/paste code. here solutions i've thought of (and pointed out downsides), i'm not super happy any: share data via controlleras + $scope: productcontroller: var product = this; product.products = products.data; // array injected via resolve producteditcontroller: var productedit = this; productedit.product = product.data; // object injected via resolve productedit.save = function(product) { productservice.save(product); // update shared data. // downside: relies on $scope update parent. var editedproduct = _.find($scope

ios - How to populate this nsdictionary data onto the uitableview -

how populate nsdictionary data onto uitableview want - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath methods getting data out dict 2015-07-11 13:19:50.972 demo[1226:23659] { posts = ( { post = { id = 1; "school_id" = 1; subject = math; }; }, { post = { id = 2; "school_id" = 1; subject = science; }; }, { post = { id = 3; "school_id" = 1; subject = english; }; }, { post = { id = 5; "school_id" = 1; subject = hindi; }; }, { post = { id = 29; "school_id" = 1; subject = biology;

javascript - Call a function from outputted JS in HTML <script> tags -

here html: <div id="test-div"></div> <button class="a-button">click</button> here js/jquery: function parent() { alert("parent"); var output = ""; output += "<p>hello world</p>" output += "<script>$('.a-button').click(function() { parent(); });</script>" $("#test-div").html(output); } parent(); when run code , click on button class '.a-button' following error in console: uncaught typeerror: parent not function however, when rid of html/script output , put click event outside of parent function so: function parent() { alert("parent"); var output = ""; output += "<p>hello world</p>" //output += "<script>$('.a-button').click(function() { parent(); });</script>" $("#test-div").html(output); } parent(); $('

c# - Log request in ASP.NET Web Api -

i try log posted data in webapi when exception thrown. have try this: protected async override task<httpresponsemessage> sendasync(httprequestmessage request, cancellationtoken cancellationtoken) { if (request.content == null) return await base.sendasync(request, cancellationtoken); var body = await request.content.readasstringasync(); request.properties["body"] = body; return await base.sendasync(request, cancellationtoken); } and in error log method posted values in properties["body"] . but when users upload image when try files: this method or property not supported after httprequest.getbufferlessinputstream has been invoked. @ system.web.httprequest.get_files() how can store posted data(text) in property?

mysql - PHP is updating instead of inserting -

i creating page user fill report , report inserted database have below php page supposed insert new values table reports, updating instead <?php include 'connectionfile.php' ; $ref = $_post['ref']; $title =$_post['titl']; $type = $_post['type']; $content = $_post['content']; session_start(); $sql = "insert reports (reference, title,id_type, content) values ('".$ref."', '".$title."', '". $type."','".$content."');"; $result =mysqli_query($con,$sql ); ?> is because id_type (primary key of table type) foreign key -in table report- of value 1 , 2? because if insert id_type=1 example, id_report (primary key of table report) increments 1, same goes id_type=2 answer might clear,my knowledge in web development forgotten. with sql-query provided, no update possible. can make update on duplicate key , not in query. please note, not have , sh

Getting line of a search term - Python Script for Notepad++ -

i'm trying automate deleting of text on html code i'm editing on notepad++, i'm using plugin pythonscript that. have 1 problem: want delete, example, <center> except first one. thought use function: editor.rereplace("search", "replace"[, flags[, startposition[, endposition[, maxcount]]]]) since don't want delete first term, set startposition 1 line after 1 first term.the problem don't find scintilla function in python script locate text looking for. maybe research function find solution: editor.research(search, matchfunction[, flags[, startposition[, endposition[, maxcount]]]]) but can't find function associated .research me. matches = [] def match_found(m): # append match start position matches array matches.append(m.end(0)) editor.research('pattern', match_found) matches[0] #should contain index of *end* of first match m.end() since want use end of match start of next search

php - woocommerce update cart function refreshes page to the wrong domain -

im using woocommerce , have run problems update cart function. the cart can updated account quantity changes of items after pressing 'update cart' button page refreshes show wrong page, says "your cart empty." ex: click "update cart" button > alpha.example.com/cart what should do: click "update cart" button > businessname.com/cart this problem occurs because current domain not primary domain , redirect. current config installed on alpha.example.com redirects businessname.com, understanding should both same page, occurs empty cart page displayed. can update cart button link businessname.com/cart editing php? if more clarity needed feel free ask. thanks.

java - Getting the output of a subprocess that inherited parent's IO -

i having trouble getting output of subprocess. use process.getinputstream() . however, in case, set subprocess inherit parent's io. need because output subprocess exceeds buffer set kernel , hang. using linux btw. //creating named pipe file fifo = fifocreator.createfifopipe("fifo"); string[] command = new string[] {"cat", fifo.getabsolutepath()}; process = new processbuilder(command).inheritio().start(); //inherit io filewriter fw = new filewriter(fifo.getabsolutefile()); bufferedwriter bw = new bufferedwriter(fw); bw.write(boxstring); bw.close(); process.waitfor(); fifocreator.removefifopipe(fifo.tostring()); //gets nothing here stdinput = new bufferedreader(new inputstreamreader(process.getinputstream())); string input = readalllines(stdinput); ideally want keep in memory since want performance , less trash. is there way redirect output of subprocess data structure? if not, there way output? i t

x86 assembly: ADD/SUB/INC/DEC without overflow and branching -

in x86 asm, possible disallow overflowing when adding or subtracting without branching? example, when subtracting 0x02 0x01 set 0x00 rather 0xff. i expect may impossible, i'm interested in answer more restricted form of question 0x01 added/subtracted. had idea goes (of being overflow flag): dec eax add eax,of i don't know other architectures, i386 couldn't find opcodes since apparently flags can't interpreted integers , used in arithmetic operations. found solution work, lowest byte when higher byte unused: dec ax sub al,ah xor ah,ah is there better way this, maybe 1 that's applicable more general cases? you can use cmov ( conditional mov ) family of instructions on newer processors avoid branching in many cases, including example describe. these instructions behave regular mov if flag values set appropriately, or otherwise nothing. see http://www.jaist.ac.jp/iscenter-new/mpc/altix/altixdata/opt/intel/vtune/doc/users_guide/mergedprojects/a