Posts

Showing posts from August, 2012

r - Separate sizes for points and lines in geom_pointrange from ggplot -

Image
using ggplot 's geom_pointrange() function, how change size of point , thickness of line separately? example: # make test data df <- data.frame(y=10, ymin=1, ymax=20, x=1) # store ggplot object p <- ggplot(data=df, aes(y=y, ymin=ymin, ymax=ymax, x=x)) # plot 1: big dot , thick line p + geom_pointrange(fill='blue', color='grey', shape=21, size=5) # plot 2: small dot , thin line (i want small dot , thick line or vice versa) p + geom_pointrange(fill='blue', color='grey', shape=21, lwd=1, size=5) plot 1: plot 2: can small dot thick line (or vice-versa)? a workaround might plot line , point separate geoms using geom_point , geom_errorbar . unfortunately, real application involves jittering, point , interval end in different places (unless maybe can control jittering?). i can find similar questions on ( like this ), don't directly answer one. thanks! you can use fatten in combination size : p + geom_point

matlab - Needed Help regarding vehicel number plate detection? -

i trying add number taken in fid = fopen('noplate.txt', 'wt'); % portion of code writes number plate fprintf(fid,'%s\n',noplate); % text file, if executed notepad file fclose(fid); % name noplate.txt open number plate written. winopen('noplate.txt') but getting error error using fprintf invalid file identifier. use fopen generate valid file identifier. error in numberplateextraction (line 52) fprintf(fid,'%s\n',noplate); % text file, if executed notepad file can body me out???

r - Rolling regression with dplyr and lsfit -

i'm trying run rolling regression dplyr . i'm using rollapplyr package zoo , lsfit i'm interested in beta of regression. here's i've tried: library(dplyr); library(zoo) df1 = expand.grid(site = seq(10), year = 2000:2004, day = 1:50) df1 %>% group_by(year) %>% mutate(beta1 = rollapplyr(data = site, width = 5, fun = lsfit, x=day)) i'm getting error: error: not arguments have same length i think rollapplyr accepts non-zoo objects may wrong. piping ( %>% ) not play rollapplyr requires data object in function. any idea? edit question different from: rolling regression dplyr want use pipes in order use group_by the function not cycle through multiple vectors. sliced site vector being compared full vector day . can write our own rolling apply function map go through groups of our vector: rollapplydf &l

sql server - How to execute part of the code only once while running multiple instances in T-SQL -

