Posts

Showing posts from August, 2011

java - Threading HttpUrlConnection -

i have 10 lists contains location data, each list has 10.000 entries. starting executerservice thread work. executorservice executor = executors.newfixedthreadpool(locationlocationlist.size()); for(list<location> locationlist: locationlocationlist){ executor.execute(new testthread(locationlist)); } it takes soo long finish work, in 10 threads. expensive part seems 1 open url , connect it. idea how can tune this? @override public void run() { while(isrunning){ gson gson = new gson(); map<integer, data> map= new hashmap<integer, data>(); for(location location: locations){ string data = getjson(location.getlatitude(), location.getlongitude()); data data= gson.fromjson(data, data.class); map.put(location.getid(), data); } weatherdao.setweatherfast(map); isrunning = false; } }

java - Change the database in a Spring web app -

i have created web app spring on basis of maven archetype spring web app kolorobot on github this archetype. since have not been developing spring several months, need help. web app using hsql db. want change db, not sure it. maybe more experience can help? content of persitence.properties file: datasource.driverclassname=org.hsqldb.jdbcdriver datasource.url=jdbc:hsqldb:mem:test datasource.username=sa datasource.password= hibernate.dialect=org.hibernate.dialect.hsqldialect hibernate.hbm2ddl.auto=create in web app there several config classes, come along parent archetype. this jpaconfig: package org.stimpy.config; import java.util.properties; import javax.sql.datasource; import org.springframework.beans.factory.annotation.value; import org.springframework.context.annotation.bean; import org.springframework.context.annotation.configuration; import org.springframework.data.jpa.repository.config.enablejparepositories; import org.springframework.jdbc.datasource.drivermanag

ios - Tableview reloadData and getting CGRect of new cell -

i have uitableview cards. every time want add new card after pushing draw button want moved center of view location in table should placed basic animation. have managed destination of new drawn card code: cellrectintabledrawncard = [[self playercardstable] rectforrowatindexpath:drawncardindexpath]; cellinsuperviewdrawncard = [[self playercardstable] convertrect:cellrectintabledrawncard toview:[[self playercardstable] superview]]; however, determine cellrectintabledrawncard need reload playercardstable reloaddata shows drawn card already. fraction of second because place new card in table animation fires after reloaddata . doing reload after animation not option, because don't have drawncardindexpath then. is there way can rect without reloading tableview? or else, there way can hide new cell after reloaddata , show after animation done? thanks! you want insert row , populate individually , not complete table reload. the code snippet shows button uses i

ruby - Can mechanize work with browsers? -

i using ruby's gem mechanize automate file upload after logging in particular site.. able login using #!/usr/bin/ruby require 'rubygems' require 'mechanize' #creating object mechanize class = mechanize.new { |agent| # site refreshes after login agent.follow_meta_refresh = true } #getting page a.get('https://www.samplesite.com/') |page| puts page.title form = page.forms.first form.fields.each {|f| puts f.name} form['username'] = "username" form['password'] = "password" # submitting form , reaching page now there 2 questions... a. can see happening on browser using agent or tool? b. there way keep mechanize waiting page load? do try selenium webdriver ? should integrates ruby program

c# - Validating Entity Framework 6 entities that have similar properties -

i'm using entity framework 6 (created database model), , have table called users, of have related tables called userxml, userextranet, usercustomer, of these tables have same fields. the tables linked foreign keys. based on user type e.g xml/extranet/customer, need perform validation userxml enabled, or userextranet enabled. here snippet of have @ moment //find user user ouser = context.user.firstordefault(u => u.email == this.email); if (ouser != null) { var ousertype = (dynamic)null; int imaxattempts; bool bvalidip = false; //authenticate type of user switch (this.type) { case usertype.xml: ousertype = ouser.userxml; //do validation break; case usertype.api: ousertype = ouser.userapi; //do validation break; default: ousertype = null; break; } } here entities. the user class public partial class user { public

user interface - What is the best method of showing a refreshing 7x7 tiled 'map' in a Java GUI? -

