Posts

Showing posts from May, 2011

arrays - Identify vectors with same value in one column with numpy in python -

i have large 2d array of vectors. want split array several arrays according 1 of vectors' elements or dimensions. receive 1 such small array if values along column consecutively identical. example considering third dimension or column: orig = np.array([[1, 2, 3], [3, 4, 3], [5, 6, 4], [7, 8, 4], [9, 0, 4], [8, 7, 3], [6, 5, 3]]) i want turn 3 arrays consisting of rows 1,2 , 3,4,5 , 6,7: >>> array([[1, 2, 3], [3, 4, 3]]) >>> b array([[5, 6, 4], [7, 8, 4], [9, 0, 4]]) >>> c array([[8, 7, 3], [6, 5, 3]]) i'm new python , numpy. appreciated. regards mat edit: reformatted arrays clarify problem using np.split : >>> a, b, c = np.split(orig, np.where(orig[:-1, 2] != orig[1:, 2])[0]+1) >>> array([[1, 2, 3], [1, 2, 3]]) >>> b array([[1, 2, 4], [1, 2, 4],

.htaccess - Redirect URL using htaccess if it contains a directory and ends in php -

i want redirect url's such example.com/blog/product.php to example.com/product.php i.e. if url contains /blog , ends in .php want redirect url /blog removed. how go doing this? thanks inside /blog/.htaccess can have code: rewriteengine on rewriterule ^([^./]+)\.php$ /$1 [l,nc,r=301] if /blog/.htaccess doesn't exist in root .htaccess can have rule: rewriterule ^blog/([^./]+)\.php$ /$1 [l,nc,r=301]

java - extracting all instances of subclass from arraylist -

i have arraylist<unit> units . want write function return objects of specified subclass, used parameter. can't work. here have: public static arraylist<? extends unit> gettheseunits(class<? extends unit> specific_unit) { arraylist<specific_unit> res = new arraylist<>(); //'specific_unit' in red here. adding '.class' or '.getclass()' after not resolve (unit u : units){ if (u instanceof specific_unit){ res.add(u); } } return res; } filter them class: public static list<unit> getunitsbyclass(class<? extends unit> specificclass, list<? extends unit> units) { return units.stream() .filter(e -> e.getclass().equals(specificclass)) .collect(collectors.tolist()); } if want make method parametrized, use option: public static <t extends unit> list<t> getunitsbyclass(class<t> specificclass, list<

Create a heatmap using Yii2 highcharts widget -

i trying adapt highcharts heatmap raw coding yii2 plugin milos schuman. area , line charts working there not example of using heatmap , tried everything. this code shown in highcharts demo: $(function () { $('#container').highcharts({ chart: { type: 'heatmap', }, title: { text: 'sales per employee per weekday' }, xaxis: { categories: ['alexander', 'marie', 'maximilian', 'sophia', 'lukas', 'maria', 'leon', 'anna', 'tim', 'laura'] }, yaxis: { categories: ['monday', 'tuesday', 'wednesday', 'thursday', 'friday'], }, series: [{ name: 'sales per employee', borderwidth: 1, data: [[0, 0, 10], [0, 1, 19], [0, 2, 8], [0, 3, 24], [0, 4, 67], [1, 0, 92], [1, 1, 58], [1, 2, 78], [1, 3, 117], [1, 4, 48], [2, 0, 35], [2, 1, 15], [2, 2, 123],

MySQL Query Shows Inconsistent Result Everytime -

select distinct pv.product_variation_key, p.product_key, p.brand_key, p.name, p.vehicle_type, p.short_description, pp.medium_image, b.brand_name, b.big_image, ts.tire_size, pv.sku, pv.price, pv.dealer_price, pv.retail_price, pv.weight, pv.width, pv.performance_rating, pv.mileage_warranty, pv.overall_diameter, pv.tread_depth, pv.maximum_psi, vte.road_hazard, vte.road_hazard_price, vte.load_index, vte.sidewall, vte.utqg, vte.load_ply_rating, vte.load_range, tsr.tire_speed_rating, cr.rating, if(pv.sku != i.sku,

soap - cross or lorraine and AddRemarkLLSRQ? -

using soap api how can write cross or lorraine remark using addremarkllsrq? i have tried using ascii code have had no luck the request <soapenv:body> <ns:addremarkrq version="2.1.0"> <ns:remarkinfo> <!--zero or more repetitions:--> <ns:remark code="x" type="general"> <ns:text>☨ remark 1</ns:text> </ns:remark> </ns:remarkinfo> </ns:addremarkrq> </soapenv:body> the response is <addremarkrs version="2.1.0" xmlns="http://webservices.sabre.com/sabrexml/2011/10" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:stl="http://services.sabre.com/stl/v01"> <stl:applicationresults status="notprocessed"> <stl:error type="businesslogic" timestamp="20

java - jTextPane color with some exception in chat -

Image
i using jtextpane use sender , receiver chat color. works fine javax.swing.text.defaultstyleddocument@123456 with every chat message. here jhon revceiver , peter sender here peter revceiver , jhon sender may m doing mistake in code. here code sender dateformat dateformat = new simpledateformat("hh:mm:ss\n\t dd/mm/yyyy "); date date = new date(); styleddocument doc = gui.jtextpane1.getstyleddocument(); style style = gui.jtextpane1.addstyle("a style", null); styleconstants.setforeground(style, color.red); try { doc.insertstring(doc.getlength(), "\t " + "you" + " : " + gui.getsendmessage() +("\n \t "+dateformat.format(date)) ,style); gui.appendreceivedmessages(""+doc); } catch (badlocationexception e){} here code receiver dateformat dateformate = new simpledateformat("hh:mm:ss\ndd/mm/yyyy "); date da

Making and sending a mix double and int array in c -

i trying send msg socket in form on double,int,int,int,int,...,int n int values how can send it? have opened socket how can put elements in 1 array sent in: status=sendto(sendsocket,msg,sizeof(double)+n*sizeof(int), 0,(void*)&out_socketaddr,sizeof(out_socketaddr)); where msg memory(array) of elements , out_socketaddr destination uint8_t array [sizeof(this) + sizeof(that) + ...]; uint8_t* ptr = array; memcpy(ptr, &this, sizeof(this)); ptr+=sizeof(this); memcpy(ptr, &that, sizeof(that)); ptr+=sizeof(that); ... avoid making struct. although structs make code more readable, introduce padding, issue in case.

coordinates - How to limit voronoi calculations in Matlab? -

i have stack of images of elliptical cylinder. within cylinder few "dots"/seeds of importance. i've calculated euclidean distance between them , nearest neighbour. next step make voronoi diagram , calculate volume of each voronoi cell. i need define space/limits of elliptical cylinder, take account when calculating voronoi diagram. any ideas? thanks in advance, yotam first let's start context guessing: matlab mupad symbolic calculations. don't see why think need draw anything? i have no clue why need draw anything, assume it's visualising calculation done.. cross section area, using specific plane equation, or cross section circumference, given plane equation. or perhaps collision points of ray, or highlight surface calculating on? in cases numerical rendering adequate, , use built in plot functions... i recommend surface (plots mesh) http://nl.mathworks.com/help/matlab/ref/surface.html but in fact previous question in here sh

amazon web services - AWS: multiple instances reading SQS -

simple question: want run autoscale group on amazon, fires multiple instance processes messages sqs queue. how know instances aren't processing same messages? i can delete message queue when it's processed. if it's not deleted yet , still being processed instance, instance can download same message , processing also, opinion. aside remote possibility of sqs incorrectly delivering same message more once (which still need account for, though unlikely), suspect question stems lack of familiarity sqs's concept of "visibility timeout." immediately after component receives message, message still in queue. however, don't want other components in system receiving , processing message again. therefore, amazon sqs blocks them visibility timeout, period of time during amazon sqs prevents other consuming components receiving , processing message. http://docs.aws.amazon.com/awssimplequeueservice/latest/sqsdeveloperguide/aboutvt.html this ke

How to track an object with deformations in a sequence of images in Matlab -

i trying make program in matlab detects object in image, , track in sequence of images. in matching algorithm, have tried comparing area, perimeter , major axis length of objects. works when objects maintain same shape during tracking time (it can move or rotate). however, goal use program on satellite images, want track ice. problem ice floes not maintain exact same shape. has deformations. do have suggestions different approach this, invariant deformations? in current program, load each image , make them binary. then, find properties of each object in each image, run code on binary representation of images: % find object properties [clust,numb] = bwlabel(image, 8); area = regionprops(clust,'area'); s = regionprops(clust, {'centroid'}); measurements = regionprops(clust,'majoraxislength','minoraxislength'); theta = regionprops(clust,'orientation'); perimeter = regionprops(clust,'perimeter'); % store centroids in matrix centro

jersey - Why the session attribute is coming as null -

a html5 ui connected backend (rest jersey business logic hibernate , db). need create , maintain session each user login until user logs out. i clueless on how approach problem. i followed approach initially when user logs in , setting attribute under session shown below httpsession session = request.getsession(true); session.setattribute("islogged", "islogged"); string value = (string)session.getattribute("islogged"); system.out.println("****************** user logge in value"+value); later in different page checking if user logged in or not way public string checkifuserloggedin() throws jsonexception,classnotfoundexception, sqlexception { httpsession session = request.getsession(); string value = (string)session.getattribute("islogged"); if(value==null) { // coming here } } i agree francesco foresti , please not rely on http session without auth

html - Cannot find correct element with same class name -

i have following html snippet: <div id="result-1"> <div class="page"> <div class="collapsingblock"> <h4>click me</h4> </div> <div class="collapsingblock collapsed"> <h4>no, click me</h4> </div> </div> </div> what i'm trying do, find second collapsingblock , it's h4 i have following: (//div[@id="result-1"]/div[@class="page"]/div[@class="collapsingblock"])[2]/h4 my xpath doesn't return element. if replace [1] finds first instance of collapsingblock though any ideas? thanks update: i have noticed, html using javascript add/remove additional class second collapsingblock , collapsed the problem value of class attribute of second inner div element not equal "collapsingblock", can see: <div class="collapsingblock collapsed"> <h4>no, click

Android: Repeat a method and delay other method after x seconds using handle -

i'm new android , have problem used same code repeat , delay method 2 class. 1 class work fine other not. don't know why. code speedmeterfragment.java public class speedmeterfragment extends fragment { .... public void speedmeterbefore() { totalrxbytesbefore = trafficstats.gettotalrxbytes(); log.d("test", "before: " + string.valueof(totalrxbytesbefore)); } public void speedmeterafter() { totalrxbytesafter = trafficstats.gettotalrxbytes(); log.d("test", "after: " + string.valueof(totalrxbytesafter)); } public void speedmeterdifference() { totalrxbytesdifference = totalrxbytesafter - totalrxbytesbefore; tvtest.settext(string.valueof(totalrxbytesdifference/1024) + " kb/s"); log.d("test", "difference: " + string.valueof(totalrxbytesdifference)); } public void speedmeter() { handler = new handler(); h

ios - Send parameter to server and get return value in NSString format -

this first time trying. till successful in getting data server in json format. now want is, have 2 nsstring values have send server , server check them. don't know checking mechanism behind. sending 2 strings , server return me try or false. , have show true or false thing. all called onclick of uibutton here tried, nsstring *str = [nsstring stringwithformat:@"http://xxxxxxxxxxxxxxxxxxxxxxx/api/captchaimage/checkcaptchvalid?validstring={%@}&encodestring={%@}",string1,string2]; nsmutableurlrequest *req = [[nsmutableurlrequest alloc] init]; [req seturl:[nsurl urlwithstring:str]]; nsurlconnection *connget = [[nsurlconnection alloc]initwithrequest:req delegate:self]; if(connget) { nslog(@"connected successfully"); } else { nslog(@"not connected successfully"); } it gives me nslog connected successfully, struck here, want response server in nsstring format, either true or false. can 1 gu

Is there a way to supply the columnDefs to ui-grid with a promise? -

the data ui-grid seems support promise of data, columndef option not seem to. if data coming in dynamic , column defs loaded dynamically how can columns definition specified promise. you can supply columndefs promise's return value in .then() handler: $scope.gridoptions = { data: [ ... ] }; columnservice.getcolumns() .then(function (columndefs) { $scope.gridoptions.columndefs = columndefs; });

sql server - Can I call mysql stored procedure have input paramater in C# without pamameter? -

i want convert stored procedure mssql mysql. in mssql can set default value user-define parameter, mustn't call stored list parameter. in mysql can't that. for example: mssql : create procedure [dbo].[abc] @a datetime = null => can: exec abc mysql : create definer=`root`@`localhost` procedure `abc`( datetime ) => must: call abc(value) anyway call mysql stored procedure in c# without list parameter? because don't want change c# code....

javascript - Popup doesn't go away after showing -

Image
i have image gallery bootstrap, after bigger image shows up, doesn't go away after cliking outside image. using asp.net mvc 5 i have this: css/html: <div id="tabs-2"> <div class="row"> <div class="col-lg-2 col-md-2 col-sm-3 col-xs-4 img-thumbnail"> <img class="img-responsive" src="http://lorempixel.com/800/600/food/1" alt="" /> </div> <div class="col-lg-2 col-md-2 col-sm-3 col-xs-4 img-thumbnail"> <img class="img-responsive" src="http://lorempixel.com/800/600/food/2" alt="" /> </div> <div class="col-lg-2 col-md-2 col-sm-3 col-xs-4 img-thumbnail"> <img class="img-responsive" src="http://lorempixel.com/800/600/food/3" alt="" /> </div> </div> <div class="modal fad

ios - ITMS-90086 Missing 64-bit support -

Image
we have xamarin application trying deploy apple appstore, when try submit application review exception itms-90086 missing 64-bit support . here screenshot: here build options xamarin project showing armv7 + arm64 selected supported architectures setting. note screenshot configuration set release ; did read in 1 of xamarin appstore guidelines must set appstore , not have configuration in project. (see screenshot below). have error getting? we able set active configuration appstore\device in project menu , have done so. appstore configuration not available in project build options. we make use of 4 statically linked libraries recompiled in xcode after updating ios sdk 8.3 . here sample screenshot of build settings 1 of our statically linked libraries. here summary of actions performed try our application submitted: upgraded xcode latest version ios 8.3 sdk installed upgraded latest version of xamarin studio upgraded latest version of xamarin.ios (ve

PHP Logout And Session Issues -

hers logout script on logout.php : unset($_session['user']['id']); session_unset(); session_destroy(); echo '<script type="text/javascript">window.location="login.php"</script>'; my problem after logout when click on browser button got redirect index.php page. index.php shown while , after redirected login.php . don't understand why redirect index.php page. don't want show page / content user second after gets logged out. no need of unset($_session['user']['id']); , session_unset(); . session_destroy() all. try - session_destroy(); header('location:logout.php'); exit;

tinyMCE on dynamically generated textarea doesn't get focus with mceFocus -

after clicking on div generating textarea. after loading tinymce on it. works after loading tinymce want set focus on using "mcefocus". isn't working. no focus set regardless browser try. $.when( btn.parent().html('<textarea autocomplete="off" name="' + fld + '" id="' + fld + '" readonly></textarea>') ).done(function() { tinymce.execcommand('mceaddcontrol', false, fld); tinymce.execcommand('mcefocus', false, fld); });

Using Oracle APEX Interactive Report Messages in HTML/Javascript -

i have created multi language apex application in guidance of oracle apex 5.0: managing application globalization . have translated interactive report messages (ie. apexir_* ) several languages. however, cannot use/refer messages in html/javascript. i have tried methods mentioned in oracle apex: understanding substitution strings : neither &apexir_help. , nor #apexir_help# worked. there suggestion use apex_lang.message in oracle apex:translating messages . however, method seem work pl/sql queries. not know how use in html or javascript. note: technical requirement show apexir_help translations in gui. ie. "help" must placed in english translation , "hilfe" in dutch translation in place of &apexir_help. in code below: <span style="margin-right: 15px"><a href="&p_help_link./0&app_id..htm" target="_blank"><font style="text-transform: capitalize;">&apexir_help.</font><

css - Error wrapping an image in an <a> tag for lightbox -

i'm running wordpress site has thumbnail gallery feature. each thumb inside <a> tag full image pops in lightbox. problem that, reason, zone behind image , 16px high (the thumb 96 x 96). can't see in css causing this. an example of can seen here <a rev="http://www.pinksandgreen.co.uk/wp-content/uploads/2010/09/walde-xc14_1-200x200.png" class="wpscimg" rel="lightbox funky paper mache deer heads" href="http://www.pinksandgreen.co.uk/wp-content/uploads/2010/09/walde-xc14_1.png"> <img width="96" height="96" src="http://www.pinksandgreen.co.uk/wp-content/uploads/2010/09/walde-xc14_1-96x96.png" class="attachment-gold-thumbnails" alt="walde-xc14_1"> </a> i can't seem alter height of through html or css , it's driving me mad! yeah, kind of. can click whole image, right? it's because anchor inline element. if want wide/high image (th

Rails sending mails with actionmailer from an virtualbox vm -

i have debian vm running in virtual box on windows machine. in vm rails application running, should send mails action mailer. i've set action mailer credentials in application.rb but when mail should send there nothing in mailbox ... seems mail isn't send or dosn't leve vm. what check if mail send properly? in development environment need these options in environments/development.rb config.action_mailer.perform_deliveries = true config.action_mailer.delivery_method = :smtp by default rails in development mode shows email body in log without real sending.

java - How to tailor existing MongoDB peacefully? -

supose have running mongodb instance(also using mongo sharding) millions of data , thousand of transactions per second, , have used morphia object-document mappe. since want keep project alive bug fixing, updating , ... in point changing data model inevitable. consider below example : have persisted class (model) : private eventasset{ @id private string id; @constraints.required private string time; private eventtype eventtype; } and have decided eventasset.class should change : private eventasset{ @id private string id; @constraints.required private string time; @constraints.required private string assetname; } as can see eventtype has been removed , required assetname added, , changes prevent application starting. major possible solutions can think of are create new db , insert old values , how manage switch between old , new db in way wont harm incomming few thousant transactions per second. use or create tool analyse cl

lua - Chartboost campaign not serving ads in iOS -

i'm attempting app serve interstitial ads (video , static) using cross-promotional chartboost campaign. feel though i've set correctly, because dashboard on website indicates sdk has been integrated app, , when put app in test mode, receives test ads. however, when turn off test mode, receive no ads. app built in corona sdk, , i'm using chartboost plugin made by swipeware, shown here. i'm using demo project on github page . think problem must way campaigns on chartboost set up, don't know why. can give me hint? i've made images out of shows on dashboard on chartboost -- seems me campaigns fe_stories_4_11_test, details shown, should showing ads nonstop. there reason wouldn't happen? https://github.com/swipeware/coronachartboostplugin

Function pointer in DLL call - how to handle in C#? -

i'm using native dll called out of c# application. 1 of dll-functions defined this: int set_line(const int width,fct_line_callback callback) fct_line_callback defined as typedef int (*fct_line_callback)(double power,void *userdata); so how can use function out of c#-application? there way define c# method used callback-function dll-call? thanks! you have declare delegate type matches native function pointer. should this: [unmanagedfunctionpointer(callingconvention.cdecl)] delegate int fct_line_callback(double power, intptr userdata); now can write pinvoke declaration: [dllimport("foo.dll", callingconvention = callingconvention.cdecl)] extern static int set_line(int width, fct_line_callback callback); if callback can made while set_line() executing calling native function simple: public void setline(int width) { set_line(width, mycallback); } private void mycallback(double power, intptr userdata) { // etc... } however, if call

php - PDO PDOStatement always outputs 1 in the end -

i new pdo , have been checking around answers not find one. reason pdostatement object outputs 1 in end. for example when this $username = 'alexander'; $sql = " select username, email user username = :username; "; $stmt = $dbh->prepare($sql); $stmt->bindparam(':username', $username); $stmt->execute(); $result = $stmt->fetch(pdo::fetch_assoc); echo '<pre>', print_r($result), '</pre>'; it outputs array ( [username] => alexander [email] => alex@live.com ) 1 notice 1 in end. , example when use rowcount() check affected rows after update statement this $username = 'martin'; $sql = " update user set username = :username id = 1; "; $stmt = $dbh->prepare($sql); $stmt->bindparam(':username', $username); $stmt->execute(); $affected = $stmt->rowcount(); echo '<pre>', print_r($affected), '</pre>';

wpf - Bind to Specific Property inside each Item in ItemsControl -

purely code , template simplification want able have each item inside items control bound property inside each array element. example public list<myobject> myobjectlist; //if bind this, each item recieves myobject data context. i want ability each item recieve myobject.someproperty data context. thought through setting itemcontainerstyle set datacontext doesn't appear work. have ideas? somthing along lines of following, each item bound property "fieldvalue" inside of each object. in case, grabs "fieldvalue" binding root object, not each individual item. <itemscontrol itemssource="{binding myarrayofobjects, itemtemplateselector="{staticresource myobjecttemplateselector}"> <itemscontrol.itemcontainerstyle> <style> <setter property="control.datacontext" value="{binding fieldvalue}"/> </style> <

How to add a VBA function to an Excel file in C# -

my c# program creates excel file, want file have vba function (so user change without rerunning program). how can this? perhaps using openxml sdk 2.0 . and parts of this answer on stackoverflow .

node.js - Not able call url from the function in nodeJS -

i trying call url localhost node js server router.post("/registration", function (req, res) { var request = require('request'); request('http://www.google.com', function (error, response, body) { if (!error && response.statuscode == 200) { console.log(body) // print google web page. } else { console.log(error); } }) }); this url called inside function rest api getting { [error: getaddrinfo enotfound] code: 'enotfound', errno: 'enotfound', syscall: 'getaddrinfo' } #1295 here if can read localhost, able read content or internet domain google.com or anyother domains not able later came know that problem of local proxy settings

session - Magento html?___SID=U at the end of urls -

i have multistore magento site. sid in front enabled want customers cross around sites without login issue. want remove "html?___sid=" @ end of urls. can do? go admin => system => configuration => web => session validation settings , disable config use sid on frontend => no for more information check here or check here

Java: instanceof returning false on Eclipse CDT IncludeRefContainer class -

i have following code: private static iproject getprojectfromactivepart(iworkbenchwindow activewindow, iselection selection) { if (selection != null && selection instanceof istructuredselection) { object element = ((istructuredselection) selection).getfirstelement(); if (element != null) { if (element instanceof includerefcontainer) { includerefcontainer cont = (includerefcontainer) element; return cont.getcproject().getproject(); } } } return null; } the statment if(element instanceof includerefcontainer) returns false, though element.getclass() returns: class org.eclipse.cdt.internal.ui.cview.includerefcontainer . trying cast element object includerefcontainer throws exeption: java.lang.classcastexception: org.eclipse.cdt.internal.ui.cview.includerefcontainer cannot cast org.eclipse.cdt.internal.ui.cview.includerefcontainer sounds strange me. how solve this?

google maps - How can i change the Marker color clicked previously to its original color -

i displaying markers on google map . when click on marker , setting different color (blue) like this.seticon("http://maps.google.com/mapfiles/ms/icons/blue-dot.png"); this full code var map; var global_markers = []; var markers = [[37.09024, -95.712891, 'trialhead0'], [-14.235004, -51.92528, 'trialhead1'], [-38.416097, -63.616672, 'trialhead2']]; var infowindow = new google.maps.infowindow({}); function initialize() { geocoder = new google.maps.geocoder(); var latlng = new google.maps.latlng(40.77627, -73.910965); var myoptions = { zoom: 1, center: latlng, maptypeid: google.maps.maptypeid.roadmap } map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions); addmarker(); } function addmarker() { (var = 0; < markers.length; i++) { // obtain attribues of each marker var lat = parsefloat(markers[i][0]); var lng = parsefloat

android - Sliding Tabs in Toolbar using Material Design -

Image
i have been learning use sliding tabs using material design using this post . have managed achieve slidingtabs below toolbar , one: but create actionbar/toolbar fragment tabs ... i able recreate looking implement. using library tabs. this view have created: import library through dependencies or download project , import manually compile 'com.jpardogo.materialtabstrip:library:1.0.9' styles.xml <resources> <style name="apptheme" parent="theme.appcompat.light.noactionbar"> <item name="colorprimary">@color/primary</item> <item name="colorprimarydark">@color/primary_dark</item> </style> </resources> mainactivity & adapter public class mainactivity extends actionbaractivity { toolbar toolbar; viewpager viewpager; contactpageradapter pageradapter; pagerslidingtabstrip pagerslidingtabstrip; @override protected

java - Android Progress Dialog doesn't show -

i want show progress dialog while i'm processing user's request. code , don't see reason why dialog not appearing on screen. public void ongoclick(button button) { progressdialog progressdialog = null; try { if (invalid) { // show error message } else { progressdialog = new progressdialog(getactivity()); progressdialog.setindeterminate(true); progressdialog.setmessage(getactivity().getresources().getstring(r.string.user_wait_message)); progressdialog.setprogressstyle(progressdialog.style_spinner); progressdialog.show(); // processing } } catch (exception ex) { ex.printstacktrace(); } { progressdialog.dismiss(); } } when move progressdialog declaration statement inside try block , removes dismiss method block, i'm able see circular dialog on screen, when change above code, nothing comes on screen. there no async call

javascript - full calendar call to google throws No 'Access-Control-Allow-Origin' header present -

i trying use full calendar embed google calendar in website. have included fullcalendar using bower , both css , js files in index file. have div included id 'calendar'. i followed docs on http://fullcalendar.io/docs/google_calendar/ in init.js file have following code: $(document).ready(function() { $('#calendar').fullcalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,basicweek,basicday' }, googlecalendarapikey: 'myapikey', eventsources: [ { url: "https://www.google.com/calendar/feeds/mycalendarid/public/basic", datatype : 'jsonp' } ], eventclick: function(event) { // opens events in popup window window.open(event.url, 'gcalevent', 'width=700,height=600'); return false; } }); i tried events instead of eventsources: events: 'https://www.google.com/calendar/feeds/mycal

asp.net - Why All .aspx code files will be checked out by changing just one of them? -

it may silly ask question tricky me know technical reason behind, might share me actual reason ;) why when using visual studio check out single file of files related aspx page (.aspx, .aspx.vb, aspx.designer.vb) in pending changes see files checked out!? for example small change e.g. attribute in login.aspx in pending changes see login.aspx.vb , login.aspx.designer.vb checked out , when compare them previous version no change can found in them? to put simply, in visual studio multiple files can represent single 'resource' such form or web page. of these files generated automatically ide, , contain code isn't intended edited manually. for example, in winforms project, form.vb file contain of methods you're used seeing, , writing code in, while form.designer.vb file has ide generated code declares , positions various controls have been placed on form in designer. these 2 files represent code same resource (a form), kept separate keep inexperienced

ios - LandScape Orientation on iPhone Not Work Correctly -

Image
recently develop application using swift in xcode 6.3. application support iphone , ipad in landscape mode (both right , left) have set supported interface orientation in info.plist landscaperight , left ipad,iphone , universal in ipad work correctly in iphone 1 landscape mode work , dont change when rotating device add appdelegate func application(application: uiapplication, supportedinterfaceorientationsforwindow window: uiwindow?) -> int { return int(uiinterfaceorientationmask.landscape.rawvalue) } but not work , adding code root viewcontroller override func shouldautorotate() -> bool { return true } override func supportedinterfaceorientations() -> int { return int(uiinterfaceorientationmask.landscaperight.rawvalue | uiinterfaceorientationmask.landscapeleft.rawvalue) } override func preferredinterfaceorientationforpresentation() -> uiinterfaceorientation { return uiinterfaceor

mysql - How do i add a summation column to my table on Rails 4 -

i have existing table "registers" columns; :full_name, :amount_paid, :user_id, :course_id . have course table columns: :title, :price . i want add column registers table calculate balance register.course.price , register. so tried rails g migration add_balance_to_registers balance:"register.course.price - register.amount_paid" but when try rake db:migrate i error you can add field registers table, populate appropriate values. first add field new migration rails g migration addbalancetoregisters balance:float then start migraation add field registers table rake db:migrate but field balance empty, have populate it. you create rake task this. inside lib/tasks/ folder add new file registers.rake . inside registers.rake add folowing code: namespace :registers desc "populate registers balance appropriate balance amount" task :sync_balance => :environment register.all.each |r| b = r.course.price - r

Looping through array of different lengths in PHP -

i have order form inputs this: <input type="text" name="booking[sandwich][roastbeef][qty]" /> <input type="text" name="booking[sandwich][cheese][qty]" /> <input type="text" name="booking[pizza][classic][qty]" /> <input type="text" name="booking[pizza][special][qty]" /> <input type="text" name="booking[coffee][qty]" /> i'm having trouble looping through arrays correctly. here kind of output have: <h2>sandwich</h2> <p><strong>roastbeef:</strong> 10</p> <p><strong>cheese:</strong> 5</p> <hr> <h2>coffee</h2> <p><strong>quantity:</strong> 15</p> if pizza input empty, heading "pizza" should not printed! same "coffee" or "sandwich" group. if order not contain in group, heading should not printed. i can't w

c# - How to get the where clause from IQueryable defined as interface -

class program { static void main(string[] args) { var c = new sampleclass<classstring>(); c.classstrings.add(new classstring{ name1 = "1", name2 = "1"}); c.classstrings.add(new classstring{ name1 = "2", name2 = "2"}); var result = c.query<classstring>().where(s => s.name1.equals("2")); console.writeline(result); console.readline(); } } public class classstring { public string name1 { get; set; } public string name2 { get; set; } } public interface isampleq { iqueryable<t> query<t>() t: class , new(); } public class sampleclass<x> : isampleq { public list<x> classstrings { get; private set; } public sampleclass() { classstrings = new list<x>(); } public iqueryable<t> query<t>() t : class, new() { //get expression here. return new enumerablequery<