Posts

Showing posts from September, 2011

c# - Observable from chained Tasks -

i'm trying create observable each item produced via asynchronous task. next item should produced via async call on result of previous item (co-recursion). in "generate" parlance - except generate not support async (nor support delegate on initial state. var ob = observable.generate( async () => await producefirst(), // task<t> producefirst() prev => continue(prev) // bool continue(t); async prev => await producenext(prev) // task<t> producenext(t) item => item ); as more concrete example, peek messages servicebus queue fetching them 100 messages @ time, implement producefirst, continue , producenext follows: task<ienumerable<brokeredmessage>> producefirst() { const int batchsize = 100; return _servicebusreceiver.peekbatchasync(batchsize); } bool continue(ienumerable<brokeredmessage> prev) { return prev.any(); } async task<ienumerable<brokeredmessage>...

reference - Updating page numbers in VBA -

i have word document uses many different fields. wrote macro updates sequence , reference , page, , numpages fields in document. updating text fields reverts them default text don't want updated. this macro worked in word 2007 updated word 2013 , doesn't work anymore. all page , numpages fields set 1 when macro runs. yet when update them manually, update correctly. was there change how fields updated in office 2013? the macro code below. sub updateallfields() unprotectdocument 'updateallfields macro dim objdoc document dim objfld field 'updates specified form fields. can take while when document gets large set objdoc = activedocument each objfld in objdoc.fields if objfld.type = wdfieldref 'updates cross references objfld.update if objfld.type = wdfieldpage 'updates page numbers objfld.update elseif objfld.type = wdfieldnumpages 'updates total page count objfld.up...

angularjs - Call the one function daily on specific time in Ionic Application -

i want call angularjs function daily on specific time send sms @ background ionic application.i have googling on same not getting track achieve this. is possible cordova ionic based app, , how implement execute necessary code if app closed or open @ background? you can try cordova local-notification plugin alert everyday, time want. can handle notification in program , trigger process want run. can't programmatically send sms in ios. can try out sms gateways send sms.

c# - WebBrowser Control Slideshow Hanging after Running for Extended Time -

