Posts

Showing posts from June, 2011

mysql - My sql select from multiple tables vs join -

Image
how following compare join statement? select t1.name, t2.salary employee t1, info t2 t1.name = t2.name; would equivalent this? select t1.name, t2.salary employee t1, inner join info t2 on t1.name = t2.name; or more outer join? it without comma. select t1.name, t2.salary employee t1 inner join info t2 on t1.name = t2.name; to use inner join or left or right or ... results want get. related values or values exist in other table , on , here can learn joins. source

sql - Distinct doesn't work -

Image
the below code gives wrong result. using distinct command type appears 2 times on results. select distinct concert.concert_id, concert.c_type, count(bookings.customer_customer_id) number_of_customers concert, customer, event, bookings customer.customer_id = bookings.customer_customer_id , event.event_id = bookings.event_event_id , concert.concert_id = event.concert_id group concert.concert_id, concert.c_type order concert.concert_id desc; results: distinct means row whole should not duplicated, in case type appears twice difference concert_id , number_of_customers.

How to make REST call to Content-Type="application/json" via VBA in Excel? -

i'm using google chrome rest api information web server. use: content-type = "application/json" , post command includes groovy code inside payload (the header remains empty): { "aaa": "dan", "bbb": "my_data", "ccc": "my_type" } or post empty in payload this works fine (i'm getting response in json format) i want post command vba excel response vba variable, can print cell in worksheet. how do it? do need download library that? i tried (without success): set objhttp = createobject("winhttp.winhttprequest.5.1") url = "[ my_url ]" objhttp.open "post", url, false objhttp.setrequestheader "content-type", "application/json" worksheets("sheet1").cells(1, 1)=objhttp please advise, needed add: objhttp.settimeouts 30000, 60000, 30000, 120000

calculate and sum cells in Javascript -

could please me code type of calculation in javascript? super easy started javascript , dont know how it, plaese through excel file, want same website, have table built in html, , when input number in "quantity" cell want calculate per excel file, https://dl.dropboxusercontent.com/u/32912319/sum.xlsx thanks lot in advance! here's html: <html> <head> </head> <body> <style type="text/css"> td {border:1px solid black; height: 30px; width: 50px;}</style> <table> <tr><td>price</td><td>100</td><td>200</td></tr> <tr><td>quantity</td><td></td><td></td></tr> <tr><td>subtotal</td><td></td><td></td></tr> <tr><td>total</td><td></td><tr> </body> </html>

regex - How to find specific text string in nested tar.gz archives? -

how find specific text string in source code files packed nested .tar.gz archives, packed inside anothe rar archive(48mb)? (on windows 7) tried use lookdisk, hangs , crash. possible find use system findstr utility, , what's regular expressions this? or other search utility, not need installation(portable). based on superuser answer example batch file searches multiple .tar.gz archive files (specified on command line) , outputs filename of .tar.gz containing specified string. it without outputting files disk. it dependant on 7-zip, can use portable version of - doesn't need "installed" - available. change value of variable searchstr (currently hell ) string want search for. i can't see obvious or easy way of returning filename of file containing text inside archive. @echo off setlocal enabledelayedexpansion set searchstr=hell rem ensure 7z.exe in path or in current directory... ie. set path=%path%;c:\program files\7-zip rem loop throu

c# - Sending Messages from the Server to the Client with SignalR -