i'm making java gui game needs show map of area around player 7x7 'tiles' large. have tiles needed png images , can them application no problem. i'm unsure of best method of making map refreshed these tiles. i planning on using loop inside loop print out series of jlabels image icons on them in 7x7 format. remove them , print new set every time map 'refreshes'. however wanted know if there easier or better way of achieving this? or if idea.

d3.js - d3 color scale - linear with multiple colors? -

i'm trying create little quantize scale, act linear color scale? when try put multiple colors linear scale, seems scale between first 2 colors. i'd multiple colors quantize scale, fade between colors. i'm unsure if possible. //red , green works ok var color = d3.scale.linear() .range(['red','green']); //doesn't work - red , green show var color = d3.scale.linear() .range(['red','green', 'blue']); //red green , blue show, doesn't fade between colors var color = d3.scale.quantize() .range(['red','green', 'blue']); you have use domain 'pivot' value like: d3.scale.linear() .domain([0, pivot, max]) .range(['red', 'green', 'blue']); from documentation continuous scale domains : although continuous scales typically have 2 values each in domain , range, specifying more 2 values produces piecewise scale. ex

python - "Sometimes" getting an InterfaceError on PostgreSQL with Peewee ORM -

i'm building website using python flask framework , peewee orm postgresql 9.3. far things going pretty well, run trouble. interfaceerror: connection closed . code on follows: pendingorders_q = customerorder\ .select()\ .where(customerorder.status == customerorder.status_pending)\ .where(customerorder.expiration < datetime.utcnow()) if len(list(pendingorders_q)) > 0: # stuff here.. i know way of counting number of results pretty nasty, don't know other ways of doing it. also, works, gives error below. don't understand why works fine, gives error. know whats going on here? file "/home/kramer65/xs/app/order_management.py", line 210, in checkexpiration if len(list(pendingorders_q)) > 0: file "/usr/local/lib/python2.7/dist-packages/peewee.py", line 1988, in __iter__ return iter(self.execute()) file "/usr/local/lib/python2.7/dist-packages/peewee.py", line 1981, in execute self._qr = resultwrappe

python - Identify offset of a value in numpy -

given flatten nxn array in numpy, i'd find minimum value, , offset in array. i've managed find minimum value, possible identify offset (which row , column)? in example below, = 0.5, how can know if 0.5 [1,0], or [2,1]? from numpy import * value = 0 num_node = 5 edge = array(zeros((num_node, num_node))) edge = [[ 0., 0., 0., 0., 0. ], [ 0.5, 0., 0., 0., 0. ], [ 1., 0.5, 0., 0., 0. ], [ 1.41421356, 1.11803399, 1., 0., 0. ], [ 1., 1.11803399, 1.41421356, 1., 0. ]] = reshape(edge, num_node*num_node) print min(filter(lambda x : x > value, a)) you use np.where : >>> edge = np.array(edge) >>> edge[edge > 0].min() 0.5 >>> np.where(edge == edge[edge > 0].min()) (array([1, 2]), array([0, 1])) which gives x coordinates , y coordinates

php - Expression Engine: Synchronising development and live environments -

i have read post seem quite old (2008) , hoping might have more elegant solution. i know how expression engine developers working local test , live environment workflow. i have expression engine 2.8.1 running on live environment (debian web server). develop channels, channel fields, themes , other content configurations in local test environment on laptop (mamp server, virtualbox vm, whatever). once happy push changes live server. the tricky part specific changes exist both in database , file system. further more don’t want push whole database live server paths / urls , other configuration options different each. i using file based templates makes part of process easier database configurations still problem. there simple clean way export / import content configuration tables between these environments? any , appreciated. most people using variety of plugins synchronisation, including low variables global variables files , snippet sync same snippets. as syncing

java - j2ee - errore regarding port number, 0 -

give me solution "several ports (8080, 8009) required tomcat v7.0 server @ localhost in use. server may running in process, or system process may using port. start server need stop other process or change port number(s)." you either need shutdown whatever listening on ports or change port number want run tomcat on. suspect tomcat running on system. can check on *nix or mac system on command line with: $ ps -efa | grep tomcat to change port number tomcat running on modify entry in tomcat server.xml file (tomcat_installation_dir/conf/server.xml). full instructions can found here

CSS Relative positioning preventing click on link -