i have stored procedure called business code. code uses parallelism, multiple instances of sp running @ same time depending on conditions. there logic in sp want execute once. have table (let's call history) holds uid run , datetime when portion of code executed. here's flow: sp begin -- logic if conditions met, check if history not have entry uid 1. add entry in history current uid 2. run once code sp end the issue that, @ times, logic above still gets executed multiple times if different instances reach part @ same time. can ensure runs once? thank you! begin transaction; insert [history](uid, ...) select @uid, ... not exists ( select * [history] (holdlock) uid = @uid ); if @@rowcount = 1 begin; -- inserted, logic should run once end; commit; holdlock (equivalent running transaction under serializable , more granular) ensures no other transaction running in parallel can insert entry in history uid; tr

MongoDB C# Why can't you use DateTime.Date with IQueryable? -

i have method set in mongodb dal class. public iqueryable<mymodel> retrieve(expression<func<mymodel, bool>> expression) { if (!bsonclassmap.isclassmapregistered(typeof(mymodel))) { domapping(); } var client = new mongoclient(mongoconnectionstring); var database = client.getdatabase("databasename"); var documents = database.getcollection<mymodel>("mymodeltable"); return documents.asqueryable<mymodel>().where(expression); } i want simple var result = retrieve(a => a.somedateproperty.date >= startdate && a.somedateproperty.date <= enddate); however, every time try, error stating: an exception of type 'system.invalidoperationexception' occurred in mongodb.driver.dll not handled in user code additional information: {document}{somedateproperty}.date not supported. i using official c# driver version 2.2.4.26.

html - adjust margin in just 1 div -

this question has answer here: margin on child element moves parent element 13 answers well, i've problem, want adjust margin on "c2" when set x, changes "c1" div margin :s here's code i'm using: <header> <div class="jumbotron"> <center><h1>bienvenidos jvasconcelos.me</h1></center> </div> </header> <div class="container"> <div class="row"> <div class="col-md-12 col-centered"> <div class="c1"> <div class="c2"> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit. quis inventore illum quaerat laboriosam eos, vel sed suscipit cumque laborum est animi aliquid tempora iusto beatae quam quisquam porro dolore! ullam

Excel VBA user-form update button -

Image
update button works if there value in cells beside target cell can not find problem in code. private sub commandbutton3_click() dim irow long, _ ws worksheet, _ nextrow long, _ cf range set ws = worksheets("stock") ws .range("a:a") set cf = .find(what:=me.combobox2.value, _ after:=.cells(1, 1), _ lookin:=xlvalues, _ lookat:=xlwhole, _ searchorder:=xlbyrows, _ searchdirection:=xlnext, _ matchcase:=false, _ searchformat:=false) end if not cf nothing if cf.offset(0, 1) <> vbnullstring set cf = cf.end(xltoright).offset(0, 25) cf.value = me.textbox2.value + .cells(cf.row, "aa").value end if else .cells(cf.row, "aa").value = me.textbox2.value + .cells(cf.row, "aa").value end if end end sub if target cell aa2 there should value in z2 or b2 otherwise nothing happens.

php - Proper character encoding to display "&acirc;&#128;&#157;"? -

i'm having nasty character encoding problems can't figure out. essentially, i'm screen scraping html off of site using php, running through php's domdocument change out url's, etc., , when it's done, outputs html weird things. ex: there should end quote, puts out &acirc;&#128;&#157; i have page's meta tag charset set utf-8 &acirc;&#128;&#157; characters showing †on site. i'm not sure if don't understand character encoding, or what. any suggestions on best way resolve this? client side meta tag, or kind of server-side php conversion? sometimes setting charset in html or response header isn't enough. if isn't setup utf-8 on server, text may incorrectly converted somewhere along way. may need enable utf-8 encoding both apache , php right in config files. (if you're not using apache, try skipping step.) apache utf-8 setup: edit either charset.conf (ideal), or httpd.conf file, adding line e

ruby on rails - Impossible to delete a flash -

i made mistake before migrating plugin, , have written flash[:notice] = :label_presta_added instead of flash[:notice] = l(:label_presta_added) i corrected mistake seems redmine plugin has trashed redmine. though delete plugin migrate once again, still error: started "/" 127.0.0.1 @ 2016-06-01 22:21:37 +0200 processing welcomecontroller#index html current user: admin (id=1) rendered welcome/index.html.erb within layouts/base (28.1ms) completed 500 internal server error in 366ms (activerecord: 116.0ms) actionview::template::error (undefined method `html_safe' :label_presta_added:symbol did mean? html_safe?): 97: <div id="sidebar"> 98: <%= yield :sidebar %> 99: <%= view_layouts_base_sidebar_hook_response %> 100: </div> 101: 102: <div id="content"> 103: <%= render_flash_messages %> app/helpers/application_helper.rb:312:in `block

regex - Match only first occurrence of digit -

after few hours of disappointed searching can't figure out. i piping grep input, want first occurrence of digit. example: nmcli --version nmcli tool, version 1.1.93 pipe grep regex nmcli --version |grep -o '[[:digit:]]' output: 1 1 9 3 what want: 1 yeah there way pipe, there "pure" single regex that? with gnu grep: nmcli --version | grep -po ' \k[[:digit:]]' output: 1 see: support of \k in regex

ruby - Overriding a method from a gem with a condition in Rails 4 -

i using gritter gem displaying simple notifications in rails app. in controllers use gflash method later adds notification in view so: gflash notification: "welcome awesome website!" now problem making different views mobile, , need override this method located in gflash module . want looks this: if browser mobile browser else use original gflash method in gritter::gflash end so added initializer in config/initializers/custom_gritter.rb: gritter::gflash.module_eval def gflash *args @@mobile_notifications == [] ? @@mobile_notifications.push(args[0][:notice]) : @@mobile_notifications = [args[0][:notice]] end def self.mobile_notifications @@mobile_notifications ||= [] end def self.reset_mobile_notifications @@mobile_notifications = nil end end this allows me have access user notifications in controllers or views , works fine: gritter::gflash.mobile_notifications but still have make sure overrides if us

java - Where to put text properties? -

Image
i'm trying localization java web application , getting error. using maven dependencies , using google app engine (jetty web server). application using spring framework. here have far: project structure: messages_en_us.properties label.firstname=first name label.lastname=last name index.jsp <%@page contenttype="text/html" pageencoding="utf-8"%> <%@taglib prefix="t" tagdir="/web-inf/tags"%> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> <t:genericpage> <jsp:attribute name="title"> welcome </jsp:attribute> <jsp:body> <script type="text/javascript" src="../static/js/index.js"></script> <div class="flex_container_column"> <spring:message code="label.firstname" /> <br> <spring:message code="l

Creating a Stopwatch progam for Python 3.3 only in IDLE -

i have assignment need create stopwatch, idle. here's have far, i'm not sure how convert times normal time. import time start = 0 def stopwatch(): while true: command = input("type: start, stop, reset, or quit: \n") if (command == "quit"): break elif (command == "start"): start = time.time() print(start) stopwatch2() elif (command == "stop"): stopwatch() elif (command == "reset'"): stopwatch() else : break def stopwatch2(): while true: command = input("type: stop, reset, or quit: \n") if (command == "quit"): break elif (command == "stop"): total = time.time() - start print(total) stopwatch() elif (command == "reset'"): stopwatch() else

hive - Hadoop - Create external table from multiple directories in HDFS -

i have external table reads data hdfs location (/user/hive/warehouse/tablex) files , created external table in hive. now, let's assume there's pre-partitioning of data , previous files spitted in several directories specific name convention < dir_name >_< incnumber > e.g. /user/hive/warehouse/split/ ./dir_1/files... ./dir_2/files... ./dir_n/files... how can create external table keeps track of files in split folder? do need create external table partitioned on each sub-folder (dir_x)? also that, needed kind of hive or shell script can create/add partition each sub-directory? you have create external table partitioned dir_x access files in multiple folders. create external table sample_table( col1 string, col2 string, col3 string, col4 string) partitioned (dir string) row format delimited fields terminated '\t' stored text

html - Custom rounded shape image using CSS -

Image
i want custom-shape image shown here: #oval-shape { width: 200px; height: 100px; background: blue; -moz-border-radius: 100px / 50px; -webkit-border-radius: 100px / 50px; border-radius: 100px / 50px; } <img id="oval-shape" src="http://d152j5tfobgaot.cloudfront.net/wp-content/uploads/2014/04/internship_yourstory.jpg"> demo any thoughts if possible? there 1 way can "fake" shape border : body { background: purple; } #oval-shape { display:block; margin: 20px auto; width: 200px; height: 200px; background: none; border-radius: 100%; box-sizing: border-box; border-bottom: 50px solid transparent; } <img src="http://d152j5tfobgaot.cloudfront.net/wp-content/uploads/2014/04/internship_yourstory.jpg" id="oval-shape">

javascript - What does it mean when there is an unnamed object with function inside? -

reading javascript files , couldn't understand piece of code. object function in it. how understand it? { // static methods function getcurrent() { return obj[k].instance } } this not object. block statement used grouping statements. in case groups static methods.

angularjs - Angular: how to post a file to the server on form submit -

i have form that's being posted back-end (kotlin, spring web). form had text inputs , post worked flawlessly. when added file input, post stopped working, returning following error: {status: 400, error: "bad request",…} error: "bad request" exception: "org.springframework.http.converter.httpmessagenotreadableexception" message: "could not read document: no suitable constructor found type [simple type, class com.test.insertconfigcommand]: can not instantiate json object (missing default constructor or creator, or perhaps need add/enable type information?)↵ @ [source: java.io.pushbackinputstream@2cb43211; line: 1, column: 2]; nested exception com.fasterxml.jackson.databind.jsonmappingexception: no suitable constructor found type [simple type, class com.test.insertconfigcommand]: can not instantiate json object (missing default constructor or creator, or perhaps need add/enable type information?)↵ @ [source: java.io.pushbackinputstream@2cb43211

java - How to create an SSLEngine with all the same public keys/certs from chrome, firefox or any browser? -

is there anyway create sslengine using certs installed chrome? remember default has quite few authority public certs installed. i think, since chrome works websites know of, bit more exhaustive , it's easier install chrome , rely on that. thanks, dean from gather each browser uses it's own certificate storage. there 3 solutions: 1 static, 1 dynamic , 1 "good enough". here go: static solution - read documentation, find out how read certificates (or whole chains) browsers' storage, export them hand , import them java's cacerts storage or custom one. dynamic solution - same thing above, during application startup. lazy good-enough solution - nothing , hope certificates in cacerts jks identical in browser, chrome, firefox, opera or ie. but note following: https://bugzilla.mozilla.org/show_bug.cgi?id=1265113 seems on windows chrome reads certificates windows' certificates store, in reality application should read system certificate st

php - Why does renameing .htaccess file allow for drupal 7 install on remote server? -

i'm installing drupal 7 on remote server. after running tar -xvzf on install file , moving files folder under public_html folder enter site url in browser. result 500 server error. if rename .htaccess file hide.htaccess.hide install process begin. i've experimented w/ line: rewritebase /drupal with various paths/folders make sense still 500 error. questions: what .htaccess file doing prevent install? what issues if of doing rename? by default apache allow override limited settings throught .htaccess file, .htaccess file provided drupal overrides more items allowed need enable allow override setting in vhost config file like... allowoverride accessfilename .htaccess please refer following links more details how set allowoverride all https://www.drupal.org/getting-started/clean-urls

wcf - Pass Windows credential as PSCredential in Powershell script using C# -

i have wcf service executes remote powershell scripts , returns results client. when wcf hosted on iis following error @ invoke line. using (var powershell = powershell.create()) { var command = new pscommand(); command.addcommand("new-pssession"); command.addparameter("configurationname", "microsoft.exchange"); command.addparameter("connectionuri", connectto); command.addparameter("authentication", "kerberos"); powershell.commands = command; powershell.runspace = runspace; var result = powershell.invoke();//error pssessionconnection = result[0]; } processing data remote server #exchangeservername# failed following error message: [authzrequestid=ac0dedbe-a345-4eac-bb8d-cd5b8eab327c][failurecategory=authz-cmdletaccessdeniedexception] user #machinename#

sms - How do I format a US short code number for Twilio? -

i don't have access short code yet in account. i'm wondering whether short code should given in from parameter e.g. 222333 or whether should prepend +1 in +1222333 . i'm not sure whether e.164 applies short codes . twilio support says no +1 necessary.

android - Dexguard crashing after library added with native code -

after adding library project contains native code (embedded .so ), app build started crash when running dexguard<flavor><buildtype> task. error says: caused by: java.io.ioexception: can't read [/home/user/project/app/build/intermediates/transforms/mergejnilibs/flavor/buildtype/folders/2000/1f/main(;;;;;;lib/*/*.so,lib/*/gdb*)] (can't write resource [lib/x86/filecointainedonlibrary.so] (new string section exceeds length of original: 243 > 242)) that might happen when dexguard obfuscates native methods. the latest version 7.1.29 should fix issue, please give try. edit: troubleshooting section of dexguard manual describes work-arounds when happens. keep names of native methods.

c++ - How do I find out what physical drive a file is on? -

i find out physical media file on (either filename or handle). i've read here can determine physical drive of given partition handle deviceiocontrol call. but how partition handle filename? (because ntfs allows mount partitions in folders, can't go drive letter.) the reason i'm asking copying file physical drive fastest when using asynchronous methods, on same drive fastest when done synchronously larger buffer. want write function determine optimum copying algorithm given file , destination. volumes in windows mapped drive letters (except on network shares). you can create volume file device handle on source , destination using createfile() passing in drive letter path (ie: \\.\c:\). use returned handle deviceiocontrol() . compare physical drives between source , destination, , should good. discussion explained here: "to obtain physical drive identifier volume, open ..." http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%

