Posts

Showing posts from August, 2010

Wordpress - customized pages with blocks - prohibit google seo index of blocks -

i'm using wordpress , woocommerce online shop. theme i'm using can customize product-category pages adding "blocks". so if want have text on top of product category page create block page, lets called "category-info". can customize block normal wordpress page. block availabe under http://example.com/block/category-info/ - nobody access block site self because block gets integrated in product category page. finally can fill in name of block in product category settings , after content of block shown on product category page. my question should in order avoid google , other search engines index "block pages" itself? should deny access in robots.txt or xml sitemap ect? it's important content of block, can see on product-category page - still gets indexed , crawled google - direct link stand-alone block page should removed. thank in advance noindex tags useful. https://support.google.com/webmasters/answer/93710?hl=en

node.js - Sails doesn't start if hook use domain -

i create sails.js server can use third party code on hook initialization. want use domain catch error safely when error occurred, error catch correctly sails server doesn't start error : error: error: hook `myhook` taking long load. make sure triggering `initialize()` callback, or else set `sails.config.plugins._hooktimeout higher value (currently 20000) @ toolong [as _ontimeout] (/.../node_modules/sails/lib/app/private/loadhooks.js:92:21) @ timer.listontimeout (timers.js:110:15) { [error: hook `plugins` taking long load. make sure triggering `initialize()` callback, or else set `sails.config.plugins._hooktimeout higher value (currently 20000)] code: 'e_hook_timeout' } here hook code : module.exports = function (sails) { return { initialize : function (next) { var scope = this; sails.after(["hook:services:loaded", "hook:orm:loaded"], function () { scope.loadplugins(next); }); }, load...

ruby on rails - How to call controller from ajax -

i have graph (based on d3) in rails app. users click on graph , i'm hoping click result in showing page in rails app based on name passed show action or users controller. problem keep on getting response: activerecord::recordnotfound in userscontroller#show which because inadverntently passing parameters {"id"=>"show"} which dont know how correct. the ajax call (with bit of javascript d3.js name from) is: var node = svg.selectall(".node") .data(graph.nodes) .enter().append("circle") .attr("class", "node") .attr("r", function(d) { return d.group * 3; }) .style("fill", function(d) { return color(d.group); }) .call(force.drag) // .on('click', connectednodes) .on("click", function(d) { getprofile(d.name); }); // function getprofile(name){ // console.log(name); // }; function getprofile(d){ $.a...

oauth 2.0 - Moxtra authorization to generate acces_token fails -

i trying embedded moxtra chat functionality app. for followed steps mentioned oauth 2 authentication moxtra developer site i able registered app in moxtra , in response got clientid , secret key it. but when follow step 1) begin authorization & request access token (client-side (implicit) flow section in above link), lands me page, says below oauth2 error there problem oauth2 protocol (error="invalid_request", error_description="invalid_client") please go client application , try again, or contact owner , ask support point note : following format of uri using access_token. https://api.moxtra.com/oauth/authorize?client_id=123&response_type=token instead of 123 (this e:g) cliendid (trust me entering correct clientid). , have not used request_uri, because document states optional parameter. please correct me if wrong above , let me know if required more information. could please me rid of , me generate access_token. can move onto next step. ...

rx java - Error handling for zipped observables -

