Posts

Showing posts from January, 2014

assembly - ASM - 8086 - Using Registers and variables -

am starting grips asm programming feel missing regarding use of registers store variables. issue have instructions modify other registers internal reasons. in cases have used these registers store application logic. there golden rules how use registers? for example: following code changes dx register , wipes out current variable. mov ax, 04h mov bx, 02h mul bx i did not want nor state want dx register wiped out. what's going on here? welcome assembly language programming. short answer pick values manipulated often. rule compilers use register allocation. score usages numerically heuristic values, put best scores in registers until there no more. in 8086 assembler, have small number of registers, , many of them have special purposes. you've discovered one: mul , div implicitly use ax , dx. think of mul instruction mul dx:ax, operand , , you'll see what's going on. makes life harder, the assembly level, architecture designer doesn't care. he&#

php - Magento xml importing - pictures are not imported -

i managed script importing products mapping of fields xml working.( magento xml import mapping ). i use magmi importer, here link magmi image attributes processor plugin (as discovered later) mandatory import pictures url: http://wiki.magmi.org/index.php?title=image_attributes_processor but can't import pictures (link picture in xml url). one product xml: <izdelek> <st>1</st> <izdelekid>75</izdelekid> <izdelekime>ati radeon 102 - b62902 (b)</izdelekime> <izdelekpodnaslov>256 mb, dms - 59</izdelekpodnaslov> <izdelekopis></izdelekopis> <izdelekkategorija>komponente</izdelekkategorija> <izdelekdodatenopis> grafična kartica omogoča razširjeno namizje na dveh ekranih (dve različni sliki)! low profile - namenjena izključno sff računalnikom! </izdelekdodatenopis> <zadnja_osvezitev>16/08/2015</zadnja_osvezitev> <url>

java - javadoc task in gradle - link to oracle's javadoc instead of displaying unlinked qualified class names everywhere -

in javadoc project generates, every time class standard java library referenced, inserts not linked qualified class name. what want have happen link being generated instead pointing oracle.com java se 8 documentation . example: static string (or link not framed version instead) instead of static java.lang.string this possible appending -link http://docs.oracle.com/javase/<javaversion>/docs/api/ command line arguments passed javadoc. refer documentation of build tool or ide on how that.

c++ - Close QTcpSocket from another thread -

