Posts

Showing posts from September, 2014

javascript - Doing math with Time using js -

i have following code: html: <form onsubmit="return false;"> <div class="col-5"> <label> page time <input id="pagetime" name="pagetime" type="time" step="1" tabindex="9"> </label> </div> <div class="col-5"> <label> ack time <input id="acktime" name="acktime" type="time" step="1" tabindex="10"> </label> </div> <div class="col-5"> <label> arrival time <input id="arrivaltime" name="arrivaltime" type="time" step="1" tabindex="11"> </label> </div> <div class="col-5"> <label> start replace / root cause found

r - lapply inside an lapply function -

having learnt loops bad im trying use lapply inside lapply. have series of sequentially numbered dataframes. in each 1 replace columns 5 , 8 letters depending on values `if value <2 value changed "l" (for loss)`, `if equals 2 value should "d"` , if >2 should "g". my starting dataframe follows structure(list(chromosome = structure(c(1l, 1l, 1l, 1l, 1l, 1l ), .label = c("1", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "2", "20", "21", "22", "3", "4", "5", "6", "7", "8", "9", "x", "y"), class = "factor"), start = c(1l, 100000001l, 10000001l, 1000001l, 100500001l, 101000001l), ratio.x = c(1.32971, 0.990806, 0.991636, 1.01224, 1.00196, 1.00834), medianratio.x = c(1.32971, 1.003

html - jquery put a value instead of selector name -

hello how usualy select element name <div id="song-name"></div> <a href="#" id="play">play</a> <a href="#" id="pause">pause</a> <a href="#" id="skip">next</a> <a href="#" id="previous">previous</a> <br><br> <audio id="1" name="song1" class="audio-player" src="music.mp3"></audio> <audio id="2" name="song2" class="audio-player" src="music2.mp3"></audio> var songname=$("1").attr("name"); but need var id=1; songname=$("id").attr("name"); what write syntax it? i need because have script show current music playing name,but show first song name if next song playing <script> $(document).ready(function() { var x = $(".audio-player

c++ same code compiles/runs never in Visual Studio and sometimes in Qt Creator -

i making of c++ exercises when noticed following problem. given code not run/compile in visual studio 2013 or qt creator 5.4.1 giving error: invalid types 'double[int]' array subscript test[0][0] = 2; ^ however when first change 16th (and 17th) line in header file double &operator[]; double operator[] , make same changes in source files -> compile (while getting multiple errors) -> , lastly changing original double &operator[]; . in qt creator 5.4.1 compile , run while giving expected results. edit: not work, changing double *operator[] instead of double operator[] reproduce problem. why happening? matrix.h #ifndef matrix_h #define matrix_h #include <iostream> using namespace std; class matrix { private: double** m_elements; int m_rows; int m_columns; public: matrix(int rows = 1, int columns = 1); double &operator[](int index); const double &operator[](int index) const; friend ostream &

ios - Keep UIButton Size the same when activated multiple times -

Image
i have uibutton constraints set width , height 80 80. when press uibutton activate uiscrollview menu, constraints changes , button looks image below. (the button blue oval shape @ bottom of screen) here's viewwcontroller.m codes uibutton , uiscrollview animations. #import "viewcontroller.h" @interface viewcontroller () @end @implementation viewcontroller @synthesize scrollview; - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. draw1 = 0; scrollview.frame = cgrectmake(0, 300, 480, 55); [scrollview setcontentsize:cgsizemake(480, 55)]; openmenu.frame = cgrectmake(220, 270, 60, 30); } - (void)viewdidappear:(bool)animated { [super viewdidappear:animated]; draw1 = 1; } - (ibaction)openmenu:(id)sender { if (draw1 ==0) { draw1 = 1; [uiview animatewithduration:0.5 delay:0.0 options: uiviewanimationoptioncurve

java - Fibonacci Recursion? -

i have started learn recursion. program i'm asked make should take term input, , output corresponding fibonacci number. have far, it's showing error. what's wrong? thanks in advance! private void btnfindnumberactionperformed(java.awt.event.actionevent evt) { int term = integer.parseint(txtinputterm.gettext()); int number = fibonacci(term); txtoutput.settext("fibonacci number " + term + " " + number); } public int fibonacci (int term) { if (term == 1) { return term; } else { int number = fibonacci(term-1) + fibonacci(term-2); return number; } } imagine fibonacci term being 2. happen? term == 1 ? wrong, continue else... so try calling fibonacci(term-1) ( = fibonacci(1) ) + fibonacci(term-2) ( = fibonacci(0) ) ok, fibonacci(term-1) ( = fibonacci(1) )... term == 1 ? true, returning 1 ok,

javascript - Bootstrap .tab('show') not working for my code -

here code on jsfiddle $('button').click(function() { $('#passive_order_categories').tab('show'); }); <script type="text/javascript" src="//code.jquery.com/jquery-2.1.0.js"></script> <script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="/css/result-light.css"> <button>click</button> <div class="tabs-container"> <ul class="nav nav-tabs"> <li class="active"><a data-toggle="tab" href="#active_order_categories" aria-expanded="true">active</a> </li> <li class=&quo

c++ - Why char array and int array get printed as different things? -

this question has answer here: why cout print char arrays differently other arrays? 4 answers int main () { int intarr [5] = {1,6,7,9,3); char charr [7] = "avneet"; std::cout << intarr << "\n"; std::cout << charr << "\n"; return 0; } the first line program prints memory address , second line, whole string (avneet). what's making difference? 1 more question. in int case, address what? address of entire array or address of first element of array. std::basic_ostream<> has overloads of operator<< char const* , signed/unsigned versions expect c-style zero-terminated string. and void const* overload used other pointer types , outputs address.

eclipse - How to use header functions in source file in C++? -

i'm new c++ programming language , different java. tried use functions header made when use function header , eclipse c++ ide says member declaration not found except constructor while found in header public. car.h file (header) : #include <string> using namespace std; class car { private : string name; string model; int year; int width; int height; int depth; public : car (); car (string n, string m, int y, int w, int h, int d); void setname(string n); void setmodel (string m); void setyear (int y); void setsize (int w, int h, int d); string getname (); string getmodel(); int getyear(); int getwidth(); int getheight(); int getdepth(); }; car.cpp file (source) #include <iostream> #include <string> #include "car.h" using namespace std; car::car(string n, string m, int y, int w, int h, int d) { //works name = n; model = m; year = y; width = w; heig

Java execute .exe file -

i want execute .exe file made c code : #include <stdio.h> #include <stdlib.h> void hellofromc(){ printf("hello c!"); } int main(){ hellofromc(); return 0; } currently trying gives me error: not find or load main class test (which class using in java): import java.io.ioexception; public class test { public static void main(string[] args) { try { string filename = "d:\\eclipse\\workspace\\testing\\testfile.exe"; runtime rtime = runtime.getruntime(); process p = rtime.exec(filename); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } } your questoin been answered in stackoverflow. could not find or load main class you can execute executable using processbuilder class in java. without parameters: process process = new processbuilder("c:\\executablepath\\testexe.exe").start(); with para

Kivy: How to correctly manipulate a widget in python that is defined in KV lang -

i have have following that's written in kv lang: textinput: id: user_input_temp font_size: 50 size_hint_y: none input_filter: 'float' multiline: false label: text: "celsius" label: id: celsius text: root.temp_conv() and attempt use user_input_temp in python code: class temperature(screen,boxlayout): def temp_conv(self): number = self.ids.user_input_temp.text input = float(number) celsius = (input - 32)*(5/9) self.ids.celsius.text = str(celsius) but receive error - valueerror: not convert string float: how can correctly convert .text of widget? (preferably using widget id) check value can't convert. in example, don't set text it's doing float('') , give error see since '' doesn't describe float. in case you'd want try conversion, return suitable or nothing @ if fails.

ios - Capture `UIImageView` properties with lldb and python -

Image
i trying use lldb , python debug view hierarchy. when set breakpoint in xcode , explore frame value like: expr @import uikit po self.imageview.frame lldb able execute command shown: when try replicate same command using python scripting so: import lldb lldb.debugger.handlecommand('expr @import uikit') expression = 'self.imageview.frame' frame = lldb.debugger.getselectedtarget().getprocess().getselectedthread().getselectedframe() expr_options = lldb.sbexpressionoptions() language = frame.getcompileunit().getlanguage() expr_options.setlanguage(language) value = frame.evaluateexpression(expression, expr_options) the value of expression value.getvalue() none . how value of self.imageview.frame using lldb python scripting can further computations on value in python? frame aggregate type (a structure or class object) , aggregate types don't have values since aren't particular unitary thing... they have summaries - pretty printed text

class - How do I Execute Java from Java? -

i have downloadfile.java , downloads file should: import java.io.*; import java.net.url; public class downloadfile { public static void main(string[] args) throws ioexception { string filename = "setup.exe"; // file saved on computer url link = new url("http://onlinebackup.elgiganten.se/software/elgiganten/setup.exe"); // file want download // code download inputstream in = new bufferedinputstream(link.openstream()); bytearrayoutputstream out = new bytearrayoutputstream(); byte[] buf = new byte[1024]; int n = 0; while (-1 != (n = in.read(buf))) { out.write(buf, 0, n); } out.close(); in.close(); byte[] response = out.tobytearray(); fileoutputstream fos = new fileoutputstream(filename); fos.write(response); fos.close(); // end download code system.out.println("finished")

c - Scheduling the transmision of frames in RTOS -

i'm planning use stm32 board send can frames. implemented simple scheduler contains 10 tasks;one task responsible send frames. to job declared structure can frame: typedef struct { unsigned int id; unsigned char data[]; unsigned char dlc; unsigned int timeofsend //this time in ms in frame should sent }tframe; and declared table of frames sent aubframes[max_frames] = { {0x12, 0xaabbcc, 4, 100}, {0x12, 0xaabbcc, 4, 1000}, {0x12, 0xaabbcc, 4, 2000}, {0x12, 0xaabbcc, 4, 2010} }; this tell board send first frame after 100 ms, second after 1000 ms, etc. what do: i added new task in scheduler period of 10 ms. task check aubframes table , if it's time send frame sends concerned frame, else nothing done. problem solution there big loss of time. example, send first frame scheduler access task 9 times, nothing do. is there solution scheduling more effective? i thought use timer interrupt, don't think that's solution since th

html - nth-child, change style of every other div with class name -

i have got elements on page, should styled same except every other one, want change styling. here css hoping select div inside stack of different elements: .stagger_reviews[class=inner]:nth-child(2n+2) { background-color:#003; } here html: <div class="stagger_reviews"> <!-- later use php load reviews, css should switch images left right --> <article class="container box style1"> <a style="background-image:url(images/blank-user.jpg); " href="#" class="image fit"></a> <div class="inner"> <header> <h2>martyn ball</h2> </header> <p> found service on google search, didn't expect great! </p> </div> </article> <article class="container box style1"> <a style="background-image:url(images/

java - Trying to execute jar using cygwin, arguments not recognized -

i have makefile calls java parser process files before compilation. while in linux works when running on windows 7 machine using cygwin input recognized jar files. my command inside make like java -jar ${my_dir}/myparser.jar -arg1 -arg2 -arg3 input.file output.file ;\ and error input.file not valid jar file... assume has paths , how cygwin handles java can't make work. thanks in advance try putting () exec java -jar $(cygpath -w /path/to/myparser.jar) -arg1 -arg2 -arg3 input.file output.file srry not enough rep add comment .

neo4j - Import a csv file inNeo4j -

Image
i want import in neo4j csv file. here example of file team.csv: _id,official_name,common_name,country,started_by.day,started_by.month,started_by.year,championship,stadium.name,stadium.capacity,average age,squad value(in mln),foreigners cel.00,real club celta de vigo s.a.d.,celta vigo,spain,30,11,1988,la liga,balaìdos,29500,25.7,60.4,10 to import in neo4j used: load csv headers 'file:///z:/path/to/file/team.csv' line create (p:team {_id:line._id, official_name:line.official_name, common_name:line.common_name, country:line.country, started_by_day:"line.started_by.day",started_by_month:"line.started_by.month",started_by_year:"line.started_by.year", championship:line.championship,average_age:"line.average age", squad_value:"line.squad value(in mln)", foreigners:line.foreigners}), (p1:stadium {name:line.stadium.name, capacity:line.stadium.capacity}) it imports properties except stadium information: name , capacity . in f

python - Iterating over a .json file and changing a attribute value -

i'm trying iterate on .json file small script find attribute named 'model' , change it's value on each object. (it's db-dump django). import codecs, json data = "" codecs.open("dump2.json", 'r', 'utf8') data_file: data = json.load(data_file) in data: key in i: if key[0] == 'model': key[1] = "app.model" #not working codecs.open('dump2.json', 'w', 'utf8') f: json.dump(data, f) what doing wrong here? don't errors. , values not changed. based on random documentation found on web . assume have such json structure: [ { "pk": 1, "model": "auth.user", "fields":{ "username": "test1" } },{ "pk": 2, "model": "auth.user", "fields":{ "username":

curl - Need some help on crontab -

per guideline post, have set cron job this. 0 6 * * * curl [https://]mysite.com/index.php/abc/corn_job > /tmp/croncheck2 2>&1 and saw on log it's executing correctly, on time. unfortunately, it's not executing task developer set process on file. let me explain bit in details. i have php application installed on subdomain , file (corn_job) used deduct credits of clients account on appropriate time. i spoke developer, , says if sets cron job on hosting, credits deducted without problem, that's on shared hosting cpanel, , setting cron job easy there. the first thing suspect execute command "curl". should curl in case or else?

mplab - Copying every nth element from one array to another -

does know of way copy every nth element 1 array another? example, have array data[x] , want copy every third (3rd) element - data[0], data[3], data[6] etc new array data2[j]. tried using loop no success. void storedata() { bufferpointer1 = &buffera[0]; x=0; i=0; j=0; while (x<no_samples-1) { data[x] = *bufferpointer1; bufferpointer1++; x++; (j=0; j<127; i++) { data2[j] = data[i+=3]; j++; } } } why aren't declaring variables in function? 4 of them seem used locally , should not visible outside function. why increment in section instead of j, typo? (j=0; j<127; i++) { data2[j] = data[i+=3]; j++; } i write this: (j=0; j<127; j++) { data2[j] = data[i]; i+=3; } i=0; // reset pointer

Android fragment onResume() refresh data -

i have fragment recyclerview. fragment populates recyclerview items (a list of users) sqlite , displays in oncreateview() method, , works fine. when go fragment b , add new user , hit done, go fragment a, should "refresh" users list. i tried achieving through moving code oncreateview() onresume(). but, have no access view on oncreateview(). what think best approach on handling this? thanks! so, @ first suppose should update data on list, 1 give adapter. if won't help, try create new adapter , bind recyclerview in onresume() method.

python - Cannot install canopy from Enthought under Debian Wheezy Linux -

i downloaded canopy linux-32-i86 newest version tried install on linux-notebook (amilo ~2004) - produced following error messages: [...] installing /ibk-varia/canopy ... please wait /home/kampmann/.local/share/applications/canopy.desktop: error: (will fatal in future): value "science" in key "categories" in group "desktop entry" requires category present among following categories: education databases in [/usr/share/gnome/applications, /usr/local/share /applications, /usr/share/applications] not updated. there wrong these texts????? unknown media type in type 'unknown/mime-type' done. can run canopy graphical environment running script: /ibk-varia/canopy/canopy or selecting 'canopy' in applications menu. on first run, canopy user python environment initialized, , have opportunity make canopy default python @ command line. details @ support.enthought.com/forums thank installing canopy! warning: pythonpath environment

python - OrientDB issue creating vertex in transaction -

i think there problem when creating records in graph using transactions. vertices created during transaction stored in cluster #3, when check on studio webapp vertex created in tx has class 'unknown' here code: client = pyorient.orientdb("localhost", 2424) client.connect("xxx", "xxx") client.db_open("admin", "admin") people_cluster = client.command("create class people extends v") client.command("create vertex people content {'name': 'dummy', 'age': 21}") attrs = {'@people': {'name': 'another_me', 'age': 31}} res = client.record_create(people_cluster[0], attrs) attrs2 = {'@people': {'name': 'me', 'age': 30}} create_rec_cmd = ( client.get_message(pyorient.record_create) ).prepare((people_cluster[0], attrs2)) tx = tx.commit() tx.begin() tx.attach(create_rec_cmd) tx.commit() # returns 'dummy' , 'anoth

eclipse - exception in thread "main" java.lang.NoSuchMethodError scala.collection.immutable.hashset$ -

header 1 # imported spark code run on eclipse getting build errors working fine on terminal header 2 /*sampleapp.scala: application counts number of lines contain "val" */ import org.apache.spark.sparkcontext import org.apache.spark.sparkcontext._ import org.apache.spark.sparkconf object simpleapp { def main(args: array[string]) { val txtfile = "file:///home/edureka/desktop/readme.txt" val conf = new sparkconf().setmaster("local[2]").setappname("sample application") val sc = new sparkcontext(conf) val txtfilelines = sc.textfile(txtfile , 2).cache() val numas = txtfilelines.filter(line => line.contains("bash")).count() println("lines bash: %s".format(numas)) } } header 3 " lf4j: class path contains multiple slf4j bindings. slf4j: found binding in [jar:file:/home/edureka/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.7.5.jar!/org/

javascript - nedb method update and delete creates a new entry instead updating existing one -

i'm using nedb , i'm trying update existing record matching it's id , , changing title property. happens new record gets created, , old 1 still there. i've tried several combinations, , tried googling it, search results scarce. var datastore = require('nedb'); var db = { files: new datastore({ filename: './db/files.db', autoload: true }) }; db.files.update( {_id: id}, {$set: {title: title}}, {}, callback ); what's crazier when performing delete, new record gets added again, time record has weird property: {"$$deleted":true,"_id":"wfzamyrx51uzxbs7"} this code i'm using: db.files.remove({_id: id}, callback); in nedb docs says followings : localstorage has size constraints, it's idea set recurring compaction every 2-5 minutes save on space if client app needs lot of updates , deletes. see database compaction more details on append-only

PHP CURL to upload multiple images in parallel -

i'm using curl wrapper https://github.com/php-curl-class/php-curl-class/blob/master/src/curl/curl.php to upload images, working if upload photo without multi-curl, when trying upload photos in parallel mode multi-curl, request headers missing part. expect: 100-continue content-type: multipart/form-data; boundary=--------------5a6bd9bcdf53e647 tried debugging , seems whole process of preparing curl, curl child of multi-curl, , file object same. i assume curlfile modifying curl headers appropriate values, seems lost when using multi-curl ..

Use a checkmark as an column alias in SQL Server 2008 R2 -

i have requirement believe should simple enough, not finding right answer to. how use checkmark column alias in sql server 2008 r2? i've tried using char(251) setting value , trying assign value column alias, no joy on one. i've tried using char(251) (and know that's more of square root mark, not sure of checkmark ascii value if there one. believe unicode value?) directly again no joy. should simple, i'm not finding it. thanks. you cannot use expressions identifiers in sql server (or other sql database matter). can, however, use unicode characters in identifiers, copy , paste desired character: select 'yes' "☑︎"; or even select 'blah' "😀"; having said that, should not doing -- presentation not task database engine; should implemented in client application.

arrays - Populate and update a table with data from a different table -

my site allows user search term returns table of associated songs. when "add track" button in particular row clicked after search, respective track name , trackid added table "playlist". problem having once "add track" clicked within different row, data row not added "playlist" table, rather replaces previous information. need able generate cumulative table. great , in advance! <body ng-app> <body ng-app> <div ng-controller="itunescontroller"> {{ error }} <form name="search" ng-submit="searchitunes(artist)"> <input type="search" required placeholder="artist or song" ng-model="artist"/> <input type="submit" value="search"/> </form> <div class="element"></div> <table id="songinfo" ng-show="songs">

javascript - Event Listeners in devtools: I see in Firefox, not in Chrome -

Image
in firefox see (good): and see attached event node. but in chrome same node see (bad): in firefox see click handled filterpro.min.js , in chrome see links jquery , include.postload.js . firefox wins? of course chrome can use bookmarklet visual event : ...but strange - in chrome can't find attached listeners node?

Microsoft Excel, =TODAY() through a condition displays strange number instead of date -

i not sure if on looking something, because still newbie excel's functions, here comes problem : lets have a1 cell, , want display todays date in cell whenever a1 cell isn't empty. so came : in cell : if(a1<>"";today();"") todays date 16.8.2015, when run today() through condition this, output : 42232 why weird number ? maybe did syntax wrong ? not sure.. tried make =today() in new cell, displayed 16.8.2015, , wanted show cell through condition, threw "42232" again. be sure cell format date , not general or number. the today function returns serial number equivalent amount of days since 1/1/1900. why seeing number instead of date.

c# - Multiplicity is not valid in Role in relationship: EF code first one to one relationship with same primary key and foreign key -

Image
i have 2 entities 1 one relationship in target entity primary key , foreign key same. here 2 entity , fluent mapping. public class register { public int id { get; set; } public string number { get; set; } // n.b: here can't have virtual property project dependencies. //public virtual customerdisplay customerdisplay { get; set; } } public class customerdisplay { public int registerid { get; set; } public double receiptviewpercent { get; set; } public virtual register register { get; set; } } public class registerconfiguration : entityconfig<register> { public registerconfiguration(bool useidentity, bool sqlserverce) : base(sqlserverce) { this.haskey(t => t.id); if (!useidentity) { property(d => d.id).isrequired().hasdatabasegeneratedoption(databasegeneratedoption.none); } this.property(t => t.number).isrequired().hasmaxlength(20); } } public class cust

qt - QJSEngine: print to console -

i'm moving qscriptengine (which deprecated) qjsengine , , see i'm unable use print : qjsengine engine; qjsvalue val = engine.evaluate( "print('123');" ); if (val.iserror()){ qdebug() << "error: " << val.tostring(); } qdebug() << "val: " << val.tovariant(); the output is: error: "referenceerror: print not defined" in qscriptengine works. then, way print console in qjsengine ? can't find in docs. tried use console.log , console not defined well. the print function not implemented in qjsengine. have implement yourself. luckily can write qobjects , make them available in script. (see section "qobject integration" @ http://doc.qt.io/qt-5/qjsengine.html ) here's how i've done it: create class jsconsole inheriting qobject: your own console class jsconsole.h #ifndef jsconsole_h #define jsconsole_h #include <qobject>

documentation - Where can I find the docs for Haskell's GHC.* modules? -

i'm trying understand how haskell package chesshs implemented. chess board represented ghc.arr.array , found out in ghci: prelude chess> :i board data board = board {turn :: color, castlingavail :: string, enpassant :: maybe (int, int), board :: ghc.arr.array (int, int) (maybe piece)} -- defined in ‘chess’ instance eq board -- defined in ‘chess’ instance show board -- defined in ‘chess’ prelude chess> by googling found out ghc.arr module part of "base" package. found documentation of package on https://hackage.haskell.org/package/base however, on page many hyperlinks various ghc.* modules not clickable. why not? can find documentation of these modules? in general, what's best way access arbitrary module's documentation? (i tried searching hoogle "ghc.arr" , "ghc.arr.array", didn't return relevant) functions ghc.* modules should in cases not used directly. reexported more

umbraco7 - Umbraco admin shows "Not found" page for settings item after production update -

Image
everything works fine on local. when uploaded website production, website area works in admin area items under settings(templates, css, etc.) have stopped opening , showing 404 page. have checked permissions , showing full control both app pool , network service user. please suggest if missing something.

python - How can I detect if a dictionary has certain criteria? -

i'm trying implement save feature game save variety of information. save part works fine, load part not work. current dictionary: player_data = {'x':x, 'y':y, 'world':mapsection, 'introcomplete':homeintro} i loading/saving this: def save_game(): open("savegame", "wb") f: pickle.dump(player_data, f) def load_game(): open("savegame", "rb") f: global player_data player_data = pickle.load(f) and see mapsection set as, use this: load_game() print(player_data) if "1_1" in player_data: print('maploaded') game_map_1_1() else: print('reset') game_intro() but reason, skips on if statement else statement. don't know doing wrong. i'm guessing want check player_data['world'] == '1_1' , not '1_1' in player_data . second 1 checks if have key named 1_1 . this not specific pickle.

opengl - GLSL: Subtract minimal element in vec3 from all elements -

glsl version 430 or higher. want subtract smallest value in vec3 vec3 itself, fast possible. example: using operation on vec3(1.3,0.3,1), should result in vec3(1,0,0.7). my current solution is: a-=min(min(a.x,a.y),a.z); this main operation in tight loop, performance benefit helps. there tricks missed?

osx yosemite - Perl Update in OS X 10.10.5, Cannot Locate Perl Modules -

update: tried again , realized perl said when tried load module, got "permission denied" error. so, re-ran script using sudo...and worked. guess must sort of permissions changes. original: updated os x 10.10.5 , suddenly, perl can no longer locate of cpan-installed modules. newly installed modules not found. know update installed perl 5.18.2, when explicitly use 5.16, modules still cannot located. the output of perl -v here: summary of perl5 (revision 5 version 18 subversion 2) configuration: platform: osname=darwin, osvers=14.0, archname=darwin-thread-multi-2level uname='darwin osx228.apple.com 14.0 darwin kernel version 14.0.0: tue jun 2 11:49:04 pdt 2015; root:xnu-2782.1.97.1.3~1development_x86_64 x86_64 ' config_args='-ds -e -dprefix=/usr -dccflags=-g -pipe -dldflags= -dman3ext=3pm -duseithreads -duseshrplib -dinc_version_list=none -dcc=cc' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemult

JavaScript turn string into json object -

so, have function works json object want make simplier created function values of json object. why doesn't work? var itemdata = { weapon: function () { return { 1: { 'name': 'dagger', 'extra_skill': 'none', 'cost': 500, 'attack': 5 }, 2: { 'name': 'pickaxe', 'extra_skill': 'mining', 'cost': 25, 'attack': 5 } } }, getweapon: function (value, x) { var obj = json.parse(value); return itemdata.weapon()[x].obj } } // outputs: dagger console.log(itemdata.weapon()[1].name) // name of weapon 1 // however, outputs: uncaught syntaxerror: unexpected token console.log('getting weapon... ' + itemdata.getweapon

mysql - Update table with connected rows -

ok, have table data (myisam): this `table` id | field1 | field2 | field3 | field4 | field5 1 | val1 | val2 | val3 | val4 | 1 2 | val1 | val2 | val3 | val4 | 1 3 | val2 | val1 | val4 | val3 | 1 4 | val2 | val1 | val4 | val3 | 1 i need update table (see where clause): create temporary table if not exists `table_temp` ( select * `table` `field7` null , `field8` null , `field9` null ); update low_priority ignore `table` `t`, `table_temp` `t2` set `t`.`field7`=current_timestamp(), `t`.`field9`=`t2`.`id` `t`.`field1` = `t2`.`field2` , `t`.`field2` = `t2`.`field1` , `t`.`field3` = `t2`.`field4` , `t`.`field4` = `t2`.`field3` , `t`.`field5` = `t2`.`field5` , `t`.`field7` null , `t`.`field8` null , `t`.`field9` null after query done, have this: this `table` after query id | field1 |