Posts

Showing posts from May, 2013

Accessing TextView from other class in android -

hello new android.i creating simple google cloud appengine app endpoint.i using using tutorial https://github.com/googlecloudplatform/gradle-appengine-templates/tree/master/helloendpoints .but thing want show result in textview not in toast. layout.xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:id="@+id/lay1"> <edittext android:id="@+id/edt1" android:layout_width="match_parent" android:layout_height="100dp" android:hint="enter number" android:inputtype="number" android:textsize="24sp" /> <edittext android:id="@+id/edt2" android:layout_width="match_parent" android:layout_height="

excel - Cutting letters from alphanumeric cell entry, pasting to another cell -

how can set macro strip letters #####xx in column , put them in column l same row? thanks! assuming you're working first sheet , you're stripping off last 2 characters while leaving first 5 characters, following code work: public sub stripoff() dim irow integer irow = 2 'assuming row 1 headers, else make 1 while sheets(1).range("i" + cstr(irow)).value <> "" sheets(1).range("l" + cstr(irow)).value = right(sheets(1).range("i" + cstr(irow)).value, 2) sheets(1).range("i" + cstr(irow)).value = left(sheets(1).range("i" + cstr(irow)).value, 5) irow = irow + 1 wend end sub

javascript - Angular JS prevent controller from running on hidden element -

i have codes .state('foostate', { url: '/foo', templateurl: 'path/to/bar.html', controller:'parentcontroller' }) // bar.html <div class="sample"> <div ng-show="bazinga" ng-controller="child1controller"> <!-- cool stuff --> </div> <div ng-show="!bazinga" ng-controller="child2controller"> <!-- cool stuff --> </div> </div> is normal when first div controller child1controller shown, controller child2controller run? how prevent controller running if hidden via ng-show="false" ? need parentcontroller , child1controller controllers running when first div visible. same when 2nd div visible, parentcontroller , child1controller controllers should one's running. if i'm not mistaken, using ng-if rather ng-show should solve issue. difference being ng-if not render element dom when

exception handling - PHP finally clause -

what best practice simulate clause? realize considered related (though don't think it's duplicate) of this question . however, in case want handle exceptions, want use (or whatever php equivalent or practice) defined python: a clause executed before leaving try statement, whether exception has occurred or not. just loosely writing code after try-catch block seems ugly practice me. in rfc adding php , suggest workaround: <?php $db = mysqli_connect(); try { call_some_function($db); } catch (exception $e) { mysqli_close($db); throw $e; } mysql_close($db); so unless upgrade php 5.5 (which contain finally construct), best option.

Vimeo API php connection issues -

i utilizing vimeo api try , display videos. have set-up app on developer.vimeo.com/apps/, while creating authentication tokens app. have downloaded , included vimeo-php api found here , still having no luck display anything, let alone specific video, group, etc. have posted simple steps recommended on github authenticate vimeo believe missing along way. /*includeds @ top of file */ include("../vimeo/autoload.php"); //following variables developer.vimeo.com/apps/myappid $client_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; $client_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; $clienttoken = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; $lib = new vimeo($client_id, $client_secret, $clienttoken); $search_results = $lib->request('/videos', array('page' => 1, 'per_page' => 50, 'query' => urlencode($_get['query']), 'sort' => 'relevant', 'direction' => 'desc', 'filter'

c# - why WPF Window.Visibility binding must have Mode=TwoWay for property's get to be called? -