i have been reading article documentation: http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/tutorial-getting-started-with-signalr-20-and-mvc-5 it says, can send message client server so: $.connection.hub.start().done(function () { $('#sendmessage').click(function () { // call send method on hub. chat.server.send($('#displayname').val(), $('#message').val()); // clear text box , reset focus next comment. $('#message').val('').focus(); }); }); but, how can send message server client? i first following tutorial http://www.codemag.com/article/1210071 explained need this: sendmessage("index action invoked."); with sendmessage() defined as: private void sendmessage(string message) { globalhost.connectionmanager.gethubcontext<notificationhub>().clients.all.sendmessage(message); } but, doesn't work. on client side, error is: obje

emacs - Which JVM version will CIDER run under on Windows -

is there way force cider use particular version of jvm? i've been updating number of projects use released java 8 including clojure projects depend on java interop. however, i've run problems tools during development. 1 of when using cider emacs. can't seem use java 8 jvm. i have jdk versions 1.7.0_17, _21, _25, _40, _45, _51, , 1.8.0 installed on system compatibility testing. when launch cider repl , check java version, see this: ; cider 0.6.0alpha (package: 20140322.332) (clojure 1.6.0, nrepl 0.2.3) eight-queens.core> (system/getproperty "java.version") "1.7.0_25" i saw similar results when using nrepl, before updating cider. see similar results when using repl within light table. things work expected using clojure repl launched command line. my java-related environment variables include: path contains: c:\program files\java\jdk1.8.0\bin\ java_home: c:\program files\java\jdk1.8.0 lein_java_cmd: c:\program files\java\jdk1.8.0\bi

css - "rowspan" behavior with flexbox -

given markup : <div class="foo"> <div class="a"></div> <div class="b"></div> <div class="c"></div> </div> and css: .foo { display: flex; flex-wrap: wrap; } .a { flex: none; width: 50%; height: 100px; background: green; } .b { flex: none; width: 50%; height: 200px; background: blue; } .c { flex: none; width: 50%; height: 100px; background: red; } jsfiddle is there way put red box in previous row stream ? avoid modifying markup. the idea here elements should have different layouts between portrait , landscape mode, , way in css-only use flexbox order property. far know, using intermediate element lock children. is looking for? .foo { display: flex; flex-wrap: wrap; flex-direction: column; height: 200px; } .a, .c { flex: 0 0 50%; background: green; } .b { flex: 0 0 100%; order: 1; back

java - Syntax error, telling me it wants ; and several other things -

just trying run through code assignment i'm doing. simple life of me can't figure out why above error @ first line (public waterlog.......). later want pass line: [ log = new waterlog(8, damcapacity); ] any appreciated, new sorry. public class waterlog(integer windowsize, integer maxentry) { private integer size = windowsize; private integer max = maxentry; private arraylist thelog(int windowsize); private int counter = 0; public void addentry(integer newentry) throws simulationexception { thelog.add(0, newentry); counter++; } public integer getentry(integer index) throws simulationexception { if (thelog.isempty() || thelog.size() < index) { return null; } return thelog.get(index); } public integer variation() throws simulationexception { int old, recent = 0; recent = thelog.get(0); old = thelog.get(thelog.size-1); return recent-old; } public integer numentries() { return counter; } } assum

regex - Key confusion in python -

hey friends have seen weird code.am new python programming.the code is import re, collections mylist = ['probes', 'gene.symbol', 'gene.title', 'go1', 'go2', 'go3', 'adx_kd_06.ip', 'adx_kd_24.ip', 'adx_lg_06.ip', 'adx_lg_24.ip', 'adx_lv_06.ip', 'adx_lv_24.ip', 'adx_sp_06.ip', 'adx_sp_24.ip', 'adx_ln_06.id', 'alm_ln_06.id', 'alm_lv_06.ip', 'alm_sp_06.ip', 'k3spg_lv_06.ip', 'k3spg_sp_06.ip', 'kkk_ln_06.id', 'kkk_lv_06.ip', 'kkk_sp_06.ip', 'endcn_lv_06.in', 'endcn_sp_06.in', 'bcd_lv_06.ip', 'bcd_sp_06.ip', 'adx_lv_06.id', 'adx_sp_06.id', 'alm_lv_06.id', 'alm_sp_06.id', 'd35_ln_06.id', 'k3spg_ln_06.id', 'k3_lv_06.id', 'k3_sp_06.id', 'bcd_ln_06.id', 'd35_lv_06.id', 'd35_sp_06.id', '

javascript - explain the comma separated for expression -

i'm trying track down bug in ember.js source code when came across loop: for (operationindex = rangestart = 0, len = this._operations.length; operationindex < len; rangestart = rangeend + 1, ++operationindex) { the constituent parts broken down looks multiple declarations, e.g.: operationindex = rangestart = 0, len = this._operations.length can explain declaration , can assume loop counter initilaized 0 given above expression? taking "template": for (a; b; c) there 3 parts in loop declaration. first part (a) executed once before actual loop begins, , used declare loop iterator can used other things. the second part (b) stop condition: it's being evaluated in beginning of each iteration, , when returning false , loop ends. the third part (c) executed in end of each iteration , used change loop iterator loop end @ point. to focus again on specific question, comma used separate 2 variable assignments.

redirect - .htaccess rewrite insert new url segment e.g. www.domain.com/wildcard == www.domain.com/new_segment/wildcard/ -

i globally via htaccess rewrite www.domain.com/wildcard/ == www.domain.com/new_segment/wildcard/ can't seem figure out. so far, have following: options +followsymlinks -multiviews rewritecond %{http_host} ^domain\.com$ [or] rewritecond %{http_host} ^www\.domain\.com$ rewriterule ^(.*)$ "http\:\/\/www\.domain\.com\/new_segment\/$1" [r=301,l] for reason, on initial page load www.domain.com/new_segment/new_segment/ if go www.domain.com/old_segment expect www.domain.com/new_segment/old_segment/ www.domain.com/old_segment/ instead. any appreciated. why want that? anyways, can easier putting desired files directory , redirection file on /old_segment /new_segment.

jquery - Html5 Input Pattern doesn't accept right input after correcting -

i have html form 2 input fields. 1 emails , on amount of money user can enter. have regex checks whether user enters correct amount bigger 0.40€. the problem : 1. enter incorrect amount of money ( example : 0.39€ ) >> says correctly .. "please enter correct amount ... " 2. correct value 0.41€ ( correct ), input field still says "please enter correct amount ... " <input required="" id="custommoney" name="custommoney" type="text" size="20" maxlength="25" value="25.00€" oninvalid="setcustomvalidity('enter correct amount > 0.40€')" pattern="^(?:(?:[1-9][0-9]*(?:(?:.|,)d{2})?)|(?:0(?:(?:.|,)(?:4[1-9]|[5-9]d))))€?$"> i couldn't recreate problem 100% on jsfiddle shows there wrong input pattern fiddle i use jquery , jquery mobile !

Is There a C#.Net Equivalent to Objective-C's Selector -

this c#.net question objective-c developers work c#.net as know, objective-c can parse method name selector ; , method can belong outside class . i able use type of method in c#.net lot cleaner creating loads of events can become messy , hard manage. if possible, how can achieve this? thank you! example: public class main { public void myprocess(callback tomethod) { // fancy stuff , send callback object tomethod(result); } } public class { public void runmethod() { myprocess(method1); myprocess(method2); } private void method1(object result) { // stuff callback } private void method2(object result) { // stuff callback } } i don't know objective-c, think want this: public class main { public void myprocess(action<object> tomethod, object result) { // fancy stuff , send callback object tomethod(result); } } pub

jquery - 2 images animated using Javascript -

from doing research , asking have far built animation moving left right using code in jsfiddle below. loops every 20 seconds. http://jsfiddle.net/a9hdw/3/ however need second image moves right left , automatically trigger straight after first image has completed animation. if amazing. thanks in advance <canvas id="canvas" width="1600" height="300"></canvas> <script> window.requestanimframe = (function(){ window.requestanimationframe || window.webkitrequestanimationframe || window.mozrequestanimationframe || window.orequestanimationframe || window.msrequestanimationframe || function( callback ){ window.settimeout(callback, 1000 / 60); }; })(); var canvas = document.getelementbyid("canvas"), cx = canvas.getcontext("2d"); function card(x,y){ this.x = x || -300; this.y = y || 0; this.width = 0; this.height = 0; this.img=new image(); this.init=function(){ // makes mycard available in i

python - Sum of colorvalues of an image -

Image
i looking way sum color values of pixels of image. require estimate total flux of bright source (say distant galaxy) surface brightness image. please me how can sum colour values of pixels of image. for example: each pixel of following image has colour value in between 0 1. when read image imread colour values of each pixel array of 3 elements. new in matplotlib , not know how can convert array single values in scale of 0 1 , add them. if have pil image, can convert greyscale ("luminosity") this: from pil import image col = image.open('sample.jpg') gry = col.convert('l') # returns grayscale version. if want ot have more control on how colors added, convert numpy array first: arr = np.asarray(col) tot = arr.sum(-1) # sum on color (last) axis mn = arr.mean(-1) # or mean, keep same normalization (0-1) or can weight colors differently: wts = [.25, .25, .5] # in order: r, g, b tot = (arr*wts).sum(-1) # blue has twice weight of red

simulation - Sprouting turtles spaced at least one patch apart -

is there way can sprout turtles given have @ least 1 empty patch between other turtles? to setup ca ask patches [ if not any? neighbors [any? turtles-here] [ sprout 1]] end

html - Why do I get XMLHTTPRequest error on the following JavaScript code? -

i trying native javascript , requesting html page using following js code, why return (in chrome) following? xmlhttprequest cannot load /live-examples/temp.html. no 'access-control-allow-origin' header present on requested resource. origin 'null' therefore not allowed access. the code using follows: var sendrequest = (function(){ // private member variables var readystate = { unsent : 0, opened : 1, headers_recived : 2, loading : 3, done : 4 } var status = { success : 200, not_modified : 304 } // private member methods function getdata(callback){ var xhr = getxhr(); if(!xhr){ console.log('unable create xhr object.') return false;

sql - Getting Data MS Access then Placing it inside VBNET texbox -

i'm trying figure out what's wrong code, i'm trying extract value of employe id selected dropdown, information of employee , place in textbox vb.net form, there's error whenever select employee id it's giving me error message of : "an unhandled exception of type 'system.data.oledb.oledbexception' occurred in system.data.dll additional information: no value given 1 or more required parameters." thus highlighting reader, i'm not sure what's problem, have initialized reader... please guide me. thanks private sub enumtext_selectedindexchanged(sender object, e eventargs) handles enumtext.selectedindexchanged dim dbsource = "data source= c:\databse\company_db.accdb" con.connectionstring = "provider=microsoft.ace.oledb.12.0; data source= c:\databse\company_db.accdb" dim sqlquery string dim sqlcommand new oledbcommand dim sqladapter new oledbdataadapter dim table new

python - PyMongo and Mongodb: using update() -

i trying use pymongo update existing index: #!/usr/bin/env python import pymongo pymongo import mongoclient client = mongoclient() db = client.alfmonitor tests = db.tests post = { 'name' : 'blah', 'active' : true, 'url' : 'http://www.google.com', } tests.insert(post) tests_list = db.tests.find({'active':true, 'name':'blah'}) test in tests_list: test['active'] = false test.update( test, ) print '====================================================' test in db.tests.find(): print test #<- when print out these, active=true still showing i've been trying follow documentation , examples have seen on none of them seem working me. can explain i'm doing wrong here? thanks! use (don't forget add multi=true if want update all matches): db.tests.update({'active':true, 'name':'blah'}, {'$set': {'active

database design - Best way to deal with Big data in mysql -

current design previously co-worker designed databse had tables customer_0, customer_1.... customer_9 wherby customer ids split 10 different tables based on last digit of id. the problem design: i dont find standard practice to deal it, have create queries strings, in stored procedures or in code, pass in id , query created @ runtime extracting last digit of id , choosing table query from. to apply foreign key constraint need have referenced tables split (i wouldnt use term partitioned here because type of splitting not partitioning) in same fashion if not intended store huge data, e.g. customer_sales tables have split 10 parts since have apply foreign key constraints. (a customer has one-to-many relation custoemr_sales) my design on tring figure out work-around came know can table partitioning solved problem. refereing this question. the prblem partitioning approach now problem approach cannot have foreign key constraint anyway in partitions, doesnt solve proble

opengl - 3D linear surface -

i need make interpolation , build linear surface using opengl, have problem algorithm. in book(rodgers computer graphics) said equation of linear surface q(u,w) = p(u,0)(1-w) + p(u,1) * w. can`t find way use it. how can this? make grid , approximate quads. pseudo-code density = 0.01; (a = 0.0; <= 1.0; += density) { (b = 0.0; b <= 1.0; b += density) { draw-quad( q(a, b), q(a + density, b), q(a + density, b + density), q(a, b + density)); } }

mysql - Illegal mix of collations for operation 'match' -

i've got query select txt, unix_timestamp(added), uid, id2, id2_type sitelog match (id2, uid, txt) against (? in boolean mode) that return error: illegal mix of collations (latin1_swedish_ci,numeric), (latin1_swedish_ci,numeric), (utf8_unicode_ci,implicit) operation 'match' my query: create table if not exists `sitelog` ( `id` int(10) unsigned not null auto_increment, `added` datetime not null, `txt` text collate utf8_unicode_ci not null, `uid` int(11) not null, `id2` int(11) not null, `id2_type` char(1) collate utf8_unicode_ci not null, primary key (`id`), key `uid` (`uid`), key `id2` (`id2`) ) engine=myisam default charset=utf8 collate=utf8_unicode_ci; mysql: 5.5.35+dfsg-0+wheezy1 how 1 fix this?

javascript - Sweet.js - Parenthesis in macros body -

i want use parenthesis in macros body group expressions. example: macro m { rule { ($x, $y) } => { $x >>> ($y * 5) } } sweet.js remove parenthesis: m(6, 7) => 6 >>> 7 * 5 i expect next output: m(6, 7) => 6 >>> (7 * 5) how can escape parenthesis inside macros body? sweet.js (technically escodegen sweet.js uses codegen) removes redundant parens (ie precedence rules mean 6 >>> 7 * 5 === 6 >>> (7 * 5) parens aren't needed) shouldn't need escape parens in macros.

c# - Saving a project using VS2010 Postbuild Events -

i'm collaborating on project buddy, , i'm working on of code while front-end interfaces/graphics. him have access project when needs (for instance check on progress). read can set post-build event vs save project somewhere else (dropbox in case, , in mine well), there's no documentation anywhere on web (that find) detailing how this. if knows , can point me in right direction, that'd great. p.s. place should posting this? please tell me if ought in different forum. why don't use free online source code repository codeplex, github or visual studio online instead? it's stored somewhere , versioned.

download - maven remembers deleted repos -

i had repo in project's main module' pom.xml file maven couldn't download library (artifact) from. made decision remove repo pom.xml , use one. when run command : mvn clean install - print out trying download libraries first bloody ( deleted project configuration {pom.xml file} ) repository .... how make maven forget deleted , not mentioned in project repositories ? thanks lot! one of reasons repository mentionned in maven settings. file default in .m2/settings.xml in personal directory.

How can i know reachablity of A* algorithm on a graph? -

i got data set of graph. then have distance between city , b. how can know reachablity of route b ? do have search reachable cities a*? i think needs time. if want know if arbitrary node reachable arbitrary node, yes, need search graph. yes, means end traversing every node on graph. yes, if have huge number of nodes, slow. life tough. if need many such reachability checks, might worth pre-process graph, , store reachability information can used faster lookups. information take lot of space, though use secondary storage (i.e. hard drive).

haskell - Cabal reporting it can't find module -

i have configured following cabal file when cabal build error in file tasty.hs saying could not find module tictac.essential , missing here? name: tdd version: 0.1.0.0 cabal-version: >=1.8 -- synopsis: -- description: -- license: license-file: license author: adfaf maintainer: info@adfadsf.se -- copyright: -- category: build-type: simple extra-source-files: readme library hs-source-dirs: src build-depends: base >= 4 ghc-options: -wall exposed-modules tictac.essential default-language: haskell2010 test-suite tasty type: exitcode-stdio-1.0 build-depends: base >=4.6 && <4.7, tasty, tasty-quickcheck, tdd hs-source-dirs: test main-is: tasty.hs source of tasty.hs module main import test.tasty import test.tasty.quickcheck qc import tictac.essent

javascript - how to open a new window for a specified java code -

this question has answer here: javascript: location.href open in new window/tab? 3 answers i have code below on page. works. can not find out how make open in new window. window.open doesn't work on it. needed. <form method="post"> <input type="radio" name="button" value="index1.html" checked>this button goes index1.html (default)<br> <input type="radio" name="button" value="index2.html">this button goes index2.html<br> <input type="radio" name="button" value="index3.html">this button goes index3.html<br> <input type="submit" value="continue"> <script> $(function(){ $("form").submit(function(e) { e.preventdefault(); window.location = $(this).find('input[type

sybase - Node.js and node-sqlanywhere - No Connection Available -

i have been trying use node-sqlanywhere query sybase database. however, cannot seem able connect database. var sqlanywhere = require('sqlanywhere'); var sqlanywhere_conn = sqlanywhere.createconnection(); var sqlanywhere_conn_params = { databasefile: 'c:\users\support\dropbox\database.db', autostart: 'yes', userid: 'user_id', password: 'password' }; sqlanywhere_conn.connect(sqlanywhere_conn_params, function(){ sqlanywhere_conn.prepare('select * some_table some_column = ?', function (err, stmt){ if (err) throw err; // statement }); }); whether trying connect database using server attribute or databasefile attribute, error code -2005 no connection available . that being said, able connect database using interactive sql either specifying server or database file. so.. must missing here , can't figure out ! thanks !! try doubling backslash characters, databasefile: 'c:\\

git submodules - how to create an environment agnostic javascript library -

i'm creating javascript library, , want environment agnostic (it not use dom, ajax, or nodejs api. vanilla javascript). so, it's supposed run in javascript environment (browsers, npm, meteor smart packages, v8 c bindings...). my approach creating git repo library, library inside single global variable, without thinking patterns commonjs or amd. later, i'll create git repo, using library git submodule, , create needed release npm module. i'm concerned if it's approach, didn't found doing way. pros: code vanilla javascript, without awareness of environment patterns. not bind commonjs. repackable (copy , paste or git submodule) javascript environment. small needed sent browsers. cons: i'll have maintain many git environments want support. @ least second git repo deliver on npm. taking jquery example, runs in both browser , nodejs, 1 git repo. there code aware of "exports" variable run on nodejs or other commonjs compatible enviroment. pros: 1

javascript - How to draw a line graph using d3.js? -

i new d3.js , trying graph 3 lines on same plot. i'm reading tsv file 4 columns: time, x, y, , z. accelerometer data. want plot x,y,z columns vs time can't seem it. suggestions? function graph(){ // set dimensions of canvas / graph var margin = {top: 30, right: 20, bottom: 30, left: 50}, width = 600 - margin.left - margin.right, height = 270 - margin.top - margin.bottom; // set ranges var x = d3.time.scale().range([0, width]); var y = d3.scale.linear().range([height, 0]); // define axes var xaxis = d3.svg.axis().scale(x) .orient("bottom").ticks(5); var yaxis = d3.svg.axis().scale(y) .orient("left").ticks(5); // define line var valueline = d3.svg.line() .x(function(d) { return x(d.time); }) .y(function(d) { return y(d.x); }); var valueline2 = d3.svg.line() .x(function(d) { return x(d.time); }) .y(function(d) { return y(d.y); }) var valueline3 = d3.svg.line() .x(function(d) { return x(d.t

android - How to resolve 'Null Pointer Exception' -

i'm new android. i'm creating application in have use map in 2 activities. application running when tap on 'tagyourself' activity (one of map activities) application crashes. log cat shows null pointer exception on line 46 this.setcontentview(r.layout.activity_tag_yourself); . log cat showing. android.view.inflateexception on binary xml file line # 17 fragment map. i couldn't understand why giving such exceptions. please me. here log cat acitivity. 04-06 23:20:02.851: i/inputmethodmanager(31122): handlemessage: msg_set_active false, true 04-06 23:20:02.867: i/inputmethodmanager(31122): handlemessage: msg_unbind 985 04-06 23:20:02.911: d/openglrenderer(31122): flushing caches (mode 0) 04-06 23:20:03.276: d/openglrenderer(31122): flushing caches (mode 0) 04-06 23:20:08.341: v/phonewindow(31122): decorview setvisiblity: visibility = 0 04-06 23:20:08.386: v/inputmethodmanager(31122): onwindowfocus: null softinputmode=32 first=true flags=#1810100 04-06 23:20:0

memory - please help me, don't read the file "mem.dat" -

description memory . vhdl library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity memory generic(file_name: string:= "mem.dat"); port (addr: in std_logic_vector(7 downto 0); data: out std_logic_vector(7 downto 0); rd: in std_logic; ld: in std_logic); end memory; architecture memory of memory type t_rom_data array (15 downto 0) of std_logic_vector(7 downto 0); type rom_file_type file of character; file rom_file: rom_file_type; signal rom_data: t_rom_data; begin process(addr,rd) variable i: natural; begin if rd = '1' := conv_integer(addr); data <= rom_data(i) after 5ns; else data <= (others => 'z'); end if; end process; process(ld) variable c: character; begin if ld='1' file_open(rom_file,file_name,read_mode); in 0 15 loop b in 7 downto 0 loop

Javascript setInterval unwanted pause -

i trying create animation few images in javascript , have code working, after runs through images in reverse pauses before starts going forward again. i'm wondering how rid of pause? here code in action http://isogashii.com/projects/javascript/ch10/dp10-6.html html <img id="pin" src="assets/pin0.gif" alt="pin animation" /> javascript var pin = new array(9); var curpin = 0; var x = false; // caching images (var imagesloaded=0; imagesloaded < 9; ++imagesloaded) { pin[imagesloaded] = new image(); pin[imagesloaded].src = "assets/pin" + imagesloaded + ".gif"; //starts pinf function when images cached if (imagesloaded == 8) { setinterval("pinf()", 120); } } function pinf() { if (x == true) { --curpin; if (curpin == 0) { x = false; } } if (x == false) { ++curpin; if (curpin == 8) { x = true; }

HTML: Multiple submit buttons in a form, each leading to a different python script? -

how can this? doesn't form have 1 action? if have 3 different buttons @ end of form , each 1 invokes different script? appreciated. something possible, not in pure html. need javascript that, because html forms action defined in form tag, accepts single action. using javascript can register differrent handlers click events of different submit buttons, send forms data different locations.

imageview - How to TOP CROP Image using PhotoView Android? -

i have 1 imageview layout_width & layout_height match_parent, 2 of them screen width , height size. need display photo fill full width , when image higher imageview height, can scroll , down. i'm using photoview library zoom, scroll, tap... i'm using centercrop scale type not solution need. show part of center image , need scroll view beginning. i tried lot of custom view extended imageview display top crop style when touch image, changed default photoview scale type. work when not use photoviewattacher how can make top crop , scroll + zoom + touch... image using photoview library ? you can achieve topcrop scale changing center_crop scale under updatebasematrix() in photoviewattacher of chris banes`s photoview. here code: else if (mscaletype == scaletype.center_crop) { float scale = math.max(widthscale, heightscale); mbasematrix.postscale(scale, scale); //changed dy = 0 top crop mbasematrix.posttranslate((viewwidth - drawablewidth * scale

html - image in rtl language in the footer -

i using opencart installed custom footer preview facebook page , on .. problem using arabic language rtl format icon in title not correct in english suppose in right of text not ... i tried background-position: 100% 0; put image below text ... so ideas my website : www.egy-smoke.com update custom style sheet, this: footer #custom-footer > div > div > div h3.facebook { padding-left: 34px; background: url(../img/icon-facebook.png) 0px 9px no-repeat; } becomes this: footer #custom-footer > div > div > div h3.facebook { padding-right: 34px; background: url(../img/icon-facebook.png) 100% 9px no-repeat; } repeat above other custom items 'اتصل بنا' , 'احنا مين'

javascript - Get document's placement in collection based on sort order -

i'm new mongodb (+mongoose). have collection of highscores documents looks this: {id: 123, user: 'user14', score: 101} {id: 231, user: 'user10', score: 400} {id: 412, user: 'user90', score: 244} {id: 111, user: 'user12', score: 310} {id: 221, user: 'user88', score: 900} {id: 521, user: 'user13', score: 103} + thousands more... now i'm getting top 5 players so: highscores .find() .sort({'score': -1}) .limit(5) .exec(function(err, users) { ...code... }); which great, make query "what placement user12 have on highscore list?" is possible achieve query somehow? it possible mapreduce , require have index on sorted field, first, if have not done: db.highscores.ensureindex({ "score": -1 }) then can this: db.highscores.mapreduce( function() { emit( null, this.user ); }, function(key,values) { return values.indexof("user12") +

c - Does it make sense to compare which one of two points to two entries of an array is bigger? -

in c, have array int a[20] . have 2 pointers int *pi , int *pj pointing 2 entries a[i] , a[j] respectively. don't know i , j . know if i > j or j<i or i==j . my thought comparing pi , pj based on pi = + i , pj=a+j . wonder if correct i > j if , if pi>pj , , i == j if , if pi==pj ? thanks! yes, < , > operators on pointers defined work in way. and pointers don't point same object or past end of it, behavior of < , > undefined. == , != defined, though. reference: n1570 6.5.8, paragraph 5: when 2 pointers compared, result depends on relative locations in address space of objects pointed to. if 2 pointers object types both point same object, or both point 1 past last element of same array object, compare equal. if objects pointed members of same aggregate object, pointers structure members declared later compare greater pointers members declared earlier in structure, , pointers array elements larger su

java - How do i make an ascending order an array of strings using the a number within the string? -

i have number example 593, need order these numbers , put them in ascending order. want know how put in ascending order. few lines excel have order.note there 10,000 lines of these. 8/26/2012,kristina,h,chung,947 martin ave.,muncie,ca,46489,khchung@business.com, $593 11/16/2012,paige,h,chen,15 mainway rd.,dallas,hi,47281,phchen@business.com, $516 11/10/2012,sherri,e,melton,808 washington way,brazil,ca,47880,semelton@business.com, $80 9/20/2012,gretchen,i,hill,56 washington dr.,atlanta,fl,47215,gihill@business.com, $989 3/11/2012,karen,u,puckett,652 maplewood ct.,brazil,fl,46627,kupuckett@business.com, $826 7/4/2012,patrick,o,song,679 mainway rd.,lafayette,ga,47161,posong@business.com, $652 after sorted this 11/10/2012,sherri,e,melton,808 washington way,brazil,ca,47880,semelton@business.com, $80 11/16/2012,paige,h,chen,15 mainway rd.,dallas,hi,47281,phchen@business.com, $516 8/26/2012,kristina,h,chung,947 martin ave.,muncie,ca,46489,khchung@business.com, $593 7/4/2012,

Emacs: paste from previous copies -

in emacs, if have made copy-and-paste of 3 different texts, shortcut keys can use paste first text copied? ctrl+y paste last(third) copy. thanks! use m-y ( yank-pop ) after c-y ( yank ) cycle through kill ring. so, paste first text out of 3 c-y m-y m-y . see earlier kills in emacs manual details on how works.

php - while loop, if statement error -

for reason when using code gives me white screen, , can't find problem in it? while ($monsterhp > 0 && $yourhp > 0) { if ($pokemon4['speed'] => $row['speed']) { $monsterhp = floor($monsterhp - $mydmg); if($yourhp > 0) { $yourhp = floor($yourhp - $monsterdmg); } }elseif ($pokemon4['speed'] < $row['speed']) { $yourhp = floor($yourhp - $monsterdmg); if ($monsterhp > 0) { $monsterhp = floor($monsterhp - $mydmg); } } } you had error in operator: => (greater or equal) it should this: >=

C++ vector(math) destination, check range based on movement -

i moving entity new position vector, when reaches it's destination, it's jumping around destination. want check on range of destination based on movement speed, can how go this? here function: void enemy::onupdate(graphics& graphics) { //function called every tick vector dest(190.f, 250.0f); vector destination = dest - posvec; vector normalise = vector::unitvector(destination); mposvec = mposvec + normalise * mvelocity;//mvelocity = 4.f mx = mposvec.x; = mposvec.y; //clamp range //if(something) } thanks.

Polymer Elements in Dart Packages -

i have dart package contains 3 extensions of polymer element: tp-element-a, tp-element-b , tp-element-c. each of these elements there html-file containing markup of element , dart file code. tp-element-c contains references tp-element-a , tp-element-b. package structure looks this: testpolymer pubspec.yaml - packages - asset tp-element-a.html tp-element-b.html tp-element-c.html - lib testpolymer.dart tp-element-a.dart tp-element-b.dart tp-element-c.dart - web index.html the definitiopn of polymer elements simple: tp-element-a.html <polymer-element name="tp-element-a"> <template> <h1>hello element a</h1> </template> <script type="application/dart" src="../lib/tp-element-a.dart"></script> </polymer-element> tp-element-a.dart part of testpolymer; @customtag("tp-element-a") class tpelementa extends polymerelement { tpelementa.created() : super.created()

php - How to retrieve the comment IP -

i need code displays ip of person/guest commented on website. here's index page; <?php include "core/init.php"; ?> <!doctype html> <link rel="stylesheet" type="text/css" href="http://hjalplista.comxa.com/daniel_emelie/style.css"> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>välkommen till hjälplistan!</title> <body> <div id="header"> <div align="right"><a href="http://www.helsingborg.se/wieselgrensskolan" target="_blank"><img src="http://i.imgur.com/y0ainit.jpg"></a></div> </div> <div id="inside"> <center> <div id="location"><a href='index.php'>hem</a> - <a href='administrative/adminonlyaccess.php'><i>admin</i></a><br><br> </div> <hr/