Posts

Showing posts from January, 2015

How to pause javascript code excution for 2 seconds -

this question has answer here: sleep in javascript - delay between actions 6 answers i want stop execution 2 seconds. this, follows code block: hw 10.12 for (var = 1; <=5; i++) { document.write(i); sleep(2);//for first time loop excute , sleep 2 seconds }; </script> </head> <body> </body> </html> for first time loop excute , sleep 2 seconds. want stop execution 2 seconds? javascript single-threaded, nature there should not sleep function because sleeping block thread. settimeout way around posting event queue executed later without blocking thread. if want true sleep function, can write this: function sleep(miliseconds) { var currenttime = new date().gettime(); while (currenttime + miliseconds >= new date().gettime()) { } }

Python and Oracle Views -

can give me brief information how "connect" oracle view python? i looked around couldn't anything. i'm new oracle db. not use connect python , info. have view connect to. at first thought can use view below, connect: db = sqlalchemy.create_engine('oracle://user:pass@server:1521/view_name') then used this: cx_oracle.connect(user='user', password='pass', dsn=cx_oracle.makedsn('server',1521,'view_name')) then realized view cannot used db name, because "tool" view existing table(s). how can accomplish this? a view in rdbms oracle "virtual" table. when querying it, query table. connect database/schema containing view, , select usual. view doesn't feature in connection details @ all, in query.

Android-Studio refresh project with build.gradle changes -

how can sync changes made in build.gradle project structure ( e.g. androidstudio recognizing lib added? kind of "reimport maven projects" maven projects - pure gradle project. i read somewhere "synchronize" item on module's context menu should update ide's settings based on build.gradle file. ok, in latest version of android studio 0.1.3, they've added gradle project refresh button next other android specific buttons in toolbar. make changes manually build.gradle files , settings.gradle , click button. should configure , refresh project settings based on gradle files.

jquery - Custom number formatter with hyperlink link -

i have achieved of required stuck small issue. i using jquery 1.8.3 , jqgrid 4.4.0. has rate column acts link open modal box break details. issue values in rate column purely numbers , have used custom template set formatting values due link (custom formatter) formatting goes off. html code: <table id="tbcmpcontents"> <tr><td/></tr> </table> <div id="divcmpcontentspager"></div> js code: var mydata = [ {id: "2", element: "salt", qty: "10.00", rate: "21200.00", cost: "200.00"}, {id: "3", element: "sugar", qty: "20.00", rate: "32500.00", cost: "600.00"} ], viewnumtemplate = { align: 'right', classes: 'numberpadding', formatter: 'number', formatoptions: { decimalseparator: ".", thousandsseparator: "", decimalplaces: 2, defaultvalue: '0.00...

scalaz - Is providing explicitly the context bound possible in Scala? -

in following code: def sum[a: monoid](xs: list[a]): = { val m = implicitly[monoid[a]] xs.foldleft(m.mzero)(m.mappend) } if have in scope monoid[int] has mappend = _ + _ , can call function explicit monoid[int] has different behavior? or solution use more verbose syntax second argument implicit monoid: monoid[int] ? the code exemple comes scalaz tutorial: http://eed3si9n.com/learning-scalaz/sum+function.html at end author shows exemple of providing explicitly monoid, didn't use context bounds: scala> val multimonoid: monoid[int] = new monoid[int] { def mappend(a: int, b: int): int = * b def mzero: int = 1 } multimonoid: monoid[int] = $anon$1@48655fb6 scala> sum(list(1, 2, 3, 4))(multimonoid) res14: int = 24 context bounds nothing more syntactic sugar. following: def sum[a: monoid](xs: list[a]) is extactly same as: def sum[a](xs: list[a])(implicit evidence: monoid[a]) this means regardless of way defin...

objective c - design & logic - Most efficient way to save reordered UITable rows -

Image
the blue table called routine , other 1 called exercise . routine.exercise has many-to-many relationship exercise.routine . i have uitableview user can re-arrange order of items , having problems thinking way design entities can reorder them & save reorder position. what want order position in uitable of exercises in x routine. e.g: routine has been selected , has following items in following order. e1 e3 e2 my problem comes when can not put order column in exercise entity because many-to-many relationship. thus, exercise have different position in different routines. i though on creating different entity hold position data mean i'd have create x amount of column having in mind amount of columns have greater typical number of exercises routine have. far viable option wondering if there better solution there lots of rows unused , while storing mean looping through empty ones , nullify them in case. can think better way or there better way in xcode sto...

powershell "if" needs to set two variables on match -

i need set 2 variables in script... the first $vmcluster - what's proper syntax set variable if "if" matches? if ($vmname -like "loupr*") {$vmcluster = "production"} it's script-block.... use line, or seperate ; . if ($vmname -like "loupr*") { $vmcluster = "production" $secondvar = "secondvalue" } or if ($vmname -like "loupr*") { $vmcluster = "production"; $secondvar = "secondvalue" }

pyparsing multiple lines optional missing data in result set -

i quite new pyparsing user , have missing match don't understand: here text parse: polraw=""" set policy id 800 "untrust" "trust" "ip_10.124.10.6" "mip(10.0.2.175)" "tcp_1002" permit set policy id 800 set dst-address "mip(10.0.2.188)" set service "tcp_1002-1005" set log session-init exit set policy id 724 "trust" "untrust" "ip_10.16.14.28" "ip_10.24.10.6" "tcp_1002" permit set policy id 724 set src-address "ip_10.162.14.38" set dst-address "ip_10.3.28.38" set service "tcp_1002-1005" set log session-init exit set policy id 233 name "the name 527 ;" "untrust" "trust" "ip_10.24.108.6" "mip(10.0.2.149)" "tcp_1002" permit set policy id 233 set service "tcp_1002-1005" set service "tcp_1006-1008" set service "tcp_1786" set log ...

mysql - Query in a LIKE-TREE table -

i have table following columns: idcat, idparent, des idcat autoincremented, des description , idparent can "0" if record parent or can have "idcat" value of parent if child. i need query select "des" of record not have child, this: select des table having count (idcat=idparent) = 0 obviously query doesn't work. can me please? this can done via not in, not exists or left join ... null - latter best-performing in mysql: select t1.des table t1 left join table t2 on t1.idcat = t2.idparent t2.idparent null

c# - Unstring a string: is it Possible? -

Image
i'm having problem of trying save properties settings.settings string. if use following in class: string pattern0 = safefilename(currmail.sendername); everything fine, once try save in settings string, turns strings , can't use properties anymore, there way unstring string? or there type (other than: string) use give me desired result? and here looks in settings.designer [global::system.configuration.userscopedsettingattribute()] [global::system.diagnostics.debuggernonusercodeattribute()] [global::system.configuration.defaultsettingvalueattribute("safefilename(currmail.sendername)")] public string namepattern0 { { return ((string)(this["namepattern0"])); } set { this["namenpattern0"] = value; } } as can see gets turned string, need object or something defaultsettingvalueattribute requires default value can represented string. typically use stri...

python - Re-feed some already crawled URL to spider/scheduler -

there url (domain.com/list) lists 10 links need crawl periodically. these links change pretty each 30 seconds roughly, need re-crawl domain.com/list check new links. crawling links takes more 30 seconds because of size cannot cron script each 30 seconds since end several concurrent spiders. missing links because spider takes long during first run acceptable situation though. i wrote spider middleware remove visited links (for cases in links change partially). tried include in process_spider_output new request domain.com/list dont_filter=true list feeded again scheduler, end tons of requests. code is: def process_spider_output(self, response, result, spider): in result: if isinstance(i, request): state = spider.state.get('crawled_links', deque([])) if unquote(i.url) in state or i.url in state: print "removed %s" % continue yield yield spider.make_requests_from_url('http://doma...

How do I shorten a one line if statement in ruby that only executes if field is not empty -

i have following if statement fills field result of function, if function doesn't return empty. i think i've seen examples before empty check , function can combined in if without me having repeat whole function again in condition. i'm looking newb dry advice please! icons = page.search("theicons").to_s if !page.search("theicons").to_s.empty? is wrong with theicons = page.search("theicons").to_s icons = theicons unless theicons.empty?

javascript - Knockout change the click event -

i'm trying find way change click event on elements. want think how ko binds click event attached element , changing function has no effect. viewmodel.clickevent = function(item){ logic } viewmodel.clickevent = newfunction; <div data-bind="click: clickeevent">mybutton</div> i think need use delegates having hard time figuring out how this. post basic example of how knockout? if have understood right. create fake event handler can modify without modifying actual event handler binded view. var viewmodel = { clickevent : function(item){ if(this.changableclickevent) this.changableclickevent(item); }, changableclickevent : null } viewmodel.changableclickevent = function(){ // logic alert('logic'); } ko.applybindings(viewmodel); see fiddle

arrays - How to convert an int[] into an List<Integer> in Android? -

it seems simple matter; have int[] prepopulate @ initialization, want convert list<integer> , doesn't work: int[] activities = {0,1,2}; list<integer> acta = arrays.aslist(activities); arrays.aslist() wants make list<int[]> instead, , don't understand why. how make list<integer> out of int[] ? change int integer integer[] activities = {0,1,2};

android - html5 mobile app where do i store dictionary of 50000 words -

html5 mobile app creation.. i designing html5 game mobile requires instant access around 50000 words. can use this localstorage if size required below 5mb. phonegap wrap app in container (not web app anymore, hybrid) you'll have database (sqlite) available. app-cache store dictionary in file , file api accessing file.

How to regenerate the icon of android project in eclipse? -

when new android project, able generate different size of app icon giving image or text, how can project under development? right click project in packeage exploler. new-> other -> android icon set select launcher icons , click next.

android - NoClassDefFoundErrror with Google Drive -

i've got project had google drive included , working fine. performed upgrade of android sdk , eclipse adt plugin , google drivie no longer works , can't understand why. i've added drive api project google play services , tick on checkbox export. i've done clean build, i've deleted bin directory of app, restarted eclipse, re-did clean build run section of app should show google account chooser app crashes. below error returned in logcat 05-18 17:17:09.089: e/androidruntime(16747): fatal exception: main 05-18 17:17:09.089: e/androidruntime(16747): java.lang.noclassdeffounderror: com.google.android.gms.common.accountpicker 05-18 17:17:09.089: e/androidruntime(16747): @ com.google.api.client.googleapis.extensions.android.gms.auth.googleaccountcredential.newchooseaccountintent(googleaccountcredential.java:171) no matter try doesn't seem make difference appreciated. update i've tried ticking export option android private libraries raghunandan sug...

C++ : loop on all files of a folder (and its subdfolders) : simplest solution? -

what's shortest solution make loop on .mp3 files of folder (and subdfolders) c++, os=windows? if possible, i'd avoid 3rd party things, such boost, if not possible, i'll use these 3rd party things (if easy install). thanks in advance. (ps: i'm sure question very common, , surely answered, after 10 minutes of search, haven't found useful.) c++ have no function getting files or folders in folder, since os specific. boost best if want cross-platform compatibility, windows @ answer here: how can list of files in directory using c or c++? simply replace printf ("%s\n", ent->d_name); with check on last 4 characters of ent->d_name see if ".mp3" , want file.

algorithm - how to generate all possible equations with a set of number and operators? -

i got maths , programming problem. for given set of character {1,2,3,4,5,6,7,8,9,+,-,*,/} . , using set of characters randomly generate 10 (or let n ) characters in array, i.e. [1,+,1,∗,3,5,7,8,1] . after need find possibility of equations using array of characters plus 1 character '='. therefore in case, [1,+,1,∗,3,5,7,8,1] following equations: 1*1=1 , 3+5=8 , 7+1=8 , 15=8+7 , 15+3=18 (maybe more) it can form multiple digit operation, i.e 15+3=18 so question trying using program generate equations all. guys give me ideas kind of algorithms can so? or methods it? my current approach: my approach not fast enough. idea is, minimum equation needs 3 number , 1 operator. and i start randomly pick 4 members generated array. if these 4 members have 1 operator, then add '=' form possible orders . e.g. 1,1,2,+ , have 112+=, 121+= ,1=12+ .... loop through that. , then increase 5 members , loop through it... do until length of array generated ...

backbone.js - How do I clear out an array's contents and replace with new contents of nested collection? -

i have project model has nested collection of projectslides. project slides images (to iterate over) show specific particular project clicked on. i can click on project name in project list , shows images, iterating through each 1 properly. if click on project name, expect array holding first project's images (project slides) clear out , replaced project slide images of new project clicked on. however, images belonging project slides of first project clear out, , second project's project slide images appended array. question how array clear out contents when click on project , have array populate new project's project slide images? in projects controller have following code: displays list of projects: showprojectlist: (projects) -> projectlistview = @getprojectlistview projects demo.aboutapp.show.on "project-name:link:clicked", (project) => console.log project @showproject project # passes project model clicked on view @project...

iphone - MKMapView doesn't display tiles on highest zoom - appears to be related to iOS 6.1.4 -

i'm working on app heavily gps-based. worked fantastically, meaning app's display of map tiles worked great, seemingly until updated iphone5 (test device) ios 6.1.4. yes, know 6.1.4 supposedly touched audio profiles, failure load map tiles coincided phone's os upgrade. ever since updated, not single application on phone (any presumably use mkmapview), except apple's maps app, load tiles when attempt zoom in max level. tiles change gray grids Ø symbol. fyi - when debugging app, mapviewdidfailloadingmap:witherror: never fires, phone doesn't think has problem. it's if tiles apple sending phone. anyway, tested on iphone5, had same problems (and updated 6.1.4), , iphone4 , ipad 2 retina, did not show symptoms. obviously, app, restrict max zoom level around this, i'm more concerned issue may not resolved until os update, while restricting user's/app's capabilities in order mask bug. has else seen happen on own devices, or heard happening...

How do you properly pull to a new branch in git using github? -

hello trying pull someones updates new branch in our project. had stuff working on stashed , created new branch. once created new branch did git pull origin <branch_name> then got error: error: there problem editor '/usr/local/bin/subl -w'. it tells me merge branch continue, nervous messing friend's work merging. can explain me best way avoid problem, can fix error? much appreciated, thank you. the error getting related core.editor setting. in .gitconfig file have section looks this [core] editor = '/usr/local/bin/subl -w' but git not succeed in spawning editor using command. should make sure editor setting points working editor. simplest way remove entire setting , let git use default. should work. you can inspect .gitconfig settings using command git config --list your git settings created number of different files, in different places depending on os. see the man page starters.

python - Check if an undirected graph is a tree in networkx -

i know if there simple way check whether undirected graph in networkx tree or not the fastest way graph g(v,e) might check if |v| = |e| + 1 , g connected: import networkx nx def is_tree(g): if nx.number_of_nodes(g) != nx.number_of_edges(g) + 1: return false return nx.is_connected(g) if __name__ == '__main__': print(is_tree(nx.path_graph(5))) print(is_tree(nx.star_graph(5))) print(is_tree(nx.house_graph()))

apache pig - Pig Batch mode: how to set logging level to hide INFO log messages? -

using apache pig version 0.10.1.21 (rexported). when execute pig script, there lots of info logging lines looks that: 2013-05-18 14:30:12,810 [thread-28] info org.apache.hadoop.mapred.task - task 'attempt_local_0005_r_000000_0' done. 2013-05-18 14:30:18,064 [main] warn org.apache.pig.tools.pigstats.pigstatsutil - failed runningjob job job_local_0005 2013-05-18 14:30:18,094 [thread-31] warn org.apache.hadoop.mapred.jobclient - no job jar file set. user classes may not found. see jobconf(class) or jobconf#setjar(string). 2013-05-18 14:30:18,114 [thread-31] info org.apache.hadoop.mapreduce.lib.input.fileinputformat - total input paths process : 1 2013-05-18 14:30:18,254 [thread-32] info org.apache.hadoop.mapred.task - using resourcecalculatorplugin : org.apache.hadoop.util.linuxresourcecalculatorplugin@3fcb2dd1 2013-05-18 14:30:18,265 [thread-32] info org.apache.hadoop.mapred.maptask - io.sort.mb = 10 is there set command within pig script or command line flag all...

c# - Using a timer to create and draw object on a specific time interval -

i want create , draw object class every 3 seconds, , objects appear on screen on random coordinates,and when click 1 of objects removed. this simple timer initialization interval of 3 seconds. in event handle drawing new objects. //timer initialization var t = new timer(); t.tick += timereventprocessor; t.interval = 3000; t.start(); //event private void timereventprocessor(object myobject, eventargs myeventargs) { //your drawing code }

java - Displaying logo in JSP -

i have been trying display image in jsp file can't seem right. picture inside folder named "img" in same directory web-inf folder. inside jsp trying show logo using normal html way of finding image can't seem right. have trying display it. don't when in dreamweaver see image displayed after deploying no longer there. have structure servlet (which root folder , name of war file) , img , web-inf folder under it. folders follow hierarchy below: servlet ---->img --->psyberassess.png ---->web-inf code jsp not working: <img src="img/psyberassess.png" width="450" height="100" border="0" /><br> just add img folder in web-inf folder instead of other folder.

joomla - Fatal error: Call to a member function attributes() on a non-object in \installer\adapter\template.php on line 81 -

when trying find , zainstalirovat through "extensions manager" created template, , when click "install", error: "fatal error: call member function attributes() on non-object in z:\home\website.joomla\www\libraries\cms\installer\adapter\template.php on line 81" who knows do, please? seems problem in templatedetails.xml file. from looking @ source of template adapter seems didn't specify extension client attribute (whether template should install site or administration). <extension version="3.1" type="template" client="site">

perl - Parsing a CSV file and Hashing -

i trying parse csv file read in other zip codes. trying create hash each key zip code , value number appears in file. want print out contents zip code - number. here perl script have far. use strict; use warnings; %hash = qw ( zipcode count ); $file = $argv[0] or die "need csv file on command line \n"; open(my $data, '<', $file) or die "could not open '$file $!\n"; while (my $line = <$data>) { chomp $line; @fields = split "," , $line; if (exists($hash{$fields[2]})) { $hash{$fields[1]}++; }else { $hash{$fields[1]} = 1; } } $key; $value; while (($key, $value) = each(%hash)) { print "$key - $value\n"; } exit; you don't column zip code in, using third field check existing hash element, , second field increment it. there no need check whether hash element exists: perl happily create non-existent hash element , increment 1 first time access it. there no need explicit...

ruby - Sorting multiple values by ascending and descending -

i'm trying sort array of objects based upon different attributes. of attributes sort in ascending order , in descending order. have been able sort ascending or descending have been unable combine two. here simple class working with: class dog attr_reader :name, :gender dogs = [] def initialize(name, gender) @name = name @gender = gender dogs << self end def self.all dogs end def self.sort_all_by_gender_then_name self.all.sort_by { |d| [d.gender, d.name] } end end i can instantiate dogs sorted later. @rover = dog.new("rover", "male") @max = dog.new("max", "male") @fluffy = dog.new("fluffy", "female") @cocoa = dog.new("cocoa", "female") i can use sort_all_by_gender_then_name method. dog.sort_all_by_gender_then_name => [@cocoa, @fluffy, @max, @rover] the array returns includes females first, males, sorted name in ascending order. but if w...

How to avoid image attachment in html email? -

i supposed send out newsletter local club. formatting in html appears fine, if user views email in web based client (e.g. yahoo, gmail, etc.), image appear separately attachment; though using url reference image. how can avoid having image appear attachment? thanks! <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>club news</title> </head> <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="-webkit-text-size-adjust: none;margin: 0;padding: 0;background-color: #fafafa;width: 100%;"> <center> <table id="table1" style="background-color: #ffffff; border-bottom: 0px none; width: 600px;...

arrays - Retrieving all localstorage data in a format that can be useful in javascript -

i doing uni assignment , part requires me pull data multiple localstorage keys , compile them in various ways (add them basically.) have got data stored form array in following format testname;testcompany;6192742222;email@email.com;1 john st;;bellevue;6056; ;5;10;20.00;44;64.00;6.40;70.40; now may have multiple of these , need take few of them, figures towards end, , add them variable number of other values other strings , hitting head against wall trying figure out. also because uni assignment cannot use jquery , json or server based software. edit: after doing suggested below still having issues, cannot th life of me code format in comments section figured put here. window.onload = getallitems(); function getallitems() { var = 0; var lslength = localstorage.length-1;   (i = 0; <= lslength; i++) { var itemkey = localstorage.key(i); var values = localstorage.getitem(itemkey); var values2 = values.split(";"); funct...

java - Giving a JPanel priority focus -

i have jpanel using keylistener content pane window; however, there buttons , text fields in grid layout on top of jpanel. how prioritize focus of jpanel retains focus after editing text or clicking buttons can read key input? you need add focuslistener on focuslost event , request focus again. this: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class jpanelfocus { public static void main(string... argv) throws exception { eventqueue.invokelater(new runnable() { public void run() { jframe f = new jframe("focustest"); jbutton b = new jbutton("button"); final jpanel p = new jpanel(); p.add(b); // here keylistener installed on our jpanel p.addkeylistener(new keyadapter() { public void keytyped(keyevent ev) { system.out.println(ev.getkeychar()); } }); // bit magic - make sure // our jpanel focussed p.a...

python - Why is my modulo condition in my prime number tester not working? -

i'm trying (and failing) write simple function checks whether number prime. problem i'm having when if statement, seems doing same thing regardless of input. code have: def is_prime(x): if x >= 2: in range(2,x): if x % != 0: #if x / remainder other 0 print "1" break else: print "ok" else: print "2" else: print "3" is_prime(13) the line comment i'm sure problem is. prints "1" regardless of integer use parameter. i'm sorry stupid question, i'm not experienced programmer @ all. your code close being functional. have logical error in conditional. there optimizations can make primality test checking until square root of given number. def is_prime(x): if x >= 2: in range(2,x): if x % == 0: # <----- need checking if evenly print "not prim...

java - Where have I messed up regarding creating a Game Menu? -

i trying create basic game menu game right now. testing out menu now, , of options wrote test out whether menu works or not. have menu class , optionpanel class well. here menu class: import java.awt.event.*; import javax.swing.*; import java.awt.*; public class main extends jframe { jpanel cardpanel; public main(string title) { super(title); setbounds(100, 100, 800, 600); setdefaultcloseoperation(jframe.exit_on_close); cardpanel = new jpanel(); cardlayout cl = new cardlayout(); cardpanel.setlayout(cl); optionpanel panel1 = new optionpanel(this); board panel2 = new board(); rules panel3 = new rules(); cardpanel.add(panel1,"1"); cardpanel.add(panel2,"2"); cardpanel.add(panel3,"3"); add(cardpanel); setvisible(true); } public static void main(string[] args) { main w = new main("ap animation demo"); } public void changepanel() { ((cardlayout)cardpanel.getlayout()).n...

java - How to get rid of text at the start of a string? -

i have text file, , starts off text before getting data need program. how go getting rid of text , pick data behind it? the file reads so: text text text text text text text text 2010 1 0.00 0.00 0.00 i'd totally skip text , straight data starts 2010 . my current way of reading text file , sorting array using scanner() so: public void readfile(){ int = 0; int j = 0; int k = 0; while(rainfile.hasnext()){ string = rainfile.next(); sorteddata[i][j][k] = a; k++; if(k==31){ j++; k=0; if(j==12){ i++; j=0; } } } } my array being sorted fine, short of manually deleting text @ start of file don't know how exclude it. thanks in advance. you can use string#indexof(string str) method find first occurence of 2010. example: string text = "text text text text text text text text 2010 1 0.00 0.00 0.00"; string...

C++ compile error c2664 ZeroMemory -

why zeromemory(&socketaddress, sizeof(connection::socketaddress)); work, doesn't? zeromemory(&connection::socketaddress, sizeof(connection::socketaddress)); i error: error c2664: 'memset' : cannot convert parameter 1 'sockaddr_in connection::* ' 'void *' &connection::socketaddress member pointer. it's not pointer, way pointer particular member of class given pointer class. zeromemory can't accept because doesn't point real memory; needs more information (a pointer instance of class containing member) before can real pointer. take @ this question more information member pointers.

opengl - Triangulate a quad with a hole in it using tessellation -

Image
is possible triangulate quad hole in using tesselation shader? example, imagine have quad. then want make hole center of quad. there need lot more of vertices make hole. and questions: can using tessellation shader? if so, how? should use geometry shader instead? that not typical application of tessellation shader, , that's not done. basically, have coarse 3d model, passed graphics card. graphics card implements tessellation algorithm, creates more refined 3d model tessellating primitives. you have supply 2 shaders: tessellation control- , evaluation shaders (in opengl terms) in tessellation control shader can "parameterize" tessellation algorithm (inner , outer tessellation factors etc). tessellation algorithm applied. thereafter tessellation evaluation shader used to, e.g. interpolate vertex attributes fine vertices. what want reminds me of csg ( http://en.wikipedia.org/wiki/constructive_solid_geometry ). it's true tessellation ...

javascript - Jquery to Get attribute values of dom elements matching a class name -

i have series of html elements such as <li id="1" class="jstree-unchecked jstree-open"> <li id="2" class="jstree-checked jstree-open"> <li id="3" class="jstree-unchecked jstree-open"> <li id="4" class="jstree-checked jstree-open"> <li id="5" class="jstree-checked jstree-open"> <li id="6" class="jstree-unchecked jstree-open"> <li id="7" class="jstree-undetermined jstree-open"> i want id's of elements have classname { jstree-checked or jstree-undetermined }. i have tried using selectors, there linq way in jquery? could please jquery like? list of id's can comma separated. the output: "2,4,5,7" the best way use .map() method: var ids = $(".jstree-checked, .jstree-undetermined").map(function() { return this.id; }).get(); console.log(ids.join()); // ...

c++ - Import a function from a different module -

say function f_a in module m_a calls function f_b in module m_b . reference across module m_a . now, i'd make module m_a self-contained, i.e. eliminate references other module. however, module m_b large in size. (in case contains maths functions in fast/accurate , single/double implementation). there way add function f_b module m_a using llvm c++ api? or have use linker api , merge whole module m_b m_a ? use text editor , cut'n'paste function target module. if link whole m_b, linker should still able detect large parts of aren't used , discard them when creating final executable. issue trying solve?

html - Pictures aligned horizontally adjust in size with window size -

i made quick example of images aligned horizontally: all of images adjust height of "wrap" div. http://i.imgur.com/voa1pbg.png yet, when make window smaller, images start come out of div , go below such: http://i.imgur.com/vkua4ju.png i want make make window smaller, images smaller. fit horizontally in size of browser. here code used make existing page: html: <h1> thriller </h1> <div id="week-wrap"> <div id="sunday" class="day"><img src="http://www.allipadwallpaper.com/wp-content/uploads/tropical-island-ipad-wallpaper-500x500.jpg"></div> <div id="monday" class="day"><img src="http://mountains.insidrinfo.com/mountains-asia/media/mountains-asia.jpg"></div> <div id="tuesday" class="day"><img src="http://s4.favim.com/orig/50/beautiful-city-light-night-street-favim.com-460323.jpg"></d...

java - Health for each enemy -

as game progresses enemies stronger. make enemies stronger made private int called thealth (probably bad programming choice) , each time sprite touched thealth--; until reaches 0 , sprite removed. worked fine until decided have more 1 sprite in scene @ time. problem having if sprite has thealth of 2 (for example)and touch it, other sprites have thealth--; too. how can give each sprite own health if touch other sprites not effected? @override public boolean onareatouched(final touchevent pscenetouchevent, final float ptoucharealocalx, final float ptoucharealocaly) { if (pscenetouchevent.isactiondown()) { if (this.getalpha() > 0.8f) { thealth--; } if (thealth == 0) { this.detachself(); mscene.unregistertoucharea(this); score++; if (score < 35) { thealth = 1; } if (score > 35) { thealth = 2; } if (score >...

html - Auto refresh a specific div blogger javascript -

i use javascript widget on blogspot. include div javascripts "non-statical" strings server , print them on page. until here works fine, problem update execution of div every few seconds in order have updated strings, without refreshing whole page, specific widget (div). have added script tries refresh specific div, had no luck. please see code below <div id="info"> <b>song:</b> <script type="text/javascript" src="xxxx"> appear have javascript turned off. </script> <br /> <b>listeners:</b> <script type="text/javascript" src="xxxx"> appear have javascript turned off. </script> <br /> <b>server status:</b> <img src="xxxxx.gif" alt="stream status" width="17" height="17" align="absmiddle" /> </div> script refreshing: <script type="text/javascript"> window.onload...

iphone - obj-c : remove the white background behind the Keyboard animation -

i want remove white background behind keyboard when appear. see attached picture! thanks help! if had guess, i'd code not animating whatever it's doing move stuff out under keyboard. try putting code in animation block, or removing entirely. use uikeyboardanimationdurationuserinfokey , uikeyboardanimationcurveuserinfokey match keyboard's built-in animation.

Samsung GS3 Specific Error s3dReadConfigFile. Works on any other Android device. -

so have mainactivity goes this. protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.setcontentview(r.layout.splash_layout); imageview imageview = (imageview) findviewbyid(r.id.logo); imageview.setimageresource(r.drawable.logo_p); handler handler = new handler(); handler.postdelayed(new runnable(){ @override public void run() { jump(); } }, 3000); } with layout this <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <imageview android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_centervertical="true" ...

javascript - Angular JS 'route' doesn't match component with %2F (encoded '/') -

i have 'route' in angular js follows $routeprovider.when('/foos/:fooid', { controller: foocontroller, templateurl: 'foo.html'}); and works great, unless :fooid component contains either '/' or '%2f' (encoded form) how can make work, 'fooid' can contain /s ? you can't because if use link %2f in it, browser decode , it'll end being / . angularjs doesn't allow use / in $route params. you can double encode it, in plnkr: http://plnkr.co/edit/e04umnqwklrtovofd9b9?p=preview var app = angular.module('app', []); app.controller('homectrl', function ($scope, $route) { }); app.controller('dirctrl', function ($scope, $route) { var p = $route.current.params; $scope.path = decodeuricomponent(p.p1); }); app.config(function ($routeprovider) { $routeprovider .when('/', {templateurl: 'home.html', controller: 'homectrl'}) .when('/dir/:p1...

java - how to draw line between 2 Geo points in android Google maps version 2? -

how can draw line between 1 geo point in google maps version 2? know accepted answers available here. according answers have override draw() function. used fragments displaying google maps. can not override function activity. can 1 me out? how can draw line between 1 geo point in google maps version 2? geopoint maps v1. draw lines in maps v2, add polyline googlemap : polylineoptions line= new polylineoptions().add(new latlng(40.70686417491799, -74.01572942733765), new latlng(40.76866299974387, -73.98268461227417), new latlng(40.765136435316755, -73.97989511489868), new latlng(40.748963847316034, -73.96807193756104)) .width(5).color(color.red); map.addpolyline(li...

testing - Rails MiniTest 'post' method not found -

i'm receiving following error when try run request specs: post :: /users/:id/authentications request::successful request#test_0001_adds authentication record user: nomethoderror: undefined method `post' #<#<class:0x007fa607163028>:0x007fa6070012c0> test/requests/authentications_test.rb:9:in `block (3 levels) in <main>' here's test itself: require "minitest_helper" describe "post :: /users/:id/authentications request" describe "successful request" "adds authentication record user" user = create_user post user_authentications_path(user) response.status.must_equal "200" end end end here's minitest_helper.rb file: env["rails_env"] = "test" require file.expand_path("../../config/environment", __file__) require "rails/test_help" require "minitest/autorun" require "minitest/rails" require "min...

c# - how to retrieve post request parameter of jquery in aspx page -

i working on project in c#.net , have jquery code in master page , master page included in home page. have created hyperlinks dynamically in home page. want when ever user clicks on hyperlink, instead of wholepage 1 part of page div class=refresh1 reload. i have include following jquery in head tag. <script type="text/javascript"> $(document).ready(function () { $("a").click(function () { var link1 = $(".mylink").text(); $.post("loaddata.aspx", { link: link1 }, function (responsetxt, statustxt, xhr) { if (statustxt == "success") alert("done!"); if (statustxt == "error") alert("error: " + xhr.status + ": " + xhr.statustext); $(".refresh1").load('loaddata.aspx .part1')...

jquery - How to show some HTML that was generated by Javascript -

here initial html, small. it's meant loading screen. <html> <head> <title>simple hello world</title> <link href="rapid-ui.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="rapid-ui.js"></script> </head> <body> body of page. </body> </html> the "rapid-ui.js" generate html string, full document - including doctype, head, meta, scripts, css, etc. after done generating html should display html on top of page in iframe in same way if "src" of iframe set url generated same html string. i tried this: function showhtml(html) { var iframe = $('<iframe id="display" frameborder="0"></iframe>'); iframe[0].src = 'data:text/html;charset=utf-8,' + encodeuri(ht...

asp.net mvc - String parameter not being populated using URL routing -

url rewriting issue. when call me url using following link http://localhost:12719/product/18 it works fine product 18 links parameter. when call using following. http://localhost:12719/product/apple it doesn't map apple product name controller, thinking trying invoke action of type apple. why map numeric , not string controller parameter? controller parameter type of string. routing below. routes.maproute( name: "product", url: "product/{id}/{slug}", defaults: new { controller = "product", action = "product", slug = urlparameter.optional }, constraints: new { id = @"\d+" } ); you have specified id numeric in regex specified in constraint. constraints: new { id = @"\d+" } remove , should work. since "product" doesnot pass \d+ test id null in action. routes.maproute( name: "product", url: "product/{id}/{slug}", defaults: new { controller...

c++ - Virtual method of copy of Pointer not working -

i'm having problem overriding methods on c++ first, worked fine, then, made changes keep code more "organized" , share on github. after doing oo changes, facilitate , make easier understand, code stopped working, , because of weird thing. viewgroup class extends view , , has method hittest override view . so, basicaly: if call hittest, must running on viewgroup (if it's viewgroup), or on view; thats ok, put virtual on method, , if direcly run on viewgroup, in fact runs hittest viewgroup, but, if create new pointer, , try run, doesen't runs hittest on viewgroup anymore, runs on view. facilitate understanding: viewgroup *v = new viewgroup(); view *t = v; v->hittest(100,100); // runs on viewgroup (ok) t->hittest(100,100); // runs on view (not ok) update: viewgroup.h: https://www.dropbox.com/s/a3lqbm73qlxds3i/viewgroup.h viewgroup.cpp: https://www.dropbox.com/s/vxbqsh6ol430x4p/viewgroup.cpp view.h: https://www.dropbox.com...