Posts

Showing posts from January, 2012

ios - "Add New Constraints" why -16 on the left and right, and not 0? -

Image
ive noticed since xcode 6 , introduction of ios8 when go pin uiview type fill frame checkbox has -16 left , right, why not 0 . because want 0 spacing. wondering -16 come from? apple suggest margin inside uiview of 16pt inside. apple put prevent labels, images, etc.. in edges of screen. if want in edge have 2 ways 1-. add constraints -16 work, don't 2-. uncheck constraint margin, , have 0 this happened on main uiview i recommend uncheck 'constraint margin' if want view on both edges

Migrate existing third-party Django model to new customized model -

i'm using django-filer file handling. has abstract model baseimage , there default model images called image inherits baseimage , not abstract. also, package allows specify custom model images: hooks import of image model, checks filer_image_model setting , return custom model if it's specified instead of image . here code so, customizing easy -- inherited model customimage baseimage , specified necessary setting -- works fine. here comes trouble: how migrate existing data old models new ones? you need run data migration details of depend on models.

Mid line through a set of dicom images in matlab -

i have set of dicom images on matlab , add midline going through images outputting images via imshow3d function thanks edit: here's have, random points not in middle run through image >> clc; >>clear; >>%imports dicom images >>run dicomimport.m; >>%random points shortest distance test >>a = [1 10 200]; >>b = [500 512 300]; >>ab = b - a; >>n = max(abs(ab)) + 1; >>s = repmat(linspace(0, 1, n)', 1, 3); >>for d = 1:3 >> s(:, d) = s(:, d) * ab(d) + a(d); >>end >>s = round(s); >>z = 593; >>n = 512; >>x = zeros(n, n, z); >>x(sub2ind(size(x), s(:, 1), s(:, 2), s(:, 3))) = 1; >>c = find(x); >>ans.img(c) = 5000; >> %shows image >>imshow3d(ans.img); so looks ans.img contains 3d matrix consisting of image stack. looks you've got going, allow me bit differently. basically, need generate set of coordinates ca

machine learning - How does StackOverflow's tag suggestions work? -

i've got database of hundreds of thousands of forum posts, , tag them in unsupervised way. i noticed stackoverflow's tag system suggests tags go. how algorithm work? i found implies svm based- official? http://dl.acm.org/citation.cfm?id=2660970&dl=acm&coll=dl&cfid=522960920&cftoken=15091676 you follow shallow (authors call deep though) inverse regression using gensim , word embeddings document classification. ideally, using both titles , text of forum posts, should able build pretty decent classification system. follow along here in notebook , paper.

apache - Plesk is blocked on change the domain prefix -

i have plesk 12.0.18 on centos server. subscriptions works fine, 1 subscription have domain problem. when change domain prefix "www.mydomain.com" or "mydomain.com", still stuck "waiting...". when happens, rest of server still works fine, not let me make changes rest of subscriptions. i try edit apache vhosts, looks fine. please need help. i think there issues plesk databases , due process getting stuck. suggest please check panel error logs file or ask system admin check this.

android - How to programmatically change tab in MvxTabsFragmentActivity? -

Image
i use mvxtabsfragmentactivity in app. have 3 tabs. use button on tab @ number "3". when click button want switch tab number "1". use code: base.ontabchanged("1"); it work - content changes, selection remains of title on "3" tab. how make selection of title changed? i think problem calling ontabchanged directly instead of calling changes tab. there couple of approaches can use this. can tabhost , call tabhost.setcurrenttab(1) . also try getactionbar().setselectednavigationitem(0); . if using actionbar (which looks are). have seen this question ? may solve problem. if answer doesn't help, should post more of code (i.e. full mvxtabsfragmentactivity class) i/we can figure out specific issue(s). good luck!

phpstorm - On tab press move out of quotes - PHP Storm -

i have searched answer have came empty handed. want able use php storm same way aptana studio can press tab move cursor out of brackets or quotes. so if writing if statement , come end of it if($x != $y|) where pipe cursor , press tab moves cursor outside of parentheses so: if($x != !y)| is there setting missing accomplish this? this feature not supported, please vote ideabkl-6984

javascript - Clean way to test many conditions of different values? -

