Posts

Showing posts from June, 2012

c++ - Must construct a QApplication before a QWidget -

everywhere "before qpaintdevice" questions , error. so, here go. i need extern qwidget able access outside (because don't know other ways it). basically, need this: create 2 qwidgets 1 window, go first window , there hide main window , show second window created main window (although main window not main(), qwidget too). i added extern qwidget *widget = new qwidget everywhere , everyhow in possible ways, , still got message. suppose, means need create qapplication (in main.cpp) , declare qwidgets. how can access qwidgets qwidgets? code here: https://github.com/ewancoder/game/tree/qwidget_before_qapp_problem p.s. final goal able show , hide both gamewindow.cpp , world.cpp battle.cpp (just regular class) and btw, adding q_object , #include both don't work. anyway, if cannot use functions 1 window another, what's point? can have 1 window in another, , in one, , 1 in another... can't last previous. after years on delphi seems strange me.

java - Setting scale to a negative number with BigDecimal -

does ever make sense set scale negative number this? bigdecimal result; . . . result = result.setscale(-1, roundingmode.half_up) what happens if do? yes, makes sense set scale negative number in situations. means number rounded nearest 10 -scale number, or 10 in case. bigdecimal bd = new bigdecimal(1094); bd = bd.setscale(-1, roundingmode.half_up); system.out.println(bd); system.out.println(bd.doublevalue()); prints 1.09e+3 1090.0 the 1.09e+3 equivalent double value 1090.0 . this useful when scientific measurement quantity has less significant digits total number of digits necessary represent number normally. precision of such number less size of number. if earth's distance sun given 92,960,000 miles, , if value 5 significant digits, equivalent to bigdecimal bd = new bigdecimal(92960000.0); bd = bd.setscale(-3, roundingmode.half_up);// 3 insignificant/imprecise "0" digits system.out.println(bd); which prints 9.2960e+7

javascript - Is it possible to have two success callback functions with a jQuery.post()? -

is possible? once jquery.post successfull instead of having 1 success callback have two. for example once form has posted data empty div called "#msg" given style , content and empty div called "colour-block" given style. code far $('#form1').submit(function(e) { e.preventdefault(); $.ajax({ type: 'post', url: 'indextest1.php', data: $("#form1").serialize(), success: function(response) { $('#msg').html("<div style='border: 1px solid black; padding:15px 50px 15px 20px; width:437px; border-radius: 8px; background:#d3edd3 url(img/accepted_48.png) no-repeat 450px center;'>now sit , relax.....</div>"); } }); }); any or pointers appreciated. things i've tried , have not worked! adding callback $('#form1').submit(function(e) { e.preventdefault(); $.ajax({ type: 'post', url: 'indextest1.php', data: $(&qu

twython - simple python script using too much cpu -

i told off vps python script using cpu (apparently script utilising entire core few hours). my script uses twython library stream tweets def on_success(self, data): if 'text' in data: self.counter += 1 self.tweetdatabase.save(tweet(data)) #we want commit when have batch if self.counter >= 1000: print("{0}: commiting {1} tweets".format(datetime.now(), self.counter)) self.counter = 0 self.tweetdatabase.commit() tweet class that's job throw away meta data tweet not need: class tweet(): def __init__(self, json): self.user = {"id" : json.get('user').get('id_str'), "name" : json.get('user').get('name')} self.timestamp = datetime.datetime.strptime(json.get('created_at'), '%a %b %d %h:%m:%s %z %y') self.coordinates = json.get('coordinates') self.tweet = {

c# - How can I reference a control on a tab from another tab? -

i have wpf mainwindow tab control. 1st tab called persons , has gridview bound persons observable collection. selecting checkboxes , click next button go next tab has identical grid of persons bound selectedpersons. on first tab's next button, apparently need refresh gridview on secondtab. like datagrid.items.refresh. i don't know how reference it. this? public override void nexttab() { ((datagrid)this.maintabs[1].controls["selectedpersonsgridview"]).items.refresh } i total newbie @ wpf , can see have no idea doing trying do. don't know patterns yet. if have named control selectedpersonsgridview don't need find control can use it's name reference it. xaml <window x:class="wpfapplication1.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width=

Extending command line options with Haskell Snap -

i have acid-state backend complements snap website. running in own process , snap web server requires ip address connect it. debugging , deployment purposes able pass in ip address command line argument when running compiled snap application. ip address accessible inside snapletinit monad acid state handler gets called. how can extend command line parameter system in snap account this? ideally, i'd like. ./app -ip 192.168.0.2 -p 8080 -e prod +rts -i0 -a4m -qg1 then apply this. app :: snapletinit app app app = makesnaplet "app" "snapplication" nothing $ ip <- getconfig "ip" d <- nestsnaplet "acid" acid $ acidinitremote ip return $ app d i recommend changing acid state snaplet read it's ip config instead of command line. configs in snap set it'll load whatever pass -e argument on command line. example, starting -e prod load snaplet/acidstate/prod.conf , starting no -e or -e devel load snapl

ios - Long delay when pushing a UIViewController -

i have run strange issue pushing custom uiviewcontroller resulting in long delay before controller appears. if change code present controller instead of pushing there no delay. i not doing fancy when create , push vc: mycustomviewcontroller *myview = [[mycustomviewcontroller alloc] init]; nslog(@"myview init done"); [[self navigationcontroller] pushviewcontroller:tagsview animated:yes]; nslog(@"myview pushed"); // switching [self presentviewcontroller:myview animated:yes completion:nil] gets rid of delay i have added number of logs try identify when delay taking place. nslogs above print expected: myview init done myview pushed then there long delay, 20-30 seconds, before of these lines print: viewcontroller loadview begins viewcontroller loadview ends viewcontroller viewdidload begins viewcontroller viewdidload ends viewcontroller viewwillappear begins viewcontroller viewwillappear ends willshowviewcontroller viewcontroller viewdidappear here didsho

javascript - how to prevent image from overlapping each other -

i have png of trashcan icon @ right top of parent div: <div id="image_part">//width: 700, height:500 <img id="preview_pic" alt="" src=""> //this load image <img style="float:right;cursor:pointer; margin-top:10px;margin-right:10px;" title="delete photo" src="img/trashcan1_icon.png" height="20" width="20"> </div> when load image, if image size smaller parent size(which image_part), image should @ center of div image_part , , still have margin between div image_part , image , trashcan visible. however, if image big enough occupy parent div image_part without margin or space , trashcan icon becomes invisible. want trashcan icon @ top of image itself. you should propably bind size of image maximum: use max-height: 500px, max-width: 700px (or smaller values have margin). you can use z-index on elements - either give preview_picture negative value

javascript - auto select the parent after deleting a selected node -

i auto select parent after deleting selected node. the following code use delete node , children if there any var selectednode = treeview.select(); $(selectednode).children('.k-group').remove(); treeview.remove(selectednode); how auto select parent node after delete? try folllowing: var selectednode = treeview.select(); var parentnode = treeview.parent(selectednode); $(selectednode).children('.k-group').remove(); // don't need line of code treeview.remove(selectednode); treeview.select(parentnode); take through documentation too: http://docs.telerik.com/kendo-ui/api/web/treeview#methods-parent http://docs.telerik.com/kendo-ui/api/web/treeview#methods-select

c# - Injecting class dynamically based on request using Unity -

i using developing mvc4 application using unity. architecture this. public interface irepositoy<t> { } public class datarepository<t>:irepository { } basically here t model. then again public interface imodel { //property , methods } public class mobile: imodel all model classes inherit interface. now in unity using following syntax registertype<irepository<mobile>, datarepository<mobile>>(); and here problem. i want "mobile" class dependent on request url. mobile page request "mobile" class injected, if "camera" page requested camera object injected. i using if-else. looking more sophisticated way make code more maintainable , robust. new unity , di don't know best way. can please help? i think you're looking @ wrong way. all need product controller in case. base class entity product , you'd inherit class in model stuff like mobile, desktop or not. check ef inheritance:

git - Composer - how to track changes to packages -

what's best way track (my own) changes composer packages , merge later updates packages themselves? these changes/customizations i've made package specific given project. i'm committing /vendor folder vcs , merging/updating changes there, imagine there's better way? should using svn:externals or git submodules kind of thing? there 2 options if external software use not offer feature need: offer patch included in official version able use feature wanted directly inside external software. modify way of including software feature added code, , use external software unaltered. the third way modifying new versions of external software liking, end in maintenance hell. seem this, shouldn't. both svn externals or git submodules additionally bad way deal this, if want use composer maintain dependencies. so right way create package depends on external package , adds feature want. can use composer exclusively manage dependencies. maintenance easy

ios - Setting up UISlider -

i've setup uislider accept values 0 10. want able have slider execute static commands each increment of uislider value, 0 10. i've linked uislider button called zoomcontrol . example, want this: - (ibaction)zoomcontrol { if(zoom.selectedsegmentindex == 0) { // execute commands } else if(zoom.selectedsegmentindex == 1) { // execute commands } else if(zoom.selectedsegmentindex == 2) { // execute commands } // + remaining statements 10 } this declaration of uislider, made in .h file, button: @interface viewcontroller : uiviewcontroller { iboutlet uislider *zoom; } - (ibaction)zoomcontrol; the errors i'm experiencing have selectedsegmentindex block. correct syntax uislider? (the selectedsegmentindex block syntax uisegmentedcontrol switch) you using property of uisegmentedcontrol named selectedsegmentindex , need access value property of uislider . use instead zoom.value try if

join - MySQL: How to query for a column and include information from related columns in the same table? -

in mysql, have table this: +-----------------------+ | assets | +-----------------------+ | id | name | rootid | +----+---------+--------+ | 1 | asset | 1 | +----+---------+--------+ | 2 | asset b | 2 | +----+---------+--------+ | 3 | asset c | 3 | +----+---------+--------+ | 4 | asset d | 2 | +----+---------+--------+ | 5 | asset e | 3 | +----+---------+--------+ | 6 | asset f | 3 | +----+---------+--------+ not greatest table structure, know...but i'm stuck now. i trying write single query that, given id value, return rootid , rootname if there 2 (2) rows same rootid . otherwise columns should null. so, using table above, if given id of 4 query should return: +----------------------------------+ | assets | +----------------------------------+ | id | name | rootid | rootname | +----+---------+--------+----------+ | 4 | asset d | 2 | assetb | +----+---------+--------+-------

CMake can I filter compiler output through another program -

can tell cmake pipe stderr output compiler and/or linker through external program , showing output of on terminal instead? for makefile generators can apply filter compiler output setting custom launcher compile rules. following cmake list file sketches necessary steps: cmake_minimum_required(version 2.8) project (main) configure_file( "${project_source_dir}/gcc_filter.sh.in" "${project_binary_dir}/gcc_filter.sh" @only) add_executable (main main.cpp) set_property(global property rule_launch_compile "${project_binary_dir}/gcc_filter.sh") in project root directory add following shell script template file gcc_filter.sh.in : #!/bin/sh # shell script invoked following arguments # $(cxx) $(cxx_defines) $(cxx_flags) -o object_file -c source_file # invoke compiler exec "$@" 2>&1 | "@project_source_dir@/myfilter.sh" the actual shell script invoked custom launcher rule first copied project binary dire

asp.net - "<" character in JSON data is serialized to \u003c -

i have json object value of 1 element string. in string there characters "<rpc>" . take entire json object , in asp.net server code, perform following take object named rpc_response , add data in post response: var serializer = new system.web.script.serialization.javascriptserializer(); httpcontext.current.response.addheader("pragma", "no-cache"); httpcontext.current.response.addheader("cache-control", "private, no-cache"); httpcontext.current.response.addheader("content-disposition", "inline; filename=\"files.json\""); httpcontext.current.response.write(serializer.serialize(rpc_response)); httpcontext.current.response.contenttype = "application/json"; httpcontext.current.response.statuscode = 200; after object serialized, receive on other end (not web browser), , particular string looks like: \u003crpc\u003e . what can prevent these (and other) characters not being encoded pro

cmake install not installing libraries on windows -

for reason, below cmake file fails install project libraries. create directory in right location, , recursively installs headers... fails install library. ideas? cmake_minimum_required(version 2.8) project(mylib) include_directories(include) add_library(mylib shared source/stuff.cpp) if(cmake_system matches "windows") target_link_libraries(mylib dbghelp ws2_32 iphlpapi) set(cmake_install_prefix "../../devel_artifacts") endif(cmake_system matches "windows") install(targets mylib library destination "lib" archive destination "lib" component library) install(directory include/${project_name} destination include) you're missing runtime destination argument in install(targets...) command. cmake treats shared libraries runtime objects on "dll platforms" windows. if change command to: install(targets mylib library destination "lib"

Pointer and struct array manipulation in C -

#define max_keys 65 struct key { int id; char cryptkeys[max_keys]; }; int main(int argc, char ** argv) { int max_line = 69; struct key *table[3]; struct key *(*p)[] = &table; //allocating space pointers in array for(int = 0; < 4; i++) { table[i] = malloc(sizeof(struct key)); } //parsing id , keys char id[3]; char key[65]; for(int = 0; < size-1; i++) { struct key *k = (struct key*)malloc(sizeof(struct key)); string = a[i]; strncpy(id, string, 3); id[3] = '\0'; k->id = atoi(id); for(int j = 4; j < strlen(string); j++) { key[j-4] = string[j]; } strcpy(k->cryptkeys, key); table[i] = k; printf("%s", table[i]->cryptkeys); //this print } for(int = 0; < sizeof(table) -1; i++) { printf("%d", table[i]->id); //seg fault here, difference above? printf(" "); printf("%s"

postgresql - How to insert (raw bytes from file data) using a plain text script -

database: postgres 9.1 i have table called logos defined this: create type image_type enum ('png'); create table logos ( id uuid primary key, bytes bytea not null, type image_type not null, created timestamp time zone default current_timestamp not null ); create index logo_id_idx on logos(id); i want able insert records table in 2 ways. the first (and common) way rows inserted in table user provide png image file via html file upload form. code processing request on server receive byte array containing data in png image file , insert record in table using similar explained here . there plenty of example of how insert byte arrays postgresql field of type bytea on internet. easy exercise. example of insert code this: insert logos (id, bytes, type, created) values (?, ?, ?, now()) and bytes set like: ... byte[] bytes = ... // read png file byte array. ... ps.setbytes(2, bytes); ... the second way rows inserted in table plain text file script. reas

operating system - Creating an overlay program in C -

i interested in developing program in c, use overlay technique (just curiosity). how can achieve loading program in parts memory, when available memory lower memory needed use program whole? there kind of guide how that, or how design program in technique correctly?

How to rename routine name and save routine code in mysql workbench 6.0.9 community version in Mac OSX -

Image
mysql workbench 6.0.9 community version doesn't have routine rename menu , can't save routine code change in mac os x through routine editor. no need workaround. edit name in code parsed out , appear tab title , in overview area.

c# - Get the value from Request.QueryString into another method -

i trying value of nom studentlistbyfilter(), can me these? default value returned 0. want insert query string(nom) studentattendancelist() value 0. public partial class attedancemanagementjt : system.web.ui.page { protected void page_load(object sender, eventargs e) { //int nom = convert.toint32(request.querystring["activityid"]); } [webmethod(enablesession = true)] public static object studentlistbyfilter() { return applymethods.studentattendancelist(convert.toint32(httpcontext.current.request.querystring["activityid"])); } the reason can't "pass" value other method isn't method. it's "page method", operates in separate request. in second request, there no "activityid" query string parameter. however, can pass query string parameter first request, through session state, second request: public partial class attedancemanagementjt : system.web.ui.page { protect

hibernate - Grails JNDI data source not working -

i have grails application data source defined in datasource.groovy as: datasource { pooled = true driverclassname = "oracle.jdbc.oracledriver" username = "myusername" password = "mypassword" } hibernate { cache.use_second_level_cache = true cache.use_query_cache = false cache.region.factory_class = 'net.sf.ehcache.hibernate.ehcacheregionfactory' } // environment specific settings environments { development { datasource { dbcreate = "validate" url = "jdbc:oracle:thin:@server:1521:instance" logsql = true } } } this works fine want use jndi data source. in config.groovy have: grails.naming.entries = [ 'jdbc/pms_dev': [ type: 'java.sql.datasource', auth: 'container', description: 'main datasource', url: 'jdbc:oracle:thin:@server:1521:instance', username: "myusername",

android - How to customize chrisbanes / ActionBar-PullToRefresh or change the colour of pull to refresh bar -

i using chrisbanes / actionbar-pulltorefresh link https://github.com/chrisbanes/actionbar-pulltorefresh , have created custom list-view , wan change colour of pull refresh bar , text colour on can see in picture in black colour. please guide me. ![enter image description here][1] change progress bar color: defaultheadertransformer.setprogressbarcolor(getresources().getcolor(r.color.accent_color)); change text color: <item name="ptrheadertitletextappearance">@style/textappearancecustomptrheadertitle</item> <style name="textappearancecustomptrheadertitle" parent="android:textappearance.large"> <item name="android:textsize">20dp</item> <item name="android:textcolor">@android:color/white</item> </style>

javascript - jQuery Create Multidimensional Array -

i having heck of time trying figure out how create multidimensional array in jquery. i instantiate array outside of loop. <script> var myarray = []; </script> inside of loop want add array elements. = 0 [loop start] <script> myarray[i][$row[sku]] = $row[qty]; // sku might repeated cause issue? see in error below "295518" repeated... <script> [loop end] in source code looks this: <script> myarray[ 1 ][ 295518 ] = 122; </script> then run @ end outside loop... <script> console.log( myarray ); </script> i error in console: uncaught typeerror: cannot set property '295518' of undefined uncaught typeerror: cannot set property '70252' of undefined uncaught typeerror: cannot set property '295518' of undefined what doing wrong in setting array? thanks! you can so: var = []; a[0] = [1,2,3]; a[1] = [4,5,6]; a[1][1] 5

Creating the Tetris shapes in Java as classes extending Area or Shape -

i working on writing tetris game myself using java. not using tutorials containing code, because want try decompose myself , see how far can take it. so far, not good. have stumbled upon creation on shapes. idea either: 1. have each basic shape (like l, cube, boat) separate classes extending or implementing area or shape can use argument g2.fill(lshape) . 2. each class have sort of state variable describing rotation position, that's next challenge, figuring out rotation.. so step 1, have written far following drafts of lshape class: draft a): public class lshape implements shape{ private rectangle[][] poc; private int rotationstate; public lshape() { rotationstate = 0; poc = new rectangle[3][3]; poc[0][0] = new brick(initial_x - brick, initial_y, brick); poc[1][0] = new brick(initial_x - brick, initial_y + brick, brick); poc[2][0] = new brick(initial_x - brick, initial_y + 2 * brick, brick); poc[2][1] = new brick(initial_x, initial_y + 2 * br

jquery - How do I make permanent changes to javascript variables or html elements inside of .click()? -

for example: $(document).ready(function(){ $('#submit').click(function(){ $('#rightad').text("hello everybody"); }); }); this changes text in #rightad moment button clicked. how make remain, "hello everybody" after click ends? or thinking wrong way? changing via script reflect until page gets refreshed. try this: html: <div id="rightad"> text.....</div> <button id="submit">submit</button> jquery: $('#submit').click(function(){ $('#rightad').text("hello everybody"); }); if using <input type="submit"/> submit page, changes flashed page gets refresh. use event.preventdefault() prevent form submission

python - Django 1.6 templates Is it possible to wrap the {% url %} so it can take ** arguements? How? -

the django's built-in tag url tag works like: {% url 'path.to.some_view' arg1=v1 arg2=v2 %} i want write super_url tag works like: kwargs={'arg1':v1,'arg2':v2,} {% super_url 'path.to.some_view' **kwargs %} or take dictionary arguments: {% super_url 'path.to.some_view' kwargs %} is possible? how? you can't pass url tag dictionary in template , should try avoid performing sort of login in template anyway (unpacking dictionaries etc.). instead, write own custom template tag using the reverse function . (untested): from django.core.urlresolvers import reverse @register.simple_tag(takes_context=true) def kwargy_url(context, view_str, kwargs): ... return reverse(view_str, kwargs=kwargs) # {% kwargy_url 'myapp.views.myview' kwarg_var %}

android - Socket code throws NullPointerException -

hi frends im working on android final year project based on sockets..im using ssynctask connect socket etc..everything works fine, since i'm using asynctask create socket connection ... socket works fine in doinbackground() method, when try send sensor data the onsensorchanged() method, null pointer exception. don't know went wrong. in short socket returns null outside asynctask class...can 1 me ? here code: package com.example.sensorsmart; import java.io.bufferedreader; import java.io.bufferedwriter; import java.io.file; import java.io.filewriter; import java.io.ioexception; import java.io.inputstreamreader; import java.io.printwriter; import java.net.serversocket; import java.net.socket; import android.app.activity; import android.content.context; import android.hardware.sensor; import android.hardware.sensorevent; import android.hardware.sensoreventlistener; import android.hardware.sensormanager; import android.os.asynctask; import android.os.bundle; import and

Regarding REST API -

i'm new rest apis , trying understand basics of them. lets begin saying have created simple cms web application using php (you create user, post entry , assign categories maybe, etc...). that being said, if wanted create mobile app same, i'll have create php functions in order send data json or xml , in order process post or put request. is rest api collection of functions i'd use handle mobile app post , put , get request using json or xml data format? if not, can example, not definition, please. to answer question,yes, rest api collection of functions client wish expose creating user, posting entry etc. accepted data format decide api. may json, xml or both. some examples: http://coenraets.org/blog/2011/12/restful-services-with-jquery-php-and-the-slim-framework/ http://peter.neish.net/building-a-mobile-app-backend-using-mongodb-and-slim-a-php-rest-framework/

perl - How to call method within builder -

i have class attribute set follows: has _data => ( => 'ro', lazy => 1, builder => '_load', ); sub _load { $self = shift; return retrieve $self->_file; } however want call method defined on class before returning data. in old-school perl oo, i'd doing this: sub _load { # assuming laziness implemented somewhere else. $self = shift; $self->{_data} = retrieve $self->_file; $self->refresh; # $self->{_data} return $self->{_data}; } but can't figure out 'clean' way in moose. i've considered following, think quite ugly, , there must better way of doing this. if make _data read-write, potentially write data accessor, call method return value accessor moose write accessor. if turn plain old method i'd have define attribute, _raw_data , store data in there, modify refresh() use attribute, , else uses _data() . violate encapsulation , access underlying $self->{_

How to fill to lower-right corner in python-curses -

i'm using curses in python3.3 , need fill entire usable space characters. error i'm getting occurs when double loop reaches last corner. traceback (most recent call last): file "main.py", line 14, in <module> curses.wrapper(main) file "/usr/local/lib/python3.3/curses/__init__.py", line 94, in wrapper return func(stdscr, *args, **kwds) file "main.py", line 9, in main stdscr.addch(y, x, ord('.')) _curses.error: addch() returned err i've noticed each time character added, cursor moves right. haven't tested thoroughly might have, suspect cursor leaves end of window on last call stdscr.addch, causes error. an additional note using maximum width or height 1 unit under window returns, i'm able loop without error. source fails: import curses def main(stdscr): height, width = stdscr.getmaxyx() y in range(height): x in range(width): stdscr.addch(y, x, ord('.'))

html - How to play MP3 from a browser with Java code and JSP? -

what need play mp3 files jsp, have no idea how. code java mp3 player, working fine, problem need play music on browser(something web service) package reproductor; import java.io.file; import javazoom.jlgui.basicplayer.basicplayer; public class reproductor { public basicplayer player; public reproductor() { player = new basicplayer(); } public void coge(string y){ } public void play() throws exception { player.play(); } public void abrirfichero(string ruta) throws exception { player.open(new file(ruta)); player.play(); } public void pausa() throws exception { player.pause(); } public void continuar() throws exception { player.resume(); } public void stop() throws exception { player.stop(); } public void reproducemp3 () throws exception{ try { reproductor mi_reproductor = new reproductor(); mi_reproductor.abrirfichero("c:/users/welrk/downloads/preview.mp3"); mi_reproductor.play(); } catch (exception ex) {

ruby on rails - ActionMailer Not Working -

so i'm trying make mailer site sends of users email when order created. i'm not sure how go it, i've been trying bunch of different things. currently, i've screwed badly can't app start. (not good.) this error message: /users/brawain/rails_projects/sample_app/config/initializers/setup_mail.rb:12:in `': uninitialized constant developmentmailinterceptor (nameerror) currently, mailer looks like: orders controller class orderscontroller < applicationcontroller def new def create @order = order.new(user_params) if @order.save usermailer.work_order(@user).deliver else render 'new' end end end end a new file made called development_mail_interceptor.rb found in config folder in environments folder. class developmentmailinterceptor def self.delivering_email(message) message.subject = "#{message.to} #{message.subject}" message.to = "cwolford@andover.edu" end end the file work_order.text.r

Jquery and Youtube API 2.0 - Getting Video Links from Playlists -

i prefer using program smplayer watch youtube videos. in order use smplayer playlist, however, i'd need right-click , copy each , every individual link , paste each 1 smplayer... i wanted simple application took youtube playlist link , obtained list of urls respective videos within playlist. copy-paste list of urls program , done. this apparently extremely difficult pull off... i came close finding solution existed here . playlists big, seems fail. so, after searching around on google, came across this post . it, able create solution... these requests seem finish whenever want, , enter output in whatever order choose. while(keepgoing&&index<absolutemax){ $.getjson(playlisturl, {}).done(function(data) { var list_data=""; if (data.feed.entry.length<resultsperpage){ keepgoing=false; } $.each(data.feed.entry, function(i, item) { var feedurl = item.link[1].h

android - java.io.IOException: Cannot append Mp4TrackImpl{handler='vide'} to Mp4TrackImpl{handler='vide'} since their Sample Description Boxes differ: -

while merging multiple videos using ffmpeg have got exception. java.io.ioexception: cannot append mp4trackimpl{handler='vide'} mp4trackimpl{handler='vide'} since sample description boxes differ: it might using, convert video in mpeg4. use h264 format set video codec change this recorder.setvideocodec(avcodec.av_codec_id_mpeg4); to this recorder.setvideocodec(avcodec.av_codec_id_h264);

java - Execute JButton when ENTER key is pressed in panel - Swing -

i have login jbutton on panel , need execute when press enter key. do have code snippet that? you can use inputmap , actionmap this. import javax.swing.*; import java.awt.*; import java.awt.event.*; class ac1 { public static void main(string args[]) { jframe f=new jframe(); f.setvisible(true); f.setsize(400,400); f.setlayout(new flowlayout()); final jbutton b=new jbutton("button"); f.add(b); f.getrootpane().getinputmap(jcomponent.when_in_focused_windo w).put(keystroke.getkeystroke(keyevent.vk_enter,0),"clickbutton"); f.getrootpane().getactionmap().put("clickbutton",new abstractaction(){ public void actionperformed(actionevent ae) { b.doclick(); system.out.println("button clicked"); } }); } }

java - Getting cannot find symbol errors. ArrayLists, Iterator -

a supermarket wants reward top customers of day, is, topn customers largest sales, topn value user of program supplies, showing customer’s name on screen in supermarket. purpose, customer’s purchase amount stored in arraylist implement method: public static arraylist write program prompts cashier enter prices , names, adds them 2 array lists, calls method implemented, , displays result. use price of 0 sentinel. my errors when compiling are: ------ compile ---------- hw1num2.java:44: error: cannot find symbol double check = iter.nextdouble(); ^ symbol: method nextdouble() location: variable iter of type iterator hw1num2.java:45: error: cannot find symbol if (check>=sorted(topn-1)) ^ symbol: method sorted(int) location: class hw1num2 hw1num2.java:47: error: no suitable method found add(double) topcust.add(check); ^ method ar

objective c - Converting JSON Result as an Array -

i have json data : array: { data = ( { "com_id" = 1; "com_name" = apple; }, { "com_id" = 2; "com_name" = "google"; }, { "com_id" = 3; "com_name" = "yahoo"; } ); message = "data found"; response = success; } here's code fetch data : nsurl * url = [[nsurl alloc] initwithstring:@"https://jsonurlhere.com"]; // prepare request object nsurlrequest *urlrequest = [nsurlrequest requestwithurl:url cachepolicy:nsurlrequestreturncachedataelseload timeoutinterval:30]; // prepare variables json response nsdata *urldata; nsurlresponse *response; nserror *error; // make synchronous request urldata = [nsur

asp.net mvc - can we identify the id of a button in mvc on httppost -

i have view has 2 submit buttons(save&close,save&new). <span> <input type="button" value="save&new" name="save&new" id="savenew" /> </span> <span> <input type="button" value="save&close" name="save&close" id="saveclose" /> </span> <span> when hit 1 of these buttons,the model data goes controller , hits post action [httppost] public actionresult company(myproject.models.company company) { return view(); } now company object has complete model data(such company.phonenumber,company.state etc etc). want identify id of button(either save&new or save&close) user clicked. both buttons click leads same actionresult(company) , want identify button click request came. cannot use @html.actionlink instead of input type =submit. need know id out using jquery. give buttons same

c# - Compute Shaders Input 3d array of floats -

writing compute shader used in unity 4. i'm attempting 3d noise. the goal multidiminsional float3 array compute shader c# code. possible in straightforward manner (using kind of declaration) or can achieved using texture3d objects? i have implementation of simplex noise working on individual float3 points, outputting single float -1 1. ported code found here compute shader. i extend work on 3d array of float3's (i suppose closest comparison in c# vector3[,,] ) applying noise operation each float3 point in array. i've tried few other things, feel bizarre , miss point of using parallel approach. above imagine should like. i managed scrawk's implemenation working vertex shaders. scrawk got 3d float4 array shader using texture3d . wasn't able extract floats texture. how compute shaders work well? relying on textures? have overlooked concerning getting values out of texture. seems how user getting data in in this post . similar question mine, not quite i&