i use qtcpsocket in dedicated thread. close thread, have personal slot connected disconnected signal of qtcpsocket . slot contains socket.close() instruction. class network { private: qtcpsocket *mp_socket; public: void connection() { mp_socket = new qtcpsocket(this); // move thread connect(mp_socket, signal(disconnected()), this, slot(disconnect())); } public slots: void disconnect() { mp_socket->close(); } }; here, slot works (even if socket in thread). if call disconnect slot myself, have following error : "qsocketnotifier: socket notifiers cannot disabled thread". why? thanks help. ;) ok, may need change design little. instead of moving socket new thread, make network class object derived, , move instead, , have socket parented it. previous answer revision did not work because close() not registered qt meta system, because plain virtual functio

ios - Loading images asynchronously in UITableView with Autolayout -

i have uitableview loads images asynchronously in uitableview. images different heights, set height constraint according height of image. this works fine when use datawithcontentsofurl, freezes ui. when load asynchronously, images pile on top of each other so: http://i.stack.imgur.com/teuwk.png the code i'm using follows: nsurl * imageurl = [nsurl urlwithstring:img]; nsurlrequest* request = [nsurlrequest requestwithurl:imageurl]; cell.imageviewheightconstraint.constant=0; [nsurlconnection sendasynchronousrequest:request queue:[nsoperationqueue mainqueue] completionhandler:^(nsurlresponse * response, nsdata * data, nserror * error) { if (!error){ uiimage *imgz = [uiimage imagewithdata:data]; [cell.cellimg setbackgroundimage:imgz forstate:uicontrolstatenormal]; [cell.cellimg sizetofit]; cell.imageviewheightconstraint.constant=result.width*(imgz.size.height/imgz.size.width); [cell setneedsupdateconstraints]; } }]; [cel

javascript - How to hide div when user clicks other place -

i need hide div id = sdwn when user clicks other place in document. <div id="sdwn" onclick="okijuyg()"> <img src="../img/lupa.png" id="ildsib" onclick="okijuyga()" > </div> <div id="atsimd"> <div class="arrow-up" id="shs"> </div> <div id="vsauceisgenius" tabindex="-1" > <img src="../img/x.png" id="ctso" href="#"> <input type="text" placeholder="people" id="imohd"> <input type="submit" value="search" id="dpmm"> <p></p> <input type="text" placeholder="hashtags" id="imohds"> <input type="submit" value="search" id="dpmmm"> </div> </div> you can use event.target check if element clicked, , if not, h

emoji - Swift `join` hangs when joining string with country flag -

i discovered while working in swift 1.2. have reported bug. wonder why? import uikit var str = "🇬🇧 lhr ✈️ sfo 🇺🇸" ([str] nsarray).componentsjoinedbystring("") // work join("", [str]) // hangs forever apple has fix problem in swift 2.0, join replace method joinwithseparator(separator: string) -> string works fine flags. here code snippet. var str = "🇬🇧 lhr ✈️ sfo 🇺🇸" ([str] nsarray).componentsjoinedbystring("") // work [str].joinwithseparator("") output 🇬🇧 lhr ✈️ sfo 🇺🇸 🇬🇧 lhr ✈️ sfo 🇺🇸 🇬🇧 lhr ✈️ sfo 🇺🇸

odftoolkit - Setting style on a paragraph using ODF toolkit simple-odf.0.8.1 -

this question has been asked member in octobre 2014, incubating simple-odf.0.8.1 not seem solve problem. i'm trying generate odf text document (*.odt), applying styles newly generated paragraphs. when opening generated document libreoffice 5, newly generated paragraphs appear default style , not wanted one. am doing wrong or there an, yet, not corrected bug ? import java.io.fileoutputstream; import org.odftoolkit.odfdom.dom.style.odfstylefamily; import org.odftoolkit.odfdom.incubator.doc.office.odfofficestyles; import org.odftoolkit.odfdom.incubator.doc.style.odfstyle; import org.odftoolkit.simple.textdocument; import org.odftoolkit.simple.text.paragraph; public class test { public static void main(string[] args) { try { // loading template document styles textdocument doc = (textdocument)textdocument.loaddocument("template.odt"); // checking if "mystyle" included odfofficestyles styles

c# - How to restrict touch movement for android on Unity -

i working on 2d car racing game android device. have coded touch movement car. problem car going beyond track. how can restrict car movement, mean how can code car stay in screen (screen resolution 480*800 , car sprites max position 4.2 , min -4.2). here r c# car controller script. using unityengine; using system.collections; public class carcontroller : monobehaviour { public float carspeed; // update called once per frame void update () { if (input.touchcount == 1) { touch touch = input.touches[0]; if(touch.position.x < screen.width/2){ transform.position += vector3.left * carspeed * time.deltatime; } else if(touch.position.x > screen.width/2){ transform.position += vector3.right * carspeed * time.deltatime; } } } } the immediate solution use clamp function know max , min values after calculating desired movement.

core data - Xcode - error in simulator on iPad (but not iPhone) accessing CoreData -

my app fails datacore error 9999 when simulate ipad not when simulate iphone. when run app on ipad there no error. the simulator using same database on desktop , have rebuilt several times. is bug in simulator? here error code: 2015-08-16 12:07:19.750 crew emergency preparedness[1195:59803] coredata: error: -addpersistentstorewithtype:sqlite configuration:(null) url:file:///users/patriciawarwick/library/developer/coresimulator/devices/a1f21642-da91-4510-9517-fc2a2756ff26/data/containers/data/application/65b75062-9c98-42aa-954f-25eec7caa8bc/documents/crewdata.sqlite options:(null) ... returned error error domain=nscocoaerrordomain code=134100 "the operation couldn’t completed. (cocoa error 134100.)" userinfo=0x7c4cb030 {metadata={ nspersistenceframeworkversion = 519; nsstoremodelversionhashes = { notes = <cdf25e0b 15955be0 b8714aa0 675ddcb3 caa5de75 7f257d1a ca6a64e3 97791f2a>; section = <78490b89 a642322e 42bbdceb 4bb3f099 6331bf84 7db3c909 cf

HTML/CSS acting very weird in my Rails 4 app (height not customizable etc) -

Image
i have 2 questions post. first why toyota camry act that? here's code: #posts - @posts.each |post| .post .post_content .title %h2 = link_to truncate((post.title), length: 25), post %p $ = post.price .post_image = link_to image_tag(post.image.url), post .data.clearfix %p.username listing = post.user.name %p.buttons %span %i.fa.fa-comments-o = post.inquiries.count %span %i.fa.fa-thumbs-o-up = post.get_likes.size the css: #posts { .post { width: 20%; float: right; margin: 1rem 1.5%; border: 1px solid #e4e4

Obtaining the integral of a healpy map -

i have healpy map deflection (gradient of lensing potential), obtained during particular lensing simulation of cmb. want obtain map of lensing potential using healpy if possible. notice there healpy function alm2map_der1() give me healpy map , first derivative given map's alms. assuming first derivative gradient of map - please correct me if wrong. want know if can use healpy backwards process of this. want remove gradient , want lensing potential. so far, attempt has been use relation between deflection , lensing potential power spectra; cls of deflection = l(l+1) * cls of lensing potential, , rearranging to: cls of lensing potential = cls of deflection / l(l+1), using synfast convert map. not seem getting correct map. is there better way trying do? maybe not using healpy? i can't first part, know converting cls destroys orientation information. 'synfast' provides map power spectrum input random orientation. if run 'synfast' on list of cls dip

CSS .cur cursor format -

i set custom cursor url(mouse2.cur) , doesnt change. (mouse2.png) works perfectly! whats problem ? body{ cursor: url(mouse2.cur),pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; } different browsers have different support in url of cursors. firefox/mac, safari/mac, chrome/mac don't support png , jpg cursors (tested 48px cursors). ie supports cursors in cur format. according caniuse: http://caniuse.com/#search=cursor w3c css3 specification states: the ua must support following image file formats: png, defined in [png] svg, defined in [svg], in secure static mode [svg-integration] any other non-animated image file format support in other properties, such the background-image property by way, w3c css3 specification says .cur cursors should supported browsers. note: @ time of writing specification (spring 2015), file formats supported cursors in common des

javascript - dynamic dependent dropdown using ajax codeigniter -

i want make dropdown select value , can fetch data database without submit button. paste code here student , making project shall thankful please help... my controller is public function find($id) { $product=$this->user_model->find($id); echo "id ".$product->email; } model public function find($id) { $this->db->where('id',$id); return $this->db->get('users')->row(); } view file: <script type="text/javascript"> $(document).ready(function() { $('#slt').change(function(){ var country_id = $('#slt').val(); $.ajax({ type: 'get', url: "<?php echo base_url('index.php/main/find/')?>"+country_id, success: function(result) { $('#result').html(result); } }); }); }); </script> <f

jsp - converting into html form to pdf -

i making student admission form student name,mobile,phone number, father name etc etc. have 2 tables of 10 rows , 6 columns details entered in new student shown in proper form in next page (example- design html page how original form looks like). want save pdf. i applied code shows error. code string s=""; try{ string ref=request.getheader("referer"); url url = new url(ref); bufferedreader reader = new bufferedreader(new inputstreamreader(url.openstream())); string line; while ((line = reader.readline()) != null){ s=s+line; } document doc=new document(pagesize.a5.rotate()); file f=new file("c:\\users\\diljeet\\desktop\\data111.pdf"); pdfwriter.getinstance(doc, new fileoutputstream("c:\\users\\diljeet\\desktop\\data111.pdf")); doc.open(); htmlworker htmlworker = new htmlworker(doc); htmlworker.parse(new stringreader(s)); doc.close(); reader.close(); }catch(exception

javascript - How to get rid of the first undefined -

is there no easier way rid of first element of undefined this, checking in loops isn't first element? var text; (d=0; d<json_nya_svar.length; d++){ (c=0; c<json_nya_svar[d].length; c++) { if (c==0 && d==0) text=json_nya_svar[d][c] + ";"; else text += json_nya_svar[d][c] + ";";} text += "\r\n"; } just give text initial value: var text = ''; also, bear in mind loop variables global, can lead various problems in long run. don't forget add var before declaration: var text = ''; var json_nya_svar = [[1, 2, 3], [4, 5, 6]]; (var d=0; d<json_nya_svar.length; d++){ (var c=0; c<json_nya_svar[d].length; c++) { text += json_nya_svar[d][c] + ";"; } text += "\r\n"; } console.log(text);

python - PySpark ReduceByKey -

i have been trying make work while, failed every time. have 2 files. 1 has list of names: name1 name2 name3 name4 the other list of values associated names each day in year on several years: ['0.1,0.2,0.3,0.4', '0.5,0.6,0.7,0.8', '10,1000,0.2,5000' ...] the goal have output like: name1: [0.1,0.5,10] name2: [0.2,0.6,1000] name3:[0.3,0.7,0.2] name4:[0.4,0.8,5000] and plot histogram each. wrote mapper creates list of tuples produces following output (this rdd object): [[('name1', [0.1]),('name2', [0,2]),('name3', [0.3]),('name4', [0.4])], [('name1', [0.5]),('name2', [0,6]),('name3', [0.7]),('name4', [0.8])], [('name1', [10]),('name2', [1000]),('name3', [0.8]),('name4', [5000])]] now need concatenate values each name in single list, each map key, value attempted returns wrong result. you can loop through each , create dictionary using dic

java - Use different methods based on parameter from constructor -

Image
i have class should have different method implementations based on parameter pass class constructor. however, select implementation run @ time of object creation, , not testing specified parameter. of sort: public class someclass(){ int parameter=-1; someclass(int param){ this.parameter = param; } public methodspecific(){ //for when parameter==1; stuff... } public methodspecific(){ //for when parameter==2; stuff... } } instead of: public class someclass(){ int parameter=-1; someclass(int param){ this.parameter = param; } public methodforall(){ switch(parameter){ case 1: something... case 2: else... } } } is there way can achieve this? edit: edit clarify situation , context. please consider figure bellow. rectangles of same color mean implementation of methods same. rectangles different colors means though name same

json - Continuing a while loop after error in R -

i trying use while loop download bunch of json files. they numbered 255 1. however, of them missing (for example, 238.json not exist). scheduleurl <- "http://blah.blahblah.com/schedulejsonfile=" <- 255 while ( > 0) { last = paste0(as.character(i), ".json") path = "/users/user/desktop/temp" fullpath = paste0(path, last) ithscheduleurl <- paste0(scheduleurl, as.character(i)) download.file(ithscheduleurl, fullpath) <- - 1 } i want write while loop such if encounters nonexisting file (as when = 238), continues 237 instead of stopping. i tried trycatch() function way, didn't work (keeps trying same url) : while ( > 0) { possibleerror <- trycatch({ last = paste0(as.character(i), ".json") path = "/users/dlopez/desktop/temp" fullpath = paste0(path, last) ithscheduleurl <- paste0(scheduleurl, as.character(i)) download.file(ithscheduleurl, fullpath)

c# - I cannot figure out how to fix an unhandled Format Excpetion -

i trying write c# program using visual studio reads data file , allow me perform various sorts on data. beginner took research figure out how write code: a: format exception unhandled. input string not in correct format i not sure went wrong. happening following line of code: candidate newrec = new candidate(str[0], str[1], str [2], str[3], str[4], str[5], str[6], convert.toint32(str[7]), str[8], str[9], str[10], str[11]); the entire code follows: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.io; using system.collections; namespace unit4ip { //used sort in asceding , descending order public struct candidate:icomparable { public char[] _firstname; public char[] _lastname; public char[] _company; public char[] _address; public char[] _city; public char[] _country; public char[] _state; public char[] _phone;

javascript - How can I make Photoshop extensions in CS3 up to CC versions -

researching subject realized html5 , javascript go stack building extensions versions of photoshop beginning cc latest cc 2015 versions. want build extension compatible versions begining cs3 cc 2015. , question is: can using html5 , javascript? (for example brackets plugin building extensions) or should use other technologies that? , possible in general make compatible extension photoshop versions cs3 cc 2015? greatful tips , answers!

c# - ObservableCollection always gets only first item in it for each created TabItem -

can point on mistake pleas. when add tabs each tab duplicates data in textboxes added in first created tab. observablecollection gets first item in each tab. i have mainview tabcontrol wich add tabs programmatically , set content them through button_click <window x:class="test.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:y="clr-namespace:test" title="mainwindow" height="350" width="525"> <grid> <toolbar height="40" verticalalignment="top"> <button foreground="aliceblue" fontweight="normal" click="button_click" fontsize="14" fontfamily="fixed miriam transparent">menu <button.contextmenu> <contextmenu > <menuitem header="add invoice

c++ - QCustomPlot: How to set percent on the y-axis? How to change tick label alignment? -

i playing around qcustomplot libary qt. created plots succesfully. got still questions: 1: how can set y-axis range 0% 100%? 2: tick labels centered below ticks. how can change left alignment? thanks help. peter // generate data: qvector<double> x(101), y(101); // initialize entries 0..100 (int i=0; i<101; ++i) { x[i] = (i*960); // x goes -1 1 y[i] = x[i]/96000.0; // let's plot quadratic function } // create graph , assign data it: ui->customplot->addgraph(); ui->customplot->graph(0)->setdata(x, y); // set axes ranges, see data: ui->customplot->xaxis->setticklabeltype(qcpaxis::ltdatetime); ui->customplot->xaxis->setdatetimespec(qt::utc); ui->customplot->xaxis->setdatetimeformat("hh:mm"); ui->customplot->xaxis->setautotickstep(false); ui->customplot->xaxis->settickstep(3600); ui->customplot->xaxis->setrange(0, 8639

c# - ASP.NET Identity is null even the token is sent -

for thesis project have implement token-based (bearer) authentication in asp.net solution. implemented taiseer jouseh ( http://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity ). the basic part working correctly. have mobile client on can register new user. can login , receive token. when make request, token sent in request header. works fine. problem is, 401 unauthorized error if call [authorize] method, if send token. removed [authorize] annotation test things: var z = user.identity; var t = thread.currentprincipal.identity; var y = httpcontext.current.user.identity; var x = request.getowincontext().authentication.user.identity; here got alwas same identity: authenticationtype=null; isauthenticated=false; name=null; claims:empty var token = request.headers.authorization; here right token. token sent request. i hope can me. have token no identity. here parts of code: oauthserviceprovider: public class simpleauthorization

logging - Android Studio Displaying to log error -

i trying display message log in android studio. use log.d(), gives me error: cannot resolve method d(). find strange because used before. maybe missing obvious. try like: log.d("debug", "some text"); log.d stands debug. make sure import log class. import android.util.log; you can import automatically holding alt key enter. check this: http://developer.android.com/reference/android/util/log.html

objective c - Am I making two queries? -

since pffiles can retrieved through getdatainbackgroundwithblock because they're not objects (i think..) after making query i'm calling getdatainbackgroundwithblock convert pffile uiimage. am making 2 queries calling findobjectinbackgroundwithblock , getdatabackgroundwithblock? if so, there way done 1 query only? pfquery *query = [pfquery querywithclassname:@"photoobject"]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error){ (id object in objects) { pffile *imagefile = object[@"photo"]; [imagefile getdatainbackgroundwithblock:^(nsdata *imagedata, nserror *error) { if (!error) { [self.annotationarray addobject:object[@"location"]]; nslog(@"annotation's coordinate : %@", self.annotationarray); self.calloutimage = [uiimage imagewithdata:imagedata]; self.geopoint = obj

How can I see the exact path of each library file being linked into my Visual Studio 2013 C++ project? -

i'm having tough time chasing down appears library file mismatch. upgraded new sdk app uses , believe have old library file lying around causing me headache. i know can unload vc++ project file , open in edit mode find out macro symbols library , additional dependency paths expand out to. full list showing every lib file linked app full path shown. note, not getting errors @ link time . instead, i'm getting subtle errors @ runtime indicate old library file may blame. is there way see information?

sql - Coding function calculate age from a DOB -

i trying populate field in table calling following function calculate person's age dob. when execute code receive following error: the error incorrect syntax near keyword 'end' i don't know why? please help. create function findage (@dateofbirth date) returns int begin return (floor(datediff(year,@dateofbirth, getdate())) end create function findage (@dateofbirth date) returns int begin declare @age int; set @age = floor(datediff(year,@dateofbirth, getdate())); return @age; end

c++ - Rcpp with Intel MKL Multithreading -

i wrote c++ shared library uses intel mkl blas operations, , threads beautifully, using 12 cores of machine. trying use rcpp call function library, , finding single threaded. in, same data, when same function called c++, uses 12 cores quickly, whereas when rcpp calls it, single threaded , takes longer (but results consistent). intel mkl dynamically linked library thusly: makefile: libraries=-lpthread -wl,--no-as-needed -l<directory>bin -liomp5 -l<bin_directory> -lmkl_mc3 -lmkl_intel_lp64 -lmkl_gnu_thread -ldl -lmkl_core -lm -dmkl_ilp64 -fopenmp lflags=-o3 -i/opt/intel/composer_xe_2015/mkl/include -std=c++0x -m64 #compiles shared library g++ -fpic -shared <cpp files> -oliblibrary.so $(libraries) -o3 -i/opt/intel/composer_xe_2015/mkl/include -std=c++0x -m64 #compile controller r, can loaded dyn.load() pkg_libs='`rscript -e "rcpp:::ldflags() $(libraries) $(lflags)"`' \ pkg_cxxflags='`rscript -e "rcpp:::cxxflags()"` $(li

c# - How to set an Object as the value in JSON string Using Asp.Net Web API? -

i building jeopardy web api application prepare .net technical interviews. i using code first entity framework create database. i using fiddler test posts/gets i have 2 tables: categories , jeopardyquestion. a question can have 1 category, , category can have many questions. model setups below. public class jeopardyquestion { [databasegenerated(databasegeneratedoption.identity)] public int jeopardyquestionid { get; set; } [required] public string question { get; set; } [required] public string answer { get; set; } [required] public int value { get; set; } [required] public virtual category category { get; set; } } public class category { [databasegenerated(databasegeneratedoption.identity)] public int categoryid { get; set; } [required] public string categoryname { get; set; } public virtual list<jeopardyquestion> jeopardyquestions { get; set; } } i able post 2 categories: ado.net , asp.net. 2

ios - Chaos in debugger during to get keyboard rect -

Image
when keyboard rectangle appears, move views. worked best answer question attempt implement in swift. when program tries uikeyboardframeenduserinfokey value found nil . if cast value nsvalue has value of nsrect type. if try cast nsrect error "undeclared type". if cast cgrect nil . what's going on here?

mdx - New mondrian cube not available in XMLA pentaho -

i have mondrian cub xml schema file. have used a basis analysis datasource. can query thing file saiku, , everthing works fine. however, when use olap4j , try connect via xmla connetor, not show in list of cubes. other cubes show , can queried. set enablexmla parameter true. code: namedlist<catalog> c = oconnection.getolapcatalogs(); namedlist<schema> l = oconnection.getolapschemas(); schema schema = oconnection.getolapschema("mycube"); namedlist<cube> cubes = schema.getcubes(); when print out list of catalogs, can see it, 1 schema , 1 cube listed when print them out. (not 1 want of course) i have refreshed , rebooted server. there else need do?

android studio - Genymotion unstable -

i've been using genymotion, been pretty laggy. had haxm accelerator installed decided mess vm manager, seems have made worse. runs smoothly upon opening application, either wait bit tell me application isn't responding, or freeze , give me "player.exe has stopped working" dialog box. changed system settings follows: 1 processor, 1024mb motherboard, 128mb video 3d acceleration enabled. other configurations set default. i have intel i5-2450m 2.5ghz chip virtualization enabled in bios. before when had haxm installed, worked fine. lagged lot. help appreciated. you using windows 10? try reinstall genymotion deleting geny folders computer, remove virtualbox too.

python - Using sys.path.insert without explicit absolute path -

new using sys.path enable module import directory, i'm sure noob question but: is possible not have use full/explicit or absolute file path when using sys.path access python script in directory, instead, provide directory path that's local module file structure? currently, have following directory structure: mymodule/ name/ __init__.py bin/ userinfo.py __init__.py docs/ setup.py tests/ name_tests.py __init__.py within setup.py file, have import userinfo.py script, asks users info during installation. in setup.py file, lines call userinfo.py script this: import sys sys.path.insert(0, '/users/malvin/pythondev/projects/mymodule/bin') import userinfo this works fine, because know entire file path userinfo.py file is, doesn't work who's trying install module because (obviously) there's no way anticipate file path on user's system. my question: there method wherein c

php - Take Current MYSQL Timestamp And Subtract It From 24 Hours -

one thing has confused me time in coding. confused on how go doing this! simply, have mysql timestamp, , want subtract 24 hours. basically, trying code lets complete action once every 24 hours, , if try complete more once tell them how long have wait again. this code have: $dailylogincheck = 2015-08-16 13:30:32 //mysql timestamp date_default_timezone_set("america/new_york"); $lastloginbonus = new datetime($dailylogincheck); $currenttime = $lastloginbonus->diff(new datetime(date("y-m-d h:i:s"))); i don't have use code (if there better way this). subtract current timestamp 24 hours, have no clue how in php :( please help! p.s. display sentence following: you have done within past 24 hours. please come in x hours x minutes , try again. hope works :-) <?php $dailylogincheck = '2015-08-16 13:30:32'; $end = new datetime($dailylogincheck); $end->add(new dateinterval('p1d'));//add 1 day find end date $now = new dat

jQuery append function shows result in an increase number -

my goal every time choose operation , press "save" button, tag operation's name appear after class change_creation. here's code $('#operations1').on('input',function(){ switch($(this).val()){ case "j": operation_name = "j"; document.getelementbyid("j").style.visibility = "visible"; break; case "r": operation_name = "r"; document.getelementbyid("r").style.visibility = "visible"; break; case "s": operation_name = "s"; document.getelementbyid("s").style.visibility = "visible"; break; case "c": operation_name = "c"; document.getelementbyid("c").style.visibility = "visible"; } }); $('.button_save').click(function(){ $('.c

Apple Watch CFBundleName accessibility readout -

in apple watch app, name of app contains letters should read out separately in apple watch companion app when accessibility on. eg. name "sampleappname at" , readout says "at" instead of "a" "t" separately however, since companion app shows name cfbundlename of iphone app, reads out incorrectly. in case of iphone app putting the unicode hex character code "&#x7f;" between letters eg. "sampleappname a&#x7f;t" in cfbundledisplayname solved issue of readout iphone app. i've tried putting in unicode hex character code &#x7f; between letters cfbundlename not solve issue. i'm not sure if right way go cfbundlename. suggestions on solving welcome.

What is the best practice for implementing tags with Neo4j and rails? -

have neo4j based rails app , want implement tags. not sure how go it. thinking of creating new model nodes "tag" label, seemed kind of overkill. there approach https://github.com/mbleigh/acts-as-taggable-on neo4j based app? it depends on want on performance considerations ;) creating tag model isn't overkill, make sure merge tags whenever create them make sure don't create duplicates. can use neo4j's graph traversal abilities jump tags other objects , vice versa, more complicated queries making recommendations between objects according how many tags share / don't share. if want have basic list of strings, neo4j supports having array properties on nodes , relationships. can use declaring property on model this: class modelclass include neo4j::activenode property :tags end the issue can't index based on arrays (i think that's planned future). if performance big concern rather showing list of tags, tag nodes might best b

javascript - How to deal with multiple trees situation when using dagre layout in Cytoscape.js -

Image
i'm new cytoscape.js , trying draw graph of dagre layout depending on users' search input. number of nodes typically 50-100. although dagre works single tree, when graph contains several trees (and includes independent nodes), roots of these trees automatically arranged horizontally(as picture shown), makes nodes , labels become small. if can take advantage horizontal space, graph surely clearer. my question how can deal multiple-tree situation, vertically arrange trees (for example, 4 roots in line , others can arranged under these trees) utilize layout space. take @ rankdir option orientation of layout : http://js.cytoscape.org/#layouts/dagre for more control, try running 1 layout per subgraph/tree: http://js.cytoscape.org/#collection/layout you can control subgraph position using boundingbox each subgraph. also see dagre docs details on config options : https://github.com/cpettitt/dagre/wiki

How I can fix the following error in replication RDF in virtuoso OpenSource? -

i'm trying replication rdf triples in virtuoso, have error when connecting pulbicador server via repl_server . function () says: error 42s22: [openlink] [virtuoso odbc driver] [virtuoso server] sr242: no system status variable st_repl_server_enable please error. you're trying use feature of commercial edition, you're running open source edition .

Regarding sending a file to Websocket via android application -

i want upload mp3 file via websocket in android application. i using external library http://autobahn.ws/android/ but problem through library,i cannot upload big file.say 5 mb. tried researching on similar types of libraries.but not found suitable one. has tried upload file on websocket in android application. thanks as per mentioned error receiving "websocketexception: frame payload large" , if go source code of library using , search error find out limitation imposed library itself. // bail out on frame large if (payload_len > moptions.getmaxframepayloadsize()) { throw new websocketexception("frame payload large"); } you'll find limitation in websocketoptions.java mmaxframepayloadsize = 128 * 1024;

amazon s3 - PowerShell Remoting Sporadic Script Exiting -

i have script executes aws s3 sync , should sync approx 255gb. however, script seems choke @ random points , exit with: [13:49:24][step 1/1] processing data remote command failed following error message: [13:49:24][step 1/1] access denied. more information, see about_remote_troubleshooting [13:49:24][step 1/1] topic. [13:49:24][step 1/1] + categoryinfo : operationstopped: (fileserver:string) [], psremotingtransportexception [13:49:24][step 1/1] + fullyqualifiederrorid : jobfailure [13:49:24][step 1/1] + pscomputername : fileserver [13:49:24][step 1/1] this error occurs after varying amounts of time, , varying amounts of data pulled down s3. there doesn't seem common denominator when dying. important fact script being executed teamcity, it's logging in tc admin on remote server. any ideas on why occurring?

javascript - How to create a chrome extension with multiple views -

i've been looking sometime , cannot find way switch between different html views in chrome extension. creating , extension user log in , want switch profile.html view once user logs in. i've tried way below opens popup window, there away loads html page current extension view? or way edit extension view through javascrip? chrome.windows.create( { tabid: newtab.id, type: "popup", url: chrome.extension.geturl('user_profile.html'), focused: true }, function(window){ // }); }); there several ways this, easiest way think of single page app. don't change views based on user action, serve content based on context. that said there 2 ways have seen done routinely: use iframes. not huge fann of one, if have existing server side rendered pages, it's easiest solution. essentially, make iframe take size need, update source of , let frame navigate need to. u

database design - What should I connect when creating a relationship between 2 tables? -

for example have 2 tables namely parent table , children table parent table parent_id name then have children table children_id name then relationship table relationship_id child_id father_id or father_name? mother_id or mother_name? if want create relationship between 2 tables indicates parents of children should link? should create field named example father_id unique id of parent or father_name direct link name of father in relationship table if want name of father? you should (and @ least in if not databases that's option anyway) use primary keys relationships. @ least 1 side of relationship needs connected table's primary key. however, example wrote, go single person table: tblperson ( person_id, -- primary key person_firstname, person_lastname, person_mother_id, -- self reference fk person_father_id -- self reference fk )