Posts

Showing posts from July, 2011

bash - determining directory and its path in focused window (linux) -

so design quite few webpages , quite annoyed time construct default head title body tags etc, , have general templates , wondering how create script in bash 1. determine directory open in focused window , 2. copy whichever template template directory have made if want blank php file basic html tags or html file basic required tags can copied on effortlessly simple shortcut can map. i know how in except determining directory of open file window(the gui not terminal) , haven't had luck googling idea, appreciated you can tty of window, , use send command. i've heard of tool called "ttyecho" though i've never used it, supposedly can used send command different pty (another window).

ios - Waypoint Optimisation - MapKit / APIs / Traveling Salesman -

many threads on topic, , found answer work - using mapquest api. but closed. http://devblog.mapquest.com/2015/05/01/looking-for-a-free-open-appkey-read-this/ i tried google maps api, many keys tried them noting worked - effort simple not using google maps. i found this, https://github.com/project-osrm/osrm-backend/wiki/server-api works great - clean , simple doesn't allow set start , end location. best route when passing in list. there this, http://www.gebweb.net/optimap/ not sure if can access api ? anyone solved issue ? maybe local sort using items long / lat position , calculate distance between points rather use api ? using this waypoints.sort { let distancea = newstart.location.distancebetween($0.location) let distanceb = newstart.location.distancebetween($1.location) return distancea < distanceb }

rest - Running Python RESTful API on Amazon EC2 -

i have working restful api written in python works in local machine. having serious trouble getting started amazon ec2. have managed create account , managed create instance , , lauch instance well. have connected instance via ssh , passed credentials. have required file (app.py) on ec2. have no idea how run it. if run ssh terminal, still local service. how make public restful api? like firewall, have open server's ports. via adding rules security group while you're configuring ec2 instance. add http rule, , allow ip addresses (0.0.0.0/0) access that. see here: http://docs.aws.amazon.com/awsec2/latest/userguide/using-network-security.html#adding-security-group-rule you can set ssh, https, , other secure ports here (but don't want accessing ssh!).

javascript - dataTables.js not resizing properly. Table overflows window still -

i using datatables.js https://datatables.net/ using responsive extension , can not table responsively resize. insight grand. the table overflows window. if expand way out columns shown, doesn't start hiding columns until 3rd column off screen i have created jsfiddle code. $(document).ready(function() { // setup - add text input each footer cell $('#table_assets tfoot th').each(function() { var title = $('#table_assets thead th').eq($(this).index()).text(); $(this).html('<input type="text" style="max-width:80px;" />'); }); // datatable var table = $('#table_assets').datatable({ responsive: true, "autowidth": false, "order": [ [13, "desc"] ], initcomplete: function() { var r = $('#table_assets tfoot tr'); r.find('th').each(function() { $(this).css('padding', 8); }); ...

java - Annotation mapping vs. XML mapping and deleting an entity -

i working migrating project pure jpa annotation based mapping xml mapping , running issue when trying delete (remove) , entity , children. works in xml mapping , not work annotation mapping. the xml mapping looks this: <set name="evaluations" order-by="evaldate desc" table="evaluation" lazy="true" inverse="true" cascade="delete"> <key column="requestid" /> <one-to-many class="org.stuff.model.evaluation" /> </set> the annotation mapping, far can tell this: @onetomany(orphanremoval=true) @joincolumn(name = "requestid") @orderby("evaldate desc") private set<evaluation> evaluations = new treeset<>(); this uni-directional relationship. the jpa code delete entity is: servicerequest sr = em.getreference(servicerequest.class, id); em.remove(sr); where above evaluation child object of servicerequest . hibernate 4.3.7 jpa impl usin...

Ruby On Rails callbacks don't work on Heroku, but work locally -

