Posts

Showing posts from February, 2012

javascript - jquery .load() does not load external JS -

i loading external content div element using jquery.load() without selector. if content loaded has embedded js, js works expected. however, if content includes script tag src=path-to-js-code js-code not loaded. am correct in observation , if there solution other embedding js in loaded content? edit : few clarifications , observations: to load content using $("#divid").load("path/to/content.php", callbackfunction(response, status, xhr) { error checking , post processing code }); changing load code to: $.get("path/to/content.php", callbackfunction(response, status, xhr) { error checking $("#divid").html(response); post processing }); does not seem change behavior (more on behavior below) i have not tried parsing response retreive script src , using getscript() . now more on behavior... using firefox, seems external js loaded if has been 2 min last load. not see attempt in firebug unless refresh 2m afte

python 2.7 - Mac Scipy Installation Error like dlopen, no architecture found etc -

while running scipy , numpy , pandas job, stumbled in first step import , got many error dlopen , no architecture found , yada yada.... solution quite simple. follow below steps requires removal of scipy if installed or fresh installation. if scipy installed follow following steps. go site-package directory i.e. cd /library/python/2.7/site-packages remove scipy in case .egg file sudo rm -rf scipy-0.12.0-py2.7-macosx-10.8-intel.egg freshly install scipy .dmg , not port, easy_install, fink or else. http://sourceforge.net/projects/scipy/files/scipy/0.10.0b2/

android - React-Native How to update text value -

i'm new on topic. having class called barkodokuycu. in class when barcodereceived(e) called need change text value in { < tv/>}. want change score value don't know how that. since being newbie on subject great know if messy or can made better in code. note: styles deleted before posting question. import react, { appregistry, component, stylesheet, text, listview, touchableopacity, scrollview, view, } 'react-native'; import barcodescanner 'react-native-barcodescanner-master'; class barkodokuyucu extends component { constructor(props) { super(props); this.state = { torchmode: 'off', cameratype: 'back', barkodno: '123123', loaded: false, }; } barcodereceived(e) { console.log('barcode: ' + e.data); console.log('type: ' + e.type); } ren

need help on google advance services: Drive.Files.Update -

i'm getting xlsx files erp google drive folder( placing them de drive pc folder) . want them feed master google sheet makes drawings , dynamic tables information files. in master sheet use function importrange(key sheet). need convert xlsx gsheets files. found convert xls files available in folder "google doc spreadsheets"? me solve first problem: "how auto convert files in drive folder automatically" make script de of post above: function convert() { var carpeta=driveapp.getfolderbyid('idfolder'); aconvertir=carpeta.getfiles(); while(aconvertir.hasnext()){ var archivo=aconvertir.next(); var name=archivo.getname(); var id = archivo.getid(); var xblob = archivo.getblob(); var newfile = { title : name, key : id, "parents": [{"id": "my id parent folder "} ] } file = drive.files.insert(newfile, xblob,{convert: true}); } } the problem here need update content of files update de content of xlsx. every day i'd run

Compound terms and Lists in Prolog -

why compound terms preferable on lists in terms of performance? example, matrix(row(1,2,3),row(1,2,3),row(1,2,3)) is preferable over [[1,2,3],[1,2,3],[1,2,3],[1,2,3]] thank you! something other (excellent) answer did not mention: access member of list position means need traverse list. access argument of term should possible in constant time. random access term should more efficient. short aside: can attempt make list traversal marginally faster. swi-prolog implementation of nth0_det/3 smells of desperation ;) you might interested in this thread , esp. this summary talks lists , terms among other things. a few rules of thumb follow. use case: if know in advance how many things have, use term. if can have 0 or more of same things, use list. if need look-up table, neither optimal efficiency: if want random access, use term if algorithm works on singly-linked list, prolog list choice. from last point follows: try find algorithms use link

c# - Flexcodesdk Picturerbox dispose causing the picturebox invisible -

i using flexcode sdk. problem that, know when put picturebox1.dispose (), picturebox becomes invisible. there ways allow picturebox stays being dispose. reasons dispose because using fingerprint in 2 seperaate form. therefore, have dispose fingerprint in first form take in second form. possible not disposing while allow taking fingerprint verification in second form? private void buttonno_click(object sender, eventargs e) { pictureboxattendanceverification.dispose(); veringerprint.fpverificationstop(); formlecverification lectverification = new formlecverification(this); lectverification .showdialog(); }