i'm new developer , 1 has me stumped. my winforms application slideshow websites rotates through list of urls, fading-in/out on each transition using second form "curtain". it's meant run indefinite period of time consistently hangs on transition after running couple of days. form1: httpwebresponse response = null; list<slide.doc> slist = null; bool repeatslideshow = true; bool pageloaded = false; double curtainanimstep = 0.05; int errorcount = 0; public form1() { initializecomponent(); cursorshown = false; this.visible = true; this.formborderstyle = formborderstyle.none; this.windowstate = formwindowstate.maximized; webbrowser1.scrollbarsenabled = false; webbrowser1.scripterrorssuppressed = true; slideshow(environment, channel); } public void slideshow(string environment, string channel) { while (repeatslideshow) { try { slist = slide.conver...

php - taking out only arithmatic operater in variable -

value -1 want take out - sign in variable how can this if want store "-" (minus) sign in separate variable, need use substr() function. <?php echo substr('-1', 0, 1); // result in "-" ?>

ios - No audio in video recording (using GPUImage) after initializing The Amazing Audio Engine -

i'm using 2 third party tools in project. 1 "the amazing audio engine" . use audio filters. other gpuimage, or more specifically, gpuimagemoviewriter . when record videos, merge audio recording video. works fine. however, not use amazing audio engine , record normal video using gpuimagemoviewriter. problem is, after initializing amazing audio engine, video has fraction of second of audio @ beginning, , audio gone. + (staudiomanager *)sharedmanager { static staudiomanager *manager = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ if (!manager) { manager = [[staudiomanager alloc] init]; manager.audiocontroller = [[aeaudiocontroller alloc] initwithaudiodescription:[aeaudiocontroller noninterleaved16bitstereoaudiodescription] inputenabled:yes]; manager.audiocontroller.preferredbufferduration = 0.005; manager.audiocontroller.voiceprocessingenabled = yes; manag...

mysql - Order by with more than 1 of lenght -

i'm getting weird results query: select id, nivel, tipo, titulo, texto, ativa quests_faq order nivel asc; the result should this: 5 10 15 20 40 50 55 etc.. instead, sorting first number: 10 15 2 30 40 5 55 etc my row "nivel" contains integers. how can use order in case purpose want? this query may looking converting nivel number select id, nivel, tipo, titulo, texto, ativa quests_faq order convert( nivel, integer) asc

(Solved) Pycharm 4.5.3 copy paste bug -

i'm on pycharm 4.5.3 on ubuntu . paste operations other applications pycharm works seems fail vice versa. within pycharm window simple ctrl+c , ctrl+v doesn't seem work. i have paste-from-history every-time , annoying. there know fix issue ? there alert regarding open jdk 7 after installing oracle jdk issue seem have been resolved.

XML to Python Class to C Struct -

i need advice. 2 questions, exist this, modules should use develop this. i have structures come xml file. want represent them in python classes (maybe using factory create class per structure). want these classes have function emit structure c struct. from research ctypes seems recommended thing use represent structures in python classes, don't see methods emit c stucts creation of header file. from op's comment think minimal solution set of helper functions instead of classes. xmltodict library makes easy turn xml data nested dictionaries, more or less json. set of helpers parse contents , generate appropriate c-struct strings that's needed. if can work dictionaries : { "name": "my_struct", "members": { [ "name": "intmember", "ctype": "int" }, { "name...

svn - Sonarqube 5.1.1 issue author is displayed but not the assignee -

i'm using sonarqube 5.1.1 java, pmd, ldap , svn plugins. using ant , jenkins building purposes. after sonarqube analysis can see issues displayed name of author in left-side. can search author , see issues author. but not automatically assigned. (i'm not using issue assign plugin because sonar source developers not compatible 5.* versions) there easy way this. highly appreciated. i've found groovy script purpose here . good?? thank you. i solved issue directions given in comments. by getting scm author name (on left side of sonarqube code view) , add exact name scm account. settings -> security -> users -> edit -> add scm account

c# - ObservableCollection Enumerator with filter -

i need filter out items observable collection. previously, ienumerable, doing: private ienumerable _mycollection {get; set;} public ienumerator<mytype> getenumerator() { var filteredtype = _mycolletion.where(t => t.myproperty.state != states.needsdelete); return filteredtype.getenumerator(); } system.collections.ienumerator system.collections.ienumerable.getenumerator() { return getenumerator(); } i'm using observablecollection . how implement same thing? edit (context): i'm keeping track of entities, working them in memory, , idea that, @ end, push these entities web service. each object in observable collection have state, such "needscreate", "needsdelete", "needsupdate" or unchanged. then, go through each of these states , call appropriate web service synchronize these changes. well observalbecollection inherit collection , on ienumerable. "exact same way" be: var collection = new observablecolle...

java - How to change the xml class name using fasterxml jackson? -

i trying figure out how change root node name using jackson fasterxml. for example: public class car { @jsonproperty("engine-type") string enginetype = "v8"; } public class ford extends car { } ford car = new ford(); objectmapper xmlmapper = new xmlmapper(); system.out.println(xmlmapper.writevalueasstring(this)); results in: <ford><engine-type>v8</engine-type></ford> this want: the root node named car. i want car lowercase in xml: for example: <car><engine-type>v8</engine-type></car> thanks i think find solution here: how deserialize xml annotations using fasterxml why don't use @jacksonxmlrootelement like: @jacksonxmlrootelement(localname = "car") public class ford extends car { }

asp.net mvc - How to create custom function on OData RESTier -

i'm referring http://odata.github.io/restier/#03-01-operations on how create custom method takes in input , return list of object. here's custom method [httpget] [odataroute("locations/pointloc.data.getlocationsbymarketid()")] public ihttpactionresult getlocationsbymarketid() { var database = new database(); var locations = database.locations.getalllocationsbymarket(1); return ok(locations); } and here's how set in dbdomain protected edmmodel onmodelextending(edmmodel model) { var ns = model.declarednamespaces.first(); var location = model.finddeclaredtype(ns + "." + "location"); var locations = edmcoremodel.getcollection(location.getedmtypereference(isnullable: false)); var getlocationswithmarketid = new edmfunction(ns, "getlocationswithmarketid", locations, true, null, false); getlocationswithmarketid.addparameter("bindingparameter", locations); model.addelement(getlocatio...

parsing - WordPress custom post type permalink structure with custom field value -

i trying modify url structure of custom post type 'project'. i url structure follows: http://localhost/project/%location%/project-name %location% custom field value associated post. so if had post called 'test' custom field value of 'seattle', url this: http://localhost/project/seattle/test i have semi completed following: function test_query_vars( $query_vars ) { $query_vars[] = 'location'; return $query_vars; } add_filter( 'query_vars', 'test_query_vars' ); function test_init() { $wp_rewrite->add_rewrite_tag( '%project%', '([^/]+)', 'project=' ); $wp_rewrite->add_rewrite_tag( '%location%', '([^/]+)', 'location=' ); $wp_rewrite->add_permastruct( 'project', 'project/%location%/%project%', false ); // register post type register_post_type( 'project', array( 'labels' => $labels, ...

linq - How to find maximum number of repeated string in a string in a list of string in c# -

if have list of strings, how can find list of strings have maximum number of repeated symbol using linq. list <string> mylist=new list <string>(); mylist.add("%1"); mylist.add("%136%250%3"); //s0 mylist.add("%1%5%20%1%10%50%8%3"); // s1 mylist.add("%4%255%20%1%14%50%8%4"); // s2 string symbol="%"; list <string> list_has_max_num_of_symbol= mylist.orderbydescending(s => s.length ==max_num_of(symbol)).tolist(); //the result should list of s1 + s2 since have **8** repeated '%' i tried var longest = mylist.where(s => s.length == mylist.max(m => m.length)) ; this gives me 1 string not both here's simple solution, not efficient. every element has count operation performed twice... list<string> mylist = new list<string>(); mylist.add("%1"); mylist.add("%136%250%3"); /...

javascript - Angular JS - set $cookies domain wide failed -

i've been having troubles setting cookies in angularjs app. situation want set cookies available site-wide, have no idea how set params cookies using angular js default $cookies object. for example, in javascript write this var exp = new date(); exp.settime(exp.gettime()+(24*60*60*1000)); // expires after day document.cookie = "mycookies=yes;expires="+exp.togmtstring()+ ";domain=.example.com;path=/"; but dom object can't loaded app easily, have use $cookies (angular-cookies.js). new code is: angular.module('myapp') .controller('myctrl', function ($scope, $filter, slug,public_routes, $cookies) { var mycookies = $cookies['mycookies']; if (typeof mycookies == 'undefined' || typeof mycookies == undefined) { $cookies['mycookies'] = "yes"; } }); but there's no way can set expiry date, path , domain not available $cookies. what should do? if yo...

dataset - How to modify the cells in a column in R -

Image
i working on dataset kaggle , here's parts of data set so delete time in "date" column, show "15-05-13" instead of "15-05-13 17:00". wondering how code this? i think should this: train$dates <- sub("15-05-13 17:00", "15-05-13", train$dates) but in way, it's going take me forever because data set huge... wendy, need is: train$date <- format(as.date(train$date,'%y-%m-%d'),'%y-%m-%d’) > train date 1 15-05-13 2 15-05-13 3 15-05-13

asp.net mvc - In MVC what extension should the view file names have? -

i have been given sample mvc project contains views extension .aspx when create new mvc project using vs2013 asp.net wizard views have extension .cshtml there 2 kinds of mvc project? in mvc extension should view file names have? .cshtml unless have reason not use razor view engine c#. are there 2 kinds of mvc project? the relevant answer there many more 2 different view engines . razor was introduce in 2010 . razor view engine comes out of box in visual studio mvc templates. see asp.net mvc view engine comparison more info on more obscure view engines work asp.net mvc.

can't get If else statement work in Powershell AD script -

the problem not script works perfect problem works on "administrator" , "guest" account, , that's don't want. created if else statement it's not working, maybe seeing fast doing wrong? what script? when locked in ad, creates html mail info (hostname, domain, username). this script: $dc = "dc1" $report= "c:\powershell\html.html" $name1 = "administrator", "guest" $log2 = "c:\powershell\temp.log" $html=@" <title>account locked out report</title> <style> body{background-color :#fffff} table{border-width:thin;border-style: solid;border-color:black;border-collapse: collapse;} th{border-width: 1px;padding: 1px;border-style: solid;border-color: black;background-color: threedshadow} td{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color: transparent} h2{color: #457dcf;font-family: arial, helvetica, sans-serif;font-size: medium; margin-left: 40px...

java - Spring component scan annotation and meta data -

i'm studying spring application, more particularly componentscan annotation scans java packages find classes annotated @component . i wondering if spring componentscan annotation stores related components found in other packages inside of meta-datas of main class (where have static void main method?) is place framework stores these informations? <context:component-scan base-package="com.mycompany.package" /> tells spring should on com.mycompany.package , find classes annotated following (not @component ): @controller @repository @service @component then spring register these classes bean factory. the spring ioc container consumes form of configuration metadata; configuration metadata represents how application developer tell spring container instantiate, configure, , assemble objects in application. configuration metada either xml configuration or java classes annotated @configuration that's spring stores config informa...

javascript - function got undefined. Basic program -

i new @ this. looked @ different examples still cannot figure wrong code index.html <html ng-app="main"> <head> <script src="angular.min.js"></script> <script src="app.js"></script> </head> <body ng-controller="maincontroller"> {{3 + 2}} </body> </html> app.js (function() { angular.module("main", []) .controller("maincontroller", maincontroller); var maincontroller = function($scope) { $scope.message = "hello angular!"; }; }()); 'maincontroller' got undefined because called before declare. solution: declare 'maincontroller' before call. (function() { var maincontroller = function($scope) { $scope.message = "hello angular!"; }; angular.module("main", []) .controller("maincontroller", maincontroller); }...

c++ - why memory leak when use circular reference in boost::shared_ptr -

in follow code memory leak happened, have doubt that. in test() fun: #include <string> #include <iostream> #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> class parent; class children; typedef boost::shared_ptr<parent> parent_ptr; typedef boost::shared_ptr<children> children_ptr; class parent { public: ~parent() { std::cout <<"destroying parent\n"; } public: children_ptr children; }; class children { public: ~children() { std::cout <<"destroying children\n"; } public: parent_ptr parent; }; void test() { parent_ptr father(new parent()); children_ptr son(new children); father->children = son;// parent_ptr_count=1, children_ptr_count=2 son->parent = father;// parent_ptr_count=2, children_ptr_count=2 //1,2,3 see note below } void main() { std::cout<<"begin test...\n"; test(); std::cout<<"end test.\n"; } // c...

java - How do I hide and unhide a link on a jsp page based on the value of another label on the same jsp using beans? -

how hide , unhide link on jsp page based on value of label on same jsp? you can still use expression language beans. <label for="...">${mybean.label}</label> <c:if test="${mybean.label eq ''}"> ... </c:if>

ruby on rails - ArgumentError: Unknown key: :conditions. Valid keys are: :class_name, :class, :foreign_key -

after trying rake:db migrate, got error in terminal rake aborted! argumenterror: unknown key: :conditions. valid keys are: :class_name, :class, :foreign_key, :validate, :autosave, :table_name, :before_add, :after_add, :before_remove, :after_remove, :extend, :primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type /app/models/user.rb:8:in `<class:user>' /app/models/user.rb:1:in `<top (required)>' /config/routes.rb:24:in `block in <top (required)>' /config/routes.rb:1:in `<top (required)>' /config/environment.rb:5:in `<top (required)>' tasks: top => db:migrate => environment (see full trace running task --trace) when run rails s, error in terminal exiting /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/core_ext/hash/keys.rb:75:in `block in assert_valid_keys': unknown key: :conditions. valid keys are: :class_name, :class, :foreig...

kbuild - How to add kernel args when compiling linux kernel? -

i followed intructions in this project , couldn't figure out how add "console=ttyama0,115200 panic=5" kernel args. knows how add kernel args? open defconfig vim ./arch/arm/configs/vexpress_defconfig change this config_cmdline="console=ttyama0" to this config_cmdline="console=ttyama0,115200 panic=5"

haskell - Importing a number of modules at once -

i have number of modules under same folder: /src/web/mylib/types/entity1.hs /src/web/mylib/types/entity2.hs /src/web/mylib/types/entity3.hs ... most of them require importing same modules such data.time, uuid , others. instead of importing models each of modules under /src/web/mylib/types/ , there way create 1 base module, say, /src/web/mylib/types/base.hs , import modules ( data.time, uuid, ... ) , import base entityx ? i've tried , failed. maybe did wrong. here's example, taken control.lens , achieves want: imports in base module , re-exports everything. module control.lens ( module control.lens.at , module control.lens.cons , module control.lens.each -- ... ) import control.lens.at import control.lens.cons import control.lens.each -- ...

arduino - Raspberry Pi to Ardunio Pro Micro Serial connections -

im connecting rpi ardunio pro micro board via serial tx/rx pins. first time im building circuits im little unsure volts , resistors , stuff. i following picture example http://blog.oscarliang.net/ctt/uploads/2013/05/arduino-raspberry-pi-serial-connect-schematics.jpg resistor set ardunio uno , not pro micro. people keep talking plugging in usb or not. im not connecting 3.3v or 5v gpio pins pi , power usb on ardunio , pi micro usb power socket. so want clarify before fry boards resistors , circuits in picture still work on ardunio pro micro (moving pins correct place on board) since arduino pro micro operates @ voltage level of 5v uno, it's serial connection uses 5v. means voltage divider circuit shown in link works pro micro. if want can math on own: vout = (r2/(r1+r2)) * vin vout input voltage @ rx pin of rpi vin output voltage of arduino @ tx pin r1 resistor near arduinos tx pin (1600 ohm) r2 resistor near rpis rx pin (3300 ohm) i hope helps :)

ios - How to add a cell to my Table View dynamically using a button -

i trying add cell table view button. have read , watched suggests have written should work, doesn't. suggestions? import uikit class rootviewcontroller: uitableviewcontroller, uitableviewdatasource, uitableviewdelegate { private var cellpointsize: cgfloat! private var albumslist: albumlist! private var albums:[album]! private let albumcell = "album" @iboutlet var mytableview: uitableview! override func viewdidload() { super.viewdidload() let preferredtableviewfont = uifont.preferredfontfortextstyle(uifonttextstyleheadline) cellpointsize = preferredtableviewfont.pointsize albumslist = albumlist.sharedalbumlist albums = albumslist.albums self.mytableview.datasource = self self.mytableview.delegate = self } override func viewwillappear(animated: bool) { super.viewwillappear(animated) tableview.reloaddata() } // mark: - table view data source override func tableview(tableview: uitableview, numberofrowsinsection section: int...

visual studio - Why am I getting "Invalid path for filesystem" when trying to commit in vs2013 using git? -

whenever try commit files in visual studio 2013 using git integration, keep getting error: an error occurred. detailed message: invalid path filesystem .../node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/got/node_modules/duplexify/node_modules/end-of-stream/node_modules/once/node_modules/wrappy/license': data area passed system call small. using git commandline / git gui works fine, not when trying use vs2013 itself. how can fix this? this known bug in vs2013. has been fixed, starting vs2013 update5. if install vs2013 update5, bug disappears, , can use visual studio commit & push.

C binary reaches 1.2G memory limit -

i dealing c program reads in file many lines of 60 characters each , allocates string in memory requesting more memory reads file in. after each malloc request, checks function oom() if request more memory successful. i have tested program increasingly larger input file, , oom() reports "out of memory" more or less when memory usage reaches 1.2g when looking @ top command while program running. on 64bit linux machine plenty more memory available. output file /my/binary/program : elf 64-bit lsb executable, x86-64, version 1 (sysv), dynamically linked (uses shared libs), gnu/linux 2.6.18, not stripped my question is: why reaching 1.2g limit? remember sysadmin used binaries able use 1.2g, coincidentally seeing here. when run qsub same execution on node of same 64bit linux sge grid reserving 50gb of memory, reports goes "out of memory" , following sge log memory footprint: max vmem = 2.313g any ideas why program reaching memory limit? ther...

PHP, linking variables to a specific date in a form -

how can assign variable specific date use in form? i want warning appear when user tries book many people on specific date. started writing code didn't know go there: <?php $spaces = 20; $num_people = get('#people'); $message = "unfortunately don't have many spaces avilable on date. have maximum of $spaces."; if($spaces < $num_people) { echo $message; } ?> how assign value $spaces specific date , link form? here form: <form method="post"> name:<br> <textarea id="name"></textarea><br> <br> date leaving:<br> <br> <textarea id="date"></textarea><br> <br> how many people?:<br> <textarea id="people"></textarea><br> <br> <input type="submit"> $num_people = get('#people'); this line should be $...

Convert clojure vector to flambo sql row -

i'm working on developing function convert vector sql row further convert data-frame , save table using sqlcontext in apache spark. i'm developing in clojure , got lost along way. thought of implementing solution thus: for each rdd (vector) convert rows convert rows data frame save data frame table use sqlcontext query particular information in table and how convert result query into rdd again further analysis. (defn assign-ecom [] (let [rdd-fields (-> (:rdd @transformed-rdd) (f/map #(sql/row->vec %)) f/collect)] (clojure.pprint/pprint rdd-fields))) i'm using flambo v0.60 api function abstracting apache-spark functions, welcome suggestion how go solving problem. here's link flambo row -> vec docs: flambo documentation: i assume have spark-context ( sc ) , sql-context ( sql-ctx ). first lets import stuff we'll need: (import org.apache.spark.sql.rowfactory) (import org.apache.spark...

javascript - jQuery slide toggle corresponding service item -

working on jquery slide toggle upon click of item in ul toggle down corresponding item in ul. i'm having trouble getting click linked id , toggling correct ul item. jquery is: $(document).ready(function() { //on click of subservices list item toggle down corresponding subservices item $(".subservices").find("li").hide().end() // hide other uls .click(function(e) { if (this == e.target) { // if handler element event originated $(this).children('ul.subserviceslist.subserviceitem').slidetoggle('fast'); } }); }); can :) fiddle here first, id of element must unique can't use same id subservices , subserviceslist . in below solution uses data-target attribute subservices . also need register handler .subserviceslist a element, not subserviceslist $(document).ready(function() { //on click of subservices list item toggle down corresponding subservices item $(".subservices > li"...

python - AttributeError: 'str' object has no attribute 'fileno' -

code: import subprocess def printit(): in range(6): j in range(6): query = "select rxpkts, txpkts ./log.csv datapath = "+str(i)+" , port = "+str(j) filename = str(i)+"_"+str(j)+".csv" open(filename, "w+"): p = subprocess.popen(["python", "q", "-h", "-d", ",", query], stdout=filename) printit() error: $ python processlog.py traceback (most recent call last): file "processlog.py", line 11, in <module> printit() file "processlog.py", line 9, in printit p = subprocess.popen(["python", "q", "-h", "-d", ",", query], stdout=filename) file "/usr/lib/python2.7/subprocess.py", line 702, in __init__ errread, errwrite), to_close = self._get_handles(stdin, stdout, stderr) file "/usr/lib/python2.7/subprocess.py"...

ios - Vote implementation in parse -

Image
i stuck long time. trying implement vote feature in collection view. if user taps button adds 1 vote parse , shows on label. code when parse dashboard see new row create , number of votes not going post my code cell import uikit import parseui import parse var votes = [pfobject]() class newcollectionviewcell: uicollectionviewcell { var parseobject = pfobject(classname: "posts") @iboutlet weak var postsimageview: pfimageview! @iboutlet weak var postslabel: uilabel! @iboutlet weak var voteslabel:uilabel? override func awakefromnib() { super.awakefromnib() // initialization code postslabel.textalignment = nstextalignment.center print("passing11") } @ibaction func vote(sender: anyobject) { if let votes = parseobject.objectforkey("votes") as? int { parseobject.setobject(votes + 1, forkey: "votes") parseobject.saveinbackg...

assembly - relocation error while linking an object file using alink which is of win32 format created using nasm assembler -

i using nasm assemble xyz.asm file xyz.obj using command : nasm -f win32 xyz.asm linking using alink gives relocation error. please me fix problem. unfortunately, can't give "tested" code call gcd sample in windows (won't windows). might little this, not close enough work. ; nasm -f win32 callgcd.asm ; alink -ope -entry _main callgcd.obj gcdi.obj win32.lib global _main extern _scanf extern _printf extern exitprocess extern xyz ; that's called section .data fmt db "%i", 0 section .bss number1 resd 1 number2 resd 1 section .text _main: push number1 push fmt call _scanf add esp 4 * 2 push number2 push fmt call _scanf add esp, 4 * 2 push dword [number1] push dword [number2] call xyz add esp, 4 * 2 push eax push fmt call _printf add esp, 4 * 2 push 0 call exitprocess perhaps windows user can give better.

c# - unity OnTriggerStay2D() for two triggers -

i using unity 5 c# , have gameobject 2 trigger colliders 1 of them in different location. need able use ontriggerstay2d , ontriggerenter2d them need find trigger being entered. right if enter 1st(polygon) trigger ontriggerenter activates 2nd(box). how can tell 2 colliders apart??? public void ontriggerenter2d(collider2d other) //2nd collider trigger { if (other.tag == "player") { found = true; //if player in shooting range idle = false; } } public void ontriggerstay2d(collider2d other) //1st collider trigger { if (found != true) { if (other.tag == "player") { shield = true; idle = false; } } } public void ontriggerexit2d(collider2d other) //2nd collider trigger { if (other.tag == "player") { found = false; shield = false; shooting = false; idle = true; } } i have tried making 1st trigger public void ontriggerstay...

string - How to enclose text within [cdata]...[!cdata] using PHP? -

i'm getting text in variable follows: $text = 'this code snippet'; now want enclose above text within [cdata]...[!cdata]. the output of echo $text should below: [cdata]this code snippet[!cdata] how should this? thanks. try $text = 'this code snippet'; $text = '[cdata]'.$text.'[!cdata]'; echo $text;

Where to put javascript files in the Phoenix framework -

so have file foo.js contains following: $( document ).ready(function() { alert("hello world"); }); and if put web/static/js folder doesn't executed, if put web/static/vendor folder does, wonder why doesn't work js folder? , should put js files? vendor folder doesn't seem right place ... as phoenixframework using bruch.io default. in default configuration. there 2 javascript folders web/static/js web/static/vendor when add .js files under /web/static/vendor these files put in non wrapped codebase. these files undergo concatinations , other processes , brunch.io other js files (which include files under web/static/js) , put in priv/static/js/app.js when add .js files under web/static/js these files content put in wrapped codebase , these file undergo concatination other brunch.io processes mentioned. reference these file need use require() require first can use it. i hope understand reasons here. researched https://github.com/brunch...

google analytics - Calculating number of sessions with a certain pagePath -

i trying calculate number of sessions having 1 specific page path @ least 1 of hits within session ("my-path"). need assure not match example "my-path-2" match "my-path/something", using following expression: nth(1,split(nth(1,split(hits.page.pagepath,'/')),'?')) the complete query yields incorrect results , following: select date, hostname, pagepath, exact_count_distinct(id) sumvisits ( select date, hits.page.hostname hostname, id, pagepath ( select (nth(1,split(nth(1,split(hits.page.pagepath,'/')),'?'))) within record pagepath, date, hits.page.hostname, hits.type, concat(fullvisitorid, string(visitid)) id [my-table] having pagepath ="my-path" ) ) group date, pagepath, hostname what doing wrong? query works using contains (selecting much) not using nth , split functions. did try: nth(2,split(nth(2,split(hits.p...

php - Mocking Laravel controller dependency -

in laravel app have controller method show particular resource. e.g. url /widgets/26 controller method might work so: class widgetscontroller { protected $widgets; public function __construct(widgetsrepository $widgets) { $this->widgets = $widgets; } public function show($id) { $widget = $this->widgets->find($id); return view('widgets.show')->with(compact('widget')); } } as can see widgetscontroller has widgetsrepository dependency. in unit test show method, how can mock dependency don't have call repository , instead return hard-coded widget ? unit test start: function test_it_shows_a_single_widget() { // how can tell widgetscontroller instaniated mocked widgetrepository? $response = $this->action('get', 'widgetscontroller@show', ['id' => 1]); // somehow mock call repository's `find()` method , give hard-coded return value // continu...

sql server - Ensuring no duplicates without unique constraint -

is possible ensure column doesn't contain duplicate values without using unique constraint (don't want go in reasons why being avoided) on column? in particular thinking of race conditions. for sake of simplicity let's column in question of type nvarchar(50) (does type matter?) it possible trigger, condition if not exists(... before insert. in fact unique constraint fastest. another option create unique index on column , supposed faster trigger , condition. if don't want add unique constraint existing table, can create additional table field nvarchar (50) , unique constraint on it. , insert value of field in new table before insert in main table in transaction (inside insert statement or in trigger).

java - How to access file inside maven shaded jar -

i'm using maven shade make shaded .jar file jetty project. project includes resource files (text property files) i'd read. how access files inside said .jar file? the current folder structure inside jar when viewed file extraction tool following: -com -some -domain -accessfilefromhere.class -fileiwanttoaccess.sql i want access files in combined jar files root named fileiwanttoaccess.sql . want access file java class accessfilefromhere.class created accessfilefromhere.java . the question asked here accessing jar file: access file in jar file? can't used not using shaded jar file. a jar jar. classloader doesn't make difference how jar created, either or without shading, maven, ant, etc... "access file in jar file" contains correct answer.

if statement - If else condition not working on button click in Android -

if don't use condition on click call activity works, when use condition not responding, neither calling if section nor else : btnupload.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // uploading file server try { strgetname = pref.getstring("key_name", null); strgetemail = pref.getstring("key_email", null); if (strgetemail.equals("")&&strgetname.equals("")) { toast.maketext(uploadactivity.this, "please create account first", toast.length_short).show(); intent intent = new intent(uploadactivity.this, basicactivity.class); startactivity(intent); } else { new uploadfiletoserver().execute(); } } catch (exception e) { /...