i've been working on school appplication using rails_admin. working fine locally when push heroku callbacks defined in models not used, not simple. come asking if has encountered problem before or me interpret logs because cannot find reason this. first, gemfile looks like: source 'https://rubygems.org' ruby '2.2.0' group :development, :test gem 'railroady' end # documenting models automatically gem 'annotate', '~> 2.6.6' # styling html using sass gem 'bourbon' gem 'neat' gem 'bitters' # using creating sql triggers inside models gem 'hairtrigger' # creating seed data files existing data in database gem 'seed_dump' # used translations of mailer , account confirmations gem 'devise-i18n' # user permissions , login gem 'devise' gem 'cancancan', '~> 1.10' gem "rolify" gem "figaro" gem "rails_admin" # bundle edge rails in...

c++ - Basic I2C read/write failure on Beaglebone -

i writing program access who_am_i registers on accelerometer , gyroscope via i2c on beaglebone black. here basic code.` int main(void) { char rxbuffer[40]; char txbuffer[32]; int gyroaddress = 0x20; int acceleroaddress = 0x1e; int tenbitaddress = 0; int opresult = 0; int i2cfd = open("/dev/i2c-1",o_rdwr); opresult = ioctl(i2cfd, i2c_tenbit, tenbitaddress); opresult = ioctl(i2cfd,i2c_slave, acceleroaddress); memset(rxbuffer, 0, sizeof(rxbuffer)); memset(txbuffer, 0, sizeof(txbuffer)); txbuffer[0] = 0x0d; opresult = write(i2cfd, txbuffer, 1); if (opresult !=1) printf("no ack bit!\n"); opresult = read(i2cfd, rxbuffer, 1); printf("part id: %d\n", (int)rxbuffer[0]); //for gyro opresult = ioctl(i2cfd, i2c_slave, gyroaddress); txbuffer[0] = 0x0c; opresult = write(i2cfd, txbuffer, 1); if (opresult != 1) printf("no ack bit!\n"); opresult = read(i2cfd, rxbuffer, 1); printf("part id: %d\n", (int)rxbuffer[0]); } ` part id both 0 when...

linux - Application on OSX cannot spawn more than 2048 threads -

i have rust application on on osx firing large amount of threads can seen in code below, however, after looking @ how many max threads version of osx allowed create via sysctl kern.num_taskthreads command, can see kern.num_taskthreads: 2048 explains why can't spin on 2048 threads. how go getting past hard limit? let threads = 300000; let requests = 1; _x in 0..threads { println!("{}", _x); let request_clone = request.clone(); let handle = thread::spawn(move || { _y in 0..requests { request_clone.lock().unwrap().push((request::request::new(request::request::create_request()))); } }); child_threads.push(handle); } before starting, i'd encourage read c10k problem . when scale, there's lot more things need keep in mind. that being said, i'd suggest looking @ mio ... a lightweight io library rust focus on adding little overhead possible on os abstractions. specifically, mio provides eve...

web services - cxf request scoped bean not working in unit test (soap) -