c# - Ball is moving at same velocity despite changing velocity variable in unity -

Image
i creating pong , working fine, however, wanted there power-ups ball velocity changes. have velocity variable seems change nothing speed @ ball starts, velocity stays flat. here image of ball panel. and here code inside ball script public float ballvelocity = 1000; rigidbody rb; bool isplay; int randint; public vector3 velocity; float elapsed = 0; private bool onleft; public vector3 startpos = new vector3(0, 0, 0); void awake() { rb = getcomponent<rigidbody>(); randint = random.range(1,3); velocity = new vector3 (ballvelocity, ballvelocity, 0); } void update() { if (rb.transform.position.x < gameobject.findgameobjectwithtag ("paddle").transform.position.x) { print ("game over"); } if (rb.position.x < 0) onleft = true; else onleft = false; elapsed += time.deltatime; rb.drag = 0; print(onleft); if (elapsed > 5) { //rb.velocity *= .5f; elapsed = 0;

printing - Print specific number of rows on Python -

how go printing 10 items per row on python. example, line of code: for index, item in enumerate (list1): if item == 'p': print (index, end=' ') i getting result print horizontally, not vertically "end=' ', need print 10 characters per line, result this: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 any appreciated! you chunk items: from itertools import chain, islice def chunk(iterable, size=10): """yield chunks of given size iterable.""" iterator = iter(iterable) in iterator: yield chain((i,), islice(iterator, size-1)) pitems = (i i, v in enumerate(list1) if v == 'p') chk in chunk(pitems): print(' '.join(str(n) n in chk)) the chunk function splits iterable groups of given size (in case 10). pitems = (...) line filters items want index of. take filtered items, split them groups of 10 using chunk , print each group.

lua - Err using coroutine -

i'm not sure if misunderstood use of coroutine, here code: talk = coroutine.create(function () print("i speaking within 60 seconds") end) time = coroutine.create(function () if coroutine.status(talk) == running = 60, 0, -1 print(i) end sleep(1) else coroutine.resume(talk) end end) coroutine.resume(time) all print speaking within 60 seconds, expecting within countdown. how fix this? talk = coroutine.create(function () print("i speaking within 60 seconds") coroutine.resume(time) end) time = coroutine.create(function () = 60, 0, -1 print(i) coroutine.resume(talk) end end) coroutine.resume(time)

javascript - Retrieving encoded video from database -

i have android app takes videos , saves them firebase database. stores videos encoded strings using guava: string encodedvideo = files.tostring(videofile, charsets.iso_8859_1); i developing companion web app using angularjs should allow users download videos (by clicking link) have been stored database. however, cannot use guava decode string since it's not available javascript. i new angularjs , web development in general. i'm sorry if ignorant question, simplest way decode string , create downloadable file?

iis - MVC 4 Web Api Route 404 issue -

Image
i have plain-vanilla mvc 4 web api project created using vs2012. (/api/values) works out-of-the-box on localhost not when deployed on iis (packages created using standard "publish..." project menu). after been through lot of articles , reading suggestion similar issue found route tester visualized how iis interpreting request. as screenshot revels, iis interpreting ~/api/values ~/api/values. aspx any input on why happening , suggestion on how resolve highly appreciated. thanks lot help.

node.js - How to start nodejs in background and restart all 10 minutes -

^topic i have debian 8 now. i have 2 node files want run 2 files program 1 should start nodejs /home/bots/server/server.js after need timeout 10 sec. programm 2 should start after 10 secounds when program 1 started. nodejs /home/bots/f.js thanks i found here nothing work :/ i assume java tag should javascript since looks you're talking nodejs. it's bit hard tell you're trying do, can launch new processes within nodejs using child process module either .exec() or .spawn() . so, if have 1 nodejs process running already, can use settimeout() , child process module launch process @ future scheduled time. for example, here's example child_process doc pages wrapped inside settimeout() : const exec = require('child_process').exec; settimeout(function() { const child = exec('cat *.js bad_file | wc -l', (error, stdout, stderr) => { console.log(`stdout: ${stdout}`); console.log(`stderr: ${stderr}`);

python - PyODBC execute stored procedure does not complete -

i have following code, , stored procedure used call several stored procedures. can run stored procedure , complete without issues in sql 2012. using python 3.3. cnxn = pyodbc.connect('driver={sql server};server=.\sqlexpress;database=mydatabase;trusted_connection=yes;') cursor = cnxn.cursor() cnxn.timeout = 0 cnxn.autocommit = true cursor.execute("""exec my_sp""") the python code executing, have determined inserting numerous prints. did see other question regarding python waiting sp finish. tried adding 'time.sleep()' after execute, , varying time (up 120 seconds) no change. stored procedure appears partially executing, based on results. data suggests interrupting 1 of sub-stored procedures, yet fine when sp run query analyzer. my best guess sql config related, lost in look. any thoughts? just follow up; have had limited success using time features located @ link below, , reducing level of nesting stored procedures.

python - Reordering image skeleton coordinates to make interp1d work better -

Image
for school project i'm analyzing centerlines of c. elegans images. i've managed generate reasonable threshold , i'm using skimage.morphology.skeletonize generate centerline: then use np.nonzero coordinates of centerline eventual goal of parametrizing these points gain insight centerline geometry. however, when use scipy.interpolate.interp1d , mess: i'm sure happens because when np.nonzero looks nonzero values, goes bottom-up , right-left , orders points such, why zig-zag effect during interpolation. there way can reorder these points interp1d plays nice them? here code: import cv2 import numpy np matplotlib import pyplot plt scipy import ndimage scipy import stats scipy import misc skimage.morphology import skeletonize scipy.interpolate import interp1d """curved worm""" img = misc.imread("model_image_crop_curved.tif") plt.imshow(img) plt.show() imgthresh = img>200 plt.imshow(imgthresh) plt.show() misc.im

javascript - Only want 2 markers on Google Map. Any previous are deleted -

i have user click once, lat/lngs saved inputs. (this have). can click again , next lat/lngs saved second set of inputs. if click again, first marker erased , new marker location saved. once user happy, click save , 2 sets of lat lngs saved in database. i'm far enough along catch click , place in text boxes save. not sure how second marker , erase 1st if 3rd, , on. //map clicked google.maps.event.addlistener(map, 'click', function (event) { marker.setposition(event.latlng); map.panto(event.latlng); var clickposition = event.latlng; //map clicked google.maps.event.addlistener(map, 'click', function (event) { marker.setposition(event.latlng); map.panto(event.latlng); var clickposition = event.latlng; to visualize simple user case: open page embedded google map. click @ point way river. click on point way down same river. lets change mind, move points. 1 @ time, or one. edit: ok, able fill 4 tex

Changing Stack's storage directory on Windows -

on windows, stack uses %appdata/stack storage directory default. there way change that? i've managed move executables (by setting local-bin-path in global config.yaml file), i'd ghc versions, compiled packages, etc. stored somewhere else. this isn't supported, should straightforward add. i've added ticket here: https://github.com/commercialhaskell/stack/issues/2067 the relevant code here https://github.com/commercialhaskell/stack/blob/6f7871b893de2792ad9b9a02d934dfa72f8d9090/src/stack/config.hs#l266

How can I apply an alpha mask to an Android drawable? -

Image
in application, need change background color of button in response events. works fine setting creating drawable, setting paint , using drawable button background: shapedrawable drawable = new shapedrawable(roundrectshape); drawable.getpaint().setcolor(color); b.setbackground(drawable); now, want overlay alpha mask onto drawable, creating "striped" button. here's how should blue , black button (assuming white background color, these sections should 100% transparent): i made alpha mask in inkscape, , imported vector asset. might need convert bitmap of sorts, i'm not sure. i've read bunch of articles , questions mentioning porterduff matrices apply, haven't been able translate these solving current problem. anyone know how this? here's visualization, making things clearer. background color of parent view of button pale pink here, , button border outlined in red (but should invisible in end product): //this help. im

javascript - My AngularJS client isn't consuming my RESTful call -

Image
i trying feet wet on angularjs consumes restful service, however, running issue. i have rest call, http://localhost:8080/application/webapi/myapp/ , returns following json: { "content": "hello world", "id": 1 } also, have following angularjs controller: var myapp = angular.module("mymodule", []) .controller("hello", function($scope, $http) { $http.get('http://localhost:8080/application/webapi/myapp/'). success(function(data) { $scope.greeting = data; }); }); and index.html has following, <div ng-controller="hello"> <p>the id {{greeting.id}}</p> <p>the content {{greeting.content}}</p> </div> where ng-app defined in body tag. but when run index.html, on tomcat server, doesn't consume rest call. instead, produces blanks binding expressions are. my index.html looks this: my first application! id co

layout - TilePane with automatically stretching tiles in JavaFX -

is there way in javafx take best both tilepane or flowpane and gridpane? here's i'd achieve: first, idea of gridpane can set m×n grid automatically resizes within parent container divide space equally m columns , n rows. can put child elements fill each cell completely, , stretch along grid. cool. there's 1 drawback: need explicitly specify should each control go, setting row & column number. then, there layout containers such flowpane or tilepane automatically reflow child elements when parent container changes size. when add child element, automatically attached @ end of list, , list of elements automatically wraps after reaching edge of container when there's few space fit element in there. here's drawback well: child elements can have rigid, pre-defined sizes. won't stretch parent element. and here's need: need best both of these containers, is, want m n grid (let's 4×4) each cell parentwidth/m parentheight/n , stretches along wind

ruby - Getting error while deploying rails app on heroku -

i m getting error while deploying app github on heroku ... build log --> -----> ruby app detected -----> compiling ruby/rails -----> using ruby version: ruby-2.2.0 -----> installing dependencies using bundler 1.11.2 running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment fetching gem metadata https://rubygems.org/........... fetching version metadata https://rubygems.org/... fetching dependency metadata https://rubygems.org/.. installing json 1.8.3 native extensions installing i18n 0.7.0 installing rake 10.5.0 installing minitest 5.8.3 installing thread_safe 0.3.5 installing builder 3.2.2 installing erubis 2.7.0 installing mini_portile2 2.0.0 installing rack 1.6.4 installing mime-types 2.99 installing sass 3.4.21 installing thor 0.19.1 installing coffee-script-sourc

android - In Retrofit in API call Success Gives User Object And Failure Does Not Gives User Object Then How to check that in Retrofit Success Block? -

user success login response { "user": [ { "name": " xyz", "email": "zy@gmail.com", "address": " ahmedabad, gujarat, india", "profilepic": "../media/profilepic/xyz_n6gsitknom_11apr16_11421442.png", "qrcode": "1", "devicetype": "1", "devicetoken": "(null)", "deviceid": "", "paymentflag": "0", "photographerflag": "0", "phone": "123456", "weburl": "", "type": "photographer", "validate": "online", "professional": "1", "events": "1.events(wedding,birthday,parties,etc)", "p

java - How to use org.jf.dexlib2 get instructions’ byte code in a dexfile -

i want instruction's byte code,but code can opcode's byte code.such 0x38 01 fb ff means if-eqz v1, -0x5 .i can 0x38 means if-eqz ,but don't know how 0x01 fb ff means v1, -0x5 for (classdef classdef: dexfile.getclasses()){ (method method : classdef.getmethods()){ if (method.getimplementation()==null) continue; (instruction :method.getimplementation().getinstructions()){ i.getopcode().values(); } } } you can use baksmali's -d option print annotated hex dump of dex file. produce 2-column hex dump, left column containing raw byte values, , right column containing annotations bytes are, per dex specification. for example: > baksmali -n -d penroser.dump penroser.apk > less penroser.dump ... (lots of other stuff :)) |[26] code_item: lafzkl/development/mcolorpicker/views/colorpickerview;->pointtohue(f)f 0075f4: 0600 | registers_size = 6 0075f6:

opengl - what is wrong in the program below -

i trying compile using command gcc -lgl -lglut ex2_6.c -o ex2_6. error given below.i got code @ ihis link http://www.glprogramming.com/red/chapter02.html .see example 2-6 on link. hemkar@ubuntu:~$ gcc -lgl -lglut ex2_6.c -o ex2_6 /tmp/ccrgl3y9.o:ex2_6.c:function reshape: error: undefined reference 'gluortho2d' collect2: ld returned 1 exit status code: #include <gl/gl.h> #include <gl/glut.h> void display(void) { glubyte fly[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x01, 0xc0, 0x06, 0xc0, 0x03, 0x60, 0x04, 0x60, 0x06, 0x20, 0x04, 0x30, 0x0c, 0x20, 0x04, 0x18, 0x18, 0x20, 0x04, 0x0c, 0x30, 0x20, 0x04, 0x06, 0x60, 0x20, 0x44, 0x03, 0xc0, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x66, 0x01, 0x80, 0x66, 0x33, 0x01, 0x80, 0xcc, 0x19, 0x81, 0x81, 0x98, 0x0c, 0xc1

Java sorted collection with a count-based sublist -

we know can use collections.sort to sort list after elements inserted. but if elements inserted once time, maybe sortedmap more effective? though, sortedmap lack sublist method. what need sortedmap can insert small amount of elements many times, , can 1~1000 sublist top-down comparator interface. any suggestion? i think sortedset navigableset in turn has methods subset , tailset , headset , ceiling , floor kind of problems. so like: sortedset<integer> set = new treeset<>(arrays.aslist(0,1,2,3,4,5,6,7,8,9)); sortedset<integer> subset = set.subset(3,7); system.out.println(subset); //[3,4,5,6] obviously can create treeset whatever comparator want, , perform searches in order find more convenient. comparator<integer> reverse = collections.reverseorder(); sortedset<integer> set = new treeset<>(reverse); //same thing here

javascript - how to calculate the duration of year when user entered the date in textbox -

how display duration?when dated entered in textbox,in next field total number of years(duration). example: if user entered 09/11/2015.it should displayed 0.5 value,by comparing today's date. `now use script script function cal() { obj = document.getelementbyid("date"); if (obj != null) { if (obj.value != "") { var year = obj.value.split("/")[2]; var today = new date(); if (year > today.getfullyear()) { alert("invalid year"); document.getelementbyid("date").value = ""; document.getelementbyid("year").value = ""; } else { document .getelementbyid("year").value = today.getfullyear() - year; } } } } ` function aa(){ var oneday = 24*60*

replace - preg_replace cannot understand the error -

the text want replace follows (it sri lankan sinhalese). මහණෙනි, එක් පුද්ගලයක්හුගේ නිෂ්පත්තිය හේතු කොට ගෙන මහත් වූ ප්‍රඥාචක්ෂුස්හුගේ පහළ වීම වෙයි, මහත් වූ ප්‍රඥාලෝකයක්හුගේ පහළ වීම වෙයි, මහත් වූ ප්‍රඥාවභාසයක්හුගේ පහළ වීම වෙයි, අනුත්තරියධර්මයන් සදෙනාගේ පහළ වීම වෙයි, සිවුපිළිසැඹියාවන්ගේ පසක් කිරීම වෙයි, (අටළොස් වැදෑරුම්) අනෙක ධාතුන්ගේ ප්‍රතිවෙධය වෙයි, (අටළොස් වැදෑරුම්) නානාධාතුන්ගේ ප්‍රතිවෙධය වෙයි, විද්‍යාවිමුක්තිඵලයන්ගේ සාක්‍ෂාත් කිරීම වෙයි, ස්‍රොතාපත්ති ඵලයාගේ සාක්‍ෂාත් කිරීම වෙයි, සකෘදාගාමි ඵලයාගේ සාක්‍ෂාත් කිරීම වෙයි, අනාගාමී ඵලයාගේ සාක්‍ෂාත් කිරීම වෙයි, අර්හත්ත්ව ඵලයාගේ සාක්‍ෂාත් කිරීම වෙයි, කවර එක් පුද්ගලයක්හුගේය? යත්: තථාගත අර්හත් සම්‍යක් සම්බුද්ධයන් වහන්සේගේ ය. මහණෙනි, මේ එක් පුද්ගලයාගේ නිෂ්පත්තියෙන් මහත් වූ ප්‍රඥාචක්ෂුස්හුගේ පහළ වීම වෙයි, මහත් වූ ප්‍රඥාලෝකයාගේ පහළ වීම වෙයි, මහත් වූ ප්‍රඥාවභාසයාගේ පහළ වීම වෙයි, අනුත්තරිය ධර්මයන් සදෙනාගේ පහළ වීම වෙයි, සිවුපිළිසැඹියාවන්ගේ සාක්‍ෂාත් කිරීම වෙයි, අනෙක ධාතු ප්‍රතිවෙධය වෙයි, නානාධාතුප්‍රතිවෙධය වෙයි, විද්‍යාවිමුක්තිඵලයාගේ සාක්‍ෂාත්

How to implement Seams in material design in android? -

i have started exploring material theme in android. came across article of seams(referd link @ developer.com) link can join 2 materials single edge , move together, not able find how 1 can achieve through code. appreciated

html - Navbar Toggle Button Stops Working -

the navbar toggle button works first 3 tabs (index.php, albums.php , photos.php). button stops working once click on videos.php tab. doesn't work tab later videos.php. note: works first 3 tabs in case. stops working fourth tab , onwards. seems problem? <div class = "navbar-header"> <button type = "button" class = "navbar-toggle collapsed" data-toggle = "collapse" data-target = "#main_navbar" aria-expanded = "false" aria-controls = "navbar"> <span class = "icon-bar"></span> <span class = "icon-bar"></span> <span class = "icon-bar"></span> </button> </div> <!--navbar collapsed --> <!-- start of un-collapsed navbar --> <div class = "collapse navbar-collapse" id = "main_navbar"> <ul class = "nav navbar-nav"> <li>

io - how to read last line in a text file using java -

this question has answer here: quickly read last line of text file? 7 answers i making log , want read last line of log.txt file, i'm having trouble getting bufferedreader stop once last line read. here's code: try { string scurrentline; br = new bufferedreader(new filereader("c:\\testing.txt")); while ((scurrentline = br.readline()) != null) { system.out.println(scurrentline); } } catch (ioexception e) { e.printstacktrace(); } { try { if (br != null)br.close(); } catch (ioexception ex) { ex.printstacktrace(); } } here's solution . in code, create auxiliary variable called lastline , reinitialize current line so: string lastline = ""; while ((scurrentline = br.readline()) != null) { system.out.println(scurrentline); lastline = scur

Data modeling Issue for Moqui custom application -

we working on 1 custom project management application on top of moqui framework. our requirement is, need inform changes in ticket developers associated project through email. currently using workeffortparty entity store parties associated project , partycontactmech entity store email addresses. here need iterate through workeffortparty , partycontactmech everytime fetch email address need send emails changes in tickets every time. to avoid these iterations, thinking of giving feature add comma separated email addresses @ project level. project admin can add email addresses of associated parties or mailing list address needs send email notification ticket change. for requirement, studied around data model didn't got right place store information. need extend entity or there best practice this? requirement useful in project management application. appreciate on data modeling problem. the best practice use existing data model elements available. having normalized

amazon web services - How to use Kinesis to broadcast records? -

i know kinesis typical use case event streaming, we'd use broadcast information have in near real time in apps besides making available further stream processing. kcl seems viable option use kinesis stream api low level. as far understand use kcl we'd have generate random applicationid apps receive data, means creating new dynamodb table each time application starts. of course can perform clean when application stops when application doesn't stop gracefully there dynamodb table hanging around. is there way/pattern use kinesis streams in broadcast fashion?

linux - how to add space of a number after first four one space then after two one space etc using awk -

i want add multiple spaces of number " 20120911162500 " add space first 4 after every two. desired output is 2012 09 11 16 25 00 this tried: echo "2012 09 11 16 25 00" |sed 's/.\{4\}/& /g' but output 2012 0911 1625 00 . this might work (gnu sed): sed 's/../ &/3g' file this prepends space third pair of characters , every 2 characters thereafter.

mysql - Unable to Select Specified Database in codeigniter -

Image
when open project in localhost loaded , insert values database table. second time shows unable loading error. my xampp shows error when once loaded site.. 1 day loaded site after day error continously shows..

python - Django REST Framework hyperlink URL failing to resolve -

i trying set hyperlinking in django rest framework api, , life of me can't find out error is. my model: class franchise(models.model): id = models.autofield(primary_key=true) name = models.charfield(max_length=255) # other fields my serializer class franchiselistserializer(serializers.hyperlinkedmodelserializer): url = serializers.hyperlinkedidentityfield( view_name='franchise_details', lookup_field='id', lookup_url_kwarg='franchiseid' ) class meta: model = franchise fields = ('id', 'name', 'url') my urls: url(r'^db/franchise/$', views.franchise_index, name='db_franchise_index'), url(r'^db/franchise/(?p<franchiseid>[0-9]+)/$', views.franchise_details, name='db_franchise_details') note included url conf, api functionality goes within /api/ url my views: @api_view(['get']) def franchise_index(request, form

javascript - Camera not tracing the path properly -

i followed this example in three.js . in example camera , curve mesh added object 3d . in case not doing it,since need place mesh on dynamically created texture . the issue facing here , curve made added scene, camera not tracing path properly. have copied code animating splinecamera in animate function , made changes . please have to my code a portion of code in animate function var time = date.now(); var looptime = 20 * 1000; var t = (time % looptime) / looptime; var pos = tube.parameters.path.getpointat(t); pos.multiplyscalar(2); var segments = tube.tangents.length; var pickt = t * segments; var pick = math.floor(pickt); var picknext = (pick + 1) % segments; binormal.subvectors(tube.binormals[picknext], tube.binormals[pick]); binormal.multiplyscalar(pickt - pick).add(tube.binormals[pick]); var dir = tube.parameters.path.gettangentat(t); var offset = 15; normal.copy(binormal).cross(dir); pos.add(normal.clone().multiplyscalar(offset)); splinecamera.posit

android - MyLocationOverlay is deprecated, any alternative? -

mylocationoverlay deprecated. there alternative? mapview mapview; mylocationoverlay mylocationoverlay; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mylocationoverlay = new mylocationoverlay(this, mapview); ... the new class mylocationnewoverlay .

javascript - Jquery hover function show and hide element -

i have hover function shows , hides sub menus until person hovers on them. problem when try move mouse down menu shows disappears again. can point out im doing wrong here.? $(document).ready(function() { $('.menu-link > a').hover(function() { $(this).next('.menu').show(); }, function() { $(this).next('.menu').hide(); }); }); nav { position: fixed; top: 0; left: 0; width: 100%; /*background-color: #333333;*/ background-color: transparent; transition: 0.2s; } nav ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: transparent; display: inline-block; } nav ul li { float: left; } nav ul li a.link { display: block; color: black; text-align: center; padding: 24px 16px; text-decoration: none; transition: 0.2s; font-weight: bold; text-transform: uppercase; position: relative; } nav ul li div.arrow-down { float: right;

javascript - How to stop duplicate data in jquery mobile after navigationg between pages -

i creating chat application in jquery mobile.the problem when navigate between pages , come chat page when submitting data data resent according number of times 1 has navigated between other pages when perform full page refresh data sent once required. i have tried adding data-ajax = false href of link(button) still doesnt work? the html code: <form id="form_message_user" method="post" action="#user_requestmoreinfo_page "> <div data-inset="true"> <label for="requestmessage" class="ui-hidden-accessible"></label> <textarea cols="40" rows="6" name="requestmessage" id="text_user_message" placeholder="type message send "></textarea> </div> <input type="submit" value="submit" id="submitmessage" /> </form> the form on page <div data-role="page" id=&quo

javascript - Namespaces in gulp -

i have gulpfile constant path object. 1 of fields array. want iterate through , assign different watch react different tasks. when try assing task in loop: for(var = 0; < path.php[i].module.length; i++){ gulp.task('sync-'+path.php[i].module, function(){ return gulp.src(path.php[i].in) .pipe(newer(path.php[i].out)) .pipe(gulp.dest(path.php[i].out)); }); } path.php[i] not defined within anonymous function. reason need because if watch whole folder takes time syncing remote, if preprocessed through plugins "gulp-newer" , "gulp-changed". the problem asynchronous function call inside loop. when callback fires @ it's final value, every callback called same value i . you need wrap async function call inside new function, ensure value of i intended in each callback. try pattern: for(var = 0; < path.php[i].module.length; i++){ (function(i){ gulp.task('sync-'+path.php[i].module, function(){ retu

php - Open a new window in ajax success to display the pdf -

i use dompdf create pdf document (on fly). have post data pdf, use ajax. this php dompdf : <?php class dompdfgenerator { public function generate($html,$filename){ define('dompdf_enable_autoload', false); require_once("./vendor/dompdf/dompdf/dompdf_config.inc.php"); $dompdf = new dompdf(); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream($filename.'.pdf',array("attachment"=>0)); } } so,i use ajax post lot data create pdf file php file this. this ajax : var result = $("#hasil-pencarian").clone().find('td:last-child').remove().end().html(); $.ajax({ url: "<?= site_url('members/megumi/cek_list_wire_rod/generate_pdf_laporan') ?>", type: 'post', data: { result: result, id_pendukung: $('.printlaporan').attr('data-id') }, datatype: 'json', success: function (response) { open new window }, error: function

git - How to get the SHA of commit from diff output? -

how can sha of commit diff output? for example diff binary file, output of git show commit is: diff --git a/0_prospektusok/far_feltetdiszek/feltetdisz_prospektus.xls b/0_prosp index 9993010..707c169 100644 binary files a/0_prospektusok/far_feltetdiszek/feltetdisz_prospektus.xls , b/0 the git show 9993010 shows file on terminal, if redirecting file , opening ms excel, contains junk. the git checkout 9993010 says fatal: reference not tree: 9993010 . how can checkout versions of a , b ? if want checkout whole repo before commit use git checkout commit~ . if want keep working copy , update file state had before commit, use git checkout commit~ -- 0_prospektusok/far_feltetdiszek/feltetdisz_prospektus.xls . explanation why git checkout 9993010 didn't work, read answer how "index f2e4113..d4b9bfc 100644" in git diff correspond sha1 id in gitk?

jpa 2.0 - jpa @postpersist @postupdate only after transaction commit -

i'm inserting/updating 3 tables while using manual transaction. want insert history table right after transaction commited. means there 3 em.persist actions (for each table), , after commiting them call method. this code: @resource private ejbcontext context; public void save(object obj) { try { transaction = context.getusertransaction(); transaction.begin(); em.persist(obj); sb2.save(obj); //persist in sb2 sb3.save(obj); //persist in sb2 transaction.commit(); } catch (exception exp) { transaction.rollback(); } } is there kind of post commit method? how can call method after commit , , not after persist ? thank's in advance. jpa not provide such events, eclipselink provides extended events through sessioneventlistener api. http://eclipse.org/eclipselink/documentation/2.5/jpa/extensions/p_session_even

java - Getting data between a date range -

i'm writing program in java there excel sheet 3 users . user1 user2 uesr3 and task process products daily, , data stored in excel below. user | product | date user1 | 123 | 2/22/2016 user2 | 143 | 2/22/2016 user2 | 145 | 2/22/2016 user3 | 182 | 2/24/2016 user2 | 151 | 2/25/2016 and in java application, when select data range, need print number of users worked on number of products in console. like if select date range 2/22/2016 -'2/22/2016'. should show me user1 - 1 user2 - 2 this sample created, in real there around 1000 rows , counter slowdown process. i'm sure can done in jdbc, don't want use jdbc application, can please let me know if can done using poi? if so, please give me reference. i'm using below code read excel. string excelfilepath = "books.xlsx"; fileinputstream inputstream = new fileinputstream(new file(excelfilepath)); workbook workbook = new xssfworkbook(inputstream);

hibernate - tables used by spring security? -

i'm developing web application using spring mvc users management , , want add security layer using spring security for managing users have table ùser`in database : id name email role contact i've tried add login , password column previous table , change sql statement : <authentication-manager> <authentication-provider> <jdbc-user-service data-source-ref="datasource" users-by-username-query="select login,password,enabled user login=? " authorities-by-username-query="select login,role user login =? " /> </authentication-provider> </authentication-manager> but authentication failed ! i want ask if there specific schema of tables used spring security because tutorials i've seen, use table user_id , login , password and other authorities user_id , enabled is possible use 1 table containing information users , login , password ? ps : i'm using hiberna

mysql - Clone tables including more than one pk -

i'd clone table onto these statements: insert clone_table1 select alias.* table1 alias inner join table2 b on alias.pidm = b.user alias.pidm "2016%" , b.userstate = 30; yes work well, until there more 1 alias.pidm on table1 . table1: id | pidm | field1 | field2 --------------------------- 1 | 5 | aa | bb 2 | 5 | cc | dd 3 | 5 | ee | ff table2: user | field1 | userstate ------------------------- 5 | kk | 30 6 | jj | 40 so, field can identify each other between table1.pidm , table2.user . so question is: how can insert where table1.pidm=5 , table2.userstate=30 rows clone_table1 ? thanks in advance. insert clone_table1 select alias.* table1 alias left join table2 b on alias.pidm = b.user , b.userstate = 30 alias.pidm "2016%"