Posts

Showing posts from August, 2012

extjs - Does removing all data from a Sencha store also remove associated data? -

i have store , model hasmany association. if call ext.getstore('sessionstore').removeall() remove associated data records in store? if not, how this? if console log record in sessionstore should have property name of association plus suffix store e.g. if name of association personalinformation there should new property in record called personalinformationstore. so answer yes removing record or store associated data removed data part of parent object. perhaps ext.storemanager.getcount() can validate existence of data / objects. i recommend chrome extension: https://chrome.google.com/webstore/detail/app-inspector-for-sencha/pbeapidedgdpniokbedbfbaacglkceae?hl=en

ajax - Json post to MVC controller with Parameters -

Image
can't seems figure out why not working. can't parameters post mvc controller method: @{ viewbag.title = "index"; } <h2>index</h2> <input id="button1" type="button" value="button" onclick="callmethodone()" /> <div id="result"></div> <script> function callmethodone() { var detailsurl = '/testdrive/methodone'; var request = { 'parameterone': "test one", 'parametertwo': "test two" }; $.ajax({ url: detailsurl, contenttype: "applicaton/json", type: "post", data: json.stringify(request), datatype: "json", success: successfunc, error: errorfunc }); function successfunc(response, status) { //alert(data + " " + status);

webforms - How to validate Laravel 4 form (html) with js framework -

i developed laravel web application forms. client not satisfied laravel form validation because validating server side , reload page, taking more time. want validate form client side.. js framework suitable laravel 4. need laravel form validation methords min,max,numeric,alphanumeric,alpha. custom validation error messages. also please give best tutorial link suggestion. ? have considered making ajax call backend, making use of laravel's form validators, user tabs next input field? way form validated prior submit.

database - SQL query to find both 4 character and 6 character values from two tables -

below 2 tables working with, along columns in tables: **## table 1 ##** grantee column w/sample data grantee ---------- clat clatx1 djsd djsdx3 adks adksx5 dkhs **## table 2 ##** inact_id column w/sample data inact_id ---------- clat djsd adks dkhs with following query: select distinct a.grantee table1 exists(select 1 table2 b a.grantee= b.inact_id); these results: clat djsd adks dkhs 4 character id's returned - not want(also want 6 character id's associated 4 character id's) in addition getting 4 character id's, of 4 character id's have id following naming convention - a02wxn, x constant, , n number 0-9, 6 character id. want able include 6 character id, if exists along 4 character id. 6 character id's exist in table 1. update: think might closer solution, hope can clarify more want results. select a.grantee table1 inner join (select

mongodb - how to display multi-dimensional data from collection in meteor -

how show multidimensional data collection. have this links.insert({ cat:[{ name:'js', sub:[{ name:'angularjs', links:[{ url:'something.com'},{url:'another.com'}] },{ name:'meteorjs', links:[{ url:'something.com'},{url:'another.com'}] }] }] }); retrieving data in helper this 'links':function(){ return links.find(); // tried links.find().fetch() one option use separate helpers specific data. want use single helper receive whole data , show like {{‪#‎each‬ links}} {{cat.name}} : {{sub.name}} : {{links.url}} {{/each}} have tried: {{#each link}} {{cat.[0].name}} : {{cat.[0].sub.[0].name}} : {{cat.[0].sub.[0].links.[0].url}} {{/each}}

Localization: Php and Javascript -

i'm thinking of best way localize website. using laravel, has php localization class, need translate javascript strings ideally , use library or translation file editable through poedit , used both javascript , php, can't find solution that. possible without having create whole new code library? the solution thought of until far ideal: use php localization class php strings use javascript localization library javascript store language in cookie read both ends. the idea of keeping 2 separate language files (one php , 1 javascript) not seem elegant solution. i saw javascript libraries laravel, require compile library javascript array file every time update something, make not dynamic , redundant, since php strings won't used in javascript , vice-versa. any thoughts on this? you have javascript files php generated per request, mean still use php localization library both. i imagine might not play nice caching javascript files in browser, have php

javascript - In jqgrid, how can I load data by condition? -

$("#list").jqgrid({ url: "assets/php/usermanager/user-read.php", datatype: "json", mtype: "get", colnames: ["userid", u, "user_group_id"], colmodel: [ { name: "userid", hidden: true }, { name: "username", width: 270, align: 'center', stype: 'text' }, { name: "user_group_id", hidden: true} ], height: "87%", pager: "#pager", rownum: 30, sortname: "userid", sortorder: "asc", viewrecords: true, gridview: true, autoencode: true, multiselect: true, caption: "user list" }); $(".ui-jqgrid-titlebar").hide(); $("#pager_right").hide(); $("#pager_center").width(220); $(".ui-pg-input").height(13); $("#list&quo

javascript - Change center img to smaller ones on mouseover -

need code need big img in center , row of 6 smaller ones. here did far cant change reason ... <!doctype html> <html> <head> <title>assignment 5</title> </head> <body onload="conv()"> <img id="img1" style="height:1000px;" src="http://www.albany.edu/~ds857942/images/globemain.jpg" alt="taiwan"> <img onmouseover="new()" style="height:100;" src="http://www.albany.edu/~ds857942/images/globemain.jpg" alt="taiwan"> <img onmouseover="new()" style="height:100;" src="http://www.albany.edu/~ds857942/images/globe2.jpg" alt="car"> <img onmouseover="new()" style="height:100;" src="http://www.albany.edu/~ds857942/images/globe3.jpg" alt="globec"> <img onmouseover="new()" style="height:100;" src="http://www.albany.edu/~ds857942/i

Unable to understand log output in android app -

here log output. need determining begin solve issue: if execute app in device version 4.4.2, no exception thrown, executing app on device lower version, app crashes.. 12-05 11:34:50.716: e/androidruntime(327): fatal exception: main 12-05 11:34:50.716: e/androidruntime(327): java.lang.runtimeexception: unable start activity componentinfo{com.solinpromex.casajuventudtrescantos/com.solinpromex.casajuventudtrescantos.mainactivity}: android.view.inflateexception: binary xml file line #18: error inflating class <unknown> 12-05 11:34:50.716: e/androidruntime(327): @ android.app.activitythread.performlaunchactivity(activitythread.java:1647) 12-05 11:34:50.716: e/androidruntime(327): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1663) 12-05 11:34:50.716: e/androidruntime(327): @ android.app.activitythread.access$1500(activitythread.java:117) 12-05 11:34:50.716: e/androidruntime(327): @ android.app.activitythread$h.handlemessage(activitythread.java:931)

html - Center divs under eachother -

Image
http://jsfiddle.net/jzlw4/702/ i want center divs under eachother, in example there bigger empty space between left , center, center , right. accomplishable? something (made in mspaint): - bootstrap make things easy: <div class="col-md-4"> <!--first column--> <div class="pull-right">some content </div> <div class="pull-right">some content </div> </div> <div class="col-md-4"> <!--second column--> <div class="center">some content </div> <div class="center">some content </div> </div> <div class="col-md-4"> <!--first column--> <div class="pull-left">some content </div> <div class="pull-left">some content </div> </div> more grid-system css centering div in div: .center{ width: 50%; /*or every other width...*/ m

javascript - jQuery - trigger function is making my page to reload without stop -

<script type="text/javascript"> $.noconflict(); jquery(document).ready(function($){ $("#superwebf1").click(function(){ event.stopimmediatepropagation(); }); $("#superwebf1").click(function(){ if ($('[name="shipping_method"]', window.parent.document).is(':checked')){ event.stoppropagation(); billing.save(); parent.jquery("#loadingdiv").show().delay(4300).fadeout(); parent.jquery("#outdiv").hide().delay(5000).fadein(); parent.jquery('#outdiv').removeclass('outerdiv'); parent.jquery('#outdiv').removeclass('outerdivnoadress'); settimeout(function() { if( $('#displayme').length ){ parent.jquery('#outdiv').addclass('outerdiv1000'); } else { parent.jquery('#outdiv').addclass('outerdiv1000n

gitignore - Git directories - how to track directories but not content -

i have .gitignore file so .gitignore /data* /node_modules/* /bower_components/* i want have directories pushed , pulled not contents of directory. above, directories ignored entirely. possible? you can put .gitignore file in each directory want track without contents, , have contents (the .gitignore 's file, is) * , ignore files in directory. git add .gitignore files , commit them. result should directories tracked (because of tracked .gitignore files in them), files in directories ignored.

Using Apache-Spark, reduce or fold an RDD depending on a condition -

i'm working apache spark , scala. have rdd of string,int val counts =words.map(word => (word, 1)).reducebykey((a,b) => (a + b)) now reduced rdd key, i'd add feature reduce words similar. i though use levenshtein distance, euclidean distance or cosine distance. so, how can apply 1 of functions reduce rdd? example: rdd -> (forks,12), (fork,4), (chair,15) , (table,1), (tables,11) admitting similarity algorithm works, how can obtain reduced rdd like: rdd -> (fork,16), (table,12), (chair,15) i tried like: counts.foldleft(){(x,y) => if(x._1.euclideandistance(y._1) > 0.9) (x,x._2+y._2) } what trying not work. if have distance(a, b) function, inefficient , complicated solve problem. need use rdd.cartesian generate possible (word1, word2) pairs. filter out great distance. have similar word pairs. let's (fox, fix) , (fix, six) , , reversals. want sum counts fox , fix , , six . need find connected components in

python - numpy array to permutation matrix -

np.array([1,2,3]) i've got numpy array. turn numpy array tuples of each 1:1 permutation. this: np.array([ [(1,1),(1,2),(1,3)], [(2,1),(2,2),(2,3)], [(3,1),(3,2),(3,3)], ]) any thoughts on how efficiently? need operation few million times. if you're working numpy, don't work tuples. use power , add dimension of size two. recommendation is: x = np.array([1,2,3]) np.vstack(([np.vstack((x, x, x))], [np.vstack((x, x, x)).t])).t or: im = np.vstack((x, x, x)) np.vstack(([im], [im.t])).t and general array: ix = np.vstack([x _ in range(x.shape[0])]) return np.vstack(([ix], [ix.t])).t this produce want: array([[[1, 1], [1, 2], [1, 3]], [[2, 1], [2, 2], [2, 3]], [[3, 1], [3, 2], [3, 3]]]) but 3d matrix, can see when looking @ shape: out[25]: (3l, 3l, 2l) this more efficient solution permutations array size get's bigger. timing solution against @kasra's yields 1ms

google app engine - gcloud preview app setup-managed-vms gives errors - 500 Server Error: Internal Server Error -

i error while setting managed vms environment of google cloud on machine. here how had invoked command: $ gcloud preview app setup-managed-vms select runtime download base image for: [1] java [2] python27 [3] go [4] please enter numeric choice (4): 2 pulling base images runtimes [python27] google cloud storage pulling image: google/appengine-python27 traceback (most recent call last): file "/home/tuxdna/software/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 175, in <module> main() file "/home/tuxdna/software/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 171, in main _cli.execute() file "/home/tuxdna/software/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 385, in execute post_run_hooks=self.__post_run_hooks, kwargs=kwargs) file "/home/tuxdna/software/google-cloud-sdk/./lib/googlecloudsdk/calliope/frontend.py", line 274, in _execute pre_run_hooks=pre_run_hooks,

php - Sum up function in laravel -

i wanted sum numofunit , total price in subject table. did told on google, still encountered errors vague me. wanted know if doing right, since still new in querying db in laravel. not sure of syntax this snippet of query: $results = db::table('subjects') ->join('subjectblocking', 'subjects.subjectcode', '=', 'subjectblocking.subjectcode') ->join('grades', 'subjectblocking.blockcode', '=', 'grades.blockcode') ->select('subjects.numofunit total_units, subjects.price total_tuition') ->sum('subjects.numofunit','subjects.price') ->orwhere(function($query) { $query->where('grades.studentid', '=', '2013-f0218') ->where('sem', '=', '1') ->where('sy', '=', '2013-20

javascript - Uglify module names with r.js optimizer -

for further uglification of script bundle optimized requirejs' r.js optimizer, makes sense obfuscate/anonymize module names inside package. unfortunately, browsing through documentation of r.js, did not find way enable this. possible? an example of mean module "productscontroller" "module1", module "billingrepository" "module17" , on. make harder make sense of uglified code.

clojure - core.logic unification matches value in map but not key -

i don't understand why following 2 examples, first 1 returns correct value (1) , while second returns () . i'd have expected result (:key) or exception can't find solution, not empty list. (l/run* [q] (l/== {:key 1} {:key q})) ;; doesnt work (l/run* [q] (l/== {:key 1} {q 1})) i haven't found documented intended behaviour or not, looking @ source code , (limited) understanding, looks unification of maps happens values, not keys. as implemented in unify-with-map* , when core.logic finds key :key in first map, looks value in second, doesn't find it, , bails on unification. since there no solutions, @arthur ulfeldt said, end () .

java - Exceed the amount of parameters in a method -

i using apache avro tool generate schema class .avsc file. running issue have more 300 fields in avro schema, causes "java error: many parameters" when using class. (because each field in schema 1 parameter in schema class constructor). java has limit of 255 parameters in method. i know may able resolve issue using generic record (instead of avro tool , class generation). before restructured whole thing, there workaround? your schema design pretty bad if table (class) has 300 fields. find way break data down multiple classes , multiple tables. reading on database normalization start.

python - matplotlib: any way to get existing colorbars? -

in matplotlib's object oriented style can current axes, lines , images in existing figure: fig.axes fig.axes[0].lines fig.axes[0].images but haven't found way existing colorbars, have assign colorbar name when first creating it: cbar = fig.colorbar(image) is there way colorbar objects in given figure if didn't assign them names? the problem colorbar added "just another" axis, listed 'normal' axes. import matplotlib.pyplot plt import numpy np data = np.random.rand(6,6) fig = plt.figure(1) fig.clf() ax = fig.add_subplot(1,1,1) cax = ax.imshow(data, interpolation='nearest', vmin=0.5, vmax=0.99) print "before adding colorbar:" print fig.axes fig.colorbar(cax) print "after adding colorbar:" print fig.axes for me, gives result: before adding colorbar: [<matplotlib.axes._subplots.axessubplot object @ 0x00000000080d1d68>] after adding colorbar: [<matplotlib.axes._subplots.axessubplot object @ 0x0000

Java, calculating difference between unique characters in strings -

let's have 2 strings , need calculate difference between unique characters. it's simple: string s1 = "abcd"; string s2 = "aaaacccbbf"; //answer: 1 the answer 1, because there no "f" in s1 variable. but characters à®®ா or 漢字, or other non ascii character? if loop though strings, 1 character கு count 2-3 times separate character, giving me wrong answer: string s1 = "ab"; string s2 = "aaaகுb"; //answer: 2 (wrong!) the code tried with: class { public static void main(string[] args) { scanner sc = new scanner(system.in); string s1 = sc.nextline(); string s2 = sc.nextline(); sc.close(); string missingcharacters= ""; for(char c : s2.tochararray()) { if(!missingcharacters.contains(c+"") && !s1.contains(c+"")) missingcharacters+= c; } system.out.println(missingcharacters.length()); }

c++ - LNK2019: the object file of my main class cannot find the definition of a class i declared and defined -

so have lnk2019 error on constructor , destructor of class classifier. error exists on method classify. see, defined in .cpp file. overlooking? here 3 errors: neutropenia_main.obj:-1: error: lnk2019: unresolved external symbol "public: __cdecl classifier::classifier(class qobject *)" (??0classifier@@qeaa@peavqobject@@@z) referenced in function "private: void __cdecl neutropenia_main::on_ts_classifier_clicked(void)" (?on_ts_classifier_clicked@neutropenia_main@@aeaaxxz) neutropenia_main.obj:-1: error: lnk2019: unresolved external symbol "public: virtual __cdecl classifier::~classifier(void)" (??1classifier@@ueaa@xz) referenced in function "private: void __cdecl neutropenia_main::on_ts_classifier_clicked(void)" (?on_ts_classifier_clicked@neutropenia_main@@aeaaxxz) neutropenia_main.obj:-1: error: lnk2019: unresolved external symbol "public: void __cdecl classifier::classify(class std::vector >,class patient_data)" (?classify@

php - Fine Uploader with form option questions -

i using fine uploader (v5.0.1) jquery, jquery.validate , jquery.form plugins multi-field form new events can have 0 2 file attachments. i have working, have few questions before go further. my client-side code generating 1 post request each file (including other form elements) plus 1 additional post request other form elements. so, if form has 2 file attachments, getting 3 post requests. normal behavior? can in 1 post request? if multiple post requests normal behavior, have generate sort of unique identifier @ client prior first post request, can avoid duplication of event records in database , associate each file upload correct event. if direction need go, there examples of type of implementation can at? if no files attached, getting alert dialog: "no files upload." form can submitted no file attachments, don't want imply user he/she must attach files. how can rid of dialog? i getting 1 post response form data plus 1 post response each file uploaded. t

postgresql - How invoke PL/pgSQL from command line instead of SQL -

i write pl/sql scripts using oracle , i'm trying first pl/pgsql script postgresql. example, created test.sql file. declare v_loc_nbr integer; begin v_loc_nbr := 0; end; which try execute using command line: \postgresql\9.3\bin\psql.exe -d postgres -f test.sql but syntax errors like: psql:test.sql:4: error: syntax error @ or near "v_loc_nbr" i think problem trying execute sql when want run pl/pgsql. should command be? i don't want explain more because erwin explained well.you need wrap sql inside do , test.sql should write this do $$ declare v_loc_nbr integer; begin v_loc_nbr := 0; end; $$ and try execute \postgresql\9.3\bin\psql.exe -d postgres -f test.sql

css shapes - How can I make a circle using css and apply it to my header? -

Image
i have been searching web past 2 hours trying find how achieve result: but don't want use images. trying use :after selector achieve result. is possible. i'm sorry if has been asked 200x , couldn't find it. swear searched. you're correct in using :after pseudo-class. assumption possibly forgot specify content: '' attribute. so first, you're going want create block , position @ bottom of header: header { position: relative; } header:after { content: ''; display: block; height: 44px; margin-left: -22px; position: absolute; left: 50%; bottom: -22px; // pull out half of size semi-circle width: 44px; } then make circular using border-radius: -webkit-border-radius: 44px; -moz-border-radius: 44px; border-radius: 44px; final code: header:after { content: ''; display: block; height: 44px; margin-left: -22px; position: absolute; left: 50%;

ember.js - Ember access array controller's content from another controller -

i have 2 controllers: postscontroller , postcontroller. post route not nested under posts ( not want because want posts view replaced post view, not added it.) this router looks like. this.resource('posts', {path: '/'}, function(){ // this.route('index', {path: '/'}); }); this.resource('post', { path: 'posts/:id' }, function(){ this.route('show'); } now, postscontroller: app.postsroute = ember.route.extend({ model: function(){ return this.store.find('post'); }, }) app.postscontroller = ember.arraycontroller.extend({ testproperty: "this test" }) and postcontroller: app.postroute = ember.route.extend({ model: function(params){ return this.store.find('post', params.id); }, }) app.postcontroller = ember.objectcontroller.extend({ needs: ['posts'], percentvalue: 100, progressbarwidth: null, advancepost: function(delta) { var = this; v

svg - SnapSVG drag rotated rectangle -

i've managed drag rectangle taking account mouse location using following code (demonstrated small square) when rectangle rotated rectangle dragged in parallel shape, please show me how correct this. thought done bit of trigonometry haven't been successful calculate opposite (x) , adjacent(y) a demo can seen here http://jsbin.com/tihobu/2/edit?html,js,output var s = snap(400,400); var smallsquare = s.rect(100, 100, 50,50).attr({fill:"#ffcc00"}); var bigsquare = s.rect(100,20,150,150).attr({fill:"#ff6600"}); var startx, starty; var t = bigsquare.transform().localmatrix; t.rotate(45); bigsquare.transform(t); var movefunc = function (dx, dy, posx, posy) { var xadj = startx - (0 - dx); var yadj = starty - (0 - dy); this.attr('x',xadj); this.attr('y',yadj); }; var startfunc = function(){ startx = this.attr('x'); starty = this.attr('y'); console.log(&quo

To start a new activity in Android , do I need to use intents? -

if want start new activity after user selects item list , have use intents? yes. way start activity use startactivity() (or startactivityforresult() ), , each takes intent .

objective c - Will this hold self inside a block? -

ok, code on arc holds self inside block: dispatch_async(someq, ^{ [self dosomething]; }); and can solved by __weak myrequest *weakself = self; dispatch_async(someq, ^{ [weakself dosomething]; }); but if dosomething has lot of references self? because dosomething code run inside block isn't same of code of dosomething on block directly? do need pass weakself dosomething method can use weakself references instead of self? like __weak myrequest *weakself = self; dispatch_async(someq, ^{ [weakself dosomethingusingthisself:weakself]; }); by doing: myrequest *__weak weakself = self; dispatch_async(someq, ^{ [weakself dosomething]; }); ...when there no more references self , weakself automatically becomes nil . async callback end sending dosomething nil in object destroyed before callback, nothing. if weakself not nil, it's pointer object. when send selector object, there 2 implicit arguments: self , _cmd (see documentation imp ),

ios - Can't create global function in Objective - C -

i'm trying create global function in objective-c. created new .m , h. file subclass of viewcontroller. this connection.m #import "connection.h" @interface viewcontroller () <nsstreamdelegate> @property (strong,nonatomic) nsinputstream * inputstream; @property (strong,nonatomic) nsoutputstream * outputstream; @end @implementation viewcontroller(connection) -(void)initnetworkcommunication { cfreadstreamref readstream; cfwritestreamref writestream; cfstreamcreatepairwithsockettohost(null, (cfstringref)@"192.168.0.10", 35000, &readstream, &writestream); self.inputstream = objc_unretainedobject(readstream); self.outputstream = objc_unretainedobject(writestream); [self.inputstream setdelegate:self]; [self.outputstream setdelegate:self]; [self.inputstream scheduleinrunloop:[nsrunloop currentrunloop] formode:nsdefaultrunloopmode]; [self.outputstream scheduleinrunloop:[nsrunloop currentrunloop] formode:nsdefaul

Using websocket/socket.io for partial page refresh -

installed websocket , socket.io run im in website , partial page refreshes. im coded , working fine. partial page refreshes, coded in server: // receive , broadcast log or monitors update socket.on('sendupdate', function(id) { io.sockets.emit('getupdate', id); }); and in client: // send update log or monitors server function sendupdate(id) // log , monitors table changes { socket.emit('sendupdate', id); // send server broadcast clients }; // receive log or monitors update function getupdate(id) { // how this??? }; so, how can update html element id without refreshing whole page? advice appreciated.

c# - Re-assigning a new model in MVVM -> does not update child collection view models -

i have root model ~ propertyportfolio ~ save/load xml file. contains child collection of property objects. when load application load object propertyportfolioservice. model uses inotifypropertychanged, service - i've got covered. i have child view displays child collection of property objects in grid. binding works fine. the problem have this: when open new propertyportfolio file re-assign propertyportfolio object in service: this.propertyportfolio = loadedpropertyportfolio; the child view/viewmodel not update. the solution have load new portfolio , recreate child objects, this: propertyportfolio loadedpropertyportfolio = /* code load new portfolio xml */; this.propertyportfolio.properties.clear(); foreach (var property in loadedpropertyportfolio.properties) { this.propertyportfolio.properties.add(property); } i'm looking better solution. i hope that's descriptive enough? further information - problem propertyviewmodel (which contains prope

Chrome Extension: How to run Javascript on page load (without popup open) -

i have chrome extension word substitutions on pages. have popup opens when click on browser action lets user control whether or not perform substitutions. have background script running sends message content scripts when page refresh happens using chrome.tabs.onupdated event handler. my problem when refresh page no substitutions made unless popup open (which possible when have inspect elements panel open on popup, because otherwise popup closes when refresh). has had experience behavior before? additional instrumentation should add diagnose problem? there different extension architecture/code arrangement should using? thanks in advance! if use localstorage on given page can store whether or not substitute words. think refreshing page similar opening new tab, script gets reinjected/reloaded rather staying open , receiving onupdate message.

C: pointer being freed was not allocated -- when calling free -

Image
my function: shot *shot_collide(shot *shot) { shot *moving, *remaining; remaining=null; moving=shot; while(moving!=null) { if(moving->y>658) //ha eléri az alját { if(remaining==null) //ha ez az első elem { shot=moving->next; free(moving); moving=shot->next; }else{ remaining->next=moving->next; free(moving); moving=remaining->next; } }else{ moving=moving->next; } } return shot; } when call free, error in xcode: nhf(1670,0x7fff77e1a300) malloc: * error object 0x10050c9e0: pointer being freed >not allocated * set breakpoint in malloc_error_break debug this sdl game, , function free shot after reaches end of map. i gotta finish sunday, i'm stuck :( edit 2 look @ lines 110 , 113 in code (pastebin). create moving, s

ruby - Google BigQuery API Delete Dataset Access Denied using Service Account keys -

i'm using ruby , google-api-client gem create simple script lists datasets in project , deletes them. script using service account credentials , bigquery api enabled. using v2 of api. the listing of datasets works fine , list (so it's not credentials or scope has problem) when try , delete dataset access denied: dataset pppppppppp:foofoofoo: delete_dataset. when @ acl on dataset set defaults, namely group: project viewers can view, group project editors can edit , group: project owners owner. if try , delete dataset console logging in project owner credentials, works fine. any appreciated. thx enis it sounds service account using not on project writers group. deleting dataset owned project requires either writer or owner permissions. dataset permissions can found here: https://cloud.google.com/bigquery/access-control#datasetroles

java - Files.newInputStream() inconsequential behaviour when the target Path is a directory? -

note: please run exact code below; no adaptations of it, in particular, not use file , bug tied new java.nio.file api ok, not "question in need of answer" rather call witnesses... scenario: have directory on os, whatever is, know have privileges access -- in unix parlance, have @ least read access (which means can list entries in it); in code below, supposed path represented system.getproperty("java.io.tmpdir") fits bill; have oracle jdk, or openjdk, 7+ installed ; have java.nio.file @ disposal. now, code below pretty simple: tries open new inputstream on directory using files.newinputstream() . code (also available here ; added comments mine): import java.io.ioexception; import java.io.inputstream; import java.nio.file.files; import java.nio.file.path; import java.nio.file.paths; public final class main { public static void main(final string... args) throws ioexception { final path path = paths.get(system.getproperty(&q

javascript - Only run a function if on X page -

i have js set tabs on 1 page. i'd run function on page prevent undefined not function console errors. how can include conditional if statement this? $(function() { $( "#tabs" ).tabs().addclass( "ui-tabs-vertical ui-helper-clearfix" ); }); so, like: if x page { $(function() { $( "#tabs" ).tabs().addclass( "ui-tabs-vertical ui-helper-clearfix" ); }); } if page has specific class assigned it, or element applies page, can it. this: $(function() { if ($('body').hasclass('classname')) { $('#tabs').tabs().addclass('ui-tabs-vertical ui-helper-clearfix'); } });

iphone - Cannot generate iOS App archive in xcode -

i have problem generating ios app archive application. application compiles fine , works in simulator. wanted make som ad hoc testing , cannot generate ios app archive. when click on product -> archive generates generic xcode archive. can me. should mention, have generated ios app archive of application. has stopped generate ios archive reason. lot. check build settings: skip install no main project target skip install yes framework (sub-projects) targets in build phases sub-projects, copy headers needs in project, not public (does not apply if building static library) installation directory under deployment valid (/applications example)

java - How can I return a 2 dimensions value to main method? -

// average of entire array private static int average(int[][] array){ (int row = 0; row < array.length; row++) { (int col = 0; col < array[row].length; col++) { int rowpcol= row*col; int average= sum(array) / (rowpcol); } } return average; } i getting error: exception in thread "main" java.lang.error: unresolved compilation problem: method average(int[][], int) in type hw8p1 not applicable arguments (int[][]) how can return method? the reason getting exception have compilation error in code. correct compilation errors before attempt run code. it in not clear causing compilation error. error message says attempting call method signature average(int[][], int) ... average method showed not have signature. i suspect have shown code doesn't match attempting compile , run. explanation have forgotten recompile it. either way, can't fix code if show wrong version of code. the compil

node.js - mup deploy killed on DO droplet but no errors in logs :( -

even redeploying deployed app doesn't work. monitored mup logs -f on separate terminal while deploying, nothing ever showed there. looks doesn't actual deploy step. have node 0.10.31 , meteor 1.0. else having problem or know how tackle it? ~# mup deploy meteor up: production quality meteor deployments ------------------------------------------------ building started: /root/ts bundling error: code=137, error: -------------------stdout------------------- -------------------stderr------------------- bash: line 1: 26400 killed meteor build --directory /tmp/2b45aa84-0ffc-4ece-9cf4-aca8500409c3 actually, errors relate bots, according previous posting on so errors not occur during deployment , should not problem. it turns out upgrading $5/mo, 500 mb droplet $10/mo, 1 gb droplet solved problem. addressed memory problem $5 droplet using memory swap , appears have run out of mileage. still, have been nice have errors in logs point me in right direct

java - How to serialize json to another json by preserving data types of key? -

i have original json string in have key , value shown below - { "u":{ "string":"1235" }, "p":"2047935", "client_id":{ "string":"5" }, "origin":null, "item_condition":null, "country_id":{ "int":3 }, "timestamp":{ "long":1417823759555 }, "impression_id":{ "string":"2345hh*" }, "is_consumerid":true, "is_pid":false } as example, 1 key "u" , value - { "string":"1235" } similarly key "country_id" , value - { "int":3 } now need is, need represent key value pair shown below. if value string data type (like value key u ), represent it's value in double quotes, otherwise don't represent it's value in double quotes. meaning value of country_id won't in string double

android - Simple Browser/Website web app mobile app/shortcut -

i have website/web app want make available on mobile devices. the website responsive , can used inthe mobile browser, want make available on google play / app store. question is: how create simple app browser, run natively on phone load web page in full screen? any simple solutions or frameworks? well there different approaches solve questions trying give rough idea following 2 approaches. easy , simple one 1) use web views , call home page url that's all. for better performance. 2) create rest apis required data mobile app . , use either web view or create own views , show user . in case if create native view app perform faster development take time.

javascript - Adding and removing stylesheets with webpack -

i'm interested in using webpack spa (i haven't used before), have several pages, each own bundle of js, css , html. firstly, there way remove stylesheets aren't being used using webpack? @ documentation , seems there isn't. example, have #wrapper div needs have width: auto pages, width: 100% page needs full screen. if modules require() stylesheets, keep being added html, , last 1 loaded have control on width , whereas want current page's stylesheet loaded. there way remove stylesheets using webpack? or there better solution problem? in addition, webpack have callback stylesheets? if need run code when css has loaded (i mean onload callback has fired, not when tag added html), there proper way of doing it?