please @ jsfiddle here - http://jsfiddle.net/ftuz5/ . know why links won't work relative positioning have used create link / menu backgrounds want covering element can't work out how resolve issue (having tried relative , z-index on li , elements, plus adding , div span element using create 'button' style background) no avail. li { list-style: none; } .side-nav li { padding-bottom: 3.125em; width: 100%; line-height: 1.25em; text-align: center; } .side-nav { position: relative; top: 1.75em; z-index: -1; display: block; color: white; text-decoration: none; background: #c7cbaf; -webkit-border-radius: 48px; -moz-border-radius: 48px; -ms-border-radius: 48px; -o-border-radius: 48px; border-radius: 48px; padding-top: 1.375em; padding-bottom: 0.75em; text-transform: uppercase; } .responsive-side-nav { background: transparent url(http://thewebbakery.co.uk/assets/graphics/responsive-icon-sml.png) no-repeat top center; } .interac

android - LG L90 doesn't install debug usb drivers -

i have problem driver lg l90. adt (for eclipse) doesn't see smartphone. problem phone isn't able install drivers. have idea how can do? drivers, tried install, of official website. how enable usb debugging lg optimus (lgd415). android version 4.4.2 (kitkat) go website , download drivers phone: http://www.lg.com/us/support/mobile-support example, mine be: http://www.lg.com/us/support-mobile/lg-lgd415rd . click on “software update & drivers” on phone, need enable usb debugging. so, go “settings”. go “about phone” go “software information” tap “build number” 5 times. pop-up appear saying “you developer”. your’re not done yet. go phone’s home page pushing home button. go “settings”. go “developer options” click “usb debugging- turn on debug mode when usb connected”. blue checkmark appear. unplug phone pc. plug in. on pop-up, make sure set “media sync (mtp)”. now phone show on option when want run app in eclipse.

php - Will it reveal a website between a link shortener and a redirect? -

so can edit links, thinking having website act middle part, store links in database , use php redirect (kind of shortener more basic code) i did test 2 url shorteners, , me seemed middle 1 wasn't revealed @ all, however, don't know happen if 1 went slow (like browser possibly receiving data x or put url in bar). also, if wasn't obvious, still able see headers received site or something? your browser know. first 1 returns response redirect header containing new url. browser use url make new request second redirect url. you can probably see happening when inspect network tab in developer tools (f12) in browser.

php - date formatting from MySQL -

i have serious problem dealing data mysql. insert date upon form submission via php using now() , inserted table field date. upon retrieval db, subtract given 10 hours, , once @ 0 function executed. conversion not seem work keep getting errors. appreciated. in advance! code: //retrieval db $sql = mysql_query("select * `objectives` limit 0 , 30"); while ($data=mysql_fetch_array($sql)) { $data['obj_date'];//2014-04-06 echo date('y-d')- $data['obj_date'];//0 } try this, can't subtract 2 dates you're doing in php have use strtotime change dates timestamps, subtract these 2, calculate want get... <?php //$data['obj_date'];//2014-04-06 //difference in seconds $difference=strtotime(date("y-m-d")) - strtotime($data['obj_date']); //calculate number of days echo ($difference/86400).' days';

java - Will JPA EntityManager's merge method lead to OptimisticLockException? -

let's merge detached entity. when do t mergedentity = entitymanager.merge(detachedentity); the entitymanager load entity (with same identifier detachedentity) database , copy data detachedentity new loaded entity. when later transaction ends, entity saved database. however, in concurrent scenario, entity in database can updated other transactions between entity firstly loaded in transaction , flushed @ end of transaction. in case, know whether optimisticlockexception thrown? if so, why merge api doesn't specify optimisticlockexception in java doc? http://docs.oracle.com/javaee/6/api/javax/persistence/entitymanager.html#merge(t) thanks because merge() method not throw exception. exception thrown when state of entity, in memory, flushed database. doesn't happen when merge() called, when flush() called, either explicitely, or before commit, or before query executed.

sql - Difference of 2 columns of query -

