Posts

Showing posts from June, 2013

javascript - HTML5 AudioPlayer Event Action 'Ended' is being call more than One time -

i working html5 audio player. implementing playlist. using 'ended' event action play next audio media file. but, @ end of media file, 'ended' event fired more 1 time. (as message log appears more 1 time.) this event listener: //event listener function addplayerlistener() { console.log("recording index: "+combinedsessionindex); var audio = document.getelementbyid("playarea"); audio.addeventlistener('ended', function () { sessionstoplay = $("#audio_files").val().split(','); console.log ("in recording end event listener...!!!"+combinedsessionindex); //it shows length '1' not '0' if (sessionstoplay.length == 1) { console.log("returned due session play length..!!!") return; } //as combinedsessionindex starts 1 if (combinedsessionindex == sessionstoplay.length) { console.log(&q

Caching images and then rendering cached images in angularjs -

i have .json file in format: [ { "graph":"https://foo.com/img1.png" }, { "graph":"https://foo.com/img3.png" }, { "graph":"https://foo.com/img3.png" } ] now when obtain file have put images cache ( $angularcachefatory ) , once done render view. this: servicename.getjsonfile().then(function(data){ var x = data; $scope.myimages = data; // download x.graph , insert cache x.foreach(function(item, index, array){ $http.get(item.graph).then(function(res){ imagecache.put('x.graph', res); }); }) }); now after have cached it, how obtain cached image in view? <img ng-src={{myimages.graph}} > this not work. doing wrong? edit: overall objective: first fetch images listed in url. store images in cache. render image in cache. when render view, don't want fetch image on network. want display imag

rgb - Display uyvy data in Qt -

i have input source dvd player video format uyvy.i want develop qt application takes uyvy data input , displays video frame.i used v4l2 linux commands in qt capture , qt widget display video frames. guess qt qimage class not accept uyvy format,it accepts rgb .so how convert data rgb? there other method ?? thanks.. i found qvideoframe supports uyvy http://doc.qt.io/qt-5/qvideoframe.html maybe there way convert qimage use qvideoframe::imageformatfrompixelformat qvideoframe cloneframe(frame); cloneframe.map(qabstractvideobuffer::readonly); const qimage img(cloneframe.bits(), cloneframe.width(), cloneframe.height(), qvideoframe::imageformatfrompixelformat(cloneframe .pixelformat())); ...

c - Allocate and free memory of an array from structure -

i have following structure: typedef struct { char *name[10]; char *msg[100]; } log; how can free name , msg arrays log structure? know free used dynamic allocation, , dynamic allocation doesn't work in structures. can do? tryed give error: typedef struct { char *name[] = (char *)malloc(sizeof(char) * 10); char *msg[] = (char *)malloc(sizeof(char) * 100); } log; who can me? thanks! declaring structure doesn't allocate memory members. memory allocated when instance of structure created. typedef struct { char *name[10]; char *msg[100]; } log; doesn't allocate memory name , msg , declare log new data (user defined) type. when create instance of log log_flie; memory allocated name , msg . can allocate memory (dynamically) elements of data member for(int = 0; < 10; i++) log_file.name[i] = malloc(n); //n desired size similarly can msg . to free dynamically allocated memory , call free for(int = 0;

node.js - Big performance loss with NodeJS loops on Amazon EC2 server -

i running amazon ec2 m1 general purpose small (1 core x 1 unit) 64 bit instance. i've established amazon instance on average half fast computer i'm working on when using single-threaded nodejs app: var time = date.now(); var fibo = function(n) { return n == 0 ? 0 : n == 1 ? 1 : fibo(n-1) + fibo(n-2); }; console.log("fibo(40) = " + fibo(40)); time = date.now() - time; console.log("took: " + time + " ms"); localhost: fibo(40) = 102334155 took: 1447 ms amazon ec2: fibo(40) = 102334155 took: 3148 ms now when in bigger app iterate on big 5mb json object (5mb being formatted , indented filesize, assume smaller internally) using 6 nested for loops (and sake of argument please assume me necessary) end 9.000.000 iterations. on localhost , takes 8 seconds . on amazon ec2 , takes 46 seconds . i expected 20 seconds @ most. what causes amazon lag more? i know v8 highly optimized. is javascript / v8 / nod

java - Hibernate joining two tables -

Image
i trying learn spring , hibernate . have following form after inserting form values in database tables, want them following: table name : student student_id studentname 1. jason stathum table name : studentdetails studentdetailsid fathername mothername student_id 1 mr.x mrs. y 1 but when insert values in database, studentdetails table looks following table name : studentdetails studentdetailsid fathername mothername student_id 1 mr.x mrs. y null as can see works student_id column doesn't filled up. please tell me doing wrong? here's codes: model class : student package com.spring.org.model @entity @table(name = "student") public class student { @id @generatedvalue(strategy = generationtype.auto) @column(name="student_id", nullable= false) private integer studentid; private string studentname; @onetomany(cascade = cascadetype.

Ninject provider can't resolve types registered within a named scope -

i using namedscoped ninject extension in attempt create object graphs constructed everytime command handler constructed container. in other words, want fresh object graph every command might processed corresponding handler. i have used .definesnamedscope("toplevelorhcestrator") binding when registering "command handlers" top level command processing. a type in named scope needs injected result of method call on type registered in named scope. thought best way ninject provider. inside provider attempt resolve type in hopes can call method on pass object creating within named scope. problem i'm having when ask icontext instance inside customer provider exception says "no matching scopes available, , type declared innamedscope(toplevelorchestrator). context.kernel.get<typealreadyregisteredinscope>().methodthatgetsanotherdependency() is possible types container inside ninject provider when registered inside named scope? edit i apologi

objective c - I keep on getting this expected identifier or '(' -

i keep getting expected identifier or '(' below code. trying example school project. anybody's appreciated. entire script. // // viewcontroller.m // pocket codez // // created dinesh1201 on 10/9/14. // copyright (c) 2014 dinesh , co. rights reserved. // #import "viewcontroller.h" @interface viewcontroller () - (ibaction)generate:(id)sender; @property (strong, nonatomic) iboutlet uilabel *password; @end @implementation viewcontroller - (ibaction)generate:(id)sender { struct label label = { .password = @"468392" }; } - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } @end the error located @ struct label label = { .password = @"468392" }; now after edit , saying variable has incomplete type 'struct label' you seem imply it's st

html - Nested div applying margin outside box model -

i'm having trouble adding margin <figure> while nested within <header> . when apply margin-top:10px applying whole body instead of inside <header> tag. using reset.css if helps @ all. this assignment in college , can't hold of tutor answer. code: <html> <body> <header> <figure></figure> </header> </body> </html> css: body { backround-color: #f2f2f2; margin:0px; padding:0px; } header { display: block; position: static; max-width: 980px; height: 100px; background: #1e1e1e; margin:0px auto 0px auto; } header figure { margin-top:10px; /** when margin top added creates margin on full page instead of inside header**/ margin-left:10px; max-width:200px; height:80px; background:red; } add padding header

javascript - HTML5 Video currentTime precision in Chrome -

i've got html5 video element , trying perform frame frame stepping. test video i'm using 2 frames(83ms) long , 24fps. playing video works expected, when trying specify currenttime attribute access frame 1 not work in chrome. does precision of currenttime in chrome? if same operation performed in safari/firefox works expected.

super - The constructor Object(String) is undefined -

i the constructor object(string) undefined on "super("title")". it's not piece of code, every single program create, containing "super" has error, leads me believe, problem of general nature (eclipse/missing import). import java.awt.color; import java.awt.flowlayout; import javax.swing.jframe; import javax.swing.jtextfield; import java.awt.font; import javax.swing.buttongroup; import javax.swing.jframe; import javax.swing.jbutton; import javax.swing.icon; import javax.swing.imageicon; import javax.swing.jlabel; import javax.swing.jlist; import javax.swing.joptionpane; import javax.swing.jcheckbox; import javax.swing.jpanel; import javax.swing.jscrollpane; import javax.swing.listselectionmodel; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.awt.event.itemevent; import java.awt.event.itemlistener; import javax.swing.jradiobutton; import javax.swing.event.listselectionli

mainframe - PL1 structure assignment with BY NAME option at runtime or compilation -

in pl1 possible assign structure option name. functionality used during runtime or during compile only? the ibm documentation not helpful in case. are talking by name in procedure assignment (better known reference) or by name in assignment ???. from manual reference, presume talking by name assignment option in pl1 assignment variation on cobol move corresponding clause. yes possible assign pl1 structure by name option. determined @ compiled time assigned what. see by name example in pl1 this lists: declare declare declare 1 one, 1 two, 1 three, 2 part1, 2 part1, 2 part1, 3 red, 3 blue, 3 red, 3 orange, 3 green, 3 blue, 2 part2, 3 red, 3 brown, 3 yellow, 2 part2, 2 part2, 3 blue, 3 brown, 3 yellow, 3 green; 3 yellow; 3 green; assignment statements using name clause 1 = two, name; one.part1 = three.part1, name; 1 first assi

c - What's the meaning of the following code? -

there cas code below can handle int type,i know function of cas don't know details shown below. inline int cas(unsigned long *mem,unsigned long newval,unsigned long oldval) { __typeof (*mem) ret; __asm __volatile ("lock; cmpxchgl %2, %1" : "=a" (ret), "=m" (*mem) : "r" (newval), "m" (*mem), "0" (oldval)); return (int) ret; } i know there should 5 parameters mapped %0,%1,%2,%3,%4 because there 5 parameters in input/output field i know "=a" means using eax register, "=m" means using memory address, "r" means using register but don't understand "0" means. i don't understand why "cmpxchgl" use 2 parameters %2, %1 instead of three? it should use 3 params cas function. where can infimation inline c asm?i need complete tutorial.

database - Effectively searching for collisions in MySQL DB -

i'm working on project store numbers strings in mysql table. have 7 columns in following order: id, x_cord, y_cord, s_random, t_random, rownumb , userid. and looking find 2 rows same x_cord , y_cord different s_random , t_random. wondering kind of efficient possibilities have achieve that, since table contain 200 millions of such rows. is better check every time add 1 or better check whole table every once in while? thanks

grails - how to call beforeDelete event when deleting many side element in a one-to-many association? -

i have 1 many association here both domain classes purchaseorder class purchaseorder { bigdecimal balance static constraints = { balance nullbale:false } list items static hasmany = [items:item] } item class item { string product integer quantity bigdecimal price def beforeinsert() { def balance = purchaseorder.balance ?: 0 total = price * quantity purchaseorder.balance = balance + total } def beforedelete() { purchaseorder.balance -= total } static belongsto = [purchaseorder:purchaseorder] } in purchaseorder class field balance, field(balance) needs calculated when item object created or when updated or deleted. beforeinsert event in item class called , update balance not case when when try delete item beforedelete not called i trying delete item way purchaseorderinstance.removefromitems iteminstance this way no error message , balance property not calculated if try iteminstance.delete(flush:true) i erro

database - Excel comments convert to access 2013 -

i have huge data on excel file, i know how convert data access database have problem. some field on data have comment if there way convert comment access 2013 or database. and field coloring if there way convert color make column. just information: https://www.google.co.uk/search?q=excel+comment+to+access and found first result: http://www.extendoffice.com/documents/excel/765-excel-convert-comments-to-cells.html for second question: afaik not possible. have extract colored values new column , transfer access. since know "how" transfer leave rest you.

java - How to fire an event when JTable is visible? -

i know whether jtable not responding componentlistener . have jtable inside tab of jtabbedpane , , have implemented componentlistener jtable can fire when table visible. but, not responding!i noticed not responding jtabbedpane well! ideas how can find whether jtable visible? how can find whether jtable visible? source: determines if component visible in window @ given screen location. import java.awt.component; import java.awt.point; import java.awt.window; import javax.swing.jrootpane; import javax.swing.swingutilities; /** * class contains collection of static utility methods swing. * * @author heidi rakels. */ public class swingutil { /** * <p> * determines if component visible in window @ given screen location. * </p> * * @param location location on screen. * @param component component in window. * @return true if component visible in window @ given screen location. */ public static boolean locat

How to remove borders of a portlet added using <liferay:runtime ... /> tag -

i'm trying add custom portlet in jsp using tag, here code: <liferay-portlet:runtime portletname="customsocialnotifications_war" /> that works fine! portlet showing borders, , need hide them. i tried overwrite css, removes borders of portal :( some idea? thanks! pd: i'm using liferay 6.2 ee ;) you can use attribute available in same tag defaultpreferences <% stringbundler sb = new stringbundler(); sb.append("<portlet-preferences >"); sb.append("<preference>"); sb.append("<name>"); sb.append("portletsetupshowborders"); sb.append("</name>"); sb.append("<value>"); sb.append("false"); sb.append("</value>"); sb.append("</preference>"); sb.append("</portlet-preferences>"); %> <liferay-portlet:runtime portletname="customsocialnotifications_war" defaultpreferences="<%

xcode - iTunes app verification, new failure started regarding embedded resource bundles on iOS -

this new , different. have embedded resource bundle 3rd party plugin. same bundle has been submitted app before on earlier versions. yesterday caused problem: "unable process application @ time due following error: bundle 'com.xxxxxx.yyyyy' @ bundle path 'payload/example.app/zzzzzzz.bundle' not signed using apple submission certificate." so tried normal signing related fixes, different find information because relates bundle inside app, not app itself. app signed fine, , in fact test if remove bundle, app verifies fine. seems apple introduced new restriction? or has gone wrong in codesigning process? this done w/ xcode 5.1.1, through distribute app store/ validate button in organizer

Rails 4: Update instead of new if a record exsists -

here schema... create_table "documents", force: true |t| t.string "document_name" ... end create_table "transcriptions", force: true |t| t.text "content" t.integer "user_id" t.integer "document_id" t.datetime "created_at" t.datetime "updated_at" end create_table "users", force: true |t| t.string "email" t.string "password_digest" t.string "role" ... end users can create transcriptions of document. want users creating 1 transcription of each document. in document index view have... <td><%= link_to 'transcribe', new_document_transcription_path(document, current_user) %></td> however, link user can create multiple transcriptions of single document. have added model validation looks like... validates_uniqueness_of :document_id, :scope => :user_id this works sto

regex - ASP.NET Web API 2 Model Validation with Regular Expression -

in web api 2 controller have create method contains following logic: if (((assignment.type).tolower() != "individual" && (assignment.type).tolower() != "staff")) { return request.createerrorresponse(httpstatuscode.badrequest, "the assignment type must either 'individual' or 'staff'"); } i using model state validation. possible assign regular expression property eliminate need checking in controller? if so, reg ex return valid if exact string (case insensitive) of "individual" or "staff" passed user of api? if want regex use new regex(@"^(individual|staff)$", regexoptions.ignorecase) but, recommend create enum corresponding values , make model property of enum.

c# - ASP.NET page not going to server after button click -

i have asp.net page use in popup. pop contains 2 image controls , markup contains jcrop plugin. page, popup opens , hence page loads. reading image in bytes, converting base64 , setting src attribute of both image controls(both have runat='server'). there 2 buttons in page. click on these buttons not hitting event handler page_load, button_clicked etc. <img id="target" runat="server" alt="main image" /> <img id="imgcropped" runat="server" alt="preview image" class="jcrop-preview" style="border-color:gray" /> protected void page_load(object sender, eventargs e) { strmimetype = session["mimetype"].tostring(); strimagedata = session["imagedata"].tostring(); strimagename = session["imagename"].tostring(); if (!ispostback) { string stemp = "data:" + strmimetype + ";base64," + strim

Python Windows service pyinstaller executables error 1053 -

i have written windows service in python. if run script command prompt python runservice.py when service installs , starts correctly. have been trying create executable using pyinstaller because i've seen same issue py2exe. when run .exe service installs not start , following error error 1053 service did not respond start or control request in timely fashion i have seen many people have had issue can't seem find definitive answer how fix this. winservice.py from os.path import splitext, abspath sys import modules, executable time import * import win32serviceutil import win32service import win32event import win32api class service(win32serviceutil.serviceframework): _svc_name_ = '_unnamed' _svc_display_name_ = '_service template' _svc_description_ = '_description template' def __init__(self, *args): win32serviceutil.serviceframework.__init__(self, *args) self.log('init') self.stop_event = w

math - evaluating function only defined by table, C++ -

i'd evaluate function in c++, have values defined in table such following: entry # en(ev) effective qm - defined in introduction(1e-16*cm^2) 1 0 4.96 2 0.001 4.98 3 0.002 5.02 4 0.003 5.07 5 0.005 5.12 6 0.007 5.15 7 0.0085 5.18 i'd have function, returns effective qm each energy. ideally interpolated value, i'll happy rounding closest energy qm known , giving result. have no idea how should done. know easy in mathematica, rest of code faster in c++. suppose create struct data: struct energyentry { double energy; double qm; }; i'm going assume can load data vector. first-level approach you're asking load data , find closest entry. keep track of closest entry , update iterate through data. @ end you'll have closest item. std::vector<energyentry> entries; loadentries(entries); // assuming can double targetenergy = 0.0015; // value want int best = 0;

arduino uno - how to redirect php page to a static IP address? -

i embedded webserver html arduino control devices through ethernet.webserver ip address 192.168.1.177. make login page using php , mysql. how can redirect 192.168.1.177 login page. please me. thanks! simply: header('location: http://192.168.1.177/'); exit;

jQuery FullCalendar object doens't support property or method qtip -

the jquery fullcalendar plugin throws qtip error in ie versions 10 , below causing not show: object doesn't support property or method 'qtip' chrome, firefox, , ie11 don't seem throw error in console. i've done several google searches document known issue have not found concrete solution. it suggested older versions of ie may not load library , add set timeout function make work did not seem help i have include following js file in page in order: jquery-1.9.1.js, fullcalendar.min.js, jquery.qtip.min.js , necessary css files include well. the error thrown on qtip function here: var tooltip = $('<div/>').qtip({ id: 'fullcalendar', prerender: true, content: { text: ' ', title: { button: true } }, position: { my: 'bottom center', at: 'top center',

tfs - Editing or creating a build definition shows an error when opening the Process tab -

Image
when edit existing build definition, or try create new one, i'm consistently greeted error message: (x) team foundation error: type microsoft.teamfoundation.clientbasicauthcredential in assembly microsoft.teamfoundation.client, version=12.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a not marked serializable. and not possible edit of build parameters on process tab result. i have tried uninstalling latest visual studio update, repairing visual studio 2013 ultimate , reinstalling visual studio again no avail. it turns out clearing credentials tfs server both windows , generic section of windows credentials manager , restarting visual studio resolve issue. i've raised bug microsoft. thank brian minisi tip lead solution .

php - Retrieve Single User Data Using Session After He Logged In -

i new field , first time working session, question may seem basic appreciate if me. have made login , logout page using session , wish display data of particular user has logged in. user redirected retailer_login.php after sign in, apart login form there 4 pages entire login , logout process. retailer_login.php, retailer_session.php, retailer_profile.php, retailer_logout.php every page working fine able display single data column of user database wish display entire information stored specific user. database id name email password country city state occupation 1 sam sam@gmail.com sam xyz zbc qwe student retailer_login page <?php session_start(); // starting session if (isset($_post['submit'])) { try { if (empty($_post['email']) || empty($_post['password'])) { throw new exception("email or password invalid"); } else { // define $email , $passwor

javascript - XHR cross-domain error on the same domain (localhost) -

explanation: i have small web application running on apache server on machine uses javascript xhr's. long time worked no problems, today xhr's stopped working on localhost, if access outside works perfectly. problem: using mozilla firefox, firebug warns: "cross-origin request blocked: same origin policy disallows reading remote resource @ http://127.0.0.1:3581/datasnap/rest/tdssmloteamento/getloteamento/true/ . can fixed moving resource same domain or enabling cors." but i'm on localhost acessing local content have xhr calls local datasnap server on same machine, resuming, locally fails, , web works. comments: i acessing apache web page within url: http://127.0.0.1:3582/beewebloteamento/principal.php this totally, really, weird me, not make sense, no-logic, why cross-domain error if i'm acessing same domain? objective: i want know happening , solve problem continue doing xhr's locally , via web (external) too.

localhost - Android XMPP client does not connect to Openfire server -

i have configured openfire server on laptop running windows7. pandion , spark desktop clients working fine on localhost. tested thoroughly multiple users. laptop connected wifi network. trying connect localhost openfire xabber client installed on samsung galaxy pop running android os. mobile connected same wifi network. http://localhost:9090/login.jsp?url=%2findex.jsp able access admin url in mobile browser. but none of xmpp clients able connect localhost openfire. configuration done- server- localhost port- 5222 username , password same provided in spark desktop client. it great know if has solution. thanks. you cannot use localhost in android client connect laptop. , not believe using localhost in android browser connect server on laptop. have use local ip address of server connect. 192.168.#.#.

css - How to maximum size without exceed the size? -

Image
i'm trying , , succeed . here html code : <div class="container"> <ul class="list-green scoutcondensedregular"> <li></li> <li></li> <li></li> <li></li> </ul> <ul class="list-green scoutcondensedregular"> <li></li> <li></li> <li></li> <li></li> </ul> <ul class="list-green scoutcondensedregular"> <li></li> <li></li> <li></li> <li></li> </ul> <ul class="list-green scoutcondensedregular"> <li></li> <li></li> </ul> </div><!-- .container --> and css code : .pairing-prosecco-wines .list-green li{ background-repeat: no-repeat; padding: 28px 5% 30

vb.net - Unable to copy file "source" to "target". Access to the path "target" is denied -

i know common error , have read dozens of threads on dozens of sites today trying fix issue. i branched project in tfs , got latest on it. when opened project, branched version not compile due "unable copy" exception on 2 project references. solution consists of several projects include dependencies on each other. activedirectories has no project dependencies datamodel has no project dependencies dataaccess dependent on datamodel bl depenedent on activedirectories, dataaccess, , datamodel smartclient dependent on activedirectories, bl, , datamodel when compile, 9 errors stating dll, xml, , pdb files activedirectories, datamodel, , dataaccess cannot copied bin\debug folder. i have tried many solutions including following: cleaning solution deleting entire bin folder ensuring of these references set copy local shutting down vs , restarting deleting entire folder , getting latest tfs setting read attribute false on bin folder , subfolders ensuring bi

Error in r for gls on corAR1-not unique -

does know how solve problem error: library(nlme) gls(number.of.fish~julian.date+temperature+size.class,na.action=na.omit,data=mydata,correlation=corar1(form=~julian.date)) error in initialize.corar1(x[[1l]], ...) : covariate must have unique values within groups "corar1" objects you have 2 or more samples taken on same julian.date , can't have in corar1() corstruct() object. how solve depend upon sampling design. these values 2 different sites? if site should in corar1() : corar1(form ~ julian.date | site) beyond that, struggling envision equally-spaced observations in time 2 sample occurring on same day. if response count, might want think again using gls() , using model discrete count data instead.

ssh - Changing a jenkins slave DNS entry -

i changed dns cname record of 1 of slaves jenkins machine uses. after change made, updated information in node points new name. since then, jenkins slave fails launch following error: [09/10/14 18:24:11] [ssh] opening ssh connection name.domain.com:22. error: server rejected 1 private key(s) ubuntu (credentialid:xxxxxxxxxxxxxxxxxxxxxxx/method:publickey) [09/10/14 18:24:11] [ssh] authentication failed. hudson.abortexception: authentication failed. @ hudson.plugins.sshslaves.sshlauncher.openconnection(sshlauncher.java:1143) @ hudson.plugins.sshslaves.sshlauncher$2.call(sshlauncher.java:648) @ hudson.plugins.sshslaves.sshlauncher$2.call(sshlauncher.java:642) @ java.util.concurrent.futuretask.run(futuretask.java:262) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:745) [09/10/14 18:24:11] [ssh] connection cl

How can I create different design (as fragment in Android) in Windows Phone 8? -

Image
i want create different designs in page , keep them in container in page. arrows, should navigate between different designs. how can achieve in windows phone 8 sdk? there fragment in android in wp8 sdk? here drawing of want create: use pivot page .this better fragment activity.

python - Sierpinski triangle recursion using turtle graphics -

Image
i trying write program draws sierpinski tree python using turtle. here idea: import turtle def draw_sierpinski(length,depth): window = turtle.screen() t = turtle.turtle() if depth==0: in range(0,3): t.fd(length) t.left(120) else: draw_sierpinski(length/2,depth-1) t.fd(length/2) draw_sierpinski(length/2,depth-1) t.bk(length/2) t.left(60) t.fd(length/2) t.right(60) draw_sierpinski(length/2,depth-1) window.exitonclick() draw_sierpinski(500,1) the program not reach 2nd line after else statement , don't know why. can me? i don't think should creating turtle or window object inside function. since draw_sierpinski gets called 4 times if orininally call depth 1, you'll create 4 separate windows 4 separate turtles, each 1 drawing single triangle. instead, think should have 1 window , 1 turtle. import turtle def draw_sierpinski(length,depth): i

java ee - what JPA provider does JBOSS application server ships with? -

i search online find if jboss application server ships jpa implementations. came hits such hibernate, eclipselink etc. not sure if these shipped jboss or added in configuration files downloading external jars , adding in classpath. what mean ship is: jboss application server comes resteasy provider jax-rs api . server , running, not need other jars such jersey etc. on same note, heard glassfish application server ships providers various j2ee components such jta, jpa , jax-rs . wondering how know implementations or providers these. thanks as far know uses hibernate: https://docs.jboss.org/author/display/as71/jpa+reference+guide during application deployment, jpa use detected (e.g. persistence.xml or @persistencecontext/unit annotations) , injects hibernate dependencies application deployment. makes easy deploy jpa applications.

c - Crash due to getchar -

the main function code follows: #define mem_incr 20 int main(void) { char *str = null, **s_words = null, *temp = null, *tempbuf = null; int wordcount = 0, i, length = 0, memo = 0; { if(length >= memo) { memo += mem_incr; if(!(tempbuf = realloc(str, memo))) { printf("memory allocation failed."); return 1; } str = tempbuf;; } } while((str[length++] = getchar()) != '\n'); str[--length] = '\0'; wordcount = word_count(str); s_words = malloc(wordcount); //allocate sufficient memory store words for(i = 0; < wordcount; i++) //now allocate memory store each word s_words[i] = calloc(max_length, sizeof(char)); //use function in order not have unfilled space segment(str, s_words); //segment string words printf("words sorted: \n"); //output message for(i = 0; < wordcount; i++) //short words shortest longest { if(strcmp(s_words[i], s_words[i + 1]) > 0) //

c++ - Eclipse Cdt Indexer - how to locate syntax errors and unresolved names -

Image
using: eclipse 4.4.0 (luna) cdt 8.4.0.201406111759 native gcc / g++ , cross gcc-arm c/c++ project external makefile i'd spend effort setup cdt indexer (including automatic discovery of gcc-arm builtin specs, build output discovery et cetera). when reindexing whole project, error log view shows this: indexed 'stm-workbench' (41 sources, 180 headers) in 3,58 sec: 13.921 declarations; 34.120 references; 0 unresolved inclusions; 1 syntax errors; 9 unresolved names (0,019 %) i want check remaining syntax errors , unresolved names located / referenced from. i surely know how locate references of unresolved inclusions (project → c/c++ index → search unresolved includes). but how locate other potential issues? of course, open every single source file of whole project because when opening file see in problems view. hope there may less dumb way. what need called problems view . enables find location of issues @ hand

android - Register Intent Filter to accept any type of file? -

i have app needs able open type of file file manager. file conversion/storage app, doesn't matter type of file is, need accept them all, similar how dropbox accept file. i can't seem figure out how register app open type of file in way. here's have in manifest under relevant activity: <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <data android:scheme="file" /> <data android:host="*" /> <data android:pathpattern=".*\\.*" /> </intent-filter> this doesn't seem have affect. doing wrong? you need set mimetype. <data android:mimetype="*/*" /> you can remove pathpattern when matching mimetype all.

c# - Split audio file into pieces -

i´m trying split audio file in pieces. the fact is: have byte array , split wav file random pieces (3 example). of course, know can´t this. have idea on how it? byte[] result = stream.toarray(); byte[] testing = new byte[44]; (int ix = 0; ix < testing.length; ix++) { testing[ix] = result[ix]; } system.io.file.writeallbytes("yourfilepath_" + system.guid.newguid() + ".wav", testing); i build solution in c# heard there lib called sox , can split silence gap this: sox in.wav out.wav silence 1 0.5 1% 1 5.0 1% : newfile : restart but everytime run command, 1 file generated. (audio file lasts 5 seconds, , each splitted file must have aroung 1 second). what best way this? thank much! edit with sox: string sox = @"c:\program files (x86)\sox-14-4-1\sox.exe"; string inputfile = @"d:\brothers vibe - rainforest.mp3"; string outputdirectory = @"d:\splittest"; string outputprefix = "split"; int[] se

javascript - AngularJS $routeParam vs $location.search(a,b) difference? -

setting url parameter via $routeparams, or setting using $location.search() setter seem achieve same thing, other how parameter appears in url, , in app set. from app.js config... $routeprovider .when('/myroute/:myparam', {}); vs. from controller... $scope.setlocationparam = function (name, param) { $location.search(name, param); }; i have simple ajax app i'm going step-by-step through few pages , want maintain state in url each subsequent route calling api based on url params set previous route. when 1 want choose 1 method on other? i'm leaning towards search param via $location because it's more descriptive thought i'd ask fine people!s

javascript - jQuery Autocomplete with ajax, can i do a getall? -

i have bound jquery autocomplete little trouble. when type in 1 or 2 letters, ajax query gets me results , autocomplete shows items. wanting trigger option "show all" button. know can use code myinput.autocomplete("search"); to trigger list when bound local datasource. when try on bound ajax populated source, doesn't trigger search empty string. wrote web api take optional query string below: public ienumerable<account> getaccounts(string query = "") typing in letter works, remote triggering via button doesn't reason. ideas? have checked minlength option? must 0 empty string. check below link detail. api.jqueryui.com/autocomplete/#option-minlength

java - Error: variable digitMonth might not have been initialized -

i'm trying write program takes birth year, month, , day , calculates day said birthday lies on. thing is, error message: error: variable digitmonth might not have been initialized total = inputyear + test2 + digitmonth + inputday; ^ i don't know how fix it. setting digitmonth number (e.g. 1)makes program work, formula, each month requires different number (1 january, 4, february, 4 march, 0 april, etc) i've looked @ other questions errors , haven't found useful yet. help? import java.util.scanner; public class birth{ public static void main(string[] args) { scanner scan = new scanner(system.in); int inputyear, inputmonth, inputday, digitmonth, test2, total, daynum; system.out.println("enter last 2 digits of year born in"); inputyear = scan.nextint(); system.out.println("enter month number born in"); inputmonth = scan.nextint(); system.out.println("enter birth

php - Regular Expression String Break -

Image
i new regex. have been trying break string initial part of string create folders. here few examples of variables need break. test1-792x612.jpg test-with-multiple-hyphens-612x792.jpg is there way using regular expression can test1 , test-with-multiple-hyphens ? you can use regex this: (.*?)-\d+x\d+ working demo the idea pattern match string -numxnum capture previous content. note case insensitive flag. match 1 1. [0-5] `test1` match 2 1. [18-44] `test-with-multiple-hyphens` if don't want use insensitive flag, change regex to: (.*?)-\d+[xx]\d+

ios - Xcode 6 GM, IB Challenge and Swift -

i'm hoping can me or let me know i'm not going out of mind. have been searching answer issue past 4 hours , have tried many solutions, none seem help. my challenge don't seem able make use of custom class view controller within gm release of xcode 6. here have done. begin new project using file -> new -> project, selected ios single view application start. once initial application has been created, runs fine within simulator. now go viewcontroller.swift , change class viewcontroller: uiviewcontroller { class viewcontrollerxxx: uiviewcontroller { next, go main.storyboard , select view controller and drop down custom list class not see custom class. now here gets strange. if open project created on earlier beta build of xcode, above process works fine , see custom class, not newly created projects. does else see behavior, or me? hoping can shed light me... btw - manually defining custom class name doesn't work either - runtime error saying

difference between varchar(500) vs varchar(max) in sql server -

i want know pros , cons while using varchar(500) vs varchar(max) in terms of performance, memory , else consider? will both use same amount of storage space? is answer differ in case of sql server 2000/2005/2008? in sql server 2000 , sql server 7, row cannot exceed 8000 bytes in size. means varbinary column can store 8000 bytes (assuming column in table), varchar column can store 8000 characters , nvarchar column can store 4000 characters (2 bytes per unicode character). limitation stems 8 kb internal page size sql server uses save data disk. to store more data in single column, needed use text, ntext, or image data types (blobs) stored in collection of 8 kb data pages separate data pages store other data in same table. these data pages arranged in b-tree structure. blobs hard work , manipulate. cannot used variables in procedure or function , cannot used inside string functions such replace, charindex or substring. in cases, have use readtext, writetext, , update

ubuntu - Linux locked processes and files -

i opened firefox , eclipse in ubuntu , selected "lock/switch account". then shutted down system pushing button in desktop box. then opened machine , firefox program not open -- says firefox process running. also, when open eclipse have select different workspace folder because default 1 being used. i restarted pc , still error. do have idea should do? thank you. execute in terminal. kill running eclipses: sudo killall -9 java to kill running ffs: sudo killall -9 firefox

php - why adding this code to my header in Wordpress doesn't activate "allow_mobile_zooming" -

should putting functions.php file load instead? here's code i'm using, allows finger zoom on mobile devices: function allow_mobile_zooming() { print '<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, minimum-scale=0.1, maximum-scale=10.0">'; print "\n";} add_action( 'wp_head', 'allow_mobile_zooming', 9999999 ); thanks! if you're adding header.php, can write html , not php: or add functions.php you've written. code looks correct. but doesn't make sense add code header.php, since it's doing calling hook add header. , if place code in header.php after wp_head(), won't work wp_head has been called.

rest - What is a restful way to implement this proposed API? -

so i'm trying develop music player office restful api. in nutshell, api able download music youtube , load current playlist of running mpd instance. want able control playback / volume api here's kind of thinking far: endpoint: /queue methods: get: gets current mpd playlist post: accepts json these arguments: source-type: specify type of source of music (usually youtube, might want expand later support pulling soundcloud, etc) source-desc: used in conjunction source-type, ie, if source-type youtube, youtube search query use these arguments go out , find song want , put in queue delete: clear queue endpoint: /playbackcontrol methods: get: returns volume, whether playing, paused, or stopped, etc post: accepts json these arguments: operation: describe operation want (ie, next, previous, volume adjust) optional_value: value operations need value (like volume) so tha

How to find the width of different icons present in system Action Bar in android -

i need resize search space when expand on click in action bar , need know empty width present in action bar. didn't find way detect empty space in action bar.please me the title of action bar got shrink when click on search icon, fix issue need set maxwidth search icon ( when expand ) , set maxwidth need empty space in action bar. --> tried collapseactionview, giving text instead of icon. public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.split_pane_menu, menu); mactionbarmenu = menu; menuitem searchitem = menu.finditem(r.id.split_pane_search); msearchview = (searchview) searchitem.getactionview(); ***msearchview.setmaxwidth(500);*** <----- set value , need know how free space there in action bar ---- ---- } please me out if specify menu action elements in xml, can assign ids each one. in code can grab reference views findviewbyid.