python - Apache: Errno 13 file permission denied -

i use aws ec2 run application "neural network in art". send images deploy website based on flask + virtualenv + apache. after sending image on server starts script, print each iteration , want store in out.txt __init__.py: #... def apply_style(image_name, style_name, iterations): command = ['"python ~/neural_artistic_style/neural_artistic_style.py', \ ' --subject ', '/var/www/superapp/superapp/uploads/' + image_name, \ ' --style ', '/var/www/superapp/superapp/uploads/' + style_name, \ ' --iterations ', iterations, \ ' --network ~/neural_artistic_style/imagenet-vgg-verydeep-19.mat"'] str = ''.join(command) network = popen(str, shell=true, stdout=pipe) stats = [] out in network.stdout: stats.append(out) line = ' '.join(stats) return line @app.route('/upload', methods=['get', 'post']

binary operator '==' cannot be applied to operands of type 'String!' and '[String]' in Swift 2 Xcode 7 -

i have developed following code , it's working fine: if metadataobj.type == avmetadataobjecttypeqrcode { //the code... } now, metadataobj.type equal array of string following: let barcodetypes = [avmetadataobjecttypeqrcode, avmetadataobjecttypeazteccode ] if metadataobj.type == barcodetypes { //the code... } i following error when use new code: binary operator '==' cannot applied operands of type 'string!' , '[string]' any suggestions? in advance you can't compare string , array of strings, can use contains : if barcodetypes.contains(metadataobj.type)

