Posts

Showing posts from August, 2011

code generation - GCC: assembly instruction lifecycle -

did ever meet description (article, tutorial) of how assembly instruction born , transformed in gcc? how (its ir predecessor, correct) appears during expand process, goes through rtl passes, becomes more , more target specific, etc. would grateful links! first, of gcc optimizations happens in middle-end, on gimple intermediate representations (i.e. optimization pass transforms gimple gimple). later, in back-end layer (at rtl level) assembler instructions generated. in fact, you'll better think in terms of gcc internal representations (mostly, gimple) in terms of assembly instruction lifecycle (nearly meaningless). you might compile -fdump-tree-all (and optimization flags, e.g. -o1 ) , might customize gcc melt (note: main author of melt). the indian gcc resource center contains lot of resources related gcc. my gcc melt documentation page contains many links , slides describing gcc internals. see this answer.

html - Bootstrap centering responsive img in container -

i want banner centered , logo above banner. can see both logo , banner , not centered. how can fix this? here live version: http://codepen.io/anon/pen/waybxb the html </head> <body> <!-- ============================== logo header ============================== --> <section> <div class="container"> <div class="row"> <div class="col-md-6"><img src="http://gvsfoundation.org/wp-content/uploads/2013/04/your-logo-here-27.png" class="logo"></div> <div class="col-md-6"></div> </div> </div> </section> <!--============================== sliding banneer ==============================--> <section class="banner "> <div class="container midtext"> <div class="col-md-12 text-cente

algorithm - segment overlapping regions into disjoint regions -

given set of closed regions [a,b] a , b integers need find set of regions cover same numbers disjoint. i suppose possible naively iterating through set several times, looking recommendation of algorithm this. please help. edit: to clarify, resulting regions cannot larger original ones, have come disjoint regions contained original ones. in other words, need split original regions on boundaries overlap. example: 3,8 1,4 7,9 11,14 result: 1,3 3,4 4,7 7,8 8,9 11,14 (this modification of answer posted earlier today deleted after discovered had logic error. later realized modify vincent van der weele's elegant idea of using parenthesis depth fix bug) on edit: modified able accept intervals of length 0 call interval [a,a] of length 0 essential if doesn't appear endpoint of interval of length > 0. example, in [1,3], [2,2], [3,3], [4,4] 0-length intervals [2,2] , [4,4] essential [3,3] isn't. inessential 0-length intervals redundant need not app

android - How to parse HTML table using jsoup? -

i trying parse html using jsoup. first time working jsoup , being little hard me. html table trying parse below. html table complicated because of many tr , td , don't know how proceed select name of each column in table 1: "group block" (table 0 topline , don't need it). i need select "bdd, bbgen, bbtest, conn, cpu, disk, files, hobbitd, http, info, memory, msgs, ports, procs, trends" set them in textview tag in xml file. possible using jsoup? i have i'm doing conexión url follows: string username = "user"; string password = "pass"; string login = username + ":" + password; string base64login = new string(android.util.base64.encode(login.getbytes(), android.util.base64.no_wrap)); document document = jsoup.connect("http://example.com").header("authorization", "basic " + base64login).get(); html code: <table summary="topline" width="100%"> <tr><td

sql - Run report based on a user's Sort on a Form -

Image
i have several reports populate off form below. add function when user uses column sort drop downs, reports @ visible records. so example report run while viewing window below return files customer named placeholder . is there simple way macro or query without resorting vba? this macro ended working well.

c# - Building a URL in HTML with Text Box Values -

i adding button website take user website , fill in various variables text boxes on site. here markup code html page: <body> <form id="form1" runat="server"> <div> <asp:label id="firstnamelabel" runat="server" text="first name:" width="100px"></asp:label> <asp:textbox id="firstnametxtbox" runat="server" width="150px"></asp:textbox> <br /> <asp:label id="lastnamelabel" runat="server" text="last name:" width="100px"></asp:label> <asp:textbox id="lastnametextbox" runat="server" width="150px"></asp:textbox> <br /> <asp:label id="emaillabel" runat="server" text="e-mail address:" width="100px"></asp:label> <asp:textbox id="emailtextbox" runat="serve

objective c - Calculate the next event from now given an NSDate in the past and a repeat interval -