my use case is: list of permalinks, , need issue 2 rest requests per permalink data in parts. when both requests back, want merge info , (here - print out). want code using zip operator. here current code (together mocks library i'm using): public class main { public static void main(string[] args) { contentmanager cm = new contentmanager(); observable .from(cm.getpermalinks(10)) .flatmap(permalink -> observable.zip( observable.<content>create(subscriber -> cm.getdatabypermalink(permalink, new subscribingrestcallback(subscriber))), observable.<content>create(subscriber -> cm.getstreambypermalink(permalink, new subscribingrestcallback(subscriber))), (datacontent, streamurlcontent) -> { if (datacontent == null || streamurlcontent == null) { system.err.println("not z...

Unknow Provider with AngularJS -

i trying request jason file angularjs.i using yeoman. these 3 files. in view folder:main.html <div class="jumbotron"> choose category1 <div class="wrap" ng-controller="mainctrl"> <select ng-model="selectedvalue" ng-change="loaddata()" > <option value="1">category 1</option> <option value="2">category 2</option> <option value="3">category 3</option> <option value="4">category 4</option> <option value="5">category 5</option> </select> <div ng-show="selectedvalue != null" class="main"> <center><h2>results category {{ selectedvalue }}</h2></center> <br><br> </div> <div class="main" > <ul class="cloudlist"> <li class="service" ng-repeat="item in services...

cocoa - Using autolayout, how can I center a subview in an NSSplitView without forcing the width NSSplitView to be static? -

Image
i have nssplitview content in both nsviews. left nsview has 2 constraints – equal widths , equal heights . right nsview has simple, nstextfield, centered via constraints center x alignment , center y alighment . hoped resize window and/or nssplitview divider: this what's happening: i've tried great deal of configuration changes, i've tried using nssplitviewcontroller vs dropping nssplitview nsviewcontroller adjust more parameters programmatically, i'm not having luck. whenever resizing window, left view takes on excess space. same happens divider (it can resized, letting go of mouse button causes snap right back). seems there's fundamental i'm missing here. the text field's content hugging priority higher split view item's holding priority. fix , view should work way expect. also, if, when resize view, left view resizing window while right view stays same size, suggests left view's holding priority may higher right's. sho...

java - How to add xmlbean document element to soap header spring-ws -

i trying hit webservice using spring-ws, webservice producer requires custom element in soap header. new webservices, , having trouble trying inject values soap header. using xmlbeans transform xsd java , marshaling , unmarshaling. have constructed xmlbean document , set values custom header element, need document or maybe element attached document injected soap header. listed below wsdl (just header) in soapui (what used learn , initial testing) <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.ups.com/xmlschema/xoltws/upss/v1.0" xmlns:v11="http://www.ups.com/xmlschema/xoltws/rate/v1.1" xmlns:v12="http://www.ups.com/xmlschema/xoltws/common/v1.0"> <soapenv:header> <v1:upssecurity> <v1:usernametoken> <v1:username>name</v1:username> <v1:password>password</v1:password> </v1:usernametoken> ...

django - Where in database does python-social-auth store access token? -

i using python-social-auth (within django) implement facebook-login. able sign app using facebook , extract user email. in database can find oauth token generated facebook? in password field in user table? it's in usersocialauth extra_data field jsonfield. example of value stored: {"expires": "5184000", "id": "00000000000000000", "access_token": "the-token-value"}

I need help about java.lang.IndexOutOfBoundsException - ArrayList -

i'm doing project guitar hero clone. when running game (just concept) error occurred: java.lang.indexoutofboundsexception . package tapnstrum2; import java.awt.*; import java.awt.event.*; import java.io.filenotfoundexception; import java.util.arraylist; import javax.swing.*; public class string1 extends jframe implements actionlistener { image s1; gnode g; playig p; int m =0; public string1(){ imageicon s1i = new imageicon("d:\\javaproject\\graphic-library\\buttons\\string01.png"); s1 = s1i.getimage(); } public image getimage(){ return s1; } public void keypressed(keyevent e) throws filenotfoundexception, interruptedexception{ arraylist gnodes = p.getgnodes(); gnode gn = (gnode) gnodes.get(m); int key = e.getkeycode(); imageicon s1iexact = new imageicon("d:\\javaproject\\graphic-library\\buttons\\string01_exact.png"); imageicon s1imissed = new imageicon("d:\\javaproject\\graphic-library\\buttons\\string01_missed.png...

Remote chunking with Spring Batch job distribution -

i have technical issue running spring batch jobs. job reading records db (mongodb) , making calculations on record (aggregations) , writing record result table. reading , processing , writing record b b aggregations of many records of a. want use remote chunking vertically scaling system causing processing part scaled , quick. problem face need synchronize records processing them not conflict when writing result b. if distribute 10 records 4 slaves conflict when writing aggregate result b . any idea , how add synchronizing policy when sending messages master slaves ? thanks in advance ... if need synchronize data you're describing, i'd recommend not going remote chunking , using partitioning instead. allow partition , eliminate synchronization issues you're facing. provide additional throughput you'd running 1 processor per slave (same in remote chunking).

Android inflated layout alignment -

i have relativelayout aligning right. if display layout setcontentview works fine if try display inflated view, it's not aligned right anymore. know if fixed? thanks. edit: the xml simple, have relativelayout padding. using android:layout_gravity="top|right" . if display whole layout setcontentview(), relativelayout aligned, when try following code alignment breaks: inflater = layoutinflater.from(mainactivity.this); view inflated = inflater.inflate(r.layout.layout, null); relativelayout layout = (relativelayout)findviewbyid(r.id.layout); layout.addview(inflated); i doing because want able add inflated view multiple times. it hard see without xml when call inflate should pass root view otherwise layout parameters specify in xml layout lost. try this, maybe? inflater = layoutinflater.from(mainactivity.this); relativelayout layout = (relativelayout)findviewbyid(r.id.layout); view inflated = inflater.inflate(r.layout.layout, layout, false); layo...

multithreading - How to send message (in C) from one thread to another? -

i'm trying send message 1 thread another. each thread knows thread id of other. how can send message between them? i've seen proposed solutions (message queue, anonymous pipe, etc.) didn't them work. didn't understand previous descriptions enough, hence topic. so sum up, shortest possible way send, let's message "hello!" thread thread, make 2nd thread show on stderr, , send 1st thread message 'hello back!'. it's easy , didn't job of researching, i've been stuck time now, , can't find decent way this. an example, it's pretty simple — first make pipe pipe() . it creates 2 file descriptor — 1 reading, , second writing. here calling 2 times have both read , write sides. calling fork (that makes second thread) , , write/read messages through pipes created. #include <poll.h> #include <stdio.h> #include <string.h> #include <unistd.h> int wait_n_read(int fd, char* buf, int szbuf) { stru...

Javascript key down only firing once when key is held down -

this question has answer here: how can avoid autorepeated keydown events in javascript? 4 answers i'm using following code load page whenever w,s,a,d keys pressed. <script> document.addeventlistener('keydown', function(e){ e = e || window.event; key = e.keycode || e.charcode; var keys = { 87: '{$up}', 68: '{$right}', 83: '{$down}', 65: '{$left}' }; if (keys[key]) window.location.href = keys[key]; }); </script> the php variables contain url address. my question is, possible have keypress register once per click? @ moment if hold key down fires rapidly. thanks tips. try 'keyup' event: <script> document.addeventlistener('keyup', function(e){ e = e || window.event; key = e.keycode || e.charcode; var keys = { 87: '{$up}', 68: '{$right}', 83...

ios - Navbar colour doesn't look right -

i've set navbar white or atleast tried to. however, hasn't come out looking white seems. here's bit of code set it. - (void)viewdidload { [super viewdidload]; [self addsidebarnavbutton]; // set navbar [self setedgesforextendedlayout:uirectedgenone]; uilabel *nav_titlelbl=[[uilabel alloc]initwithframe:cgrectmake(0, 0, self.navigationitem.titleview.frame.size.width,40)]; nav_titlelbl.text=@""; nav_titlelbl.textalignment=nstextalignmentcenter; uifont *lblfont=[uifont fontwithname:@"futura-medium" size:20]; [nav_titlelbl setfont:lblfont]; self.navigationitem.titleview=nav_titlelbl; // set navbar colour self.navigationcontroller.navigationbar.bartintcolor = [uicolor colorwithred:255.0/255.0f green:255.0/255.0f blue:255.0/255.0f alpha:1.0]; self.navigationcontroller.navigationbar.translucent = yes; unfortunately can't attach navba...

php - Disable "Add to Cart" button if the user already purchased that item from the Database -

i have been working on issue past couple days , it's been driving me nuts, thought bring question @ hand here. please note still learning php :) practice project. i creating mockup registration page users of registration page can signup, purchase items, , see others purchased item (this intentional). current issue want disable user purchasing item purchased disabling "add cart" button if item user exists in database already. basically, buyer can purchase 1 item database , when try purchase 1 going store, "add cart" button disabled them. note: when made (about 2 months ago) using mysql learning mysqli started (very slowly) converting it. database file has both connections mysql , mysqli it, allowed me utilize both @ same time learned , went along. <?php session_start(); // starts session carry variables include_once('this sql file goes. removed it'); //connects page database /* verifies user logged in, if not redirect them index.php */ if($l...

Is this the right way to list data from table1 via a key in table 2? (SQL) -

i'm complete beginner databases , sql , i've been smashing head against wall while question. i've tried looking answer before posting find more complex questions answers didn't apply me. apologize if chance answered , missed it. task: list names , last-names of workers work in marketing. table1(workers) table2(departments) id last-name name department# department# department-name 1 ... ... 2 2 marketing 2 ... ... 5 5 ... 3 ... ... 8 8 ... 4 ... ... 6 6 ... this wrote: select name, last-name workers, departments departments.department# = workers.department# , departments.department-name = "marketing" is correct way write query in instance or "departments" in second line of q...

sql server - Sql querying same table for overlapping dates -

i'm trying write query overlap in date range reported. i able several queries, , loops, wondered if made more efficient 1 query, table joins itself. the table structure is: create table [dbo].[rentals]( [id] [int] identity(1,1) not null, [room_id] [int] not null, [check_in] [datetime] not null, [check_out] [datetime] not null, [customer_ref] [bigint] null) so given same room_id, want able query if other booking same room_id falls between check_in , check_out of booking same room_id (to avoid double bookings). i have use normal code, rather linq due existing project. this have far, appears returning records: select r1.id, r1.room_id, r1.check_in, r1.check_out,r1.customer_ref tblrental r1 inner join tblrental r2 on r1.room_id = r2.room_id , r1.check_in < r2.check_out , r1.check_out > r2.check_in can refine query return records room_id same, , there overlap? thanks...

javascript - Can I locally remove table cells on a website using the Firebug console? -

context: trying choose university course list provided via table search engine. search engine recognises suffixes if there prefix, i.e. cosc3 or cosc350 . 3 or 350 not return results. what know if possible use firefox's firebug parse console command remove table rows don't contain 100-level paper. pseudocode: string regex = [a-z]{4}; each(tr) { each(td) { if(!td.contains(regex + "1") { tr.delete(); } } } my pseudocode pretty ineffective designed give general idea do. yes, it's possible. the general idea outlined in pseudo-code. tricky thing note when operating on "live" htmlcollection, can't loop them arrays. // rows var table = document.getelementbyid('my-table'); var trs = table.getelementsbytagname("tr"); // go through each row var = 0; while (i < trs.length) { var tds = trs[i].getelementsbytagname("td"); var deleted = false; /...

ruby - Jekyll - How can I make avoid a paragraph to be added on a YAML frontmatter markdownify item -

okay... have project i'm using jekyll podcast project. , chose list hosts in shownotes yaml front matter item: hosts: - name - name b - name c using piece of code <li> <strong>hosts:</strong> <ul> {% host in page.hosts %} <li>{{ host }} {% endfor %} </ul> i receive correct list <ul> <li> <strong>hosts:</strong> <ul> <li>name </li> <li>name b </li> <li>name c </li> </ul> </ul> however, want markdownify doing <li> <strong>hosts:</strong> <ul> {% host in page.hosts %} <li>{{ host | markdownify }} {% endfor %} </ul> but jekyll returns: <ul> <li> <strong>hosts:</strong> <ul> <li><p>name </p></li> <li><p>name b </p></li> <li><p>name c </p></li> </ul> </ul> any way forbid jekyll a...

c# - MVC5 JSON parsing -

i have json 3rd party system (so can't change json). trying parse list of methoditems, items collection null . using built-in mvc 5 json deserializer in controller action. missing. { "method": { "name": "getitems", "items": { "item 1": { "name": "myitem", "value": "toothbrush" }, "item 2": { "name": "my item 2", "value": "razor" } } } c# objects here public class requestroot { public method method { get; set; } } public class method { public string name { get; set; } public methoditem[] items { get; set; } } public class methoditem { public string name { get; set; } public string value { get; set; } } items should treat dictionary, try this: public class method { ...

In R, for all columns count factors/characters occurence, group by key -

this question needs solving data.table or dplyr . have dataset (data frame) looks this: summary(mooc_events) signup_id time source event min. : 1 min. :2013-10-27 browser:3869940 access :3112191 1st qu.: 18721 1st qu.:2013-12-19 server :4287337 discussion: 649259 median : 48331 median :2014-05-30 navigate :1009309 mean : 63476 mean :2014-04-05 page_close:1237883 3rd qu.:110375 3rd qu.:2014-06-15 problem :1261170 max. :200905 max. :2014-08-01 video : 796958 wiki : 90507 artefact_sha length:8157277 class :character mode :character one signup_id have multiple events, there many rows starts same signup_id. what i'm trying achieve aggregated dataset (data.table or data frame) columns there distinct va...

javascript - jquery and event scroll -

i have 1 class html various elements want add class new class in first element scroll top reach top ofos elements, when scroll reach second add in second , on. tried this var element = $(".element"); $(window).scroll(function () { var scroll = $(window).scrolltop(); for(var = 0; < element.length;i++){ if(scroll > element.eq(i)){ element.eq(i).addclass("newclass"); } } }) html piece <div> <div class="element"> <img src="img/image1" /> </div> <div class="element"> <img src="img/image2" /> </div> <div class="element"> <img src="img/image3" /> </div> </div> but line element.eq(i).addclass("newclass") dont work :) how should do try use if(scroll > element.eq(i).offset().to...

python - Get user input without interrupting program execution -

i'm working on program (a chat bot actually, can see code here if want) has infinite loop running @ times. i use asyncio part of code, tried creating subroutine received input , checked commands. however, didn't seem worked. what want able issue program commands without interrupting execution using input() would. preferably, have > character , line stays @ bottom of screen program output appearing above , allows input. is possible asyncio or need multi-threading program or else? edit : 1 thought had perhaps use ncurses gui-thing has entry field @ bottom , bot's output above entry field. possible? you should able use asyncio since stdin stream can select...

aql - How to approximate execution time of ArangoDB count function -

i considering using arangodb new project of mine, have been unable find information regarding scalability. specifically, looking information regarding count function. there reliable way (perhaps formula) approximate how long take count number of documents in collection match simple boolean value? all documents in collection have same fields, different values. how can determine how long take count several hundred million documents? just create collection users , insert many random documents need. for in 1..1100000 insert { name: concat("test", i), year: 1970 + floor(rand() * 55), gender: % 2 == 0 ? 'male' : 'female' } in users then count: for user in users filter user.gender == 'male' collect count number return { number: number } and if use query in production, make sure add index too. on machine reduces execution time factor > 100x (0.043 sec / 1.1mio documents). check query explain further estimate how...

Spring Boot Bootstrap Modal Login from home -

i have login working actual login "/login" page, , on home page "/" have modal window, when error, redirects login page , displays error messages no problem. when login correct, logs user in after refresh you're logged out again. not sure how whole modal thing. need method , assign form maybe modelattribute both? tried didn't work. here modal login form in home "/" <!-- modal --> <div id="mymodal" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- modal content--> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">please sign in</h4> </div> <div class="modal-body"> <c:if test="${param.error != null }"> <div class="alert alert-danger">...

linux - Cannot open /dev/video0 (No such device) -

i trying install webcam on synology nas (arm, linux kernel 3.2.40). have compiled , installed kernel modules, seem work. kernel output when inserting modules , plugging camera (logitech c270): [ 130.963903] linux video capture interface: v2.00 [ 136.098356] usbcore: registered new interface driver uvcvideo [ 136.104135] usb video class driver (1.1.1) [ 145.384393] usb 3-2: new high-speed usb device number 4 using etxhci_hcd_150119 [ 145.628583] uvcvideo: found uvc 1.00 device usbdevice (046d:0825) [ 145.726156] input: usbdevice /devices/pci0000:00/0000:00:00.0/usb3/3-2/3-2:1.0/input/input0 this lsusb output: # lsusb libudev: udev_has_devtmpfs: name_to_handle_at on /dev: function not implemented bus 002 device 001: id 1d6b:0002 linux foundation 2.0 root hub bus 001 device 001: id 1d6b:0002 linux foundation 2.0 root hub bus 004 device 001: id 1d6b:0003 linux foundation 3.0 root hub bus 003 device 004: id 046d:0825 logitech, inc. webcam c270 bus 003 device 001: id 1d6b:00...

html - How can I stop a text link to go up each time it is selected? -

i'm using blogger. i have modified bit css of template, though can't find why each time link (section) selected goes up. @ first thought margin-top issue, don't find problem in actual css. since don't know how deep can go css in blogger, don't know else do. tried using inspector in chrome there's nothing wrong or i'm blind. take look: select link top , cry me. http://safetyinsolitude.blogspot.mx/ add following css-selector: .tabs-inner .widget li { line-height: 3.2; }

Block SMS Push Notification of a particular number in Android -

i developing android app receives sms particular number constantly. want app parse sms , display user accordingly. wrote broadcast receiver intercepts sms , can read message sent particular number. not want user push notification when mobile receives sms number. there way can go it? from android developer website, seems android 4.4+ cannot use abortbroadcast function avoid broadcasting other applications. yes there no way can block sms going other applications. have achieved customising android framework proprietary implementation.

ruby - How to pass options via Rake to Yard to Kramdown to use GFM -

i've gem i've produced docs written github flavoured markdown (gfm) take advantage of syntax highlighting. unfortunately, github decided use own syntax code block fencing (three backticks) yardoc parse correctly i've chosen kramdown parser, supports gfm . on top of that, when push code rubygems documentation generated running rake task (as far understand). need find way tell yard use kramdown gfm parser, via rake. kramdown selects parser via -i switch: $ bin/kramdown --help command line options: -i, --input arg specify input format: kramdown (default), html, gfm or markdown but don't know how yard pass that, either via yard binary or through rake. suppose possible creating yardoc plugin, i've never done , not sure if work, , seems things getting out of hand @ point! what i'd really markdown standard this, that's not question unfulfilled desire… i'm not sure stackoverflow can much. any appreciated.

python - Django tests getting error -

i'm trying prepare simple tests app. have model below: class kategoria(models.model): nazwa = models.charfield('nazwa kategorii', max_length=30) class meta: verbose_name = "kategoria" verbose_name_plural = "kategorie" def __str__(self): return self.nazwa in tests.py: import unittest blog.models import kategoria class kategoriatestcase(unittest.testcase): def setup(self): self.nazwa = 'nowa_kategoria' def test_tworzenie_obiektu(self): tworzenie_nowej_kategoria=kategoria.objects.create(self.nazwa) self.asserttrue(tworzenie_nowej_kategoria) self.assertequal(nowa_kategoria.nazwa,'nowa_kategoria') on end test fails because: typeerror: create() takes 1 positional argument 2 given what doing wrong? create takes keywords arguments. in test_tworzenie_obiektu method change tworzenie_nowej_kategoria = kategoria.objects.create(self.naz...

javascript - Replace only part of text in jQuery function -

i'm using solution replace list of emojies: (function($){ var emojies = ["smile", "smiley", "grin", "joy"]; var emojiregex = new regexp(":("+ emojies.join("|") +"):","g"); $.fn.toemoji = function(){ return this.each(function() { this.innerhtml = this.innertext.replace(emojiregex,function(fullmatch,match){ return '<span class="emoji '+match.tolowercase()+'"></span>'; }); }); }; })(jquery); //and use $(document).ready(function(){ $(".content div").toemoji(); }); but replace content div ( this.innerhtml... ), however, there no way , replace :emoji: , not text? because, if text has break line, ex: hi! how you? will replace for: hi! how you? in addition other problems... so, how do? the problem reading div innertext not include html ...

scala - How to compose prameterized-types in scalaz validation? -

i've got code this: import scalaz._, scalaz._ case class cat( val lang: string, val title: string, val icon: string, val count: int, val id: option[long]) case class invaliddataexception[t]( msg:string, val value:t, cause:option[throwable] = none ) extends exception ( msg, cause getorelse null ) trait categoryservice { private type notemptyerrorlist = nonemptylist[invaliddataexception[_]] private type _validation = validation[notemptyerrorlist,category] def createcategory( lang: string, title: string, icon: string, channels:string, channelcount:int = 0)( implicit availablelangs: list[string], ...

java - Unable to get each item from selected multiple line Jlist? -

after doing lots of research still unable items selected multiple line jlist. here code listselectionlistener: list.addlistselectionlistener(new listselectionlistener() { public void valuechanged(listselectionevent e) { listmodel model = list.getmodel(); for(int i=0; < model.getsize(); i++){ system.out.println( model.getelementat(i)); } } }); i added button print selected items: btnnewbutton.addmouselistener(new mouseadapter() { @override public void mouseclicked(mouseevent e) { listmodel model = list.getmodel(); for(int i=0; < model.getsize(); i++){ system.out.println( model.getelementat(i)); } } }); but still getting same output : com.example.main.student@c36b5fb com.example.main.student@2e61eb2 com.example.main.student@151f708e com.example.main.student@563e55b0 i expecting output "name: paul0 age: 0....

angularjs - How to set route precedence with ui-router? -

more specifically: i have route myapp/about and route myapp/:userid how ensure ui-router matches /about before /:userid ? you need create state 2 myapp/about will have 1 state called about & other have accepting userid parameter. .state('about',{ url: '/myapp/about', templateurl: 'appp/views/about.html', controller: 'aboutcontroller' }) .state('userdetails',{ url: '/myapp/:userid', templateurl: 'appp/views/userdetails.html' controller: 'userdetailscontroller' }) by defining them different state ui-router call about statestate when /myapp/about url appears in browser, when url other /myapp/about appears in browser call userdetails state accept userid part after /myapp/ parameter value using $stateparams service. for making more better add regex on route ask number or can set regx there, suppose want accept number 3 digits change url option of state url: "/myapp/{use...

python - Does custom header show up in Networks tab of browser after being set using Browsermob-Proxy? -

i've set custom request headers via rest api based on browsermob-proxy: post /proxy/[port]/headers - set , override http request headers. example setting custom user-agent. however, header doesn't show in network tab of browser. can expect see custom request header show in network tab of browser configured corresponding proxy? if not, how can make show in networks tab using python?

html5 - IE11 throws AppCache Fatal error -

i humbled now. have been trying application cached in ie11 browser no luck. i thankful if 1 tell me whats going wrong. did lot of reading whole day , couldn't find causing issue. issue: my offline application gets cached correctly based on manifest file in chrome , firefox. app doesn't cached in ie11 (which ie have). have no clue going wrong. my code: manifest.appcache cache manifest #v1.0 cache: /formsoffline/index.html network: * index.html <!doctype html> <html ng-app="app" lang="en" manifest="manifest.appcache"> <head> <meta http-equiv="x-ua-compatible" content="ie=edge" /> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>forms</title> <link href="/formscommon/vendor/css/all.css" rel="stylesheet" /> <link href=...

Enabling code completion for bootstrap.js in PhpStorm -

for reason no code completion bootstrap.js. added non minified version https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.js adding library manually in javascript library settings. same thing happened me knockout until found out have use knockout-debug version since non minified version. but bootstrap isn't working. i had no completion 'typeahead'. didn't bother try other functions bootstrap wasn't expecting completion them ever. found out dropped in favor of twitter's typeahead.js . but @lazyone .

parallel processing - Issue with clEnqueueReadBuffer Function in OpenCL - in an Array Sum Sample -

everyone, i'm beginner on opencl , wrote simple code in c sums 2 arrays. here part of code: // create kernel. cl_kernel kernelsum = clcreatekernel( myprogram, "sum", &error ); // set input array. size_t arraysize = 1000; char* = ( char* ) malloc( sizeof( char ) * arraysize ); char* b = ( char* ) malloc( sizeof( char ) * arraysize ); char* c = ( char* ) malloc( sizeof( char ) * arraysize ); (int = 0; < arraysize; += 1) { a[ ] = 1; b[ ] = 2; c[ ] = -1; } // set buffers. cl_mem a_buffer = clcreatebuffer( mycontext, cl_mem_read_only | cl_mem_copy_host_ptr, arraysize * sizeof( char ), a, &error ); cl_mem b_buffer = clcreatebuffer( mycontext, cl_mem_read_only | cl_mem_copy_host_ptr, arraysize * sizeof( char ), b, &error ); cl_mem c_buffer = clcreatebuffer( mycontext, cl_mem_write_only, arraysize * sizeof( char ), null, &error ); printf( "buffers created.\n" ); // sett...

BMP Image Compression and Decompression in java -

i searching way compress , decompress bmp image in java. i found easy way using javax.imageio , following tutorial . using following 2 classes ( imagewriter , imagewriteparam ) , example provided compressing image . what looking use same classes , same mechanism decompress "my compressed image" got provided example . is there anyway same mechanism ? any other solution compress bmp welcome . thanks in advance. the simplest ways read , write images in java using imageio, using read , write static methods directly. read: bufferedimage image = imageio.read(new file("input.bmp")); write: bufferedimage image = ...; // disk or created in memory, etc if (!imageio.write(image, "bmp", new file("output.bmp"))) { // todo: handle not written case } using imagereader , imagereadparam , , imagewriter , imagewriteparam respectively (as in tutorial), gives more control on parts of image decode, size or region, or fo...

calendar - couldn't store event in android Calender -

hey i'm trying add calender event app didn't working @ cant see event in calender app neither didn't reminder code public class calendarsync { context context; public calendarsync(context context) { this.context = context; } public void pushappointmentstocalender(activity curactivity, int eid, string title, string addinfo, string place, int status, long startdate, long enddate, boolean needreminder, boolean needontimereminder) { try { string eventuristring = "content://com.android.calendar/events"; contentvalues eventvalues = new contentvalues(); eventvalues.put("calendar_id", 1); eventvalues.put("title", title); eventvalues.put("description", addinfo); eventvalues.put("eventlocation", place); eventvalues.put("dtstart", startdate); eventvalues...

javascript - JS: Is it possible "something(arg)" and "something.my_method(arg)" at same time -

i know how create function something(arg) something = function(arg) { console.log('function result', arg); } i know how create object function something.my_method(arg) something = { my_method: function(arg) { console.log('method result', arg); } } is possible write code, wher both something(arg) , something.my_method(arg) exists? like this in file: // needed code something(123) something.my_method(234) output in console: function result 123 function result 234 well, javacript, , there many ways it. edit: thought this, , tried imagine other way same thing, , cannot find any. there's @elcodedocle thought close not ask, or otherwise other solution rewrite or 1 suggest below. the quick , dirty way create function: something = function(arg) { console.log('function result', arg); } and create property holds other function: something.my_method = function(arg) { console.log('method result', arg); } ...

AWK printing bash variable more than once -

i'm trying utilize awk 1 liner uses bash variable. problem being printed more once or giving out error. bash variable looks (without echo line): echo "$time" 49.80 63.4 61 60.4 61 the awk line i'm trying use this: awk -v time="$time" -f, '{print $1,$2,$3,$4,$5=time}' file the output this: santaclara 6/7/2015 d 4 49.80 63.4 61 60.4 61 santaclara 5/29/2015 d 5 49.80 63.4 61 60.4 61 santaclara 5/21/2015 d 5 49.80 63.4 61 60.4 61 santaclara 4/29/2015 d 5 49.80 63.4 61 60.4 61 santaclara 4/22/2015 d 5 49.80 63.4 61 60.4 61 and i'm looking this: santaclara 6/7/2015 d 4 49.80 santaclara 5/29/2015 d 5 63.40 santaclara 5/21/2015 d 5 61 santaclara 4/29/2015 d 5 60.4 santaclara 4/22/2015 d 5 61 i've several variations on awk line , have gotten errors. doing wrong? use paste instead: $ paste file <(echo "$time") use -d switch if want specific delimiter (tab default).

php - INPUT_SERVER returns null -

i got weird results when try use filter_input input_server (i using php 5.6.9). i run code: var_dump($_server); foreach (array_keys($_server) $varkey) { var_dump($varkey, filter_input(input_server, $varkey)); } i every filter_input(input_server, $varkey) returns null. $_server have correct values. why that's happening? this known php bug. try this: $result = filter_input(input_server, 'server_name'); /* * overcome bug filter_input php versions return null * on implementations of fcgi/php 5.4 , older * versions well. * * https://bugs.php.net/bug.php?id=49184 */ if (empty($result) && isset($_server['server_name'])) { $result = filter::sanitize($_server['server_name'], $filter); } this wrapper until fix situation. until must deal it.

c++ - Replacing character in the string -

i trying enter in array 2 ` backqoutes. enters single quote. please me here ? input: abc"cde"fgh"ijkl" ouput: abc``cde''fgh``ijkl'' my code: #include <stdio.h> #include <iostream> #include <cstring> using namespace std; int main() { string mystr; long int i=0,j=0,l; while(getline (cin, mystr)) { // l=strlen(mystr); l=mystr.length(); for(i=0;i<l;i++) { if (mystr[i]=='"') { j=j+1; if(j%2==1) mystr[i]='``'; //problem here else mystr[i]='"'; } } cout << mystr; i++; } return 0; } it c++. "``" not char 2 char. use concatenation instead like result += "``";

c# - Switching images in picturebox -

in windows forms application have display few (or more) images in 1 picturebox - need change every 10 seconds (or similar). first retrieve images database , display them in specific picturebox. every image has unique id , 1 image works fine. i have sql database (sql server 2014) , use linq. public void displayadds(imagead img, int imgid) { using (var dbcontext = new linqclassesdatacontext()) { var table = t in dbcontext.imageads t.id == imgid select t; img.image = table.single().image; picturebox1.image = bytearraytoimage(img.image.toarray()); } } in end 'displaying' has in foreach loop, because have list of ints (list), display images selected ids. i tried using threads, or refreshing, , simple loop didn't work: for(int i=0; i<5; i++) { displayadds(img, i); } here other methods tried , didn't work. public void displayad...