i have votequestion table: votequestion(iduser → user, idquestion → content, isup) and question table: question(idquestion → content, title) i want select 5 questions best score (upvotes-downvotes). upvote votequestion isup = true , downvote votequestion isup = false . i tried following query, it's not looking for. it's giving same score every question. with upvotes ( select count(*) "a" "votequestion", "question" "votequestion"."idquestion" = "question"."idquestion" , "votequestion"."isup" true ), downvotes ( select count(*) "b" "votequestion", "question" "votequestion"."idquestion" = "question"."idquestion" , "votequestion"."isup" false ) select "title", "question"."idquestion", upvotes."a"-downvotes."b" total &qu

Sublime text 3 brackets highlighting like in Notepad++ -

Image
i use bracket highlight plugin, works if cursor located inside brackets. if put cursor after closing bracket, highlighting not work: in notepad++: how same in sublime? looking @ screenshots, placing cursor after closing bracket, highlight still works. there still line under bracket, less visible (probably opacity used or something). i skimmed through brackethighlighter documentation, couldn't find way change appearance (although i'm pretty sure should possible, since plugin pretty customisable).

amazon web services - Logstash & Elasticsearch mass log process -

i know what's best configuration processing mass log files - i've enabled aws new feature, elb logs , ship elasticsearch using logstash, i have 400 million requests per day, architecture should choose? best regards. for logstash/elasticsearch "all depends" on events, how complex logstash configurations are, , how complex resulting events are. best proof of concept starting 1 index 1 shard on 1 machine , fire events @ until find limit. same procedure processing events logstash. then you'll have reference hardware necessary process volume of events.

c++ - Visual Studio 2010 linking libraries and include paths for multiple projects -

i working on visual studio 2010 project use glew, glut , glm. have linked libraries , dll project. question how do once , when create new project linked , libraries , paths linked past project still there. so dont have again. thank you. you can create own project templates. create empty project libraries linked. file -> export template select "project template", choose template name , icons. check if "automatically import template visual studio" checked. now can create projects template.

How to keep a Service with listeners alive after unbind in Android? -

i'm build chat app using xmpp. i've created service handle connection , incoming messages, adding different listeners needed. the problem is, however, whenever activity calls unbind on service (e.g. when activity paused or stopped when user puts app in background) service gets destroyed, though has listeners inside (such chat listener, message listener, etc..) how can keep service alive able receive messages when app in background? read using foreground service quite frowned upon, i'd rather avoid if possible. i had when developing app recently. the trick start service on own , bind using intent . when unbind it, service still continue running. intent = new intent(this, dataservice.class); startservice(i); bindservice(i, this, context.bind_auto_create);

google analytics - Unable to track page in fake folder -

Image
i have urls mywebsite.com/something/something cannot track. what can track e.g. www.mywebsite.com/faq what cannot track e.g. www.mywebsite.com/myaccount/mycampaigns there no such folder myaccount, made .htaccess: rewriterule ^faq/?$ faq.php [nc,l] rewriterule ^myaccount/mycampaigns/?$ mycampaigns.php [nc,l] how track whether user got page? i forgot add tracking code page. thought added pages , still, missed one. amateur am.

perl - How to get status update in NCBI standalone BLAST? -