how can calculate first date later date in past repeating interval? example: // date in past nsdate *pastdate = [nsdate my_datewithstring:@"11/09/2001"]; // time interval nstimeinterval repeatinterval = 14 * 24 * 60 * 60; // 2 weeks // current date nsdate *now = [nsdate date]; // 23/07/2015 // start calculating next date -> nsdate *nextdate = /* interval added past date */ // result later now? // no? calculate again // abracadabra nslog(@"nexdate = %@",nextdate); // 28/07/2015 i don't want use iterations. i'm concerned calculating case start date 1 year in past , repeat interval of day. here solution, has iterations. nsdatecomponents *twoweeksdatecomponents = [nsdatecomponents new]; twoweeksdatecomponents.weekofmonth = 2; nsdate *date = self.picker.date; nscalendar *calendar = [nscalendar currentcalendar]; nsdate *now = [nsdate date]; nsdate *nextdate = date; nscomparisonresult result = [nextdate compare:now]; while (resu

WebGL bufferSubData is not working when trying to set a point size during a mousemove event -

i want draw different point sizes during mousemove events using webgl. example, press mouse , draw points size of 1 pixel. select different size , when press mouse , move, can draw points new size. i discovered strange , appreciate feedback. i created array of point sizes: var pointsizes = new uint8array(2000); i added attribute shader point sizes: attribute float pointsize; the main function has: gl_pointsize = pointsize; if populate array size, works fine long not bind in mousemove event: for(var = 0; i<=1999; i++) {pointsizes[i] = 5.0;} //draw points of size 5 apointsizebuffer = gl.createbuffer(); gl.bindbuffer(gl.array_buffer, apointsizebuffer); gl.bufferdata(gl.array_buffer, pointsizes, gl.static_draw); apointsize = gl.getattriblocation(program, "pointsize"); gl.vertexattribpointer(apointsize, 1, gl.unsigned_byte, false, 0, 0); gl.enablevertexattribarray(apointsize); as bind buffer , set buffersubdata in mousemove event, no points shown

Does SQL Server 2014 evaluation copy provide SSIS -

i installed sql server 2014 express. doesn't have ssis, installed sql server 2014 evaluation. still don't see ssis. installing in wrong way or ssis come purchased sql server 2014 standard edition , above. i need load multiple flat files database can work on them together. express version comes without ssis. there not free version of ssis. need either sql server standard, developer, or enterprise edition access bids. if have visual studio can download sql server data tools , able create ssis projects if have visual studio 2013, download , install this: http://www.microsoft.com/en-us/download/details.aspx?id=42313

javascript - Unique containers per tweet - Twitterapi Jason Mayes -

