Posts

Showing posts from April, 2014

c# how to add and remove a Point to a Queue -

can tell me how can add , remove point queue. because dequeue returns implicit error. f.e. queue q = new queue(); point = new point(0,0); point j = new point(0,0); q.enqueue(j); j = q.dequeue(); queue.dequeue returns object, need cast correct type: queue q = new queue(); point j = new point(0, 0); q.enqueue(j); while (q != null) //loop problem--see below { j = (point)q.dequeue(); } alternatively, can use generic version of queue , queue<t> . since queue of type declare, dequeue returns objects of type, there's no need cast: point j2 = new point(0, 0); queue<point> q2 = new queue<point>(); q2.enqueue(j2); j2 = q2.dequeue(); finally, while loop throw invalidoperationexception when execute, because after first dequeue, attempt dequeue again when queue empty.

android - CardView background color states not being respected -

in brief: how can define color states of cardview's cardbackgroundcolor property (in listview layout, in case)? (i using rc1 of android l developer preview, on phone 4.4 installed, , "com.android.support:cardview-v7:21.0.0-rc1" in build.gradle) longer: in cardview layout, set corner radius , background color of cardview via cardcornerradius , cardbackgroundcolor. however, background color doesn't repect selected states, i.e. if list item pressed, example. if, in inner view of cardview, set background colour, , associated states, respected, however, display on corners defined in cardview. so, how can ensure states in cardview's cardbackgroundcolor respected? here's color used cardbackgroundcolor, colour_with_states.xml: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" andro

php - .htaccess Internal Server Error: ErrorDocument not working (RewriteEngine on) -

whenever have rewriteengine on errordocument - part not working. current .htacces file: errordocument 404 404.php options -multiviews rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /$1.php [qsa,l] so when open not existing file in browser, 500 internal server error , not getting redirected 404.php - file. please me ;) this because you're blindly rewriting .php end of uri. let's take see happens when go 404 url: you request: http://example.com/blahblah the uri not file (passes !-f ) the uri not directory (passes !-d ) the uri matches (.*) . the uri gets rewritten include .php the uri /blahblah.php the uri not file (passes !-f ) the uri not directory (passes !-d ) the uri matches (.*) . the uri gets rewritten include .php the uri /blahblah.php.php the uri not file (passes !-f ) the uri not directory (passes !-d ) the uri matches (.*) . the uri gets rewritten include

css - drop down menu disappears on hover (blogger) -

i'll honest right off bat, not coder. got original code tutorial , tweaked colors , fonts, when hover on main menu item , try click sub-menu, vanishes. see other threads common problem, can't seem find asked question code mine. /**mbw mybloggersworld.com navgation bar **/ #mbwnavbar { background: #ffffff; width: 960px; color: #fff; margin: 0px; padding: 0; position: relative; border-top:0px solid #ffffff; height:35px; } #mbwnav { margin: 0; padding: 0; } #mbwnav ul { float: left; list-style: none; margin: 0; padding: 0; } #mbwnav li { list-style: none; margin: 0; padding: 0; border-left:1px solid #ffffff; border-right:1px solid #ffffff; height:35px; } #mbwnav li a, #mbwnav li a:link, #mbwnav li a:visited { color: #000000; display: block; font:bold 16px coming soon; margin: 0; padding: 9px 12px 10px 12px; text-decoration: none; } #mbwnav li a:hover, #mbwnav li a:active { background: #ffffff; color: #000000; display: block; text-decoration: none; margin: 0; padding: 9px

Clear phpcodesniffer markings in eclipse -

Image
phpcodesniffer has added lot of markings source file based in psr1, psr2 standards. many of them related code formatting tags , spaces. i want clear current markings , run codesniffer later on in development, not @ current stage. my searches did not yield results. i posted example of editor screen below. how can clear markings. i managed solve in following way. open 'problems' tab @ bottom of screen. if not available, can access window -> show view -> other -> problem menu option. choose problems want delete (in case, all) chose delete

ios - GCD and progressHUDs -

