Posts

Showing posts from June, 2014

c - Camera will not move in OpenGL -

i having problems using camera in opengl/freeglut. here code: http://pastebin.com/vci3bjq5 (for reason, when paste code code feature on site, gives extremely weird output.) as far can tell should rotate camera when arrow keys pressed - nothing. seems initial camera position wrong. clue why is? the display function called once. need either set idle function glutidlefunc() or tell glut display function must called again glutpostredisplay().

java - Adjust size of JButtons and window -

Image
the window must contain jpanel contains 8 x 8 array of jbuttons , each size of 69 x 69 pixels , displaying imageicon instead of text. @ bottom of window jlabel, right­aligned jtextfield , 2 more jbuttons shown. window must non­resizable size of 578 x 634 pixels. upon startup, window should show random arrangement of colored buttons shown. this have far, , appreciated! import java.awt.*; import javax.swing.*; public class shinybuttons extends jframe { public static byte red = 0; public static byte orange = 1; public static byte yellow = 2; public static byte green = 3; public static byte blue = 4; public static byte light_gray = 5; public static byte dark_gray = 6; public static byte rows = 8; private byte[][] buttontable; public shinybuttons() { buttontable = new byte[rows][rows]; resetbuttons(); } private void resetbuttons() { (int r=0; r<rows; r++) (int c=0; c<rows; c++

How to modify the following VIM regex to work with white space after commas? -

i took regex question: what vim command(s) can used quote/unquote words? :%s/\([^,]\+\)/"\1"/g it turns this: foo,foo bar,bar@foo,foo# bar,bar$ foo# into this: "foo","foo bar","bar@foo","foo# bar","bar$ foo#" i modify regex work this: foo, foo bar ,bar@foo ,foo# bar, bar$ foo# turning this: "foo", "foo bar", "bar@foo", "foo# bar", "bar$ foo#" any suggestions? something work :%s/\s*\([^,]\+\)/ "\1"/g | %s/^ // match leading whitespace before putting capture group. put space before capture group in quotes. put , space in first column need remove space use second substitute command.

sql - How to check if a string is in a list of strings with a minimal disk/space usage? -

i have encountered question need compare string list of strings , determine if string in list(for example, check if string 'abc' in list of strings ['ab','bc','abc']). problem straight forward given assumption store whole list in clear text. when list gets bigger, few million/billion records, takes lot of space store list(especially if need regularly different lists). there anyway efficiently using minimum storage space(that don't need store whole list)? (specifically question doing in sql table, have store column , index efficiency purpose) check out trie data structure - it's designed you're trying accomplish minimal space, , fast up. here's article (you can find many more searching) trie prefix i'm not sure how works goals of storing options in sql - store trie data structure in database

import - Python Nameerror after importing file -

i'm learning python 3.3 first time , in tutorial have own module , import them. problem here if import worked, nameerror depending of method use import it. here 2 codes import: from package.fonctions import table table(5) # appel de la fonction table # ou ... import package.fonctions fonctions.table(5) # appel de la fonction table here code supposed call: def table(nb, max=10): """fonction affichant la table de multiplication par nb de 1 * nb jusqu'à max * nb""" = 0 while < max: print(i + 1, "*", nb, "=", (i + 1) * nb) += 1 the first import method work, not second. tells me name "fonctions" not defined, import worked , first method worked too. in tutorial, both method work, me doesn't if copy-paste code. want understand why. import package.fonctions doesn't define fonctions name. enables call package.fonctions.table(5) instead. to enable fonctions.

How to remove "caret" cursor from HTML/CSS Navigation? -

here's code: jsfiddle.net/q49hb <ul id="navigation"> <li><a class="" href="#">home</a></li> <li><a class="" href="#">blog</a></li> <li><a class="" href="#">services</a></li> <li><a class="" href="#">about</a></li> </ul> there's little caret cursor in between each list item when hovering over. noticed floating left rid of it, can't center navigation, trying do. help? so re-cap, i'm looking to: space out list items, leaving no excess space. not show carrot cursor when hovering in between items. centering unordered list nav on page. you can 1 of 2 things. you can set parent element ( #navigation ) cursor: pointer; stop caret showing in between links: http://jsfiddle.net/q49hb/1/ #navigation { cursor: pointer; } or can remove whites

reddit - How many submissions can be made using praw at a time? -

i used praw submit link on subreddit, when tried add 1 more asked me after hour. when same thing using reddit site, allows me add many links want. praw inhibits add more 1 link per hour per user or checked reddit api? the answer still no . asking question fifth time not change that.

Home Store View and Editing Home Link in Magento -

i'm not web designer/coder friend had designer quit on him , needing getting website , running. website www.wilfrednewman.com they using magento 1.7, blanco theme. i'm wondering couple things: 1) how edit first item of menu (clothing leads coming-soon.html). in cms static blocks has page-menu defined other links generated(bespoke,wedding,about,press,store), clothing not there. don't know edit clothing. i can go through tutorial , see how make nav_block1 blanco ( http://www.techturn.com/tt/blanco_magento_theme.pdf ), , have done that. adds link end of menu established. think follow add links, don't know how edit first link doesn't matter 2) how "storefront" view. basic store-front has newest products listed? that's want clothing link to. googling these problems brings me wrong solutions, such editing home button in magento navigation, can't find solution need, i'm sorry if common i'm not googling right thing! to

listbox - Need to access the MULTIPLE (possible) Selected Options -

i have constructed "listbox" in html using select & option tags , single selections working expected inside respective polymerelement. however, when enable mutiple options multiple=true attribute turned on expected values of top most selectindex , value passed me in option_selected() "lifecycle" method. i have found multiple solutions involving jquery , js, nothing have tried has worked dart-polymer. (the straight js solution found not access variables.) the html/polymer code (inside tag) looks this: <select multiple=true style="width:250px;" selectedindex="{{selected}}" value="{{value}}" size="8" on-click="{{option_selected}}" on-change="{{on_change}}" > <option template repeat="{{dataele in dataar}}" > {{dataele}} </option> </select> the preferred solution dart or polymer-dart. thanks! you selected values wa

javascript - JQuery - Image Loop Wait for Loading -

i have following loop dynamically loads images onto page. small numbers of images, 10, works great. beyond that, start getting issues in loading images, remote server overwhelmed , not sending images (get red x's instead of images). images sent server imaging database, unfortunately overwhelmed. for (var c = 0; c < b; c++) { url = transurl + "&action=getrelateditem&docid="+ d[c].id +"&side=front"; img = $("<img />").attr('src', url ).attr('width','600'); allimages.append(img); } in page, allimages empty div on page. think need wait image load before moving on , trying load one, , on, i'm not sure how ask loop stop , wait image load before moving on next one? thanks in advance. update : per kevin, adjusted src assignment i believe you're looking basic image preloader. tried adapt current code, believe using loop current needs wouldn't clean in terms of performance.

How to get a URL string parameter passed to Google Apps Script doGet(e) -

given url: https://script.google.com/macros/s/macroname/dev?thearg="69.28.15.332" the important part on end: ?thearg="69.28.15.332" i'm trying pass information apps script in url. why won't .gs google apps script function value of string @ end of url? doget(e) function. function doget(e){ var passedinip = e.parameter.thearg; logger.log(passedinip); if (passedinip === "69.28.15.332") { return htmlservice.createhtmloutput("<h2>something</h2>") } }; i error msg printed in browser: the script completed did not return anything the logger.log log something. logs [date time edt] "69.28.15.332" , value same in log, value i'm checking for. equality test fails. the argument passed "as is", can test using code below : function doget(e){ var passedinip = e.parameter.thearg; logger.log(passedinip); if (passedinip == "69.28.15.332") { r

math - Probability of a sample space -

i have been doing exam review class questions database no solutions given. i'm kind of confused answer be > consider sample space s={a,b,c,d} , probability function pr: s->|r on s. events: a={a}, b={a,b}, c={a,b,c}, d={b,d} you given pr(a)=1/10, pr(b)=1/2, , pr(c)=7/10 pr(d)? show work. i thought pr(d)=1-(pr(a) + pr(b) + pr(c)) 3 probabilities equal more 1. tried looking @ superset of s still couldn't find answer. what answer , why? the answer p(d) = 7/10 to find this, @ how samples combined in brackets create events, , note a+b+c+d=1 , lowercase letters not uppercase ones. each of given events find 1/10 = 5/10 = 1/10 + b => b = 4/10 7/10 = 1/10 + 4/10 + c => c = 2/10 p(d) = 4/10 + d since a + b + c + d = 1 d = 1 - + b + c = 1 - (1/10 + 4/10 + 2/10) = 1 - 7/10 = 3/10 so p(d) = 4/10 + 3/10 = 7/10

apache poi - Read from a specific row onwards from Excel File -

i have got excel file having around 7000 rows approx read. , excel file contains table of contents , actual contents data in details below. i avoid rows table of content , start actual content data read. because if need read data "cpu_info" loop , search string occurrence twice 1] table of content , 2] actual content. so know if there way can point start row index start reading data content excel file , skipping whole of table of content section? as taken apache poi documentation on iterating on rows , cells : in cases, when iterating, need full control on how missing or blank rows or cells treated, , need ensure visit every cell , not defined in file. (the celliterator return cells defined in file, largely values or stylings, depends on excel). in cases such these, should fetch first , last column information row, call getcell(int, missingcellpolicy) fetch cell. use missingcellpolicy control how blank or null cells handled. if take example cod

regex - How to match one word or another in Elisp regexp -

i have string contains html code, below: ... <a href="../link.png">image link</a> ... <img src="../image.png" /> ... <pre class="should_not_match">...</pre> ... i want extract resource paths: ../link.png of href in a , , ../image.png of src in img . have following code: (with-temp-buffer (insert html-content) ;; html-content content mentioned above (beginning-of-buffer) (while (re-search-forward "<[a-za-z]+[^/>]+[src|href]=\"\\([^\"]+\\)\"[^>]*>" nil t) (message (match-string 1)) ;; more code here )) the output includes not wanted ../link.png , ../image.png , should_not_match , know because incorrect [src|href] in regexp (i want match either src or href ). use following regexp: "<[a-za-z]+[^/>]+(src|href)=\"\\([^\"]+\\)\"[^>]*>" but returns nil now. tried following, without luck: "<[a-za-z]+[^/>]+\\(s

c++ - Multiple constructors in a class -

i have class a,b,c,d have member of class x in it. have class called class p. in class create instance of class p well. in class p need access x instance of , method of (this method available in class b,c,d same method signature , parameters), therefore pass class class p while initializing class p. so code looks like; class p; class a{ public: x x; p *p; a(){ x = new x(); }; void setdata(){ p = new p(this); } }; class p{ public: *a; p(a *_a){ = _a; a->x.resetval(); } }; now need create instances of p in class b,c,d , pass instances of classes p. to knowledge achieve must either make a,b,c,d child class of new class (class parent) , set constructor of class p accept class parent instance, or must create separate constructors classes a,b,c,d in class p. class parent { x x; } class p; class a:: parent{ ...........//code }; class p{ public: parent *prnt; impl(parent *prnt

c++ - How to debug this code written to split an array by space? -

i need write program sentence , split words delimiter(space);so i've wrote code below doesn't seem working properly. idea's how debug code? example: input: meet me tonight desired output: meet me tonight given output: meet me ton ght i'm confused why output not expect. here's i've come far: #include <iostream> using namespace std; const int buffer_size=255; int main() { char* buffer; buffer = new char[255]; cout << "enter statement:" << endl; cin.getline(buffer, buffer_size); int q=0, numofwords=1; while(buffer[q] != '\0') { if(buffer[q] == ' ') numofwords++; q++; } char** wordsarray; wordsarray = new char* [numofwords]; int lenofeachword = 0, num = 0; int* sizeofwords = new int [numofwords]; for(int i=0; i<q; i++) { if(buffer[i]==' ') { sizeofwords[num] = lenofeachword;

Why am I getting a "Not a valid JAR" while running a MR job on my local hadoop? -

this error precisely. alis-macbook-pro-2:hadoop aligajani$ hadoop jar /user/aligajani/job/wordcount.jar /user/aligajani/input /user/aligajani/input-output not valid jar: /user/aligajani/job/wordcount.jar alis-macbook-pro-2:hadoop aligajani$ yes, have copied file in hdfs. yes, have verified compiled correctly. the example wordcount works fine. i think jar should in local path (at least in old api).

angularjs - Why a method in expression is called two times in angular.js -

Image
i want know why method called 2 times while used in angularjs binding expression. you can find code here @ jsbin why callme() method called 2 times. found same question posted not satisfactory answer. , if want avoid called 2 times how it. you binding function expression <p>{{callme()}}</p> that's why it's called many times, because runs everytime when angularjs calls digest() ... here picture how digest work maybe helps better...

youtube - multi-cast video streaming in android (rtp) -

i new in android developing application streams video server , broadcasts same clients mobile basic idea server app stream video web base video streaming site(youtube), , play on same phone , @ same time broadcasts streamed video packets other clients, clients capture stream video , play same(with out requesting main web server youtube) problem want solution playing rtp audio/video stream on android have created server sends rtp packets multiple clients(for on vlc), , want rtp media player play on android phone * work done * i have created server-multi client socket app (which of no use now) transfers data server clients then have app streams rtp audio(real time audio mic) phone pc( in vlc player) , if 1 know how play same in phone using media player or ??

mysql - possible solution to php allowed memory exhausted : copy data to temporary db -

as can guess title, working on 250 mbs of data , hence getting php memory exhausted error. ini_set('memory_limit', '-1'); possible solution dont know why feel unsafe technique. there cons of using it? my solution copy relevant data temporary database, whatever need to, , delete it. user might close tab before deletion occurs check existing temporary databases before every operation , if exists, delete it. is way approach? thanks! in special cases, can adjust size of memory: $memory_berfore = ini_get('memory_limit'); // in php.ini // new limit ini_set('memory_limit','256m'); //128m, 256m, 512m, 1024m,... (x*2m) ... treatment ... // older limit ini_set('memory_limit',$memory_berfore);

javascript - Add to existing older slideshow script to include a caption for images -

i'm wondering if there small change or addition make existing script, add captions images in slideshow, or if should abandon old script , start fresh. i'm new beginner javascript please bare me. there 2 pages- intro page , slideshow page. intro page has small thumbnail images when clicked take visitor slideshow page see large version of thumbnail, , there visitor can click through large thumbnail-representive images or go intro page. here's intro page (relevant part): <table> <tr> <td><a href="arbor-viewer-test-files.html?img=0"> <img src="images/thumbnails/arbor_0.jpg" width="100" /> </a></td> <td><a href="arbor-viewer-test-files.html?img=1"> <img src="images/thumbnails/arbor_1.jpg" width="100" /> </a></td> <td><a href="arbor-viewer-test-files.html?img=2"> <img src=&quo

asp.net - why my server.mappath() is not working in another pc? -

i have project in pc..but when saving uploaded files in folder inside project.now when transferring project in pc server.mappath() not working..why?? my problem upload function protected void addproblem_click(object sender, eventargs e) { string filepath; if (problemupload.hasfile) try { if(problemupload.postedfile.contenttype=="application/pdf") { // problemupload.saveas("f:\\0\\my project website\\sgipc\\problems\\" + problemupload.filename); // filepath = "f:\\0\\my project website\\sgipc\\problems\\" + problemupload.postedfile.filename; problemupload.saveas(server.mappath("\\sgipc\\problems\\" + problemupload.filename)); filepath = server.mappath(problemupload.postedfile.filename); string con = " "; con = configurationmanager.connectionstrings["connectionstring"].tostring();

.htaccess - Hiding Directory in URL with htaccess is not working -

i have website1.com setup when users visit website1.com redirected via meta tag in index.html website1.com/directory then use website , go links such website1.com/directory/index.html or ever. trying hide "directory" in link users see website1.com/index.html i have place htaccess rewrite url website1.com/index.html @ website1.com/directory/.htaccess i not doing else special , should easy task. current exact htaccess follows: rewriteengine on rewritecondition %{request_uri} !^directory/ rewriterule ^(.*)$ directory/$1 [l] should easy right..... 404 in server have mod_rewrite & mod security , suspect 1 of them causing not work can't imagine why. missing here? your rule incorrect since %{request_uri} variable has starting / you need place in document root use code in document root .htaccess: rewriteengine on rewritecondition %{request_uri} !^/directory/ rewriterule ^(.*)$ /directory/$1 [l]

java - How to make object referencing to the same thing? -

public class number { private int j; public number(){ j = 3; } public number(int m){ j = m; } public void setnum(int n){ j = n; } public int getnum(){ return j; } } /// (different file, same directory) public class user { private number jim; public user(){ this.jim = new number(); } public static void main(string []args){ user keith = new user(); user justin = new user(); ?????????????????????????? } } i want keith.jim = justin.jim , justin.jim = keith.jim . such if keith.jim.setnum(34) , both keith , justin's jim.j 34 . how that? idea implement in bigger piece of code. also, user.java , number .java must exist. context cannot changed,i can add new methods cannot alter context in number (e.g put j in user instead of number). each user must have number object ev

android - screen orientation vs home button onStop() -

i trying build app if user press home button , goes home page via intent ( via onstop() button overridden ) problem happens when orientation changes, calls onstop method go home page also. i tried read boolean isfinishing anw never true. how can avoid that? found ... posting answer let other know in android there method called : ischangingconfigurations() .. if true rotation happenned

java - Performing operation using Generic and primitive type not working -

trying learn basic operations using java-genric, tried make generic class, takes number , operation on , returns value throwing error parent class : public class helloworld{ public static void main(string []args){ mathsexec<integer> my_obj = new mathsexec<integer>(); int rst = my_obj.doaddition(100); system.out.println("solution : "+rst); } } generic class : class mathsexec<t>{ //didn't extend number because m strictly sending int values t doaddition(t nmbr){ int k=100; t rst; rst = nmbr+k; return rst; } } error : mathsexec.java:6: error: bad operand types binary operator '*' rst = nmbr+k; ^ first type: t second type: int t type-variable: t extends object declared in class mathsexec 1 error i understand why error coming( incompatible types operation ) per generics, type t should have been converted intege

mysql - Which database should i prefer? -

i thinking of storing persons contact data centrally. there many persons , each have contact list. there more number of updates , selects on database user searching contacts or searching person not in his/her contact list. person may updating contact details. inserts in database limited because 1 time enrollment there. confused in using databases mysql or neo4j. because when think of searching person database neo4j seems better. when think of handling millions of records mysql seems better. can suggest database suits best? mysql/neo4j/ both mysql , neo4j or other database? neo4j allows store connections between people via contacts, if want leverage network effect in application makes sense that. it depends on how want people search , interact app. if treat people individual records no connections mysql enough. otherwise neo4j work better. if have time tiny poc realistic data both , decide yourself.

mysql - multiple joins and aggregate function -

Image
i have consolidated few database tables 1 , made better db design. adjust needed sql scripts based on old table. new db scheme looks this: so have table each player (fcs_spieler). i have table each team (fcs_teams) and record in year player plays in team (fcs_spieler2team). it can 1 player plays in 2 different teams same year. now have table fcs_sponsorenlauf. people can bet on player. i top 15 players bets. have tried 2 days getting working sql without no luck. problem either sum double amount of should or players show in list not have single bet. in addition somehow not able manage case player plays in 2 teams same year. wrong sql below? suggestions, ideas? thanks select s.spid, s.vorname,s.name,t.bezeichnung,sum(sp.betrag) sum fcs_sponsorenlauf sp join fcs_spieler s on (sp.2spieler = s.spid) join fcs_spieler2team s2t on ( sp.2spieler = s2t.spieler , sp.year = s2t.year) join fcs_teams t on (t.id = s2t.team) sp.betrag_art = 'fix' , sp.validated = 1 , sp.year =

android - Error updating sdk -

an error occurred while collecting items installed session context was:(profile=profile, phase=org.eclipse.equinox.internal.p2.engine.phases.collect, operand=, action=). no repository found containing: osgi.bundle,com.android.ide.eclipse.adt,22.6.0.v201403010043-1049357 no repository found containing: osgi.bundle,com.android.ide.eclipse.adt.package,22.6.0.v201403010043-1049357 no repository found containing: osgi.bundle,com.android.ide.eclipse.base,22.6.0.v201403010043-1049357 no repository found containing: osgi.bundle,com.android.ide.eclipse.ddms,22.6.0.v201403010043-1049357 no repository found containing: osgi.bundle,overlay.com.android.ide.eclipse.adt.overlay,22.6.0.v201403010043-1049357 no repository found containing: org.eclipse.update.feature,com.android.ide.eclipse.adt,22.6.0.v201403010043-1049357 no repository found containing: org.eclipse.update.feature,com.android.ide.eclipse.ddms,22.6.0.v201403010043-1049357 try this: "if downloaded adt part of

java - .exe file is not working in some systems. created using Launch4J s/w -

i working in windows swt desktop app. need create installer have used launch4j s/w. requirements: - windows 32 or 64 bit , java 32 bit. here problem .exe working fine in systems , not working in systems. app stops after opening splash screen. also in systems, app working fine. getting dialog box launch4j s/w saying "an error occurred while starting application."

java ee - Integrate in a CDI application that the container does not support it? -

my application deployed on jonas 5.2.2 doesn't support cdi ejb . need use cdi on ejb . know how use cdi on war part of application don't know in ejb part. is there way add support cdi ejb application in container not support it? my boss won't upgrade server version supports it. [edit] use cdi-weld: i've found beginning of solution : //cdi uses annotatedtype object read annotations of class annotatedtype<daotest> type = beanmanager.createannotatedtype(daotest.class); //the extension uses injectiontarget delegate instantiation, dependency injection //and lifecycle callbacks cdi container injectiontarget<daotest> = beanmanager.createinjectiontarget(type); //each instance needs own cdi creationalcontext creationalcontext ctx = beanmanager.createcreationalcontext(null); //instantiate framework component , inject dependencies test = it.produce(ctx); //call constructor system.out.println("instance&q

How to auto detect the encoding of srt subtitle file -

i have product here have weakness in auto detect encoding of srt subtitle files compared competitor. can auto detect encoding smi files, since has language info in header. srt, cannot that. how can apply auto detect srt files? references example algorithm can learn first step appreciated. fyi, product should support western europe, central europe, cyrillic alphabet, greek, turkish, hebrew, arabic, baltic, korean, s-chinese, t-chinese, vietnam, thai. there plenty of tools detect charset of text file (e.g. srt files). example, in command line of linux machine can use chardet: chardet subtile_file_name.srt this utility should installed pip (python installer). in ubuntu: sudo apt-get install python-pip pip install chardet if need integrate detector in application, there open libraries job. example, in tool dualsub implemented in java, used juniversalchardet .

Ruby - Imap server connection gets disconnected after 2 days even after being reconnected every 25 minutes -

i login imap server: imap = net::imap.new("imap.gmail.com") imap.login("username", "password") imap.select("inbox") and use imap idle fetch mails , when come. , since imap server connection automatically gets disconnected after 30 minutes, reconnect imap server every 25 minutes. all works fine until goes on more 48 hours. following error when imap.logout the error message: ioerror closed stream - ["org/jruby/ext/openssl/sslsocket.java:664:in `syswrite'", "/opt/jruby-1.7.6/lib/ruby/shared/jopenssl19/openssl/buffering.rb:318:in `do_write'", "/opt/jruby-1.7.6/lib/ruby/shared/jopenssl19/openssl/buffering.rb:415:in `print'", /opt/jruby-1.7.6/lib/ruby/1.9/net/imap.rb:1210:in `put_string'", "/opt/jruby-1.7.6/lib/ruby/1.9/net/imap.rb:1182:in `send_command'", "/opt/jruby-1.7.6/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'", "/opt/jruby-1.7.6/lib/ruby/1

javascript - Typoscript Condition not working on IE11 -

i want hide typo3 felogin permalogin option in ie 11 only. i've added code; [browser = msie] && [version >= 11] plugin.tx_felogin_pi1.showpermalogin = 0 [global] but not working anymore. using typo3 version 4.7.17. also how add css hack ie11 ? is there anyway identify ie11 navigator useragent? does knows solution ? it seems condition has error. according manual condition should shown below: [browser = msie] && [version = >10] plugin.tx_felogin_pi1.showpermalogin = 0 [global]

c++ - OpenGL 2D Hex Board shaped like a Rhombus -

Image
so working on gui hex board game. hex game has 121 hex shapes in 11 11 rhombus. have drawn 11 11 board shaped quad or square. how go translating coordinates draw hex shapes rhombus? here piece of code draws board every frame. void draw_board(hexboard* h) { glpushmatrix(); gltranslatef(1.5f, 1.5f, 0.0f); (auto iter = h->drawlist.begin(); iter != h->drawlist.end(); ++iter) { pointref t = *iter; colorref c; float scale_factor = h->get_scale_factor(); if (t.player == 0) { c.red = 1; c.green = 1; c.blue = 1; } else if (t.player == 1) { c.red = 1; c.green = 0; c.blue = 0; } else if (t.player == 2) { c.red = 0; c.green = 0; c.blue = 1; } int x_increment = 2; int y_increment = 2; glpushmatrix(); //cout << t.x_pos << " " << t.

Track the last redirected url android -

iam loading web page webview. login page. when user enters credentials page redirects multiple times. want track last redirected url. any idea on how can done. here code: mywebview.setwebviewclient(new webviewclient() { @override public void onpagefinished(webview view, string url) { // todo auto-generated method stub super.onpagefinished(view, url); if(progressbar.isshowing()) { progressbar.dismiss(); } string absoluteurl = view.geturl(); absoluteurl = uri.decode(absoluteurl); int absoultecount = absoluteurl.length(); string redirectedurl = endpointhost+"authorize/index"+deviceid; int redirectedcount = redirectedurl.length(); alertdialog.builder alertdialogbuilder = new alertdialog.builder(details.this);

c# - radgridview change color of text between {} -

Image
i using radgridview display string data in column. using databinding. of text strings have portions of text encased {} , display text in different color. from looking around on net have found can change text color of text in text block im having trouble applying databound datagrid column. could advise if possible. ---edit--- heres xaml define datacolumn: <telerik:gridviewdatacolumn x:name="colmastervalue" header="localise - master value" datamemberbinding="{binding mastervalue}" showdistinctfilters="false" isreadonly="true"/> heres display: so want {customer.panel.field} appear in different color. let's try next solution. will use custom textblock can separate regular character , '{' or '}'. let's add replace mechanism can replace original text decorated text. text except '{' or '}' colored in way. here xaml code: <telerik:gridviewdataco

eval - make javascript literal inheriting from different prototype -

i have code goes against practice. however, not want comments on - purely academic. <html> <head> <script> function run() { var fakecontext = { array : fr.contentwindow.array || fr.array; //another context/window array } fakecontext.array.prototype.remove = function(el) {/*some code*/}; (fakecontext) { var somecode = "var x = ['1', '2']; x.remove('2')"; eval(somecode); } } </script> </head> <body> <iframe src="about:blank" name="fr"></iframe> </body> </html> this array created when evaluating somecode inherits top level array in code runs instead of inheriting fakecontext.array . meaning array x not have prototype function .remove() how can (if there way) literals in somecode -string inherit fakecontext s array.prototype ? the problem array literal [] not evaluate in same way new array() . first create nati

scala - how to deal with a sbt multi project with non-standard artifacts? -

what trying do: first, let me present (very) simplified version of i'm trying achieve. consider following multi-project: root |___backend | |___frontend | |___deployer the backend packaged onejar , , performs standalone process background work. frontend web-service play project (packaged zip file dist ). deployer yet self executable jar packaged onejar , packaging modified include other projects artifacts. deployer job initialize system. deploys other artifacts specified machines, , initializes distributed system. what problem: basically, i'm trying (unsuccessfully) play's dist zip artifact & backend onejar self executable artifact packaged inside deployer jar (with other resources files) the deployer jar should like: deployer-executable.jar |___0/ | |___backend-selfexec.jar | |___frontenf-dist.zip | |___1/ | |___other resources (mostly configuration files) | |___ ... | |___meta-inf/ ... |___com/simontuffs/onejar/ ... |___doc/ ... |___lib/

java - How to set a PropertyActionListener in a <p:datatable> -

i use primefaces , want set action listner on selected row show 1 of column in dialog. my datatable this: <p:datatable var="ligne" value="#{detailgrillebean.lignes}"> <p:column headertext="question"> <h:outputtext value="#{ligne.questionbs}" /> </p:column> <p:column headertext="note"> <p:rating value="#{ligne.reponse}" readonly="true" /> </p:column> <p:column headertext="justification"> <p:commandlink oncomplete="ndialog.show();" title="view detail" > <f:setpropertyactionlistener value="#{ligne}" target="#{detailgrillebean.selectligne}" /> <h:outputtext styleclass="ui-icon ui-icon-sear

c# - Date-picker is not working in MVC -

i using jquery 2.1.0 , been called in _layouy.cshtml page @scripts.render("~/bundles/jquery") trying add datepicker view getting error 0x800a01b6 - javascript runtime error: object doesn't support property or method 'datepicker' . jquery 2.1.0 predownloded when created new project under script folder there no jquery-ui folder. can problem? view: @model movie.models.moviemodel @{ viewbag.title = "add"; layout = "~/views/shared/_layout.cshtml"; @scripts.render("~/bundles/jquery-ui"); } <h2></h2> @using (html.beginform()) { @html.antiforgerytoken() <div class="form-horizontal"> <h4>moviemodel</h4> <hr /> @html.validationsummary(true) <div class="form-group"> @html.labelfor(model => model.dob, new { @id = "news_date", @class = "control- label col-md-2" }) <div class="col-md-10">

treeview - Silverlight HyperlinkButton inside RadTreeView -

i use radtreeview display navigation; therefore, need show hyperlinkbuttons. i've got 2 issues: 1) clicking hyperlinkbutton doesn't set 'selected' state radtreeviewitem (it seems hyperlinkbutton won't bubble click event radtreeviewitem?) 2) hyperlinkbutton not @ full width because of issue #2, can select radtreeviewitem clicking right next hyperlinkbytton, selects item , no navigation triggered (which makes sense, because didn't click hyperlinkbutton, item). want able navigate clicking anywhere; therefore, hyperlinkbutton needs @ full width. can please provide me tips? thanks in advance help!!!

xml - AS3 Duplicate function -

so playing little code , attempting duplicate dynamic text flashtip2 show different values xml like: return (math.floor(math.random() * (0 + 0 + 0)) + 13); - on dynamic text flashtip2. how can duplicate without errors of duplicated values? code is: var xmlloader:urlloader = new urlloader(); var xmldata:xml = new xml(); xmlloader.addeventlistener(event.complete, loadxml); xmlloader.load(new urlrequest("http://www.cbbh.ba/kursna_bs.xml")); /* loads xml */ function loadxml(e:event):void { xmldata = new xml(e.target.data); parsedata(xmldata); } /* gets data today's tip */ function parsedata(mtip:xml):void { var itemxmllist:xmllist = xmllist(mtip..item); var count:int = itemxmllist.length(); var finalcount:int = count - 1; //trace(finalcount); function randomrange(minnum:number, maxnum:number):number { return (math.floor(math.random() * (0 + 0 + 0)) + 12); //+ 12 or 13 } var randomnum = randomrange(0, finalcount); trace(randomrange(11,

javascript - Converting absolute layout to use floats -

Image
i’m looking advice on project working on , appreciative of assistance. aim: to make drag , drop cms allows user draw elements on grid , move them desired position. changes recorded in json format , converted html/css when user presses publish button. resultant html should clean , flexible (i.e. cater content vary in height/length). system should able handle creating e-commerce sites simple information sites. problem: the logical way achieve drag , drop system in html use absolute positioning set width s , height s; method doesn't lend finished site content of variable lengths , absolutely positioned elements taken out of flow of document unaware of elements around them. solution: create system converts absolutely positioned elements floated elements. example: in cms system user creates following layout drawing boxes on grid: header of fixed height navigation of variable height image of fixed height main content of page of variable height list of visited

java - JPA With EclipseLink 2.3 Lazy Loading Weaving Method Not Found Exception -

we have web application jpa eclipselink 2.3. we want enable lazy loading, requires enable weaving. weaving process runs fine except cause number of errors when run our page. the error below: exception [eclipselink-0] (eclipse persistence services - 1.2.0.v20091016-r5565): org.eclipse.persistence.exceptions.integrityexception descriptor exceptions: --------------------------------------------------------- exception [eclipselink-60] (eclipse persistence services - 1.2.0.v20091016-r5565): org.eclipse.persistence.exceptions.descriptorexception exception description: method [_persistence_setothrsrceofslselmntlinkid_vh] or [_persistence_getothrsrceofslselmntlinkid_vh] not defined in object [avon.maps.entities.srceofslselmnt]. internal exception: java.lang.nosuchmethodexception: avon.maps.entities.srceofslselmnt._persistence_getothrsrceofslselmntlinkid_vh() mapping: org.eclipse.persistence.mappings.onetoonemapping[othrsrceofslselmntlinkid] descriptor: relationaldescriptor(avon.

python - Whitespace removing in file -

i want remove whitespaces in file using python. that, using: output = "file.out" open(output) templist: templ = templist.read().splitlines() filelist = [] line in templ: if line.startswith("something"): filelist.append(line.strip(' ')) i managed append required lines, whitespace removing not work. can me? =] .strip() removes whitespace start , end of string. i think easiest way go use regex: import re ... line in templ: if line.startswith("something"): filelist.append(re.sub(r"\s+", "", line)) \s matches kind of whitespace (spaces, newlines, tabs etc.).

hql - Data visualisation tools availble on hive hadoop -

please suggest visualisation tools can work on hive-hadoop. the thing is, should accept hive . it depends type of data analysis , visualization have in mind. if intend use proprietary tool, tableau 1 of among many other options . if prefer tools open source (free , multi-platform), should consider using: hue beeswax hbase pig google chart colorbrewer r qt/qml octave opengl hive not block using of tools data visualization, long know how manipulate data , how work respective toll analysis/visualization of data.

drawable - How to programmatically set drawableRight on Android Edittext? -

i know set drawableright in xml. required programmatically because change per condition. you can use function below: edittext.setcompounddrawableswithintrinsicbounds(0, 0, r.drawable.drawableright, 0); the order of params corresponding drawable location is: left, top, right, bottom

javascript - Stop relative divs scrolling past a certain point -

how can stop relative divs scrolling past point? here's fiddle understand basically, want able scroll normal, difference being don't want see behind header tag, i.e. stands when scroll, can see divs through header tag, want when scrolls, cut off point bottom of header tag when scrolling won't see past header line. hope makes sense. here's header css #header { height:40px; width:100%; background:transparent; position:fixed; border:1px solid black; top:0; } you give header (non- transparent ) background-color , or create new scroll-area below header overflow: scroll/auto

sql server - How can i increase number of rows in sql table -

this table structure id name 1 2 b 3 c 4 d how can number rows=16 if number of records=m resultant should m^2 i tried query result select * t union select * t union select * t union select * t select * table t1 cross join table t2 demo

eclipse - How to import a non-Zend PHP project into Zend Studio without copying files? -

Image
i using wamp on windows 7 development environment. wanted test zend studio installed trial , wanted import existing project studio see no way of doing it. while developing using wamp project files under c:\wamp\www\<project folder> directory. my project doesn't have following files created if project created using eclipse , pdt think needed successful project import .settings [folder] .project projects these files imported zend going to file > import > general > existing projects workspace and project recoginized due eclipse files being present. in case there no such files , project created using simple text editor there way in zend studio import project workspace without copying files. i want make zend studio realize project file structure on c:\wamp\www\<project folder> directory can start coding. here want clarify had changed default workspace c:\wamp\www after zend studio started. when try import project using php project existi