the goal here place each tweet within own unique container. want break out of box , scatter feeds anywhere on site. here attempt @ this. although not work, gets overall goal across. again, using jason mayes twitter api. thank you var config5 = { "id": 'xxxxxxxxxxx', "domid": '', "maxtweets": 12, "enablelinks": true, "showuser": false, "showtime": true, "datefunction": '', "showretweet": false, "customcallback": handletweets, "showinteraction": false }; function handletweets(tweets) { // loop data. var items = []; var results; (i = 0; < tweets.length; i++) { var tweets = [i]; results = this({ item = tweets[i] }); items.push(results); } // insert tweets dom $("#twitter1").html(items.slice(0, 1)); $("#twitter2").html(items.slice(1, 2));

javascript - How to make Google stop logging user in automatically in PassportJS? -

Image
i allowing users log in domain name. specific functionality works , not root of problem. problem users stuck in sort of negative feedback loop when attempt log in incorrect email address. in reference picture above, user (in blank incognito page no information) starts @ step one. clicking login brings them step 2 , step 3. attempting log in email address ending incorrect domain brings them step 4. desired. after step four, if log out of website, presented step one. desirable. code logging out follows. app.get("/logout", function(req, res) { req.logout() req.session.destroy() res.clearcookie("connect.sid") res.redirect("/") }) what happens after click login again undesirable. instead of bringing them step 2 (desired, can log in again correct email address), brings them straight step four. if google remembering logged in last. here code passport.js configuration file . short question: how can signal google not this? or tr

java - modify return value of all getter methods -

i have java class contains fields setters , getters. this: public class test{ public string field1; public string field2; ... //setters , getters } i want logic before executing every getter method. in fact want method called before calling getter methods, return value of getter method, modify , set new value(without changing body of getter methods, if possible using custom annotation). example: test test = new test(); test.setfield1("field1"); test.setfield2("field2"); now, want when use test.getfield1() , 1 method called , change value of filed1 property. there anyway doing that? edit: ambrish , kayaman realize 1 possible way in spring mvc application aspectj . question is there anyway doing custom annotation? you can use aop library such aspectj define pointcuts getter methods. allow perform things before (and after) calling method.

regex - grep between two strings if pattern in the middle linux -

i want grep between 2 strings if there pattern between them. example, in text: first wanted string start, second end, , pattern 1 2 3 each in new line. start abc abc 1 2 3 abc end bla bla start abc abc 1 2 4 abc end bla bla start abc abc 1 2 3 abc abc end the result should be: start abc abc 1 2 3 abc end start abc abc 1 2 3 abc abc end thanks! sed -ne '/start/{:a;n;/end/!b a;/\n1\n2\n3\n/p}' line line: we need text starting 'start': sed -ne '/start/{ we found 'start', add 'end' pattern space; set label named 'a': :a add next line pattern space: n if not found 'end' - jump 'a' /end/!b now check if have desired pattern contain 1 2 3 , print they separated '\n' on separate lines /\n1\n2\n3\n/p }'

soap - Replace Anonymous Inner Class By Lambda. How does this work? -

while sending soap message, wanted add custom headers did below; jaxbelement<configurationresponse> jaxbelementresponse = (jaxbelement<configurationresponse>) getwebservicetemplate() .marshalsendandreceive(urltosend, new objectfactory().createconfigurationrequest(request), new webservicemessagecallback() { @override public void dowithmessage(webservicemessage message) throws ioexception, transformerexception { saajsoapmessage soapmessage = (saajsoapmessage) message; soapheaderelement id = soapmessage.getsoapheader().addheaderelement(new qname(uri, localpart, prefix)); id.settext(text); } }); but "netbeans" tell me

vba - Run-time error '50290': Application-defined or object-defined error Excel -

i've use asynchronous winhttp in excel vba shoot out lot of requests website. after reply received, module called writes sheet. generally works fine, if user not have focus on excel, error out "run-time error '50290': application-defined or object-defined error". it errors out on line: pcol = thisworkbook.worksheets("wha").cells.find("producta").column i tried following syntaxes well: pcol = sheet3.cells.find("producta").column pcol = sheet3.rows(5).find("producta").column pcol = sheet3.rows(5).find(what:="producta").column pcol = sheets("wha").cells.find(what:="producta", lookat:=xlwhole, lookafter:=sheet3.cells(5, 1)).column all no avail... i know can force focus on excel in vba,but ideally, don't mind if macro runs in background while user getting smarter on stackoverflow.com in mean time :-) does have suggestions on how overcome this, please? thanks! appactiv

javascript - How to pass data from Server to Client in Meteor -

i learning meteor , javascript. using npm package meta data of url on server side. works fine. undefined when passing result client. appreciate help. here code if (meteor.isclient) { meteor.call('getmetadata', "http://www.bbc.co.uk/news", function (err, data) { if (err) { console.log("error", err); }; console.log("meta data: " + data); //shows undefined }); } if (meteor.isserver) { meteor.startup(function () { var preview = meteor.npmrequire('page-previewer'); meteor.methods({ getmetadata: function (url) { preview(url, function (err, data) { if (!err) { console.log(data); //works fine return data; } }); } }) }); } you need convert preview function synchronous function,using future this, make function wa

android - Java regex with reserved chars -

this question has answer here: android - how replace part of string string? 5 answers i'm using pattern string this url = "http://mywebsite.com:1700/[lang]/service/?customerid=[customerid]"; i'm using code replace parameters. url.replace("[lang]", languagename); also tryied : url.replace("\\[lang\\]", languagename); but not worked. java strings immutable. replace() returns new string , need capture it: url = url.replace("[lang]", languagename);

javascript - How to inject AngularJS custom directives into a bootstrap pre-loaded modal? -

i new angular.js , after watching codeschool free course decided try different it. i trying use button to: inject angular custom directive existing bootstrap modal body; push json array angular controller directive; display bootstrap modal i created following files test: ** pictures-table.html: <p ng-hide="pictures.length">no pictures</p> <table ng-show="pictures.length"> <thead> <tr> <th>picture</th> <th>label</th> <th>remove</th> </tr> </thead> <tbody> <tr ng-repeat="apic in pictures"> <td><img ng-src="{{apic.pthumb}}"/></td> <td><input type='text' ng-model='apic.text'/></td> <td><button class="close" type="button"><span>&times;</span></button></td> </tr> </tbody> </table&g

ios - How to enable restkit logging in swift -

in ios can enable restkit logging with: rklogconfigurebyname("restkit/network*", rklogleveltrace); but, can't find solution same in swift here rklcl_configure_by_name("restkit/network", rklcl_vtrace.value); rklcl_configure_by_name("restkit/objectmapping", rklcl_voff.value);

pandas - ipython notebook startup file -

i have following startup in ~/.ipython/profile_default/startup location: import sys, os sys.path.append(os.environ["pythonpath"]) import pandas pd pd.set_option("display.max_columns", 999) pd.set_option("display.max_rows", 999) pd.set_option("precision", 5) now reason pythonpath working pandas display options not. recommend try troubleshoot issue? you can put following in ~/.ipython/profile_default/ipython_config.py file. automatically executes when start notebook in command line ipython notebook . options find useful: # configuration file ipython. c = get_config() c.interactiveshellapp.exec_lines = [ 'from __future__ import print_function, division', '%matplotlib inline', 'import sys, os', 'sys.path.append(os.environ[\'pythonpath\'])', 'os.chdir(\'path/to/your/working/dir\')', 'import pandas pd', 'import numpy np',

javascript - How do I make JS code not affect other DIV? -

hi try make list of item, have "add" , "minus" button each item. problem js code had control 2 items together. ex. if click "add" item1, item2 gets added well. looks js functions works button elements. when click "button" element, buttons triggered. how can add them individually? ps: guess need specific id js trigger. thought add unique item id each 1 , trigger button under specific id other buttons under other item id don't triggered. here html code: <div class="row bb"> <div class="col-xs-12 food-container"> <a href="#"><img src="img/1.png" class="min-w img-responsive" /></a> <div class="food-detail"> <div class="food-name">test</div> <div class="food-sales">test:233333</div> <div class="food-price"> ¥5

javascript - find specific property inside array of object -

i use following code , want find if path equal key try following loops without success,what doing wrong here? i need find if key exist https://jsfiddle.net/0ukl2jxh/ var obj = { "prov": [{ "save": { "key": "aaa", "method": "sa" }, "delete": { "key": "bbb", "method": "del" } }] }; var obj2 = { "prov": [{ "save": { "key": "ccc", "method": "sa" }, "delete": { "key": "ccc", "method": "del" } }] }; var myarray = []; myarray.push(obj); myarray.push(obj2); (var = 0; < myarray.length; i++) { var configobj = configs[i]; (var j = 0; configobj; j++) { var prov = configobj[j];

How to get this soap header and syntax in php -

i need achieve following <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ret="http://retailexpress.com.au/"> <soapenv:header> <ret:clientheader> <!--optional:--> <ret:clientid>9bf6dd42-35b9-46dd-948a-1c3c91906caa</ret:clientid> <!--optional:--> <ret:username>wsi</ret:username> <!--optional:--> <ret:password>wsipass</ret:password> </ret:clientheader> what get: <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://retailexpress.com.au/" xmlns:ns2="namespace"> <soap-env:header> <ns2:clientheader> <ns1:username>wsi</ns1:username> <ns1:password>wsipass</ns1:password> <ns1:clientid>9bf6dd42-35b9-46dd-948a-1c3c91906caa</ns1:clientid> </ns2:clientheader> </soap-env:header>

android - download a json data to a recyclerview into a fragment -

i have been working android application , using 2 tabs have created 1 fragment each , want display recyclerview fragments. problem is, when download json data server, data downloaded lost. can not see in recyclerview. have tried many times nothing happend. here code: this fragment: public class noticia extends fragment { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment view view = inflater.inflate(r.layout.noticia, container, false); recyclerview = (recyclerview) view.findviewbyid(r.id.noticiasrecyclerview); recyclerview.setlayoutmanager(new linearlayoutmanager(getactivity())); buscanoticia(); return view; } private void buscanoticia() { new noticiaasynctask().execute(); } class noticiaasynctask extends asynctask<string, string, string> { @override protected void onpreexecute(

Document index time boosting in solr via Apache Nutch -

i crawling websites using apache nutch. have give boost 1 website out of all. suppose out of 100 urls, there wiki url in seed. want give data wiki boot, should displayed @ top. using solr 4.10.3. i recrawl these websites after few days. think, index boot via solr not work, nutch should it. idea ?

css3 - Bootstrap navbar alighn menu items on main -

i looking way can align menu items in middle of navbar. i increased width of navbar move links middle of navbar. any or examples apreciated. here current navbar layout. <nav class="navbar navbar-inverse navbar-fixed-top bs-docs-nav" role="banner"> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" rel="home" href="index.php" title="logo"> <img src="images/logo.png"> </a> <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span>

ios - Trouble passing data between scenes when I segue -

i've done tutorials pass data through scenes prepareforsegue:sender: method, right when try use passed data, it's null. i'm using navigation controller well. here's .h - #import <uikit/uikit.h> #import "talkchattableviewcontroller.h" @interface createchattableviewcontroller : uiviewcontroller @end here's .m - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([[segue identifier] isequaltostring:@"idseguemychatstochat"]){ talkchattableviewcontroller *tctvc = [segue destinationviewcontroller]; tctvc.chatobjectid = @"test"; nslog(@"%@", tctvc.chatobjectid); //succesfully logs out test } } when log in above method, comes out fine. when go talkchattableviewcontroller class doesn't log out in viewdidload ; it's null. the header looks this: #import <uikit/uikit.h> @interface talkchattableviewcontroller

c# - Perform GC.Collect on another process -

i have application creates new processes in runtime , inside these processes appdomains. to monitor survived memory of appdomain need first perform gc.collect, when in process don't know how it. there way? thanks in advance. maybe there more direct way, here 1 works: make other app expose rpc endpoint can call initiate gc. example, use .net remoting open simple named pipe connected service. code surprisingly small.

regex - Remove surrounding text with regular expression -

i have code many functions, each containing own log entry. each log entry surrounded if statement. want remove if statement, leaving log entry, think can using regular expression find , replace. for example: if (log.isenabled()) { log.write("log message variable: %s ", var); } should replaced with: log.write("log message variable: %s", var); i've tried things along lines of if \(log.isenabled\(\)\) \{ (.*) } capture , group expression, haven't gotten work yet. is there expression can capture log entry in middle can find/replace instead of doing hand? thanks! if won't have internal curly braces (the { , }) can use like \{\s*(.*)\s*} ...which according https://regex101.com matches log.write("log message variable: %s ", var);

Android camera pre-start preview for faster camera use -

i using qrcodereaderview https://github.com/dlazaro66/qrcodereaderview implementing own qr code scanner , works camera still starts slow (3-4 seconds) , came idea pre start previewing camera before using (keeping camera open when focus on fragment has button start scanning opened right away when needed) , tried seems don't understand concept , still starts slow. here code qrcodereaderview: import com.google.zxing.binarybitmap; import com.google.zxing.checksumexception; import com.google.zxing.formatexception; import com.google.zxing.notfoundexception; import com.google.zxing.planaryuvluminancesource; import com.google.zxing.result; import com.google.zxing.resultpoint; import com.google.zxing.client.android.camera.open.cameramanager; import com.google.zxing.common.hybridbinarizer; import com.google.zxing.qrcode.qrcodereader; import java.io.ioexception; public class qrcodereaderview extends surfaceview implements surfaceholder.callback, camera.previewcallback { public i

c# - Handling Back Navigation Windows 10 (UWP) -

in xaml page i've got frame. i'm trying have backbutton event navigate inside frame . so tried use piece of code public mainpage(){ this.initializecomponent(); if(windows.foundation.metadata.apiinformation.istypepresent("windows.phone.ui.input.hardwarebuttons")) { windows.phone.ui.input.hardwarebuttons.backpressed += hardwarebuttons_backpressed; } } private void hardwarebuttons_backpressed(object sender,backpressedeventargs e) { if(insideframe.cangoback())insideframe.goback(); else application.current.exit(); } but in phone after doing hardwarebuttons_backpressed event close application. it seems running default button behavior on mainpage... how can fix it? , in windows10 add new events handle navigation? [update] now found out it's better use systemnavigationmanager in windows 10 instead of input.hardwarebuttons.backpressed . systemnavigationmanager currentview = systemnavigationmanager.getforcurrentview();