using form of progresshud (sv, mb, etc) run problem hud either hidden right after displayed or stays there permanently. in below example, hud stays permanently, regardless of if twitter feed (or page other view controllers) has finished loading. how can make hud disappear after task in separate thread completes? [mbprogresshud showhudaddedto:self.view animated:yes]; dispatch_async(dispatch_get_global_queue( dispatch_queue_priority_low, 0), ^{ //sets auth key (user or app) rmacc twitter feed sttwitterapi *twitter = [sttwitterapi twitterapioswithfirstaccount]; [twitter verifycredentialswithsuccessblock:^(nsstring *username) { [twitter getusertimelinewithscreenname:@"rmaccnewsnotes" count:10 successblock:^(nsarray *statuses) { dispatch_async(dispatch_get_main_queue(), ^{ [mbprogresshud hidehudforview:self.view animated:yes]; }); self.twitterfeed =[nsmutablearray arraywithar

MiniMagick Ruby cropping external images returns the image too small -

Image
i running following code , getting unexpected output external images. require "mini_magick" image = minimagick::image.open('https://s3.amazonaws.com/dropsitecms/32a0f5e44c6ab32db614e1dbe6e773900708de5f.demo.cloudvent.net/raw/uploads/versions/404-circle-cf2d9a11b44d04de64d68843dd278140---%280-76-266-114-350-150%29---.png') image.crop "260x112!+0+0" image.write 'image.jpg' system("open image.jpg") starting base image: it returns result far small: i expected result when start local copy of base image: your parameter settings wrong, change width/height this,then work, have try : require "mini_magick" image = minimagick::image.open('aa.png') image.crop "100x200!+0+0" image.write 'image.png'

Encoding error after converting application into executable using py2exe and getting them from mysql (pySide, Python 3) -

i have application runs if run in directly python. however, after turn executable using py2exe encoding "breaks". i run code gets string "comitê" mysql server. if run code: frommysql = getfrommysql() local = "comitê" print(frommysql) print(local) and save 2 files, 1 running directly python, other after compiling py2exe, following results: from python: using sublime text 3 -> reopen encoding -> utf-8: comit? comit? using sublime text 3 -> reopen encoding -> western (iso 8859-1): comitê comitê after py2exe: using sublime text 3 -> reopen encoding -> utf-8: comit? comitê using sublime text 3 -> reopen encoding -> western (iso 8859-1): comitê comitê it's worth noting in beginning of files have: # -*- coding: utf-8 -*- the code (removing unimportant bits): main window code: # -*- coding: utf-8 -*- import sys import pyside.qtgui

javascript - getting ajax response when the page loads? -

im creating star rating system , works need have current amount of votes displayed when page loads , im having issues implementing code have work due plugin source code , ajax not language im familiar with. it puts current votes in element want when click handler activated selecting rating not sure if need add current function or create new 1 , if how not conflict current one. thanks in advance. <!doctype html> <html lang="en"> <?php require 'core/init.php'; ?> <head> <meta charset="utf-8"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> </head> <body> <div> <table> <tr> <td><div id="randomtest" class="star"></div></td> <td id="cvotes"></td> </tr> </table> </div>

python - How to make a simple login without a database and without a form -

i want add simple login feature 1 can either logged in or not logged in (no user-specific data needs stored). i made user class: class user(object): def __init__(self, username, hash): self.name = username self.hash = hash and load list of users ini file. i implemented user_loader function @self.login_manager.user_loader def load_user(userid): user in self.users: if user.name == userid return user return none what goes in login method? @self.server.route("api/login", methods=["get", "post"]) def login(): i want login ajax request send credentials , json response contains username or error message. simple example, work post /api/login username=test_user&hash=test_hash data or get /api/login?username=test_user&hash=test_hash : class user(usermixin): def __init__(self, username, hash): self.name = username self.hash = hash @proper

How to find files with no file extension in directory tree with a batch file? -

how write batch file called ex5.bat lists files matching of following criteria within windows folder , down through sub directories? files extension starting letter c. files without file extension. dir c:\windows\*. c:\windows\*.c /s/b/a-d

How to create button shadow in android material design style -

Image
new material design guidelines introduce elevated buttons dropping nice shadow. according preview sdk documentation there elevation attribute available in new sdk. however, there way achieve similar effect now? this worked me. layout having button <button xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="@dimen/button_size" android:layout_height="@dimen/button_size" android:background="@drawable/circular_button_ripple_selector" android:textappearance="?android:textappearancelarge" android:textcolor="@color/button_text_selector" android:statelistanimator="@anim/button_elevation"/> drawble/button_selector.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:dr

javascript - MongooseJS Not saving to array properly -

i want append value mongoose array array never seems update. following: in controller, append eventname array eventsattending so: $scope.currentuser.eventsattending.push(event.eventname); $http.put('/api/users/' + $scope.currentuser._id, $scope.currentuser) .success(function(data){ console.log("success. user " + $scope.currentuser.name); }); i try update array so: // updates existing event in db. exports.update = function(req, res) { if(req.body._id) { delete req.body._id; } user.findbyid(req.params.id, function (err, user) { if (err) { return handleerror(res, err); } if(!user) { return res.send(404); } user.markmodified('req.body.eventsattending'); user.save(function (err) { if (err) { return handleerror(res, err);} return res.json(200, user); }); }); }; but array never seems update. i've tried following: // updates existing event in db. exports.update = function(req, res) { if(req

string - How do I have a program create its own variables with Java? -

i start off saying if common knowledge, please forgive me , have patience. new java. trying write program store many values of variables in sort of buffer. wondering if there way have program "create" own variables, , assign them values. here example of trying avoid: package test; import java.util.scanner; public class main { public static void main(string args[]) { int inputcachenumber = 0; //text file: string userinputcache1 = null; string userinputcache2 = null; string userinputcache3 = null; string userinputcache4 = null; //program while (true) { scanner scan = new scanner(system.in); system.out.println("user input: "); string userinput; userinput = scan.nextline(); // in text file if (inputcachenumber == 0) { userinputcache1 = userinput; inputcachenumber++; system.

javascript - Optimizing online photo gallery for retina devices -

i have existing website (a photo blog) loads majority of photos flickr. i'd enhance experience users high resolution screens , load higher res versions of photos, i'm not sure best way go. since images in question not ui elements, there no sensible way solve problem css. leaves either client side javascript, or server side find-and-replace specific image patterns (since come flickr, it's easy detect , easy enough figure out url double-sized image). for client side, concern regular sized images 500-800 kb in size, there there can 10-30 images per gallery, causing lots of excess bandwidth use retina users. for server side, it's tricky determine if request comes retina device or not. 1 idea had (which have yet test out), run javascript function checks window.devicepixelratio , sets cookie accordingly, , on each successive page request server know if device high res or not. leaves entry page non-retina images, @ least next ones have high res images loaded right a

php - Why with this unexpected end of file error? -

im new beginner. have been working on 3 days, before ask question here. googled problem not same mine eventhought have same error. please me. the error - parse error: syntax error, unexpected end of file in c:\xampp2\htdocs\li\assignment1\edit_projek3.php on line 33 line 33, it's mean last line. <html> <head><title>edit projek</title></head> <body> <?php $dbcon = mysql_connect("localhost","user",""); if(!$dbcon){ die("tidak berjaya disambungkan: " . mysql_error()); } mysql_select_db("dbpelanggan",$dbcon); if(isset($_post['update'])){ $updateproject = "update projek set kod_projek='$_post[kodbaru], tajuk_projek='$_post[tajukbaru]', norujukan='$_post[rujukanbaru]' kod_projek='$_post[hidden]'"; mysql_query($updateproject, $dbcon); $listproject = "select * projek"; $queryproject = mysql_query($listproject,$dbcon); echo &quo

osx - Bash: "tput initc" doesn't seem to work -

i'm working on bash script in start off tput initc commands specifying custom colours use in script. when run script test, seems still using terminal.app 's default "basic" theme colours. (i'm testing using virtual machine running fresh install of mavericks.) here commands i'm using: tput initc 0 300 300 300 tput initc 1 800 210 100 tput initc 2 650 760 380 tput initc 3 800 460 180 tput initc 4 350 530 670 tput initc 5 630 380 470 tput initc 6 470 710 760 tput initc 7 810 810 810 tput initc 8 570 570 570 tput initc 9 1000 280 200 tput initc 10 720 710 0 tput initc 11 1000 780 430 tput initc 12 530 760 1000 tput initc 13 820 820 1000 tput initc 14 440 760 830 tput initc 15 910 910 910 so pick example, should set yellow (3) kind of brownish colour, when tput setaf 3 , echo text (either on separate lines or including within echo using $() syntax) still prints same default yellow. what doing wrong? i've found little along way of documentation on

tableview - cell separated overlapping overlapping cell iOS -

i have table view in iphone app. have 2 dynamic custom cells crated , cell seperater in between both of them. storyboard shows cells separater coded in app. separater overalpping second cell , covering part of top including text. can fix overlap? - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *c=nil; if (indexpath.row==0) { static nsstring *cellidentifier = @"areacell"; lsareacell *cell=[tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; aplarea *area=[self getareaforindexpath:indexpath]; cell.areaimageview.image=[uiimage imagenamed:area.imagename1]; c=cell; } else { static nsstring *quotecellidentifier = @"quotecellidentifier"; aplquotecell *cell = (aplquotecell*)[tableview dequeuereusablecellwithidentifier:quotecellidentifier]; cell.backgroundview = [[uiimageview al

.net - Which is the proper way to end the execution of the application inside a constructor block? -

i've noticed if try use application.exit instruction inside constructor sub not take effect, should proper way end execution of application in circunstances? i know use application events cancel startup event, or wait load or shown event exit application calling application.exit method, i'm asking learn proper way in constructor sub without using end statement, in case possibly. this example: public class form1: inherits form ''' <summary> ''' initializes new instance of <see cref="form1"/> class. ''' </summary> public sub new() application.exit ' end end class environment.exit(0) trick.

javascript - nodejs request returning null body from server for a POST request -

i sending http post request node using request ( https://github.com/mikeal/request ), , getting null body. same request getting sent hurl.it returning correct response correct body. request getting sent same nodejs server same server returning correct body. infuriating working last week , no longer working in nodejs. my server.js is: var request = require('request'); request({ uri: 'insert url here; contains sensitive info', method: 'post', body: 'insert body here; contains sensitive info', followredirect: true, maxredirects: 10 }, function(error, response, body) { console.log('body in response is: ' + body); }); anyone have idea how fix this? thank you. i resolved issue. server posting apparently expecting user agent in header wasn't sending, throwing null exception, , returning null. has since been fixed. thank you.

c# - Streamline Date Parsing into method -

i'm trying think of cleaner way this. want move helper method not using out params. realize have use out params tryparse, don't have choice i'd kind of reusable method: startdate , enddate in "yyyy/mm/dd" format , string begin , i'm parsing below. datetime startdt; datetime enddt; startdt = (datetime.tryparse(startdate, out startdt) ? startdt : datetime.now); enddt = ((!datetime.tryparse(enddate, out enddt) || string.isnullorempty(enddate))) ? (startdt.addminutes(configuration.instance.recentorderswindowdurationminutes)) : enddt; well, if want 2 results single method have either use out parameters or wrapping type. if you're lazy , doing once, use tuple<datetime, datetime> . public tuple<datetime, datetime> getrange(string startdate, string enddate) { datetime startdt; datetime enddt; if (!datetime.tryparse(startdate, out startdt)) startdate = datetime.now; if (string.isnullorempty(enddate) || !da

c++ - Code inside loops wont print -

void graph::sortw () { int length = vertices*vertices; int array[length]; (int = 0; < length; i++) { array[i] = 0; cout << array[i]; // nothing prints } cout << "i"; // convert 1d array (int = 0; < vertices; i++) { (int j = 0; j < vertices; j++) { array[i*vertices+j] = matrix[i][j]; cout << array[i*vertices+j] << " "; // nothing prints } } cout << "j"; qsort(array, length, sizeof(int), compare); // (int i=0 ; i<25; i++) // cout << array[i] << endl; // loop prints?! } i have no idea why output ij only. sort called in constructor so: // sort weights using qsort sortw(); anyone have ideas? i'd suggest put a cout << vertices; at beginning of function. guess ist vertices zero?

objective c - When do we use self. or [self ] in stringWithFormat? -

when using stringwithformat nsstring in return statement when use self. ; [self ] or instance? for example, have return [nsstring stringwithformat:@"%@ %@" , self.someinstance or [self someinstance] or someinstance]. self.someinstance equivalent [self someinstance] . former using dot-syntax became available in objective-c 2.0. it's personal preference option use. suggest being consistent throughout app , use 1 format. using someinstance on own, without self. or [self ] , different , accesses instance variable directly. should avoided outside of init methods.

version control - Git: How to squash all commits on branch -

i make new branch master with: git checkout -b testbranch i make 20 commits it. now want squash 20 commits. with: git rebase -i head~20 what if don't know how many commits? there way like: git rebase -i on branch another way squash commits reset index master: git checkout yourbranch git reset $(git merge-base master yourbranch) git add -a git commit -m "one commit on yourbranch" this isn't perfect implies know branch "yourbranch" coming from. note: finding origin branch isn't easy/possible git (the visual way easiest , seen here ).

linux - why doesn't iozone generate output file? -

i'm using iozone3 tesing, on xamin (an debian-based os (xamin.ir/en/)). when enter iozone command, example iozone -rab output.xls , test runs successfully . but after running test (after displaying message: iozone test complete. ),instead of generating excel file, iozone returns results in shell . why doeasn't generate excel file? i think should $touch output.xls file first maybe file not exist :)

Using Kawa in Emacs -

Image
are there modes or resources kawa in emacs? i've checked, not able find any. mostly, i'd able run kawa repl inside of emacs, kind of completion/syntax checking great too. i don't have prior experience kawa, have "universal" way deal repls: plugin isend + hacks follow instructions in section 2 , section 3 of article http://wenshanren.org/?p=351#sec-2 setup isend (it's bit tedious, please let me know if have problems) open shell in emacs, assume buffer name *shell* m-x shell open kawa repl in *shell* classpath=/usr/local/lib/kawa.jar && export classpath && java kawa.repl create new buffer test.kawa , turn on lisp-mode m-x lisp-mode (you can use mode want) associate *shell* test.kawa m-x isend-associate *shell* now type sexps in test.kawa , select them , press c-enter send them *shell* execution (the cursor won't move)

objective c - Getting notification list from OS X Notification Center -

it's possible send notifications notification center on mac using nsusernotification , nsusernotificationcenter api classes. but there any way of reading notifications notification center? there no public api that. nothing app store conform. but as part of little tech-demo-app disconotifier (where flash keyboard leds in response notification) wrote ddusernotificationcentermonitor class see: https://github.com/daij-djan/disconotifier/tree/master/disconotifier it works using filesystemevents , sqlite , checks notification center's database it works , database has info (table: presented_notifications) but.. fragile , private

android - Show DatePicker with other calendar system -

i have datepicker in custom dialog shows date , user can select date , user selected date. want go further showing other calendar for e.g. persian calendar date instead of gregorian calender date . in app when user selects date datepicker can return persian date in log. don't know how change datepicker show perisan date.please help. @override public boolean oncreateoptionsmenu(menu menu) { menu.add("add detail").seticon(r.drawable.ic_compose).setshowasaction(menuitem.show_as_action_if_room | menuitem.show_as_action_with_text); return true; } @override public boolean onoptionsitemselected(menuitem item) { final dialog dialog = new dialog(this); dialog.setcontentview(r.layout.custom); final edittext amount = (edittext) dialog.findviewbyid(r.id.amtedittext); final datepicker datepicker = (datepicker) dialog.findviewbyid(r.id.datepicker1); button cancelbutton = (button) dialog.findviewbyid(r.id.canelbutton); button okbutton =

html - Remove Extra padding from CSS3 multi-column items, how? -

Image
i'm trying create masonry layout using css3 multi-column have problem. last item have padding push bottom element lower tot bottom. want remove bottom padding multi-column element have narrower bottom padding element below it. here's bottom padding want removed. this image of problem : here's markup. <div class="span8" id="content-wrapper"> <div class="content" id="container"> <article class="item"> ... </article> <article class="item"> ... </article> <article class="item"> ... </article> <article class="item"> ... </article> </div> <nav class="pagination loop-pagination"> <a class="prev page-numbers" href="#">previous</a> <a class="page-numbers" href="#">1</a> <span class="page-numbers current&q

c++ - Allocating a large 2D array of NumericVectors in Rcpp -

i trying allocate large(ish) 2d array of numericvectors (the total memory should around 16mb barring overhead), stack overflow. here smallest reproducible example can come with: require(rcpp) require(inline) testfun = cxxfunction( signature(x="list"), body='using namespace std; vector<vector<numericvector> > rs=as< vector<vector<numericvector> > >( x ); return wrap(rs);', plugin="rcpp") x=lapply(1:1000,function(g) lapply(1:1000, function(h) runif(3))) testfun(x) profiling gdb tells me deep in libr.so recursion. note while here arrays rectangular use numericmatrix instead in actual problem jagged. thoughts. edit: solution using (fairly new) listof<t> template class: require(rcpp) require(inline) testfun = cxxfunction( signature(x="list"), body='using namespace std; listof<listof<numericvector> > rs=as< listof<listof<numericvector&

ios - Storing data in NSUserdefaults or coredata? -

i need store dictionary in app it's life time should same life time of data stored in nsuserdefaults. there few ways achieve thinking of core data , nskeyedarchiever , nsuserdefaults . i going update information frequently , dictionary not going large data . my question method best? because storing , retrieving nsuserdefault costly operation. - core data seems overkill , meant manage larger amounts of data. require maintain entire core data stack persistent store, context, model etc. - nskeyedarchiver not meant frequent changes , more code nsuserdefaults. + nsuserdefaults best scenario describe. simple, transparent , sanctioned api, has fast underlying database associated it, can synched via icloud etc.

android - Listview filter the data contained in database very slowly -

i'm working english persian dictionary ... unfortunately, not using lazzy listview sample in project , project had list , filter out 50 thousand words database , slow typing , updating list occured , please me use lazzy listview in project , use optimized filter reduce use of memory , increase speed .... tnx this classes : mainactivity public class mainactivity extends activity { listview list; imageview cleartext; edittext editsearch; typeface edtsearchfont; static string[] word; static int[] index; static listviewadapter adapter; static arraylist<listviewstruct> arraystructlist = new arraylist<listviewstruct>(); context context; // oncreate @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.listview_main); co

javascript - AngularJS with ui-router: Changing value of a parent dependency of from child's controller -

environment : angularjs application (using ui router) has nested states. short version: how change value of parent-state's dependency inside child's controller, such siblings of child state, using dependency new value. long version : take following configuration: shopapp.config(function($stateprovider) { $stateprovider.state('shop', { url : '/shop', templateurl : 'shop.html', resolve : { user : function($q) { // callback ends returning null // because user not logged in } }, controller: function($scope, user) { // user null @ point $scope.user = user; } }).state('shop.login', { url : '/login', templateurl : 'login.html', controller : function($scope) { // onloggedin called form-processing // logic once user has logged in $scop

ios - i want to run method after requestaccesstoentitytype alertview generates -

generally access ios calendar app in iphone call selector requestaccesstoentitytype:completion: alert generated this so after press ok buttonindex want run method generally know use clickedbuttonatindex method alertview called? any appreciable..... according ur above comment, think u requesting access calendar. u have request authorization calendar app. hope url may you clickhere

javascript - Days are getting plus one when printing using angularjs -

i facing weird problem angularjs date format - following date getting in response - "start_date":"2014-08-16t18:30:00.000z" now when applying angularjs date formats filter - response.data.start_date = $filter('date')(response.data.start_date, 'mm/dd/yyyy'); my date added +1 , showing in form - 08/17/2014 let me know doing wrong here ? fyi - on local server(localhost) nothing coming server. the z on string means it's in "zulu" time (gmt/utc). there timezones 18:30 on 16th gmt is on 17th local time. 1 of places india, gmt+0530 (you've said you're in ist time zone). 18:30 + 5.5 hours = midnight next day, local time in india.

java - Displaying tab in JSP page -

i trying display text file content in body of jsp page.i used bufferedreader , stringbuilder it. file contents contains tab instead of spaces between words.while displaying ,the tab between words displaying single space between words in browser. thanks use 1 of following 1. <pre></pre> blocks. 2. css - using padding 3. 4 times &nbsp; after reading file , while generating html can use 1 of these options. for more options refer - html: tab space instead of multiple non-breaking spaces ("nbsp")?

python - Can't DELETE when POST, PUT, and GET works, AngularJS-CORS, Flask-CORS -

i'm @ loss, cant understand on how come delete requests not coming through when post, put , works fine. , i'm pretty sure did every bit configuration necessary cors work. i'm using angularjs , flask-cors extension and here's current work: angular config: angular.module('...' [...]).config(function($httpprovider) { $httpprovider.defaults.usexdomain = true; delete $httpprovider.defaults.headers.common['x-requested-with']; }); angular factory: angular.module('...').factory('...'), function($http) { return { deleteelectronicaddress: function (partyid, contactmechanismid) { return $http({ url: urlbase + 'party/' + partyid + '/contact-mechanism/' + contactmechanismid, method: 'delete', }); }, somemoremethods: { ... } } } my flask codes, (i'm using proposed app structure miguel grinberg on book flask web development) config.py class config: ...

php - Symfony2 ManyToMany or OneToMany or what? -

i'm trying since 2 weeks code running. database structure (simplified): table user | id | username | table tasks | id | task title | task type |user table task type | id | task type title | table task done | id | task id | user id what want: add task, select if task global ( visible every user) or if task visible 1 user ( global or user-id put table field "user" in table "tasks". if marked task "done", want make entry table "task done" task id , user id ( user id's value comes page, entry done, same value in table "tasks" field "user" , when task "global" task, value "user id" in table "task done" can't "global" id of user, working task. i tried many ways many many, 1 many , on. errors, can me? have read, there problems table field names "id" field. maybe can tell me how setup database structure / entites. me lot! kind regards, marvin

mysql - Asterisk 1.4 -- SQL -- how to determine transferred and missed calls by certain queue -

is possible determine, if call ended in target queue (let's 720) or transferred , answered in queue (let's 721)? is there parameter describes transferred call state? no, there no easy way you have answered/hanguped state in queue_log. to manage transfer need add special dialplan or event listener. simple way - add in dialplan variable __entered_queue=720(duble __ mean have moved sub-channels on new channels create) , read variable in dialplan. more complex way - ami event listener track calls , mark it.

symfony - Doctrine Mongodb references() -

is possible doctrine mongodb createquerybuilder() add multiple references document ? here's example of want do: have 2 collections : users , movements in 1:n relation user has multiple movements , movement refers user. to movements user, can $user->getmovements(); i can call doctrine createquerybuilder this: $query->createquerybuilder('movement'); $query->field('user')->references($user); both give me expected results. if want fetch movement of 2 or 3 users in 1 query ? is possible (which tried did not work) $q->field('user')->references($user1); $q->field('user')->references($user2); // etc. i stuck kind of query. ! colzak. ok, found solution may not best 1 works. instead of doing $q->field('user')->references($user); you can do $->field('user.$id')->equals(new \mongoid($user->getid()); so if have array of user, can like $userids = array(); foreach ($user

uisplitviewcontroller - iOS - Split View Controller - How do I get a pointer (reference) to the Detail View Controller from inside the Master View Controller? -

ios - split view controller - how pointer (reference) detail view controller (the bigger right one) inside master view controller (the smaller left one)? my gut tell me main split view controller should have reference detail view controller , own master view controller, can't figure out how it. any thoughts? split view controllers do have references master , detail view controllers, via viewcontrollers property. in ios 7.x , below, viewcontrollers array should have 2 view controller objects in it. first object master view controller , second object detail view controller. in ios 8.0 , above, viewcontrollers array has @ least 1 view controller object in – master (or "primary") view controller. if second view controller object in array, detail (or "secondary") view controller. when split view controller collapsed, master view controller in array, , when expanded contain both master , detail view controllers. you can use splitviewcontroll

Write the division and the remainder on two variables using php -

this question has answer here: how divide numbers without remainder in php? 6 answers i dividing 1779 30. want write answer (without remainder) 1 variable , write remainder variable. how this? number without remainder: $result = (int) (1779 / 30); the remainder: $result = 1779 % 30;

excel vba - vba - find matches cells and copy it - optimizing code -

i have col d (in sheet1 called students), col a (in sheet2 called students too)and col b(in sheet2 called age).in cold there lot of similar students name , sorting z. i want loop col d once , if exists match students name in cola ( sheet2 ), want copy in cold ( sheet1 ) b column(sheet2)that matches cola ( sheet2 ). i sorted cold because don't want loop every similar students name. mean: if student name (for example: andrew)in cold matches student name ('andrew')in cola , copy colb (matches col a- example andrew has 15 years old) in cold ( sheet1 ). , if string 'andrew' repeated in cold (i found in cells), don't loop again colb ( sheet2 ), copy value first string. for example: (sheet1) cold: students: row1: andrew row2: andrew row3: andrew row4: andrew row5: andrew row6: andrew row7: ben row8: ben row9: edoardo row10: helen row11: leonardo

opencv - Save vector <DMatch> in FileStorage -

i want write vector<dmatch> in file. checked it’s possible write vector of classes keypoints, mat, etc, it’s not possible it. knows how can it? section of code following: mat imdescriptors; vector<keypoints> imkeypoints; filestorage fs(name, cv::filestorage::write); fs <<” c” << "{"; fs << "descriptors" << imdescriptors; fs << "keypoints" << imkeypoints; fs << “}”; it works ok, when add code element: vector<dmatch> good_matches; fs << “goodmatches” << good_matches; i following error: c:\opencv248\build\include\opencv2\core\operations.hpp(2713): error c2665: 'cv::write' : of 9 overloads convert argument types.

vba - Insert rows in a protected worksheet in excel 2010 -

i want insert rows in protected worksheet. using following code in thisworkbook code window, not working. can please me? private sub workbook_open() worksheets("sheet1") .protect password:="vba2014", userinterfaceonly:=true, allowinsertingrows:=true .enableoutlining = true end end sub the userinterfaceonly:=true parameter in worksheet.protect serves protect user interface, not macros. if argument omitted, protection applies both macros , user interface. that say, allows macros run on protected sheet users still restricted doing things allowed within protection settings you try setting allowinsertingrows:=true when applying worksheet protection approach isn't effective e.g. if have tables/list objects or merged cells on sheet.

android - OnPostExecute() of asynctask is not called first time -

i using asynctask in application. first time onpostexecute() not getting called. after next time calling. can problem? this how invoke asynctask - new notificationlistasynctask(this, notificationcounthandler).execute(); and below asynctask - import java.io.ioexception; import java.io.unsupportedencodingexception; import org.apache.http.client.clientprotocolexception; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import android.content.context; import android.content.sharedpreferences; public class notificationlistasynctask extends asynctask<string, void, void> { context context; private static final string tag_data = "data"; private handler handler; public static final string key_notification_count = "key_notification_count"; public static final int key_notification_message = 1001; private static final string tag_notification_id = "id"; public notificationlistasynctask(context context, handler h