for example, running standalone blast+ thousands of est sequences remote (ncbi) server. not getting status message 15 of 100 sequence running. possible status message that? or other way send 1 after sequence using perl scripts? many thanks! i suggest using bioperl ( http://metacpan.org/pod/bioperl ) , bio::tools::run::remoteblast module. see http://metacpan.org/pod/bio::tools::run::remoteblast , here code example give in remoteblast.pm module while (my $input = $str->next_seq()){ #blast sequence against database: #alternatively, pass in file many #sequences rather loop through sequence 1 @ time #remove loop starting 'while (my $input = $str->next_seq())' #and swap 2 lines below example of that. $r = $factory->submit_blast($input); #my $r = $factory->submit_blast('amino.fa'); print stderr "waiting..." if( $v > 0 ); while ( @rids = $factory->each_rid ) { foreach $rid ( @rids ) {

c - Is it undefined behaviour to call a function with pointers to different elements of a union as arguments? -

this code prints different values after compiling -o1 , -o2 (both gcc , clang): #include <stdio.h> static void check (int *h, long *k) { *h = 5; *k = 6; printf("%d\n", *h); } union myu { long l; int i; }; int main (void) { union myu u; check(&u.i, &u.l); return 0; } i think should undefined behavior, because of pointer aliasing, cannot pinpoint part of code forbidden. it write 1 union element , read other, according defect report #283 allowed. ub when union elements accessed through pointers rather directly? this question similar accessing c union members via pointers , think 1 never answered. it took me while realize crux of issue here. dr236 discusses it. issue passing pointers function point overlapping storage; , whether compiler allowed assume such pointers may alias each other or not. if discussing aliasing of union members simpler. in following code: u.i = 5; u.l = 6; printf("%d\n", u.i); th

Question mark in SAS -

what question mark in sas mean? proc print data=employees; name ? w; run; i read here used in input statement supress warnings. in above example in where . presume means contains . difference of using ? in input , where ? as mentioned in this documentation article , ? 1 of several where -only operators work in where statement (largely result of where statement working more sql query where natural sas statement). there no relationship between , ? usage in input statement.

c - Weird behavior of printf() calls after usage of itoa() function -

i brushing c skills.i tried following code learning usage of itoa() function: #include<stdio.h> #include<stdlib.h> void main(){ int x = 9; char str[] = "ankush"; char c[] = ""; printf("%s printed on line %d\n",str,__line__); itoa(x,c,10); printf(c); printf("\n %s \n",str); //this statement printing nothing printf("the current line %d",__line__); } and got following output: ankush printed on line 10 9 //here nothing printed current line 14 the thing if comment statement itoa(x,c,10); code above mentioned statement printed , got following output: ankush printed on 10 line ankush //so got printed current line 14 is behavior of itoa() or doing wrong. regards. as folks pointed out in comments, size of array represented variable c 1. since c requires strings have null terminator, can store string of length 0 in c . however, when call itoa

size - Why my ffmpeg libs are so large? -

i compiled ffmpeg libs on ubuntu 64-bits using following script: mkdir ~/ffmpeg_sources #x264 cd ~/ffmpeg_sources wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2 tar xjvf last_x264.tar.bz2 cd x264-snapshot* ./configure --prefix="$home/ffmpeg_build" --bindir="$home/bin" --enable-static --disable-asm make make install make distclean #ffmpeg cd ~/ffmpeg_sources wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 tar xjvf ffmpeg-snapshot.tar.bz2 cd ffmpeg pkg_config_path="$home/ffmpeg_build/lib/pkgconfig" export pkg_config_path ./configure --pre

c# - Number Guessing Game: difficulty setting -

this how generating random number, able have user select difficulty: easy = 1-10, intermediate = 1-50, hard = 1-100. wondering how done. appreciated. { class hilow { private int number; public int number { { return number; } } public hilow(int taker) { number = new random().next(taker); } } } { class hilowui { public void welcome() { console.writeline("\nwelcome highlow game!" + "\n\ninstructions: \ntry guess number between selected difficulty range." + "\nif guess right number win!"); console.writeline("\ndifficulty: \n[1] (1-10) easy \n[2] (1-50) intermediate \n[3] (1-100) hard"); } public void play() { welcome(); while (true) { hilow hi = null;

html - Javascript Cannot read property 'document' of undefined -

i've inherited else's web site , i'm trying resolve why javascript-based rollover menu doesn't work in ie (compatability mode enabled). the code, via included menu.js: function gomenu(m,n){ if(n){ showmenu(m); }else{ hidemenu(m,n); } } function showmenu(m) { for(i=0;i<6;i++){ if (i!=m){ hidemenu(i); } } if(document.all){ eval('document.all.menu'+m+'.style.visibility="visible"'); }else{ eval('document.menuspan.document.menu'+m+'.visibility="show"'); } } function hidemenu(m) { if(document.all){ eval('document.all.menu'+m+'.style.visibility="hidden"'); }else{ eval('document.menuspan.document.menu'+m+'.visibility="hide"'); } } and code in html file basic <span id="menu0" onmouseout="gomenu(0,0);" onmouseover="gomenu(0,1);"> <layer onmou

Why doesn't "webgl" context work on Chrome? -

this piece of code returns null on chrome returns proper context on firefox. var create3dcontext = function(canvas, opt_attribs) { var names = ["webgl", "experimental-webgl"]; var context = null; (var ii = 0; ii < names.length; ++ii) { try { context = canvas.getcontext(names[ii], opt_attribs); } catch(e) {} if (context) { break; } } return context; } this how called: var setupwebgl = function(canvas, opt_attribs) { function showlink(str) { var container = canvas.parentnode; if (container) { container.innerhtml = makefailhtml(str); } }; if (!window.webglrenderingcontext) { showlink(get_a_webgl_browser); return null; } var context = create3dcontext(canvas, opt_attribs); if (!context) { showlink(other_problem); } return context; }; var getwebglcontext = function(canvas, opt_attribs) { if (isiniframe()) { updatecssifiniframe(); // make canvas backing store siz

java - how to remove unwanted lines/noise in OpenCV? -

i developing ocr app android(building java application). want detect text image captured camera , pre-processing using opencv,but getting lines being read text,i have followed approach: 1-rgb greyscale 2-threshold 3-gaussian blur 4-median blur 5-dilation 6-erosion results atleast better before still not getting right results. how can remove noise,what general sequence of filters these can applied image improve result ocr. new opencv please guide me through. thanks. old image updated image from above image able find result no 3,but when contours drawn somthing dont want there noise also.what missing here.dont know further. revised code: package simple_contours; import java.util.arraylist; import java.util.list; import org.opencv.core.core; import org.opencv.core.cvtype; import org.opencv.core.mat; import org.opencv.core.matofpoint; import org.opencv.core.point; import org.opencv.core.rect; import org.opencv.core.scalar; import org.opencv.core.size; import org.open

sql - Creating Table (Oracle) -

i creating 2 tables. first table creates no errors, when try create subhead table, error: line 2, missing right parenthesis. not sure wrong line. below sql statements: create table head (code numeric(4,0) not null primary key, headname varchar(50) not null unique, htype varchar(1) not null, hdate date not null, opbal decimal(11,2) not null ); create table subhead (hcode numeric(4,0) not null foreign key references head(code), subcode numeric(4,0) not null, subname varchar(50) not null, sdate date not null, opbal decimal (11,2) not null, constraint pk_subheadid primary key (hcode, subcode) ); syntax: http://docs.oracle.com/cd/b28359_01/server.111/b28286/clauses002.htm#sqlrf52167 note "in-line" constraint syntax : "col col_type references tab(col)" , not "foreign key" the data type number number not numeric so memory did not fool me - can have multiple in-line constraints (although synt

javascript - Increment field on all records in Mongo? -

the error being thrown in angular itemcontroller, error: typeerror: path must string $scope.createproduct = function() { // validate formdata (using our exentions.js .filter) make sure there //if form empty, nothing happen if (!isemptyobjectfilter($scope.formdata)) { // call create function our service (returns promise object) emotions.create($scope.formdata) // if successful creation, call our function new emotions .success(function(data) { $scope.formdata = {}; // clear form our user ready enter $scope.products = data; // assign our new list of emotions }) .error(function(data) { console.log('error: ' + data); }); } }; adding else if, moving every record down when new position matches exist

python - Kivy compiling errors on macos -

trying compile ios first python kivy project on macos. http://kivy.org/docs/guide/packaging-ios.html $ git clone git://github.com/kivy/kivy-ios $ cd kivy-ios $ tools/build-all.sh if try build, terminal works while , @ end error: .... ['/users/xxx/kivy-ios/tools/liblink', '-arch', 'armv7', '-isysroot', '/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos7.1.sdk', '-miphoneos-version-min=7.1', '-arch', 'armv7', '-pipe', '-no-cpp-precomp', '-isysroot', '/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos7.1.sdk', '-miphoneos-version-min=7.1', '-o3', '-qunused-arguments', 'build/temp.macosx-10.9-armv7-2.7/ios.o', 'build/temp.macosx-10.9-armv7-2.7/ios_mail.o', 'build/temp.macosx-10.9-armv7-2.7/ios_browser.o', '-o', 'build/lib.macosx-10.9-arm

Documentation for three.js controls? -

three.js comes many useful controls, cause camera movement in response keyboard , mouse input. they @ https://github.com/mrdoob/three.js/blob/master/examples/js/controls , accessed in code e.g. three.orbitcontrols . however, can't find documentation or comments says situation use control or intended do. can point me information, or have analyze code figure out if, example, prefer flycontrols firstpersoncontrols ? the documentation controls exist, deleted repository here . seems bizarre thing do, there explanation of sorts here . guess docs incomplete anyway , easier delete them finish them. :-p

javascript - Foundation Sass, Accordion and Tabs not working -

i having problems foundation , accordion , tabs modules. created project using command line compass create <project name> -r zurb-foundation --using foundation , customized style sheet using sass , _settings.scss . although, can't accordion , tabs modules working , don't understand why. realized both foundation.accordion.js , foundation.tab.js files not come with, in js folder when creating project did. therefore decided put them myself there standard downloading of foundation still not working. included script tags them @ end html page. do guys know if there's possibility create foundation project using sass includes 2 modules? can't use standard foundation since customizing everything. thanks help. i found answer problem. used create foundation projects using command above. although, realized preferable create project using foundation new project_name (nodejs , bower needed). this, comes along, including foundation.accordion.js , foundation

objective c - Add boundaries to an SKScene -

i'm trying write basic game using apple's sprite kit framework. far, have ship flying around screen, using skphysicsbody. want keep ship flying off screen, edited update method make ship's velocity zero. works of time, every , then, ship fly off screen. here's update method. // const int x_min = 60; // const int x_max = 853; // const int y_max = 660; // const int y_min = 60; // const float ship_speed = 50.0; - (void)update:(cftimeinterval)currenttime { if (self.keyspressed & down_arrow_pressed) { if (self.ship.position.y > y_min) { [self.ship.physicsbody applyforce:cgvectormake(0, -ship_speed)]; } else { self.ship.physicsbody.velocity = cgvectormake(self.ship.physicsbody.velocity.dx, 0); } } if (self.keyspressed & up_arrow_pressed) { if (self.ship.position.y < y_max) { [self.ship.physicsbody applyforce:cgvectormake(0, ship_speed)]; } else { self.sh

html - Detect if a div has more than one line -

how can detect if div has more 1 line? mean this: div :multiline { ... } i'd format content regarding number of lines (1 or more) if you're willing use javascript/jquery, check height of div , see if greater 1 line of text. of course, isn't error-proof, wouldn't know way.

c++ - Unresolved Externals between functions -

i'm getting unresolved external error can't figure out what's causing it. error lnk2019: unresolved external symbol "public: __thiscall abc::abc(class abc const &)" (??0abc@@qae@abv0@@z) referenced in function "public: __thiscall hasdma::hasdma(class hasdma const &)" (??0hasdma@@qae@abv0@@z) 1>c:\users\matt\documents\visual studio 2010\projects\gsp_125_lab5\debug\gsp_125_lab5.exe : fatal error lnk1120: 1 unresolved externals the program runs when delete block of code: hasdma::hasdma(const hasdma & hs) : abc(hs) { style = new char[std::strlen(hs.style) + 1]; std::strcpy(style, hs.style); } but don't know part of being referenced elsewhere. here abc header , hasdma header. class abc { private: enum {max = 35}; char label[max]; int rating; protected: const char * label() const {return label;} int rating() const {return rating;} public: abc(const char * l = "null", int r = 0);

jquery - a dark transparent mask for div -

i trying apply dark transparent mask on product div when hovers on product image. have created mask whole screen before. used same logic time well, acts weird. tried use mouseenter, mouseleave doesn't work. mask keeps appear disappear mouse pointer did not leave image. below how looks: , don't know why mask target whole screen when target box1 in jquery. jsfiddle html <div id="box1"> <img src="http://smilesoftware.com/assets/images/uploads/products/icon_pdfpenipad_140x140.png" alt="orange" title="orange" /> <a href="#">view detail</a> </div> css div#box1 { border: #999 2px solid; width: 180px; height: 250px; } div#box1 > img { position: absolute; z-index: 2000; max-height: 240px; } div#box1 >a { display: none; position: absolute; top:100px; left: 40px; margin: 10px 0 0 10px; z-index:3000; background: white; text-decoration: none; } div#box1:hover

for loop never ends in c -

i'm trying write c program prints grid each year. have loop iterates prints grid each year how many years choose in argument. loop prints grid endless number of years exceeding boundary put on reason. here's code: int main(int argc, char *argv[]) { if (argc != 3) /* argc should 2 correct execution */ { /* print argv[0] assuming program name */ printf("usage: %s filename", argv[0]); } else { int year = atoi(argv[1]); double grida[11][11]; double gridb[11][11]; int in; int n; printf("%d\n",year); file *file = fopen(argv[2], "r"); (int = 0; < 12; i++) { fscanf(file, "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf", &grida[i][0], &grida[i][1], &grida[i][2], &grida[i][3], &grida[i][4], &grida[i][5], &grida[i][6], &grida[i][7], &grida[i][8], &grida[i][9], &grida[i][10], &grida[i][11]);

How can I integrate Bower with Gulp.js? -

i trying write gulp task few things install bower dependencies concat dependencies 1 file in order of dependencies i hoping without having specify paths dependencies. know there command bower list --paths unsure of if possible tie together. any thoughts? edit so trying use gulp-bower-files , getting eaccess error , not generating concatenated file. gulpfile.js var gulp = require('gulp'); var bower = require('bower'); var concat = require('gulp-concat'); var bower_files = require('gulp-bower-files'); gulp.task("libs", function(){ bower_files() .pipe(concat('./libs.js')) .pipe(gulp.dest("/")); }); bower.json { "name": "ember-boilerplate", "version": "0.0.0", "dependencies": { "ember": "1.6.0-beta.1", "ember-data": "1.0.0-beta.7" } } and keep coming across error events.js:72

Why it is slower to get query result from z3 java API then get from z3 directly? -

just noticed benchmarks, slow query result z3 via java api. however, if dumped query smt2 format, , run z3 in command line directly, takes less second. wonder why? i noticed problem contains (push) command, removing changes performance dramatically. when z3 first sees (push) , switches different solver supports incrementality , can have dramatic impact on performance. setting verbosity 15 via -v:15, first line of z3s output tells solver using, e.g., when push command present says (combined-solver "using solver 2 (without timeout)") and when not, says (combined-solver "using solver 1") for given example, solver 2 happens faster.

java - MySQL and JSP Database connectivity with Glassfish server 4 -

Image
here code. **insert.html** <html> <head> <title>donate blood !</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <form action="store.jsp" method="post"> name: <input type="text" name="nam"><br> rollno: <input type="text" name="rno"><br> blood group: <input type="text" name="grp"><br> <input type="submit" value="add me !"> </form> </body> </html> **store.jsp** <%@page import="java.sql.drivermanager"%> <%@page import="java.sql.s

database - Efficient persistence strategy for many-to-many relationship -

tl;dr: should use sql join table or redis sets store large amounts of many-to-many relationships i have in-memory object graph structure have "many-to-many" index represented bidirectional mapping between ordered sets: group_by_user | user_by_group --------------+--------------- louis: [1,2] | 1: [louis] john: [2,3] | 2: [john, louis] | 3: [john] the basic operations need able perform atomic "insert at" , "delete" operations on individual sets. need able efficient key lookup (e.g. lookup groups user member of, or lookup users members of 1 group). looking @ 70/30 read/write use case. my question is: best bet persisting kind of data structure? should looking @ building own optimized on-disk storage system? otherwise, there particular database excel @ storing kind of structure? before read further: stop being afraid of joins . classic case using genuine relational database such postgres. there few reasons this:

python - While loop ignores print? -

ok im working on basic dice game, when gets while loop doesnt print message inside, message placeholder. dicenumber = none numberchoice = none ready = none test = "lol" class playerclass(): points = 0 class enemyclass(): point = 0 def rolldice(): dicenumber = dicenumber.randint(1,9) def start(): print("hello welcome dice game.") print("the goal of game guess number dice land on.") print("the option 1 6 , game won getting 3 points.") print() print("are ready play?") print("1 - yes") print("2 - no") ready = int(input()) start() while ready == 1: print("hello") use global inside start function. also, trying put while ready==1 , in infinite loop! dicenumber = none numberchoice = none ready = none test = "lol" class playerclass(): po