viewmodel: public floatingtoolbarwindowviewmodel(guiitems guiitems) { guiitemsinstance = guiitems; guiitemsinstance.host = host; guiitemsinstance.refreshvisibility = refreshvisibility; } private visibility _windowvisibility; public visibility windowvisibility { { return _windowvisibility; } set { //raises propertychanged-event setvalue(ref _windowvisibility, value); } } // check if of toolbars should in window , sets visibility public void refreshvisibility(int roleid) { if (guiitemsinstance.toolbaritems.any(i => i.toolbarlocation == toolbarlocation.float && i.roleid == roleid)) windowvisibility = visibility.visible; else windowvisibility = visibility.hidden; } xaml: visibility="{binding windowvisibility, mode=twoway}" this means can never work because in end showwindow updates property vi

How do you animate while fetching data with redux and thunk? -

say have index page facebook list of friends. want pre-fetch first ten friends' profiles, when route 1 of profiles, application won't need make request. but want animate transition .x seconds profile page that, in case profile isn't loaded, don't see loading screen (hoping actual request return in less animation time). the tricky part me wrap head around is: when change route , re-render page actual profile (rather animation transitioning it). it seems set in stone router should concerned fetching data necessary, waiting, , rendering actual profile. it seems action creator must figure out when change route. , since seems route can changed after both transition and api call have finished, way can figure action creator looks like: function visit_profile(profile_id) { return (dispatch) => { download_promise = dispatch(download_profile(profile_id)); animation_promise = dispatch(transition_to_profile(profile_id)); return p

vb.net - COMException was unhandled Visual Basic 2010 error -

i following error message when running code; private sub submit_click(byval sender system.object, byval e system.eventargs) handles submit.click 'determine text inpu' dim ieapp shdocvw.internetexplorer dim iedoc object dim preurl string dim localfilename string dim errcode long ieapp = createobject("internetexplorer.application") ieapp .visible = false .navigate("http://mfreport.paho.org/barr/default.asp") while .busy : application.doevents() : loop **while .readystate <> 4** : application.doevents() : loop .document.forms("rptform") .jobname.value = job.text .usrname.value = user.text .jobdate.value = dtp.text .submit() .action.click() end while not cbool(instr(1,

Laravel 5.2 with session inside MongoDB. How to read the session data from an external PHP application? -

there 2 php applications : - application 1 based on laravel 5.2 - application 2 plain php both have connection same mongodb cluster. the session manager of application 1 using mongodb store session data. want able read session data application 2 in plain php. i tried same folder share session data. not better. someone haves idea ? thanks use laravel on both applications ;)

php - Querying inside of a for loop -

i wondering if there way doing more efficiently. right now, have class retrives statuses database. it's pretty simple , shouldn't effect performance much. public function ($var1, $var2, $var3) { $feed = array(); //initialize empty array //query database $statement = $this->database->prepare("select id, name, excerpt, post, timestamp, tags, title posts col1 = ? , col2 = ? , col3 = ? order id desc limit 15"); $statement->execute(array($var1, $var2, $var3)); while($row = $statement->fetch(pdo::fetch_assoc)) { $posts[] = array( "id" => $row["id"], /*etc...*/ ); } return $posts; } //end and page set know not efficient @ all: <?php ($count = 1; $count <= $total; $count++): //display calendar echo $count; $feed = $feed->get($count, $total, $var3); foreach ($feed $post): echo $post["id"]; endforeach; endfor; ?>

javascript - passing headers with ajax in jquery -

i have problem passing headers in ajax call on jquery. $.ajax({ url: '/resources/ajax/customize.aspx?' + qs + '&nocache=' + math.random(), contenttype: "application/json", headers: values, context: $this, cache: false, success: function(data) { //do stuff here } }); in cases, gets headers values right, doesn't headers value. made sure 'values' variable contains data. wondering there specific cases headers don't pass in ajax? update: tried as: $.ajax({ url: '/resources/ajax/customize.aspx?' + qs + '&nocache=' + math.random(), contenttype: "application/json", beforesend: function(xhr) { xhr.setrequestheader('values',values); }, //headers: values, context: $this, cache: false, success: function(data) { //do stuff here } }); and there no luck that. update 2 figured out problem. there url vari

jquery - php: converting an array of objects to pure array -

following array received @ server side : [{"id":"2","foo":"bar","children":[{"id":"4","foo":"baz","children":[{"id":"6"}]},{"id":"5"}]},{"id":"7"},{"id":"3"}] there way convert nested array this? [ ['id' => 2, 'foo' => 'bar', 'children' =>[ 'id'=> 4, 'foo' => 'baz' .... p.s: find out without using function have desired code format on server side. maybe because of sending data post request (using ajax) convert data array serialize , send , on server side have nice array same i'm looking for.im not sure ralated php or laravel or jquery !? array ( [0] => array ( [id] => 2 [children] => array ( [0] => array

x86 - Assembly coding with masm32 -

in assembly coding, working masm32. how can put value variable, not defiened @ .data segment, local decleration? thous: .486 .model flat, stdcall option casemap :none include \masm32\include\windows.inc include \masm32\macros\macros.asm include \masm32\include\masm32.inc include \masm32\include\gdi32.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc includelib \masm32\lib\masm32.lib includelib \masm32\lib\gdi32.lib includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib .data .code start: call main exit main proc local dewit:dword mov dewit, 0 print dewit ret main endp end start i tried this: mov dewit, 0 it didnt work. however, code: mov dewit, input("enter number") did put value it. anybody? ** local decleration can in procedure since using masm32 if trying print out 32-bit v

c# - Dropdownlists not populating with data from 3 separate reference tables -

currently working asp.net mvc 6 using ef7. using default controller generator. reason drop downs not populating data on create or edit page though data present. just clarify 3 select lists being populated 3 different tables connected main table adding to. here's got. controller code private readonly schoolcontext _context; public schoolscontroller(schoolcontext context) { _context = context; } public iactionresult create() { viewdata["districtid"] = new selectlist(_context.districts, "districtid", "district"); viewdata["locationid"] = new selectlist(_context.locations, "locationid", "location"); viewdata["tierid"] = new selectlist(_context.tiers, "tierid", "tier"); return view(); } view code @model school is included @ top , here 1 of select element looks like <div class="form-group"> <label asp-for="districtid" cla

c# - Change dataGridView Cell Formatting on button click (not on cell click) -

i coding hotel booking manager school project. need chceck if guest in hotel has checked in or chcecked out. if guest not chcecked in or chcecked out day writen in database, need change color of row, mark reservation needs atention. i trying find solution change cell formatting on button click(for now, later scheduled task). know how change cell formatting while loading data datagridview. i have been trying this datagridview1.rows[(int)myreader["id"]].style.backcolor = system.drawing.color.lightpink; but says there no style method, understand because method cellformatting class. i write code in cellformatting class, can't call on button click because don't know write between () sender , e. private void datagridview1_cellformatting(object sender, datagridviewcellformattingeventargs e) you can use defaultcellstyle property of datagridviewrow set style row, example: foreach (datagridviewrow row in datagridview1.rows) { //if criteria

android - When will a dynamically added fragment be re-added? -

the fragment documentation shows example of activity dynamically adding fragment in oncreate(...) : if (savedinstancestate == null) { // during initial setup, plug in details fragment. detailsfragment details = new detailsfragment(); details.setarguments(getintent().getextras()); getfragmentmanager().begintransaction().add(android.r.id.content, details).commit(); } this almost makes sense me, except 1 detail. thought reason checking savedinstancestate == null if activity being re-created, can expect framework re-add fragment us. however, thought framework if fragment has tag, , example uses version of fragmenttransaction#add(...) not take tag. understand it, if activity recreated, not have detailsfragment . is understanding wrong? , if framework re-add fragment, @ point in activity's lifecycle guaranteed have done so? i thought framework [ re-add fragment ] if fragment has tag no. according the documentation

Xamarin Forms: How do I implement WebSockets? -

we want transfer data client server in realtime, have decided go websockets. using xamarin.forms surprisingly difficult find suitable websocket library. the best match "websocket4net" because directly suggested on xamarin's homepage. not able install library, because supports versions of .net v4.0. (we using v4.5) whenever try change target framework of pcls v4.5 v4.0 loads of weird errors stating "windows.input library not found", "observablecollection not found" etc. so using library "websocket.portable.core", although lacking functionality worked out. reason can receive 1 message. event "messagereceived" called once. has heard such problem websockets? maybe time use library, can't find one? i can't find solution how implement websockets natively each platform. thanks in advance websockets.pcl has native implementation each platform , it's documented https://github.com/nventimiglia/websocke

Example of memory leak in c++ (by use of exceptions) -

in c ++ how program there paragraph say: a common programming practice allocate dynamic memory, assign address of memory pointer, use pointer manipulate memory , deallocate memory delete when memory no longer needed. if exception occurs after successful memory allocation before delete statement executes, memory leak occur. c++ standard provides class template unique_ptr in header deal situation. any on introduce me real example exception occur , memory leak like post ? class myclass { public: char* buffer; myclass(bool throwexception) { buffer = new char[1024]; if(throwexception) throw std::runtime_error("myclass::myclass() failed"); } ~myclass() { delete[] buffer; } }; int main() { // memory leak, if exception thrown before delete myclass* ptr = new myclass(false); throw std::runtime_error("<any error>"); delete ptr; } int main() { /

c - Reconstructing "flags" argument to mmap call -

one of arguments mmap flags . extent possible reconstruct flags used information in /proc/self/maps ? see details on /proc/self/maps in this question . some ideas (actually not full answer): map_private , map_shared flags may determined permissions column map_anonymous determined empty path some flags (probably map_hugetlb , map_locked ) may determined /proc/self/smaps some flags map_fixed (probably map_32bit , map_uninitialized ) not saved anywhere after mmap() returns some flags ( map_nonblock , map_noreserve , map_populate ) stored somewhere, don't think they're accessible through /proc hth

python - Kivy and external event loop -

i'd develop remote controlled framework running apps based on kivy. idea use podsixnet (or similar network layer client-server communication) remotely start/control/stop kivy apps. based on running external event loop (for network events), how take event loop of whatever kivy app want run kivy's responsibility? from kivy.app import app kivy.uix.button import button podsixnet.connection import connection, connectionlistener class app1(app): def build(self): return button(text='hello world 1') class app2(app): def build(self): return button(text='hello world 2') class client(connectionlistener): def __init__(self, *kargs, **kwargs): connectionlistener.__init__(self, *kargs, **kwargs) self.connect((kwargs['host'], kwargs['port'])) self.current_app = app1() self.current_app.run() def network_switchgame(self, data): """gets triggered if appropriate messag

Length of comprehensions in Python -

new @ python, please... just came across comprehensions , understand going possibly ramify perhaps dot products or matrix multiplications (although fact result set makes them more interesting), @ point want ask whether there formula determine length of comprehension such as: {x * y x in {3, 4, 5} y in {4, 5, 6}} . evidently don't mean particular one: len({x * y x in {3, 4, 5} y in {4, 5, 6}}) = 8 , of general operation of type element-wise multiplication of 2 sets, , taking result set of resultant integers (no repetitions), for given length of x , y, consecutive integers, , known x[1] , y[1] . i understand question @ crossroads of coding , math, asking here on off chance happened common, or well-known computational issue, since have read comprehensions used. in sense interested in question. base on comments far, sense not case. edit: for instance, here pattern: if x = {1, 2, 3} len(x * y) comprehensions equal 9 provided y[1] = or > 3 . example, len({x * y

Conditionally convert multiple formats of Date and DateTime string into JavaScript Date Object -

with little utility javascript function below can convert basic date string javascript date object. the date string can in multiple formats this... stringtodate("17/9/2014", "dd/mm/yyyy", "/"); stringtodate("9/17/2014", "mm/dd/yyyy", "/"); stringtodate("9-17-2014", "mm-dd-yyyy", "-"); what hoping expand allow conditionally strings have time in them 09:12:49 09:12:49am , 09:12:49pm so function below creates date object line... var formateddate = new date(dateitems[yearindex], month, dateitems[dayindex]); would have instead like... var formateddate = new date(dateitems[yearindex], month, dateitems[dayindex], hours, minutes, seconds, milliseconds); adding hours, minutes, seconds, milliseconds if detected in original string. would such task possibble code? // convert date string js date object // can parse multiple date formats // stringtodate("17/9/2014", &

matlab - Separating then stacking 3D mat files -

so have large amount of 2d mat files need stack, of files saved in 3d, i.e. 1024*1024*2. i'm struggling write while loop separate 3d files , stack them while stacking normal 2d files. function ndims(matrix) give dimension of matrix so, 3 dimensional ones can do: if ndims(a)==3 a=[a(:,:,1);a(:,:,2)] % stack 2 layers of matrix vertically end

swift2 - How do I delete a SKSpriteNode? -

i have figured out how create skspritenode when touch screen using touchesbegan method or touchesmoves method in xcode. what figure out how delete 1 node created when lift finger off screen. touchesbegan , touchesended methods of skscene called asynchronously. must hold sprite object create in touchesbegan in variable belonging skscene can still access when touchesended called. if have done that, removefromparent should work, why not set hidden , reuse same sprite next time user touches screen.

java - Web view in XML lying under main bar -

Image
i building app has webview configured in xml (fragment_recent_news) driven file (recent news), while webview configured meet main bar in xml (see picture), webview goes further under main bar should, though not following relative layout guidelines. doing wrong? fragment_recent_news(xml): <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.hardingsoftware.hrcfitness.recentnews"> <webview android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/webview" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_alignparentbottom="true" android:layout_alignparentright="true" android:layout_alignpare

ruby on rails - How to find which fields in a model should be set? -

i have ror application, , scaffold generation gave me new , edit actions model. in views, there _form.html.erb. form has inputs 2 fields happen attr_accessible no inputs fields created_at , updated_at , id . i want generate custom other forms , views models. want know how programmatically find fields should set manually, , fields set rails. if have model widget, widget.columns gives fields. how rails scaffold generation know fields put in form. also, there code determines how "created_at" , "updated_at" set? or done db? update :to clarify, want things specifically: i generating forms uploading large number of rows/entities. need know fields include in form. widget.accessible_atributes fields set manually? i need know fields include automatically. if use new method of model, created_at , updated_at , , id set automatically. want load 1000's of rows in table , sql load file command , think need set created_at , updated_at not id. how know fields s

python - joblib.Parallel running through spyder hanging on Windows -

i'm running python 3.5.1 on windows server 2013 @ work. have embarrassingly parallel tasks seem work on python 2.7 same code, unable figure out how run on python 3.5.1. i'm using anaconda 2.4.1 the code looks this... i've stripped down minimum. \ ->main.py \apackage\ ->__init__.py ->amodule.py code main.py from tpackage import aclass def go(): x = aclass().afunction() return x if __name__ == '__main__': x = go() print(x) code __init__.py from .amodule import aclass __all__ = ['aclass'] code amodule.py from joblib import parallel, delayed class aclass(object): def afunction(self): x = parallel(n_jobs=2,verbose=100)( delayed(add1)(i) in range(10) ) return x def add1(x): return x + 1 does have need if __name__ == '__main__': statement? didn't think need because parallel protected inside def statement , should run when __main__ module called,

java - Apache POI 3.13 Offline/Offset elements for a .doc -

Image
so have requirement validate generated .doc when content/ element paragraph or table pass page, , if element/content it's alone on other page need take element/content , put alone element/content public void investigardoc(xwpfdocument doc){ try { creaciondefooter(doc);//footer creation method xwpfparagraph cuerpoobservaciones = doc.createparagraph(); //paragraph 1 cuerpoobservaciones.setalignment(paragraphalignment.distribute); xwpfrun imprimeobservaciones = cuerpoobservaciones.createrun(); seccionobservaciones(doc,imprimeobservaciones,cuerpoobservaciones); //table creation method xwpfparagraph cuerpofirma = doc.createparagraph(); //paragraph 2 cuerpofirma.setalignment(paragraphalignment.center); xwpfrun imprimefirma = cuerpofirma.createrun(); seccionfirma(doc,imprimefirma,cuerpofirma); //signature creation method doc.write(new fileoutputstream("c:\\test.doc&quo

Assigning elements of a python list to a string -

how pass element of list string? str = categories[0] thanks. firstly; in case trying declare "i" string...python weakly typed language means not need declare variable types. instead of writing "int = 5" write "i = 5" if categories list of strings following: categories = ["categorya", "categoryb", "categoryc"] = categories[0] if categories not list of strings want convert value of 1 of index's of categories string following: categories = [128, 240, 380] = str(categories[0]) if ever need convert int (or possibly convert float) can use int(i) or float(i)

Extract values from raster ArcGIS 10.x -

i got vegetation raster. pixels have several fields (i.e. basal area oaks, density of oaks, volume of oaks, pixel value, etc). how extract selected field values set of xy points? the primary tool you'll working raster point (conversion toolbox). includes parameter pick field pull data from: the field parameter allows choose attribute field of input raster dataset become attribute in output feature class. if field not specified, cell values of input raster (the value field) become column heading grid_code in attribute table of output feature class. if want exclude values or subset data, can done either before converting (using con or similar) or after (select attribute , export or delete). doing afterwards gives bit more flexibility, leads larger point datasets.

javascript - Trying to make a button switch between two different values -

i don't know if sort of loop protection, want button when clicked toggles image on or off , code not working: <script> document.getelementbyid('standbybutton').onclick = function() { if (document.queryselector('#standby img').style.visibility = 'hidden'){ document.queryselector('#standby img').style.visibility = 'visible' } else { document.queryselector('#standby img').style.visibility = 'hidden' } return false; } </script> what missing? if image hidden, make visible. if else, make hidden. no? you're using assignment operator ( = ) , not comparison operator ( == or === ). edit: fyi, jslint (or similar) have caught this.

c# - Custom message box show time expiring before it runs out WinForms -

i have custom message box class : public class autoclosemsb { readonly system.threading.timer _timeouttimer; readonly string _caption; private autoclosemsb(string text, string caption, int timeout) { _caption = caption; _timeouttimer = new system.threading.timer(ontimerelapsed, null, timeout, system.threading.timeout.infinite); messagebox.show(text, caption); } public static void show(string text, string caption, int timeout) { new autoclosemsb(text, caption, timeout); } private void ontimerelapsed(object state) { intptr mbwnd = findwindow("#32770", _caption); if (mbwnd != intptr.zero) sendmessage(mbwnd, wmclose, intptr.zero, intptr.zero); _timeouttimer.dispose(); } private const int wmclose = 0x0010; [system.runtime.interopservices.dllimport("user32.dll", setlasterror = true)] private static extern intptr findwindow(string

evaluate the value of a expression in java using beanshell by passing variable to Math.pow( ) -

i trying evaluate expression in java directly, though easy expression , seems difficult me using beanshell anyway , problem: i can directly evaluate value of exponential using in java double c = math.pow(2,3); or way int a=2,b=3; double c = math.pow(a,b); in beanshell trying same , works: import bsh.interpreter; interpreter interpreter = new interpreter(); int a1=2, b1=3; string equation = "math.pow(2,3)"; object checkit = interpreter.eval(equation); system.out.println(checkit.tostring); but these lines dont work: string equation = "math.pow(a1,b1)"; object checkit = interpreter.eval(equation); system.out.println(checkit.tostring); **this progress ** update : code shows me error message sourced file: inline evaluation of: ``math.pow(finalstr,2);'' : undefined argument: the beanshell script not have access java local variables. script can see values have been given beanshell interpreter using of set() methods: import bsh

ios - Why the two CGRect don't intersect when they do visually? -

Image
i building app. needs accept user input uitextfield s. , keyboard hide text field need move view when keyboard cgrect intersects text field's frame . i followed this tutorial added of own logic because have multiple text fields. here relevant code: (the whole thing in vc conforms uitextfielddelegate ) var focusedtextfield: uitextfield? var viewmovedup = false var keyboardsize: cgrect! override func viewdidappear(animated: bool) { super.viewdidappear(animated) nsnotificationcenter.defaultcenter().addobserver(self, selector: selector("keyboardwillshow:"), name:uikeyboardwillshownotification, object: nil); nsnotificationcenter.defaultcenter().addobserver(self, selector: selector("keyboardwillhide:"), name:uikeyboardwillhidenotification, object: nil); nsnotificationcenter.defaultcenter().addobserver(self, selector: selector("onrotate:"), name:uideviceorientationdidchangenotification, object: nil); } override func viewdiddisapp

Angular 2 Quickstart App Throwing Errors -

when run code "5 min quickstart" https://angular.io/guide/quickstart here code i'm running , npm-debub.log https://gist.github.com/140173804bb527b5ed20 file structure: 2angular/ tsconfig.json package.json index.html app/ app.components.ts boot.ts do know what's going on? get both ts files inside of app folder or change system configuration not them in there: system.import('app/boot') and make sure running npm install before npm start

ios - UIImage Caching cause memory high -

Image
consider: +(nullable uiimage *)imagenamed:(nsstring *)name; i use method so: uiimage *image = [uiimage imagenamed:@"test"]; but image's type png. in project, loads lot of different images. so, cache hight your images huge. 3001*4057 12 million pixels. theres 3 bytes in 1 pixel (one byte red, green , blue each), image size have 12million * 3 bytes, 36mb per image. i scale down image size if can.

javascript - create dynamically buttons to show dialog -

i have button (create) , when it's clicked, creates new button (change coordinates) should able open dialog when it's clicked. first of created body of dialog window, created via javascript, how looks in html: <div id="dialog-form" title="change coordinates"> <p class="validatetips">both fields required.</p> <form> <fieldset> <label for="lon">longitude (decimal)</label> <input type="text" name="lon" id="lon" value="" class="text ui-widget-content ui-corner-all"> <label for="lat">latitude (decimal)</label> <input type="text" name="lat" id="lat" value="" class="text ui-widget-content ui-corner-all"> <input type="submit" tabindex="-1" style="position:absolute; top:-1000px"> </fieldset>

javascript - Handlebars loop to assign value to attribute -

i have values of array length dynamic. have image holder of 4. means if length of array 2, have 2 filled holder , left 2 empty holder. unfilled holder div i've tried below code doesn't suite needs, because produce div according length of arrays. {{#each product.image}} <div style="background-image:url(http://example.com/{{this}})"></div> {{/each}} <div></div> <div></div> <div></div> if want max number of 4 divs, filled data there , left empty if no data can use custom helper function: handlebars.registerhelper('times', function (index, options) { var result = ''; for(var = 0; < 4; i++) { if(options.data.root.product.image[i]){ result += '<div style="background-image:url(https://upload.wikimedia.org'+options.data.root.product.image[i]+')"></div>'; } else { result += '<div>empty div</div&g

Generating big sitemap, using MySQL and PHP -

i've made simple sitemap.php , generates sitemap.xml , using sitemap.xsl theme - it's populated mysql database. everything works, have 4,000,000+ products, , takes long time, , lot of memory, generate it. does have idea, how can make better performance? sitemap.php: http://pastebin.com/gm3sa4bs sitemap.xsl: http://pastebin.com/wvuuwt99

python - Use argparse to parse a list of objects -

i have program function takes class initializer , list of objects. each object consists of 3 variables id, value, , tag. class package(): def __init__(self, id, value, name): if (value <= 0): raise valueerror("amount must greater 0") self.id = id self.value = value self.tag = tag class purchase(): def submit(some_list): //do stuff def main(): //help here! parser = argparse.argumentparser() parser.add_argument("id", help="id") parser.add_argument("value", help="value") parser.add_argument("tag", help="tag") args = parser.parse_args() some_list = [args.id, args.value, args.tag] submit(some_list) i'm trying implement argparse in main() can run program doing like: python foo.py "int0 [(int1, float1, int2), (int3, float2, int4) ....]" . number of objects in list variable , depends on user input. i

java - Why doesn't pass-by-refernce work? -

this question has answer here: is java “pass-by-reference” or “pass-by-value”? 74 answers i understand passed reference in java. why doesn't work in case? had thought should print out "hate" instead of "love". class test { static class str { public string str; public void set(string str) { this.str = str; } } public static void main(string[] args) { str s = new str(); string str = "love"; s.set(str); str = "hate"; system.out.println(s.str); } } in main function, str stores reference string. when doing str = "hate" , reference changes original object "love" has been stored in s.str , remains there. see this more clarification.

javafx - Intelliguard, the YGuard based Obfuscation plugin for IntelliJ, seems totally awesome, but fails to work, and gives "Icon cannot be found" error -

intelliguard, yguard based obfuscation plugin intellij, seems totally awesome, fails work, , gives "icon cannot found" error. https://plugins.jetbrains.com/plugin/4511?pr=idea https://code.google.com/p/intelliguard/ after installing intelliguard plugin, awesome way, @ last step of configuration steps, there error: icon cannot found in '/nodes/moduleclosed.png', aclass='class com.github.intelliguard.ui.jaroptionsform' there material on error: https://github.com/ronniekk/intelliguard/issues/1 that material, @ bottom, mentions newest commit, , 1 guy able create working plugin.jar it. newest commit: https://github.com/olehrgf/intelliguard/tree/intellijidea13.1 this seems great solution current obfuscators, because free , configurations handled simple use gui. any in getting work appreciated.

python - turtle delete writing on Screen and Rewrite -

in code, under function, do: t = turtle.turtle() t.write(name, font=("arial", 11, "normal"), align="center") but when change screen, want delete text, , rewrite somewhere else. know "easy way out" of clearing whole screen. there way delete writing? i have tried drawing white square on text, did not work. has tried different? at first, thought simple matter of going same location , rewriting same text in same font using white ink. surprisingly, left black smudge , took 10 overwrites in white make presentable. however, came upon better solution, use separate turtle write text want dispose of , clear turtle before rewriting text in new position, else on screen, drawn different turtle, remains: import turtle import time def erasablewrite(tortoise, name, font, align, reuse=none): eraser = turtle.turtle() if reuse none else reuse eraser.hideturtle() eraser.up() eraser.setposition(tortoise.position()) eraser