Instagram API throwing OAuthAccessTokenException 400 error using client id -

i using following api latest 3 posts public accounts show on website: https://api.instagram.com/v1/users/{user-id}/media/recent/?client_id={client-id}&count=3 i had created app client-id. today, api has started throwing following exception: { meta: { error_type: "oauthaccesstokenexception", code: 400, error_message: "the access_token provided invalid." } } could please let me know how resolve this? based on date, have older app got hit api migration today, mine. in short, instagram decided make developing platform way more annoying requiring api requests authenticated per user, data users shares publicly. (like me) redesigning app entirely. to tell, log in instagram.com/developer , click manage clients; hit edit next set of keys your're trying use. near top, have section called ' client status ' -- if yours reads ' sandbox mode ', fun times ahead! interact less 10 users , can stay i

Best practices for Android databases -

my android application needs local database. best manner this? class sub use, subclass, reimplement, etc. have found information on net still don't know best practices. it's pretty broad question , depends little on level on experience , usage. but common practice create own contentprovider abstract access database. way can use uri execute select/update/delete/insert queries. for sqlite database itself, use sqliteopenhelper abstract creation , upgrading of sqlite database. allow upgrade database without user losing of data in easy manner. i can attach piece of code used in 1 of older projects started. implementing whole thing may out of scope of single question/answer. public class myserviceprovider extends contentprovider { private sqlitedatabase db; @override public boolean oncreate() { // initialize database , assign private variable mydatabasehelper sqlhelper = new mydatabasehelper(getcontext()); db = sqlhelper.ge

java - ATG: Update Order Pattern -

it has been known must use following pattern in order update order in atg form-handlers doesn't inherit purchaseprocessformhanlder : boolean acquirelock = false; clientlockmanager lockmanager = getlocallockmanager(); try { acquirelock = !lockmanager.haswritelock(profile.getrepositoryid(), thread.currentthread()); if (acquirelock) { lockmanager.acquirewritelock(profile.getrepositoryid(), thread.currentthread()); } boolean shouldrollback = false; transactiondemarcation transactiondemarcation = new transactiondemarcation(); transactionmanager transactionmanager = gettransactionmanager(); transactiondemarcation.begin(transactionmanager, transactiondemarcation.required); try { synchronized (getorder()) { ... ... ... } } catch (final exception ex) { shouldrollback = true; vlogerror(ce, "there has been exception during processing of order: {0}", getorder().

c++ - Qt. Making a QGraphicsItem follow cursor at all times -

i wish make custom graphics item follow cursor without needing clicked on. view has setmousetracking(true) , graphics item has setflag(itemismovable, true); setaccepthoverevents(true); , doesn't track cursor, have click , drag it. proper way make qgraphicsitem follow cursor? you can capture mouse event on item if cursor pass above it. example, instead of clicking on item, can react on mousemove events. but seem want more global behaviour. track mousemoveevent directly on qgraphicsview (or on qgraphicsscene if have multiple views) (see mousemoveevent ). after that, keep reference on item , make move each time intercept event

python - How to use file as a Queue -

i need use file queue don't know how start (also other aproach welcome), because have non-secure transmission between device , computer, , need data saved until sent , recieved. data list holds same type , amount of elements. imagine file structure: file data 0 <- send_pointer data 1 data 2 data 3 <- new_item so code like: while true: data = data_gather() file.write(data, new_item) new_item += 1 x = file.read(send_pointer) if send_function(x): file.delete(send_pointer) send_pointer += 1 else: print('error sending x') i hope understand issue, english not best. edit installed module: https://pypi.python.org/pypi/pqueue/0.1.1 but don't know how use well. can't find way delete data have read file. thanks! edit 2 solved pqueue. #!/usr/bin/python import time offset = 0 while true: infile=open("./log.txt") infile.seek(offset) line in infile: print l

android - How to intercept third party library gcm -

my app implements gcm. using third party library implements gcm. when message comes library, there way intercept (without damaging app)? one idea considering create broadcastreceiver somehow knows when gcm comes library , receives way (i don't care if library gets notified well; want too). btw right library not receiving gcm @ because have gcm. but, again, in case want app able library's gcm regardless whether library gets too about gcm connection server , in implementing gcm server you'll need decide gcm connection server protocol(s) want use enable app server interact gcm connection servers. note if want use upstream messaging client applications, must use xmpp. it mentioned 1 of 2 components in server side of google cloud messaging that: an application server must implement in environment. application server sends data client app via chosen gcm connection server , using appropriate xmpp or http protocol. additionaly, regarding intercepting gcm

python - Counting number of occurrences in Foreign Key relationships -

i have following models set up: class team(models.model): # stuff class alliance(models.model): # alliance made of 3 teams teams = models.manytomanyfield(team) class match(models.model): # 2 alliances per match alliances = models.manytomanyfield(alliance) # 1 winner per match winner = models.foreignkey(alliance, related_name='winner') i trying find teams , alliances have wins. have gotten alliances work through this: from collections import counter def most_alliance_wins(): matches = match.objects.all() count = counter() m in matches: count[m.winner] += 1 # remove ties del count[none] return count.most_common(5) however, teams wins method won't work, saying can't access manager model, i'm not sure in code i'm trying access manager, i'm bit lost. from collections import counter def most_team_wins(): matches = match.objects.all() count = counter() m in matches: team

add fields to polymorphic devise user rails 4 -

i have rails app, using devise users. have 2 types of users share fields , have own. made polymorphic models 2 types. when added fields base devise user, form adding new user doesn't seem recognizing new fields. devise user class user < activerecord::base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable belongs_to :meta, polymorphic: true end polymorphic artist model class artist < activerecord::base has_one :user, as: :meta, dependent: :destroy has_and_belongs_to_many :artist_expertises accepts_nested_attributes_for :user has_many :connections has_many :teachers, through: :connections end overwriting devise registrations class registrationscontroller < devise::registrationscontroller private def sign_up_params params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation) end def account_update_params p

New to Python 3.4+ Scripting and writing JSON text files and saving them -

i'm trying write script in python can manipulate json ".txt" files within folder , saving new json ".txt" file within same folder. know how manipulate file, i'd need manually type in actual path. there way type in folder name , name of text file manipulate instead of typing full path? because right now, i'm having do import json simple_path = input('please input path directory: ") >>> 'c:\user\path1\path2\simple.txt' open (simple_path,'r+') f: simple_data = json.load(f) somefunction() f.seek(0) out_file = open('c://user//path1//path2//simple_edit.txt','w') json.dump(simple_data, out_file) each time want manipulate specific json text files, i'd have change whole path, , i'd have edit "out_file" manually every single time, can make more flexible? since i'll placing script main folder sub-folders , json files. it'

Eclipse navigator opened file in other sub-window -

Image
i messed eclipse's navigator configuration. in default settings when open/double click file in navigator, open in window in picture 1. , now, altered (undesired) behavior makes eclipse open new tab in same window, hiding navigator tab (picture 2). i'd revert default behavior in picture 1. how do this? i'm using mars.2 release (4.5.2) it seems using top menu window > prespective > reset perspective works.

java - Test OpenGL ES matrix operations in console application Mac OS X -

a console application test matrix operations not working because netbeans cannot find android.opengl.matrix.* import. there way can access methods setidentitym or rotatem ? found it. copied /users/[username]/library/android/sdk/sources/android-21/android/opengl/matrix.java local package called android.opengl. better suggestions welcome.

jquery - Cropping pictures with jcrop -

i want exact same thing page: http://deepliquid.com/projects/jcrop/demos/crop.php however, didn't find code anywhere! idea how can it? there other method jcrop? thanks! really not question stackoverflow, check page provide , see: the manual: http://deepliquid.com/content/jcrop_manual.html the server side guide: http://deepliquid.com/content/jcrop_implementation_theory.html in first link in section further reading can find more useful documentation.

c++ - Ceres solver developer documantion -

i trying use ceres solver project. need modification on ceres code (change way solves linear systems). searched as 'developer' documentation, find api. don't want api, because don't want use ceres is. need documentation internal structure. has tip me, or knows can find it? sorry if seems naive. work on code without documentation hard. you better off asking specific questions on ceres solver mailinglist.

libGDX Framebuffer Alpha Issues -

Image
i'm having issues libgdx framebuffer , alpha. below 2 images of expected result , actual result. can please tell me doing wrong , how can correct it. here code: framebuffer buffer; sprite sprite; spritebatch batch; texture texture1; texture texture2; texture texture3; sprite texture2sprite; @override public void create () { batch = new spritebatch(); texture1 = new texture("1.png"); texture2 = new texture("2.png"); texture3 = new texture("3.png"); texture2sprite = new sprite(texture2); texture2sprite.setalpha(0.5f); texture2sprite.setposition(100, 100); buffer = new framebuffer(pixmap.format.rgba8888, gdx.graphics.getwidth(), gdx.graphics.getheight(), false); sprite = new sprite(buffer.getcolorbuffertexture()); sprite.flip(false, true); } public void createfbo() { buffer.begin(); gdx.gl.glclearcolor(0f, 0f, 0f, 0f); gdx.gl.glclear(gl20.gl_color_buffer_bit); batch.begin(); batch.d

javascript - Count number of elements in $resource.query() object -

i'm trying count number of elements returned $resouce.query() object, can increment , use id next object saved. following service communicate server: eventsapp.factory('eventdata', function($resource) { var resource = $resource('/data/event/:id', {id: '@id'}); return { getevent: function(eventid) { return resource.get({id: eventid}); }, saveevent: function(event) { var count = 0; resource.query(function(data) { count = data.length; // accessible here! }); event.id = count; // not accessible here! return resource.save(event); }, getallevents: function() { var count = 0; var lol = resource.query(function(data) { count = data.length; }); console.log(count); return resource.query(); } } }); however, mentioned in comments, i'

java - how can i draw an image pixel by pixel to jframe -

i'm beginner @ java, until day tried thought myself. day here; i've got pixels of image array rgb. want click button , make animated-like image has created pixel pixel. this did not works; import java.awt.borderlayout; import java.awt.flowlayout; import java.awt.graphics; import java.awt.graphics2d; import java.awt.event.mouseadapter; import java.awt.event.mouseevent; import java.awt.image.bufferedimage; import java.io.file; import java.io.ioexception; import javax.imageio.imageio; import javax.swing.imageicon; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.border.border; import javax.swing.border.titledborder; public class pixell extends jframe { int x = 0; int y = 0; jbutton btn; jbutton btn2; jbutton btn3; jlabel lbl1; file file = new file("c:\\users\\gok\\desktop\\df.jpg"); bufferedimage image = imageio.read(file); int w = image.getwi

sql - change yy/mm/dd to dd/mm/yy -

i've got bunch of records containing dates in database have been entered dd/mm/yy. interpreted program i'm using (sequel pro) yyyy/mm/dd. for example, if entered record august 18th 2013 as: 18-08-13, record instead come 2018-08-13. i have many records. there way change these either format show correct date?

javascript - How to add quotation marks in a string? -

hi have array using code below var selectedvalues=new array(); selectedvalues=divisi.split(","); and result is itd, ito, keuangan, sumber daya manusia but want have result "itd", "ito", "keuangan", "sumber daya manusia" do know how make that? thankyou the split return array of strings itself, if question. http://php.net/manual/en/function.split.php edit: adding more detailed answer: <?php $divisi = "itd, ito, keuangan, sumber daya manusia"; $selectedvalues = array(); $selectedvalues = split(",", $divisi); var_dump($selectedvalues) ?> the script above returns below array when run on http://phpfiddle.org/ array(4) { [0]=> string(3) "itd" [1]=> string(4) " ito" [2]=> string(9) " keuangan" [3]=> string(20) " sumber daya manusia" } as pointed out split deprecated: http://php.net/manual/en/function.split.php . please use

while loop - C++ - inputting and outputting multiple integers with io redirection -

i'm new c++ , writing simple program should take integers file ints , output them formatted appropriately. issue program skips 1 of values when outputting. eg (\n representing new line) "51 123\n -10\n 153 111" come out "123\n -10\n 153\n 111\n 0". tips or pointers bettering code great. here code: using namespace std; int main(int argc, char *argv[]) { size_t i; int n; int a, b, c, d, e; if (argc == 1) { while (cin >> n) { cin >> a; cin >> b; cin >> c; cin >> d; cin >> e; cout << setw(10); cout << << "\r\n"; cout << setw(10); cout << b << "\r\n"; cout << setw(10); cout << c << "\r\n"; cout << setw(10); cout << d << "\r\n";

python - Find unique permutation of a list binary values without generating all possibilities -

forgive ignorance. have brain fart @ moment , unable come solution. let's have list of [1, 1, 0, 0] . want calculate 4 digits binary numbers have 2 1s , 2 zeros, like: ['0110', '0011', '0101', '1100', '1010', '1001'] this works: from itertools import permutations set([''.join(x) x in list(permutations('0011', 4))]) but calculate entire permutations , discards duplicate. meaning, calculates 24 times need 6. more significant if collection [1, 1, 1, 1, 0, 0, 0, 0] . this should easy can't wrap head around it. use itertools.combinations() find possible positions ones, construct numbers using positions: def binary(length=4, ones=2): result = [] positions in combinations(range(length), ones): result.append("".join("1" if _ in positions else "0" _ in range(length))) return result result: in [9]: binary() out[9]: ['1100', '1010

python tkinter tag_bind not working inside loop -

Image
from tkinter import * def onobjectclick(event, obj): canv.itemconfig(obj, width=2) def no_onobjectclick(event, obj): canv.itemconfig(obj, width=1) root = tk() canv = canvas(root, width=500, height=500) can_obj = [] w=10 ii=0 while ii < 2: points = [w,100, w+10,0, w+20,100] ln = canv.create_line(points, fill='green') can_obj.append(ln) w+=10 ii+=1 ii=0 ##this part working fine ##canv.tag_bind(can_obj[1], '<enter>', lambda event : onobjectclick(event, can_obj[1])) ##canv.tag_bind(can_obj[1], '<leave>', lambda event : no_onobjectclick(event, can_obj[1])) ##canv.tag_bind(can_obj[0], '<enter>', lambda event : onobjectclick(event, can_obj[0])) ##canv.tag_bind(can_obj[0], '<leave>', lambda event : no_onobjectclick(event, can_obj[0])) #this not working above obj in can_obj: canv.tag_bind(obj, '<enter>', lambda event : onobjectclick(event, obj)) canv.tag_bind(obj,

javascript - mongoose findall return data from a different model -

in users.js : var mongoose = require('mongoose'); var user = mongoose.model('user', { username: { type: string, required: true, unique: true, lowercase: true, }, tasks: [{ type: mongoose.schema.types.objectid, ref: 'tasks', }], }); module.exports = user; i add newuser named user1 , save mongo. the mongo doc looks like: { "_id" : objectid("574fb94f6a1e7d1826c16058"), "username" : "user1", "tasks" : [ ], "__v" : 0 } then try fetch document , works fine in handler: in handlera.js : var user = require('../models/users.js'); module.exports.getuser = function(req, res){ user.findone({username: "user1"}, function(err, data){ if(err){ console.log('getuser err', err); res.send('error') } else { console.log('getuser fx success = ', err, data); res.send(data)

architecture - Endian-ness: Bits in a Byte vs. Bytes in Memory -

when specific architecture either little-endian or big-endian, referring whether numerical significance stored left-to-right or right-to-left in memory. question is: ordering refer how bits or ordered in byte, or how bytes ordered in memory? for example, consider number 6000=1770h=0001011101110000b . if both bits in byte , byte in memory little-endian, stored as 00001110 11101000 = 0e e8, if bits in byte big-endian, bytes in memory little-endian, stored (for it's worth, happens how visual studio seems telling me memory organized in x64 architecture) 01110000 00010111 = 70 17, if bits little-endian, bytes big-endian, stored as 11101000 00001110 = 0e e8, and finally, if bits big-endian, bytes little-endian, stored as 00010111 01110000 = 17 70 (hopefully did right.) so then, terms "little-endian" , "big-endian" refer to? terms refer ordering of bits in byte, or ordering of bytes in memory, or both? furthermore, if vs tells me that,

firstDay option in fullcalendar does not work properly -

Image
i surprised firstday option in fullcalendar not works properly. when im setting firstday = 1 (it means monday first day of week), top labels on month getting changed dates not changing. see screen shots better understanding. help me sort out issue please. thanks in advance.