cxf soap application, using following versions: springbootversion = 1.2.3.release springversion = '4.1.6.release' cxfversion = '3.1.0' junitversion = '4.12' i have spring bean request scope: @component @scope( value=webapplicationcontext.scope_request, proxymode = scopedproxymode.target_class ) public class requestscopedclass which fetch dynamically applicationcontext in cxf endpoint implementation: @component @webservice(endpointinterface = "ch.xyz.paymentserviceinterface" ) public class paymentserviceimpl implements paymentserviceinterface { ... requestscopedclass rsc = appctxt.getbean( requestscopedclass.class ); rsc.dosomething(); my goal test frontend of soap service simulating client connects listener port etc., ensuring whole cxf stack interceptor chain (including custom interceptors) executed. managed setup configuration including org.apache.cxf:cxf-rt-transports-http-jetty dependency , starting e...

java - How to set login button go to next applet? -

how set button go next applet? code like: if (strp.matches(strp) && stru.matches(stru)) { register rg=new register(); rg.setvisible(true); this.setvisible(false); } else { joptionpane.showmessagedialog(null,"user name or password not correct."); return; } after confirming password , username, shows blank. how set applet after clicking button go next applet? please try below... if (strp.matches(strp) && stru.matches(stru)) { class applet2 = class.forname("register"); // give complete name of register class including package name applet applettoload = (applet)applet2.newinstance(); applettoload.setstub(this); setlayout( new gridlayout(1,0)); add(applettoload); applettoload.init(); applettoload.start(); } else { joptionpane.showmessagedialog(null,"user name or password not correct."); return; }

eclipse - Can't play sound in Android Native Extension -

here's how try it: try { mediaplayer mediaplayer = mediaplayer.create(context.getactivity().getbasecontext(), r.raw.mysound); mediaplayer.start(); } catch(exception e) { log.d("no sound",e.getmessage()); } (mysound.mp3 in res/raw/ folder in eclipse project) i pack sound file .ane in platform.xml this: <packagedresource> <packagename>com.myname.androidextension</packagename> <foldername>res</foldername> </packagedresource> while having mysound.mp3 file in android-arm/res/raw/mysound.mp3 when check .ane file, mp3 inside. but when run app on phone, dont hear sound, instead weird logcat line: no sound | file res/layout/main.xml drawable resource id #0x7f030002 i don't understand it. since it's native extension ment playing sounds, don't need layouts , there no main.xml in project. been googling mad, unable find use. what mean , how can make sound play? thanks! update : have marked extension proje...

python - Entry Widget is driving me nuts!: Tkinter Reddit Scraper thinks that a string entry is numbers? -

im in middle of small project, create tkinter gui outputs top ten posts user-defined subreddit reddit.com using api. because need have subreddit choice of user, needs inputted using tkinter entry widget. however, problem i'm having widget not refresh when user puts in information, , instead outputs bunch of numbers (".4302552760.4302552816.4367528344") right when program launches. can't seem thing record user puts in string variable can run through next few classes , make damn thing work. ive hit real roadblock here, , appreciate help. ill give few samples of code, whole thing, , specific problem areas: the whole code follows: import tkinter tk functools import partial webbrowser import open datetime import date import praw '''initialising applicaiton''' class redditscraper(tk.tk): def __init__(self, *args, **kwargs): tk.tk.__init__(self, *args, **kwargs) container = tk.frame(self) container.pack(side=...

postgresql - role "postgres" does not exist; cannot createuser -

i on linux mint cinnamon 2.2.16. during process of getting rails , running, having problems postgres. postgres@bl ~ $ psql --version psql (postgres-xc) 1.1 (based on postgresql) 9.2.4 i unable working under usual username, changed default user using sudo su - postgres i cannot work createuser. postgres@bl ~ $ psql psql: fatal: role "postgres" not exist postgres@bl ~ $ createuser -s -u $user createuser: not connect database postgres: fatal: role "postgres" not exist postgres@bl ~ $ sudo -u postgres createuser newname sorry, user postgres not allowed execute '/usr/bin/createuser newname' postgres on bl. postgres@bl ~ $ psql /usr/bin/psql postgres@bl ~ $ psql \l psql: fatal: role "postgres" not exist after thoroughly researching problem , tearing out more few hairs, decided variation of problem packaging/installation, similar problem noted here: unable create user postgres: role "postgres" not exists i did ...

Clearcase Remote Client add minified file (8000 chars in a line) -

i have minified files i'm trying add clearcase via remote client. apparently these files failing due large number characters in 1 line. i found solution if 1 using full client here , i'm not sure how make happen in remote client. what right process create files compressed_file ? i mention same issue in " clearcase issue while “add file source control” " , " clearcase. how split long javascript on multiple lines? ". the solution consists mkelem element type compressed_file should possible ccrc, using rcleartool , include rcleartool mkelem .

java - The state field path cannot be resolved to a valid type -

first of all, have researched question still can't figure out why isn't working me. i'm developing dynamic web application in java uses jpa store login information of users. have no trouble inserting new users or listing users table. i'm trying write login method authenticate users, in want select user given username , password. here's method in daoimpl class: public user login(string username, string password) { string sqlcommand = string.format("select u users u u.uname = '%s' , u.password = '%s'", username, password); query q = this.getentitymanager().createquery(sqlcommand); //q.setparameter("uname", username); //q.setparameter("pass", password); try{ return (user) q.getsingleresult(); } catch(exception e) { return null; } } and here's entity class: @entity(name=user.table_name) @table(name=user.table_name, schema=persistentobject.schema) public class u...

python - looping a function in a data frame -

my project: i'm creating elo rating tennis players, have 2 different data frames. (1)a dataframe of players rating (2)a dataframe of matches ordered chronologically working on database of matches retrive rating of both players , apply 2 functions (i have them defined) predicted_result(rating1, rating2), , updated_rating(rating1, rating2). first 1 gives me expected result of match given ratings, second 1 gives me updated ratings. need record updated ratings in player database. i think i'm looking loop line line: on first line of match dataframe retrives ratings from player database runs both functions replaces old rating updated rating in player database. match dataframe winner loser 0 nadal federer 1 djokovic verdasco 2 nadal djokovic 3 del potro verdasco player dataframe player rating 0 nadal 2320 1 djokovic 2280 2 verdasco 2120 3 federer 1890 4 del potro 1542 i found answe...

python - How to use foreign key to get related objects? -

i have person have many images . use this: person.image[x].image retrieve image address. how can associate using foreign key person images ? , access images using person object ? class person(models.model): user = onetoonefield(user, on_delete=models.cascade) gender = charfield(max_length=1, choices=genderchoices, blank=true, null=true) birth_date = datefield(blank=true, null=true) def __unicode__(self): return self.user.username class image(models.model): person = foreignkey(person) itype = charfield(max_length=1, choices=imagechoices) image = imagefield(upload_to=image_path, blank=true, null=true) created = datetimefield(auto_now_add=true) def __unicode__(self): return self.image.path person.image_set.all() 1 way, , if needed can filter through images of person given query, e.g. persom.image_set.filter(...) , , if want count, person.image_set.count() you can read more on how query related objects here: ...

dimensional modeling - Best practice for natural keys in a dimension that includes data from multiple source table -

i designing dimension data warehouse includes several related attributes various tables. when loading fact tables surrogate keys dimension tables based on keys from source system rather text matching on various attributes. situation 1 i'm facing preferable have several source system key columns in dimension table (one each of relevant tables) lookup on, or create single lookup column using sort of hash or concatenation? please let me know if need more info. the best practice column amounts 'source system' , 1 (or more) columns of unified type accommodate native keys of source systems (probably bit of head room future proofing). a hash or concatenation identify source should seen workaround when can't control data model. a 'source' column helps lineage. so suppose have 3 source systems varying 'product code' formats char 8 , 10 , 15 respectively. add columns: sourceid char(5) - e.g. or further surrogate look-up 'source' ta...

asp.net - Issue with Similar Rewrite Rules in Web.config -

i have rule in web.config works. <rule name="guestbook rewrite" stopprocessing="true"> <match url="(.*?)-guestbook" /> <action type="rewrite" url="guestbook.asp?gb={r:1}" /> </rule> when goes mydomain.com/view-guestbook or mydomain.com/sign-guestbook go appropriate pages. what having difficulty have several pages of guestbook entries, want able add rule when goes “view-guestbook-page-9” getting mydomain.com/guestbook.asp?gb=view&pagenum=9. had added following rule, did got 500 errors. going guess either in conflict previous rule or syntax incorrect. <rule name="guestbook view page rewrite" stopprocessing="true"> <match url="view-guestbook-page-(.*)" /> <action type="rewrite" url="guestbook.asp?gb=view&pagenum={r:1}" /> </rule> how can have both rules or single rule solve both? i got figured out. had add condit...

eclipse - Getting Latest Version for all files in a Project -

is there way latest version files in project tfs? i'm wondering if eclipse has easy one-click solution somewhere. tfs offers team foundation server plug-in eclipse, part of team explorer everywhere tools. you can download tfs plug-in eclipse https://www.microsoft.com/en-us/download/details.aspx?id=40785 after that, can right-click on project in package explorer, , select "get latest version" entire project (recursively). can multi-select several projects latest version in all projects.

sql server - VS 2013 SqlServer Project: [dbo].[MYVIEW] has an unresolved reference to object [master].[dbo].[spt_values] -

i have set correct sql server version , added master database database reference. there have been several unresolved references master database before , after adding reference of disappeared. just 1 did not resolve. select * "master".."spt_values" c does know how resolve unresolved reference? the master.dbo.spt_values view undocumented internal view , seems master.dacpac doesn't include it. view used tally number table. if case, use itzik's virtual table: virtual auxiliary table numbers and can replace spt_values view function, better in performances. hth

Akka Gotchas when dealing with Futures -

consider following code bit: def receive = { case computeresult(itemid: long) => //val originalsender = sender computeresult(itemid).map { result => originalsender ! result } } the computeresult results in future, how introduction of val prevent sending result wrong sender? let have different senders (sender1 , sender2). sender1 first sends message followed sender2. without val in method above, see there possibility sender2 result meant sender1. what don't how introduction of val prevent me scenario described? sender function (that's why convention akka 2.3 onwards write sender() ). binding value originalsender , can close on immutable value , know won't change, if message comes in before future completeresult completes. because receive function, every invocation result in new local value called originalsender .

apache - Mod_rewrite (htaccess) QSA and removing charactes from appended query string -

i've been struggling htaccess redirects. spent time reading , searching , couldn't solution works scenario. i'm in process of making 301 redirect old website (asp) new 1 (wordpress). old pages has parameters query need process remove 'http://' string redirect work. example url (old) redirect looks like: http://www.domain.org/index.asp?documentid=2410&utm_source=it+travel+reminder&utm_medium=informz%2fnetforum&utm_campaign=it%2ftravel+reminder%2fmonthly+monthly+travel+reminder&zbrandid=4050&zidtype=ch&zid=28841368&zsubscriberid=1036792259&zbdom=http://my.informz.net redirected to: http://www.domain.org/permalink-2410/?qs=true&utm_source=it+travel+reminder&utm_medium=informz%2fnetforum&utm_campaign=it%2ftravel+reminder%2fmonthly+monthly+travel+reminder&zbrandid=4050&zidtype=ch&zid=28841368&zsubscriberid=1036792259&zbdom=my.informz.net and .htaccess code redirect it: rewritecond %{query_s...

java - To implement a zookeeper system do I need to have zookeeper downloaded on every machine or just the master? -

do need download zookeeper on each system i'm trying connect or master machine? you need zookeeper running on each instance of zookeeper cluster: minimum of 3 machines if you're serious this.

c# - Office 2010 monitoring calendar events -

hey have following code in vb.net translated c# found on internet monitoring outlook calendar events (add, modify , delete). the code is: public class thisaddin private sub thisaddin(sender object, e system.eventargs) handles me.startup dim monitor new calendarmonitor(me.application.activeexplorer()) addhandler monitor.appointmentadded, addressof monitor_appointmentadded addhandler monitor.appointmentmodified, addressof monitor_appointmentmodified addhandler monitor.appointmentdeleting, addressof monitor_appointmentdeleting end sub ...etc etc... end class ======================= public class calendarmonitor private _explorer explorer private _folderpaths list(of string) private _calendarfolders list(of mapifolder) private _calendaritems list(of items) private _deleteditemsfolder mapifolder public event appointmentadded eventhandler(of eventargs(of appointmentitem)) public event appointmentmodified event...

regex - selecting words that only have specific letters in them -

i trying print words match regex provide , contain letters provided in second parameter. regex works perfectly, letter selection not. import re def search(regex,letters): letters=set(letters) pattern=re.compile(regex) word in content: word=word.strip() if(pattern.findall(word)): if letters & set(word): print(word) #search(r'^(n|u|p|g|o|u|e|b|l){6}$') #search(r'^t(i|a)[a-z]{3}') content=["hello","helps","halts","random"] search(r'^h(e|a)[a-z]{3}','hltsa') #returns: hello,helps,halts my goal return halts, because matches second parameter. import re def search(regex,letters): letters=set(letters) pattern=re.compile(regex) word in content: word=word.strip() if(pattern.findall(word)): if set(word) >= letters: print(word) #search(r'^(n|u|p|g|o|u|e|b|l){6}$') #search(r'^...

WebSocketPayloadException with Tornado and websocket python connection -

what mean when sending compressed/binary data tornado client on websocket? file "/usr/lib64/python2.7/site-packages/websocket/_abnf.py", line 380, in extract raise websocketpayloadexception("cannot decode: " + repr(frame.data)) websocket._exceptions.websocketpayloadexception: cannot decode: "x\x9c\xc5\xcd it means set binary=true option in self.write_message() call

javascript - How to change body style using angular -

i have following code , bunch of other angular code :- <body class="ftb2"> lot of code here </body> and in angular controller have var bodytemp = $document[0].body; bodytemp.removeclass("ftb2"); it gets bodytemp not remove class. chrome debugger :- bodytemp: body.ftb2 alink: "" etc.... not sure reason? ps:- angualar scope defined inside div within body , cannot change code :- <body class="ftb2"> <!-- angular boot strapped id--> <div id="xyz"> </div> </body> bootstrap code :- var root = document.getelementbyid("xyz"); angular.bootstrap(root, ["appinvest"]) its bad way of doing this, since there no option need add dom manipulation controller. angular.element($document).find('body').removeclass('ftb2') working plunkr

bootloader - 51-android.rules for Nexus 5 -

i having trouble writing android rules file nexus 5 on ubuntu 14.04. have created new rules file instructed in android developer site, still cannot detect device in boot mode. my 51-android.rules contains following: subsystem=="usb", attr{idvendor}=="1004", mode="0660", group="plugdev" when try enter adb devices in terminal, shows nothing. can me out this? in advance. adb devices shows devices in adb , recovery modes only. need use fastboot tool control android device in boot mode.

making multi-index in pandas dataframes in Python? -

i have data set there matrix of numeric values indexed time variable. each matrix numpy array (that can converted dataframe columns corresponding columns of matrix). if have these matrices how can make them single dataframe each matrix has time index? specifically: # time t1 d1 = pandas.dataframe({"a": [1,2,3,4], "b":[10,20,30,40]}) # time t2 d2 = pandas.dataframe({"a": [10,20,30,40], "b": [1,2,5,6]}) # time t3 d3 = ... i want make index called "time" index these dataframes, , aggregate values columns "a" , "b" across time index. how can in pandas? my attempt: d=pandas.dataframe([d1,d2],index=(0, 1),columns=["time"]) update : unutbu's solution adding 2 hierarchical columns is: c = pd.concat([d1, d2], keys=[('t1', 'p1'), ('t2', 'p2')], names=['time', 'position']) my final question how access resulting structure? example how do vectorized...

ios8 - GIDSignIn returns "Keychain error" -

i'm implementing sign in google plus. implementation copied examples developer google . when login first time works fine. if logout using [[gidsignin sharedinstance] signout]; next time login in error domain=com.google.gidsignin code=-2 "keychain error" please advice can done in situation. thanks i'm having same issue here. after doing tests, i've noticed if run app without debugger (build, stop, run app) works expected...try it

acumatica - Add ImageSet and Images for pages/grids -

in acumatica 5.1 possible add new imagesets , images buttons? for example, in custom application i'm working on i'd create new image few of buttons show above grids. the documentation/information references imagesets , imageid's w/in set there isn't reference on how create new ones (if possible) thank you i propose try following within declaration of button: public pxaction<pmtask> syncpmtaskwithjira; [pxbutton(commitchanges = true, imageurl = "http://i.stack.imgur.com/uicp0.jpg?s=64&g=1", disabledimageurl = "https://www.gravatar.com/avatar/1d02905a73147ffff3eb0e953a609abd?s=328&d=identicon&r=pg", hoverimageurl = "http://i.stack.imgur.com/uicp0.jpg?s=64&g=1")] [pxuifield(displayname = "sync jira")] protected void syncpmtaskwithjira() {}

php - Get selected value from dropdown menu, from an array? -

i feel missing here. did manual customizations on short (wordpress) script , try set <select><option> "selected" if has been selected. in order accomplish this, tried find out if $term->id = similar selected option value (which id well). far, cannot seem submitted <select><option> . says 'array'. below script. see doing wrong here? clear, seems $_get["listing_cat"] here. when try print $_get["listing_cat"] within foreach outputs 'array'. <form method="get" action="<?php echo trailingslashit( home_url() ); ?>" class="custsearch"> <select name="listing_cat[]"> <option value="1" disabled="disabled" <?php if(!count($_get)>0 || !$_get["listing_cat"] ){ echo 'selected="selected"';} ?>>pls choose</option> <?php $cat_args = array( 'orderby' ...

javascript - jQuery droppable not working on absolute positioning -

i have div divided 6 grids. grids using absolute positioning placement. for reason jquery droppable not working on absolute divs. can tell me whats wrong code? i created jsfiddle here show current code. this jquery part. $(".ui-draggable").draggable({ helper: 'clone', cursor: 'move', tolerance: 'fit', stack: '.ui-draggable', revert: "invalid" }); $(".ui-droppable").droppable({ accept: ".ui-draggable" }); it seems working fine, try this $(".ui-draggable").draggable({ helper: 'clone', cursor: 'move', tolerance: 'fit', stack: '.ui-draggable', revert: "invalid" }); $(".ui-droppable").droppable({ accept: ".ui-draggable", drop: function( event, ui ) { alert('dropped'); } }); you'll see drop event fires correctly a...

php - image cropping tool without javascript -

i have built image upload ability crop image center php. works should. now, want provide user " dragabble div " can place onto image crop selected part. i know there lot of javascript packages containing such functions, want try without js. any thoughts welcome.

oracle11g - How do I create a new Connection in Oracle SQL Developer? -

i've installed oracle database 11g release 2 on windows 7. i'm in oracle sql developer , i'm trying create new connection, when click in "connect" , got message: "status: failure -test failed: network adapter not establish connection" . in connection window, i've tried changing role sysdba, os authentication, port, , sid, when changing values got same message. tnsnames.ora contents: # tnsnames.ora network configuration file: f:\oracle\product\11.2.0\dbhome_1\network\admin\tnsnames.ora # generated oracle configuration tools. oraclr_connection_data = (description = (address_list = (address = (protocol = ipc)(key = extproc1521)) ) (connect_data = (sid = clrextproc) (presentation = ro) ) ) orcl = (description = (address = (protocol = tcp)(host = 192.168.0.104)(port = 1521)) (connect_data = (server = dedicated) (service_name = orcl.168.0.104) ) ) listener.ora: # listener....

operators - What does ,= mean in python? -

i wonder ,= or , = means in python? example matplotlib: plot1, = ax01.plot(t,yp1,'b-') it's form of tuple unpacking. parentheses: (plot1,) = ax01.plot(t,yp1,'b-') ax01.plot() returns tuple containing 1 element, , element assigned plot1 . without comma (and possibly parentheses), plot1 have been assigned whole tuple. observe difference between a , b in following example: >>> def foo(): ... return (1,) ... >>> (a,) = foo() >>> b = foo() >>> 1 >>> b (1,) you can omit parentheses both in (a,) , (1,) , left them sake of clarity.

multithreading - Writing Errors in Multiprocessing Python -

i trying write files after editing using multiprocessing code python (2.7). works charm small number(<20). when try more files (20+), goes berserk. using python 2.7.5 on centos 6.5 4 core processor. import sys, os import multiprocessing import glob list_files = glob.glob("protein/*.txt") def some_func(some_file): open(some_file) some: open(file_output) output: lines in some: #do #edited_lines = func(lines) output.write(edited_lines) pool = multiprocessing.pool(10) # desired number of threads = 10 pool.map(some_func, list_files,) pool.close() pool.join() the final written files overlap each other. file 1 lines 1 .. file 1 lines 2 .. file 1 lines 3 .. file 1 lines 4 .. file 1 lines 5 .. file 1 lines 6 .. file 1 lines 7 .. file 1 lines 8 .. file 1 lines 9 .. file 1 file 2 lines 1 .. file 2 lines 2 .. file 2 lines 3 .. file 2 lines 4 .. file 2 lines 5 .. file 2 lines 6 .. file 2 lines 7 ....

cakephp 3 multi level associated save -

i have users model has hasone relationship employees model. when save user add record in employees table user_id. works fine. the employee can associated belongstomany courses through coursesemployees table. saves ok when save employees. my problem want save 3 three courses not saved. save user -> save employee new user_id -> save courses chosen new employee employee_id in courses_employees employeestable.php public function initialize(array $config) { $this->table('employees'); $this->displayfield('name'); $this->primarykey('id'); $this->addbehavior('timestamp'); $this->belongsto('users', [ 'foreignkey' => 'user_id', ]); $this->belongsto('hotels', [ 'foreignkey' => 'hotel_id', 'jointype' => 'inner' ]); $this->belongstomany('courses', [ 'foreignkey' => ...

java - why am i unable to play audio file -

hey there using command processbuilder pb = new processbuilder("c:\\programfiles\\videolan\\vlc\\vlc.exe", videopath); process start = pb.start(); it can play video unable play audio file. file can played on vlc externaly. all had play them on windows media player instead of vlc

c++ - How to store a variable in a header, to use in the main cpp? -

i tried asking question, bit more fuzzy on details, arrived home , hope can explain myself better. say, have class, in case, testclass , declared constructor , methods in testclass.h already. now, want create new array of these elements, , store them somewhere, load in main.cpp , when want to. what tried doing, is, doing in new header, called contents table.h . here, tried making array of these testclass elements. however, don't know, how go doing this. testclass.h #pragma once #include <string.h> #include <iostream> using namespace std; class testclass { private: string name; string description; public: testclass() { name = ""; description = ""; } testclass(string name, string description) { this->name = name; this->description = description; } ~testclass() { } }; and here contents table, want store data, manually write in, had 2 ideas doing this, n...

apache kafka - Storm UI improper values and Capillary tool -

Image
i quiet new apache storm , have been trying trident topology kafka i.e. transactionaltridentkafkaspout . works fine except storm ui. though i've not produced data topic, storm ui keeps showing invalid emitted/transferred values. meaning count keeps on increasing when there no data in topic. i've tried deleting data/logs stored in zookeeper, storm, kafka , recreate kafka topics , have set topology.stats.sample.rate: 1.0 but still problem persists. and came across tool called capillary to monitor storm cluster. using below properties capillary.zookeepers="192.168.125.20:2181" capillary.kafka.zkroot="192.168.125.20:/home/storm/kafka_2.11-0.8.2.0" capillary.storm.zkroot="192.168.125.20:/home/storm/apache-storm-0.9.3" i using kafka's embedded zookeeper here. not working getting below exception. ! @6mbg4bp7l - internal server error, (get) [/] -> play.api.application$$anon$1: execution exception[[jsonparseexception: unexpected cha...

javascript - $.get keeps leading to [object%20Object] -

i working quickbase database , trying pull json data via api, reason every time try get in console "400 (bad request) [object%20object]" <!-- load handlerbars.js --> <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.rc.1/handlebars.min.js"></script> <!-- load jquery cdn easy dom manipulations --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/themes/smoothness/jquery-ui.css" /> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script> <!-- simple handlebars template blog post, inside {{variable}} variables can afect js objects--> <script id="simple-template" type="text/x-handlebars-template"> <h1>{{title}}</h1...