so , want test many conditions, different values... right bunch of if,else statements... but looks ugly im sure there must better way... any ideas ? im thinking maybe loops or putting vars in array, cant figure out how.. thx! var dataobject = {} if (newstate.playerid){ dataobject["filter[player_id]"] = newstate.playerid }else{ dataobject["filter[player_id]"] = this.state.playerid } if (newstate.pagelimit){ dataobject ["page[limit]"] = newstate.pagelimit }else{ dataobject["page[limit]"] = this.state.pagelimit } if (newstate.timefrom){ dataobject["time[from]"] = newstate.timefrom }else{ dataobject["time[from]"] = this.state.timefrom } if (newstate.timeto){ dataobject["time[to]"] = newstate.timeto }else{ dataobject["time[to]"] = this.state.timeto } if (newstate.gameid){ dataobject["filter[game_id]"] = newstate.gameid }else{ dataobject["filter[game_id]"

Android Service, do we have to use startService or BindService? -

i developping musicplayer app, , use local service make mediaplayer run in background. seems can either send intent start service or bind service. understand point of startservice, leave running , send intent stopservice, , bindservice, ibinder communicate service. however, i'm wondering what's point of doing this? have send intents make work? if retrieve static instance of service, , directly call methods, can implement both start , communicate it. i found example of not using startservice nor bindservice, works simple musicplayer. the fragment calls service: https://github.com/zacharytamas/spotify-sampler/blob/master/app/src/main/java/com/zacharytamas/spotifysampler/ui/playerfragment.java the service class: https://github.com/zacharytamas/spotify-sampler/blob/master/app/src/main/java/com/zacharytamas/spotifysampler/services/playerservice.java however, i'm wondering what's point of doing this? to have service running, tell os "hey, doing

.htaccess - Force HTTP for non WWW and WWW -

i'm trying force users http, don't want people access our site https. code below redirects http fine visits site https://www not https://website rewriteengine on rewritecond %{https} on rewriterule (.*) http://%{http_host}%{request_uri} [r=301,l] how make same thing when people enter url without www? site being forced www though wordpress. thanks! rewriteengine on rewritecond %{https} ^on rewritecond %{http_host} ^(www\.)?(.+) rewriterule (.*) http://%{http_host}%{request_uri} [r=301,l] ## expires caching ## <ifmodule mod_expires.c> expiresactive on expiresbytype image/jpg "access 1 year" expiresbytype image/jpeg "access 1 year" expiresbytype image/gif "access 1 year" expiresbytype image/png "access 1 year" expiresbytype text/css "access 1 month" expiresbytype text/html "access 1 month" expiresbytype application/pdf "access 1 month" expiresbytype text/x-javascript "access 1 month&quo

c++ - BitBlt Memory leak -

i using bitblt display bitmaps on buttons. of it, fine, there memory leak causes program crash after while. doing wrong ? int springboard::drawbasicbuttons(drawitemstruct* pdis, hinstance hinstance){ rect rect; static hbitmap hcurricon, hiconoff, hiconon; rect = pdis->rcitem; hfont font = createfont(13, 0, 0, 0, 300, false, false, false, default_charset, out_default_precis, clip_default_precis, default_quality, default_pitch, l"arial"); tchar txtstr[max_path]; bool istext = false; int textsize; if (idc_hold == pdis->ctlid) { hiconoff = (hbitmap) loadbitmap(hinstance, makeintresource(basic_holdoff)); hiconon = (hbitmap) loadbitmap(hinstance, makeintresource(basic_holdon)); _tcscpy( txtstr, _t("hold ")); istext = true; if (pdis->itemstate & ods_selected) hcurricon = hiconon; else hcurricon = hiconoff; } hdc hdc = createcompatibledc(pdis->hdc); sele

php - Send data (POST or GET) to server with Volley Lib in Android -

i've developed application i'm going send data phone server json , use volley library in android. can not send data server! my simple php code : $name = $_get["name"]; $j = array('name' =>$name); echo json_encode($j); my java code : private void makejsonobjectrequest() { mrequestqueue = volley.newrequestqueue(this); string url = "http://my-site-name/sampleget.php"; stringrequest jsonobjreq = new stringrequest( request.method.get, url, new response.listener<string>() { @override public void onresponse(string response) { log.d("result:", response); toast.maketext(getapplicationcontext(), response, toast.length_short).show(); } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror err

c# - Append DataVizualisation Chart Control to text file -

i'm developing system takes data input textboxes, , on button click, saves these values respective listbox ready written text file once process complete. the next stage has been using data create graphs, has gone i'm looking way add these onto end of text file it's included in 1 place. tried (included in total 'savetofile' function): consolefile.writeline(chartbp.text); //chart title chartbp.saveimage((filename), system.drawing.imaging.imageformat.jpeg); consolefile.writeline("\n\n"); this appeared work ok threw run-time error stating file not accessed because being used process. i don't think i'm far off need be, don't have enough experience charts know try next. have idea how make work, or method wouldn't produce error? appreciated! if problem rid of exception, this: consolefile.writeline(chartbp.text); consolefile.close(); filestream imgfile = file.open(

java - Change context language according to the current device language -

alright know it's okay have many languages in single app . couldnt find proper way . here want start , want activity detect android device language , change simple text "@string/hello" according . know method locale.getdefault().getlanguage() dont know how apply . secondly want give user option change language if wants . public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); locale.getdefault().getlanguage(); } here simple layout <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" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingt

javascript - How to local storage the table after adding rows in html using JS or angular Js? -

i have used code below link. http://codepen.io/akashmitra/pen/enrvko html <div ng-app="app" ng-controller="ctrl"> <table class="table table-bordered table-hover table-condensed"> <tr style="font-weight: bold"> <td style="width:35%">name</td> <td style="width:20%">status</td> <td style="width:20%">group</td> <td style="width:25%">edit</td> </tr> <tr ng-repeat="user in users"> <td> <!-- editable username (text validation) --> <span editable-text="user.name" e-name="name" e-form="rowform" e-required> {{ user.name || 'empty' }} </span> </td> <td> <!-- editable status (select-local) --> <span editable-text="user.company"

Eclipse gives error for 'undefined' Java function it can easily find -

i've been having trouble eclipse. i'm working on java project that's configured git. after submitting code through git, eclipse generates these errors, saying many functions undefined. functions still there, eclipse take me them when ctrl+click function. for instance have class: public class myclass { public myclass () {} public void myfunction () { //do stuff } } and have class uses it: public class secondclass { public void callfunction () { myclass = new myclass(); a.myfunction(); } } the myfunction call in secondclass causes 'undefined' error in eclipse. i've tried refreshing project doesn't make difference. way i've found eclipse behave correctly comment out function can't find, uncomment it, , save file. there better way this? or prevent eclipse having problem? sounds going wrong eclipse. when happens typically following. (continue next bullet if previous did not help): r

nosql - Firebase Rules Flat structure for stores, user, products relationship -

i try build firebase datastructure. come sql world , have problems understanding nosql datastructur. i have datastructure stores. each store has datafields storename, address , on. store should have users object storing users work in store , able add new products , modify them. there dataobject stores products , products should have relation users(stores). can give me hint how build flat possible? my data structure right now: "rules": { "users": { "$uid": { ".write": "auth !== null && auth.uid === $uid", ".read": "auth !== null && auth.provider === 'password'" } }, "products": { "$uid": { ".write": "auth !== null && auth.uid === $uid", ".read": true } }, "stores": { "$uid": { ".write": "auth !== null

javascript - parse.com "error: unauthorized" when trying to save object -

i using masterkey yet still getting unauthorized error when trying save object. can figure out why? can see "started making ticket" gets logged. , request.params pull correct information. also, side question...i under impression if response.error executed stops code, send error message function called cloud code , run error handling there. have console.log error message in cloud code, , error alert in function called it. getting console log show, not alert. assumption wrong in doesnt passed, , terminates entire thing upon executing response.error? parse.cloud.define("createrecord", function(request, response) { var caseclass = parse.object.extend("cases"); var ticket = new caseclass(); console.log("started making ticket"); ticket.title = request.params.title; ticket.category = request.params.category; ticket.priority = request.params.priority; ticket.description = request.params.cmnts; ticket.save(null, {us

ember.js simple-auth with django rest: No authenticator for factory "simple-auth-authenticator:django-rest-auth" could be found -

i'm trying ember work ember-simple-auth ( https://github.com/simplabs/ember-simple-auth ) , django-rest-auth ( https://www.npmjs.com/package/ember-cli-django-rest-auth ) looks i'm missing something.. i keep getting "uncaught error: assertion failed: no authenticator factory "simple-auth-authenticator:django-rest" found!" , i'm not sure i'm missing. basically followed example https://github.com/simplabs/ember-cli-simple-auth-example , replaced authenticator django-rest-auth , added initializer ember-cli-django-rest-auth docs. any ideas i'm missing? if there's working example of ember-cli-django-rest-auth great. thanks! edit: added config environment.js env.app.api_host = 'http://localhost:8000'; env.app.api_namespace = 'chat/api'; env['simple-auth'] = { authorizer: 'authorizer:django-rest', servertokenendpoint: 'http://localhost:8000/api-token-auth/', crossoriginwhitelist:

javascript - google map marker from database using php sql -

i have code populate markers database on google map , it's not working ,the xml file working , referred https://developers.google.com/maps/articles/phpsqlajax_v3 , of no use. markers.php code <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "jainmunilocator"; $connection=mysqli_connect($servername, $username, $password, $dbname);; if (!$connection) { die("connection failed: " . mysqli_connect_error()); } $sql = "select name,id,lat,lng muni_location,munishri mid=id"; header('content-type: application/xml'); $result=mysqli_query($connection,$sql); $dom = new domdocument("1.0"); $node = $dom->createelement("markers"); $parnode = $dom->appendchild($node); if (mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)){ if(isset($row['id'])){ $id = $row['id']; } if(isset($row['name'])){ $name = $row['n

android - How to clear history of an activity when i use onActivityResult -

i capturing multiple pictures using camera intent in activity (say activity b). onactivityresult not called if add android:nohistory="true" or android:launchmode="singleinstance" . then, may know clear activity history in application. because whenever hit button opened activity (say activity a) same activity keep calling.. know can able call activity in activity calling activity b non-activity extends pageradapter fullscreenimagedisplay. please check below code. @override protected void onactivityresult(int requestcode, int resultcode, intent data) { switch(resultcode) { case result_close_all: setresult(result_close_all); finish(); } super.onactivityresult(requestcode, resultcode, data); } let me know if code may or not.

Android facebook login callback not happening -

i'm trying implement facebook login android app using facebook sdk 4.1.0. loginbutton placed inside splashactivity , upon successful login should start mainactivity. however, facebook callback method not runnning @ me , can't figure out causing this. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); facebooksdk.sdkinitialize(this.getapplicationcontext()); setcontentview(r.layout.activity_splash); callbackmanager = callbackmanager.factory.create(); cache = new diskbasedcache(getapplicationcontext().getcachedir(), 1024 * 1024); network = new basicnetwork(new hurlstack()); mrequestqueue = new requestqueue(cache, network); getuserinfo(); skip = (button) findviewbyid(r.id.btnskip); skip.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent done = new intent(getbasecontext(),mainactivity.class); startactivity

python - NameError: global name 'win32netcon' is not defined -

hey i'm trying run scripts in python 2.7 , i've downloaded matching python windows extension package. reason i'm still getting error. know can download win32netcon? win32wnet.wnetaddconnection2(win32netcon.resourcetype_disk, nameerror: global name 'win32netcon' not defined you need import win32netcon first. import win32wnet, win32netcon win32wnet.wnetaddconnection2(win32netcon.resourcetype_disk, password, username, flags)

xcode - advantage and disadvantage developing app programmatically without storyboard and xib -

what advantage , disadvantage not using storyboard , xib. building application without using storyboard , xib, happen if project build programatically. storyboards dont speed development, identify ux issues , overview of current ux of application. software should built future in mind , storyboard allows entry point project other developers or designers, yourself, if reason left project while. having in code or xib files wastes time, great documentation slower process visual layout of apps ui. xibs on own can cause design issues. for performance, storyboards optimized. overall name suggests, visual story or flow app. should split different functionality of app different storyboards e.g. if have side menu loads different view stacks, use different storyboards needed. obviously not 1 or other storyboards , code, depends on situation, might use xib here , there. software dynamic , new ideas come about, not have fixed solutions, boring.

Is there any way to read one image row/column into an array in Python? -

i've translated ct reconstruction software idl python, , first experience ever python. code works fine except it's much, slower. due, in part, fact idl allows me save memory , time reading in 1 row of image @ time, using following: image = read_tiff(filename, sub_rect = [0, slice, x, 1]) i need read 1 row each 1800 different projection images, far can tell can create image array reading in entire image , converting array. there trick read in 1 row start, since don't need other 2047 rows? it looks tifffile.py christoph gohlke ( http://www.lfd.uci.edu/~gohlke/code/tifffile.py.html ) can job. from tiffile import tifffile tifffile('test.tiff') tif: page in tif: image = page.asarray(memmap=true) print image[0,:,:] if interpret code correctly extract first row of every page in file without loading whole file memory (through numpy.memmap).

Project-specific print margin in Eclipse -

the print margin can set opening preferences , going general-->editors-->text editors . default value there 80 columns. the 80-column value fine me i'd override specific projects. going properties of project found nothing related it. possible @ all? no, there 1 preference value , global rather per project. see preference page source org.eclipse.ui.internal.editors.text.texteditordefaultspreferencepage

node.js - npm path and installation issues - suggestions -

Image
i have used install nodejs on d:\ drive instead of c , have set environment variables d drive node & npm folders. then changed npm installation path "prefix=d:\node\node_modules\npm " on "npmrc" file. confirm user based modules pointing on d drive npm folder instead of appdata. i tried install express js globally , used check package tree on cli mentioned below, npm ll -g while trying command getting npm extraneous err, please suggest me way have use npm path , installation stuffs. thanks in advance. it might seem idea install packages globally, 1 great reason not to. often used packages express , , cookies should kept local package. because of versioning issues. might have 1 package using express2 , new 1 wants use express3 . have trouble if global install. when in doubt leave off -g , , use --save instead. (this adds package npm dependencies list.) on other hand, command line tools mocha , yeoman , , uh not else know of should i

google app engine - How to update one property for multiple NDB entities? -

i have ndb model class below: class contest(ndb.model): end_date = ndb.dateproperty(required=true, indexed=true) ended = ndb.booleanproperty(required=false, indexed=true) ... i have daily cron job mark contests passed end_date ended equal true . i've written following code it: contests = contest.query() current_datetime = datetime.datetime.utcnow() today = datetime.date(current_datetime.year, current_datetime.month, current_datetime.day) contests = contests.filter(contest.end_date < today) contests = contests.filter(contest.ended == false) contests = contests.fetch(limit=10) contest in contests: contest.ended = true ndb.put_multi(contests) but don't it, since have read entities update 1 value. there way modify read keys_only ? the object data overwrites existing entity. entire object sent datastore https://cloud.google.com/datastore/docs/concepts/entities#datastore_updating_an_entity so cannot send 1 field of entity, "remov

Java static reference vs dynamic reference and calls -

here post 2 simplified versions of code (but self sufficient, don't need know other variables , on). i need class including problem import class synchronous_writing package. need class static various classes must call , modify object created @ first subsequently, , not option pass data 1 class make code unreadable... this class public, still access current class involve problem described below version below. advance help. backbone of synchronous_writing: public final synchronous_writing { public synchronous_writing() { // variable initialize } public static void writer () { //operation performed } } 1st version: import synchronous_writing; public classfiletoedit_parser { // public static final class synchronous_writing syncedwriter ; // note editor; ";", not { public filetoedit_parser ( string inputfile_filetoedit, string outputfile_editedfile, charset charset, string hitlist_fieldsseparator,

rubygems - Deploying blog with Octopress on github -

Image
what i'm doing: i have been trying deploy octopress blog using github host , jekyll , liquid designing purpose. have installed necessary file gitbash windows , jekyll , octopress ,rubygem , devkit. can see blog preview using 'rake preview' , coming fine should. 'rake generate' , 'rake deploy ' worked fine on gitbash , gave me positive reply. am unclear 3 things: do have copy _deploy folder github repository. getting 2 error on gitbash: 1.change machine code 65001(for have used chcp 65001 on cmd) 2.permission denied on public key when using rake deploy command. also see ruby gem error polling changes , have use ctrl+c out of terminal can give many links tutorials if there's 1 can me practically socially;p real help. also when on source folder gitbash typed git push -u origin master getting following 2 errors.

mysql - SQL GROUPBY & SUM OF A COLUMN -

i have table below structure +------------+--------+------------------+-----+ | e_date | client | time | ins | +------------+--------+------------------+-----+ | 2015-06-04 | coma | 0.00478515625 | a1 | | 2015-06-04 | coma | 0.0025390625 | a1 | | 2015-06-04 | coma | 0.0 | a1 | | 2015-06-04 | coma | 0.0 | a1 | | 2015-06-04 | comb | 0.0115234375 | a2 | | 2015-06-04 | comb | 1.953125e-4 | a2 | | 2015-06-04 | comb | 0.0103515625 | a3 | | 2015-06-04 | comb | 0.0 | a3 | | 2015-06-05 | coma | 0.00478515625 | a4 | | 2015-06-05 | coma | 0.0025390625 | a4 | | 2015-06-05 | coma | 0.0 | a1 | | 2015-06-05 | coma | 0.0 | a2 | | 2015-06-05 | comb | 0.010351 | a1 | | 2015-06-05 | comb | 0.05625 | a1 | +------------+--------+------------------+-----+ i looking following output - +------------+--------+-----+-------------------

javascript - Fixing cross domain issues on a 360 canvas createjs gallery -

i trying fix cross domain errors on example http://cssdeck.com/labs/ze8jtaqe ^ using old version of easiljs lib - tried start updating lib - breaks application. if loading images cross-domain, taint canvas. since loading them images (tag loading), can @ least loaded , displayed despite being on different domains. if using xmlhttprequests (or xhr, preloadjs uses default), fail load entirely. in case recommend people use tag loading in preloadjs loadqueue (as @theoldcountry said above). to load images easeljs stage, , interact stage (including mouse interactions, filters, etc), image must include cross-origin response header (more info on cors here ). once served, must set crossorigin property on image: var image = new image(); image.crossorigin = "anonymous"; image.src = "http://etc.png"; without crossorigin property, errors in canvas, , without server providing cors header, different error, same result. note preloadjs supports cors well,

python - Access response from spider in items pipeline in scrapy -

i have spider class productsspider(scrapy.spider): name = "products" allowed_domains = ["example.com"] start_urls = [ 'http://example.com/url' ] def parse(self, response): and have pipeline class class productsdatapipeline(object): """ item pipeline products data crawler """ def process_item(self, item, spider): return item but want response argument of parse function in parse_item function without setting attribute item object,is possible no it's not possible. responses not forwarded pipelines. either have store response in item or use external storage store response , fetch in pipeline. second option better, , avoids many problems can result storing response in item (e.g. memory problems). example save response form of storage in parse callback, save reference storage in item field, , fetch response storage in pipeline. but depends on trying do, re

javascript - D3: Create bar for only one string in my json -

i want create bar graph 1 of strings in json. here example of json: var fruits = [{ kind: "grape", color: "red", quantity: 12, tasty: true }, { kind: "kiwi", color: "brown", quantity: 98, tasty: true }, { kind: "banana", color: "yellow", quantity: 0, tasty: true }]; now, want create single bar in graph quantity. is possible or should reformat data? the length of bar should mean of values. here code far: d3.select("svg").selectall("p") .data(fruits) .enter() .append("rect") .attr("x", 0) .attr("y", 0) .attr("width", 20) .attr("height", function(d, i) { return d3.mean(fruits, function(d) {return d.quantity * 20}) }); that sort of gives me "one" bar right length. it's 3 bars stacked

asp.net - How to download an excel Sheet With a Dialog Box? -

i wanted show dialog box user save file prefers to. , had written code achieve this. byte[] filebytes = system.io.file.readallbytes(excelpath); system.web.httpcontext context = system.web.httpcontext.current; context.response.clear(); context.response.clearheaders(); context.response.clearcontent(); context.response.appendheader("content-length", filebytes.length.tostring()); context.response.contenttype = "aapplication/xml"; context.response.appendheader("content-disposition", "attachment; filename=" + excelpath); context.response.binarywrite(filebytes); this downloading directly excel sheet directly without dialog box, i'm having no clue why not showing me dialog box. excel sheet of .xlsx format

jquery - Get select2 4.0.0 ajax response data -

i have more fields associated select2 beside id , text , can't them way did in version 3.5.2 (i'm using version 4.0.0 now): var id = $('#something').select2('data').id; var name= $('#something').select2('data').text; var email= $('#something').select2('data').email; i found id , text: var id = $('#something').val(); var name = $('#something').text(); but must other fields associated , i'm not finding way. note: select2 filled via ajax request database table , checked json data correctly returned data.

ios - "Size to Fit content" in Interface Builder only works sometimes? -

"size fit content" in interface builder works sometimes? how come? 2 seemingly exact button, different images (from asset catalog), 1 of them can autoresized while other cannot; size fit content greyed out 1 of them. update: 2nd button time, restarted xcode , magically works... normal? the menu option greyed out if item has been sized fit. if want test this, change content width or height. deselect , reselect item (the menu seems update when select item) check menu item. no longer greyed out.

oop - How can I retrieve properties from this object by PHP? -

this question has answer here: php access object property @ @ rate symbol 1 answer i have object responded expedia api. [surcharges] => stdclass object ( [@size] => 1 [surcharge] => stdclass object ( [@type] => taxandservicefee [@amount] => 9.59 ) ) how can retrieve @type và @amount properties. i tried width surcharges->surcharge->type or surcharges->surcharge->@type not success try surcharges->surcharge->{"@type"}

java - Elastic Search: Combining multiple search results -

i have tricky case dont know how solve. i have 2 queries: q1 , q2 2 queries result in r1 , r2 each of results sorted in special order. as overall search result want return concatenation of r1+r2 before returning application. the reason break pagination if later. any idea? probalby easy question stuck on this... ps: we experimented sorting first priary sort criteria , score.. score breaks first sort criteria somehow cant score working within bucket. you can boost fruits factor, score higher vegetable score, yet preserving order. can simple weight function score query put /test post /test/fruits/1 { "field": "hello world" } post /test/fruits/2 { "field":"hello" } post /test/veges/1 { "field": "hello world" } post /test/veges/2 { "field":"hello" } post /test/_search { "query": { "function_score": { "query&quo

javascript - REGEX to capture sentences with quotes -

i having trouble putting regex match quotes , sentences. here (simplified) specs trying meet: a sentence chain of characters followed punctuation mark (a dot, keep things simple) or newline. a quote chain of characters between 2 " . each sentence should new match. a sentence can contain quotes, , quotes can contain sentences. last sentence in quote should end capture. so far have come this: \s*((?:("[^"]*")|[^.\n])*\.+"?)\s* test case: regex101 as can see can't separate quotes sentences. example: §2: "your lordship," mya informed lord robert, "lady waynwood’s banners have been seen hour down road. here soon, cousin harry. want greet them" should full match, regex gives me 3 , captures next paragraph. §3: "they invited," said uncertainly, "for tourney. don’t..." should stop full match , regex goes on capture alayne closed book. i can't figure out going wrong, appreciated. edit: desired ou

sql - Use DateDiff function to match two colunms -

i have following check: '20'+convert(char,tc.transactiondatestamp,12) = pr.dateout , substring(tc.transactiontimestamp,1,2) + substring(tc.transactiontimestamp,4,2) + substring(tc.transactiontimestamp,7,2) = pr.timeout this works, if time in tc.transactiontimestamp different pr.timeout 5 seconds doesnt match. need put in check allow these 2 match if time diff 30 seconds. any appreciated, thank you. is this? '20'+convert(char,tc.transactiondatestamp,12) = pr.dateout , substring(tc.transactiontimestamp,1,2)+substring (tc.transactiontimestamp,4,2)+substring (tc.transactiontimestamp,7,2) between pr.timeout , pr.timeout+30

AngularJS syntax error on expression when using add/subtract operators -

i have element below : <a class="previous i-previous fa fa-caret-left" href="" ng-click="setpage(currentpage-1)" ng-hide="currentpage == 0"> </a> i had code working have exception : error: [$parse:syntax] http://errors.angularjs.org/1.2.26/ $parse/syntax?p0=undefined&p1=is%20unexpected%2c%20expecting%20%5b)%5d&p2=null&p3=setpage(currentpage&p4=setpage(currentpage the code causes exception : ng-click="setpage(currentpage-1)" when removed -1 works seems problem part. what might cause of exception? edit : i have code in controller : $scope.currentpage = 0; $scope.setpage = function (page) { $scope.currentpage = page; }; it caused batarang in chrome, disable or use other browser test, or use incognito mode. https://stackoverflow.com/a/31006278/5039495

java - What type returns the get method? -

if type variable wildcard, return type of method be? public class myclass{ } list<? extends myclass> nms = new arraylist<myclass>(); nms.add(new myclass()); //compilation error myclass n = nms.get(0); //compiles fine the thing return type of get not pure myclass type. eclipse's telling me it's cap#2 , argument of add method cap#1 cap#2 subtypeof myclass , myclass not subtypeof cap#1 ? so, i'm interested compiler captured type in class hierarchy? if create public class mysubclass extends myclass{ } will cap#2 subtype of mysubclass either? no, <? extends myclass> unknown class extends myclass (can myclass itself). there no guarantee has relationship mysubclass . replace myclass number , mysubclass bigdecimal . have <? extends number> . long . long has nothing bigdecimal (even though both extend number ). as 2 methods, get return myclass . add accept instances of unknown type (and since compiler cannot enfo

Making a HTML/CSS code work for all resolutions? -

i have html mixed css index.html code don't know how can make work resolutions. way it's coded, seems hard make changes perhaps not doing right. could me out achieving desired result? <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>welcome ro server</title> <meta name="generator" content="wysiwyg web builder 8 - http://www.wysiwygwebbuilder.com"> <style type="text/css"> body { height: auto; background-color: #000000; background: url(images/background.jpg) no-repeat; color: #000000; background-size: 100%; } </style> <style type="text/css"> { color: #c8d7eb; text-decoration: underline; } a:visited { color: #c8d7eb; } a:active { color: #c8d7eb; } a:hover { color

appbar - Windows Phone 8.1 BottomAppBar disappeared after resuming or navigating to another page -

i have bottomappbar declared in xaml 1 listpage , bottomappbar in reportspage. when app resuming bottomappbar disappeared , it's disappeared when i'm navigating listpage reportspage using messagedialog control. listpage: <page.bottomappbar> <commandbar x:name="bottomapplicationbar" loaded="frameworkelement_onloaded"> <appbarbutton x:name="addappbarbutton" isenabled="true" label="{binding [select_button], source={staticresource localizedstrings}}" icon="edit" /> <appbarbutton x:name="refreshappbarbutton" isenabled="true" label="{binding [refresh_button],source={staticresource localizedstrings}}" icon="refresh" /> <appbarbutton isenabled="false" x:name="settriptypebarbutton" label="{binding [triplist_bulkedit_set_trip_class], source={staticresource localizedstrings}}" visibility="

multithreading - how to extend Java Virtual Memory in CentOS? -

as wrote on title, want extend virtual memory while performing java code. currently, i'm writing code word analyzer. in eclipse if there 1000 number of inputs gives 1000 fine outputs. when run server, gives 80% outputs , 20% null. after asked problem know , said because of small size of virtual memory in server. i run java program .sh file , content of .sh file written below. export java_home="usr/lib/jvm/java-1.6.0-openjdk.x86_64" path=$path:java_home/jre/bin export java_home java -cp /home/account/count_con.jar countconversation.countcon_starter & and type "bash .sh file". please give me kind advice how run java code virtual memory size in server(os:centos). thank you after java command set flag -xmx size m fyi xms initial java heap size xmx maximum java heap size xss java thread stack size

Git: add stage description -

Image
my short question - there possibility add description (message) staged files? alternative "git commit -m "fancy message goes here"". thanks. staged files purely local repo , not available review (because nobody else have access local repo) commits, on other hand, can pushed , reviewed. typically on gerrit server , allow reviews , votes, , either reject commits, , push them in turn target repo, in "guarded commits" way.

html - Remove border from image in Internet Explorer -

does know how remove light border border shown around glyphicon in internet explorer in example.in chrome not display. http://www.prepbootstrap.com/bootstrap-template/iconpanels alternatively use box-shadow instead of border : .icon { text-align: center; position: relative; } .info { margin-top: -24px; background: hsla(0, 0%, 0%, 0.04); border: 1px solid hsl(0, 0%, 88%); padding: 15px 0 10px 0; } .image { position: relative; z-index: 2; margin: auto; width: 76px; height: 76px; /* border: 7px solid hsl(0, 100%, 100%); */ line-height: 76px; border-radius: 50%; background: hsl(126, 37%, 55%); vertical-align: middle; -webkit-box-shadow: 0 0 0 7px white; -moz-box-shadow: 0 0 0 7px white; box-shadow: 0 0 0 7px white; } .icon:hover .image { -webkit-box-shadow: 0 0 0 7px black; -moz-box-shadow: 0 0 0 7px black; box-shadow: 0 0 0 7px black; } .image

c# - ASP.NET MVC 5 in AWS and MongoDb, 503 Service is unavaliable -

Image
i have web app in asp.net mvc 5 hosted in aws (elastic beanstalk). has load balancer 2 web servers (t2.medium). in other hand, have mongodb hosted in mongolab (database service) dedicated cluster plans, m1, 1.7 gb ram in aws too. i have simple web api (called throught javascript) inserting in mongodb click events of user (log info behaviour of user in web app). last week, had 1200 users connected @ same time, , after 10 minutes, server began response, 503. service unavaliable. if see telemetry monitor web server in aws, fine. cpu normal (about 20%), , servers up. i have read lot error (app pool of iis restarting because many errors in short time), in elmah log, don't find exceptions. i don't know origin of problem, , show telemetry of mongodb. can me please? regards. edit: have installed in ec2 instances windows server 2012 core edition iis 8 (no user interface)