Posts

Showing posts from January, 2015

java - Using Spring security 3 to authenticate against REST a user only with username -

this deal. have single authentication using username of application user, , have work angular, spring , mysql. already, have rest post service receive email (username) , have check if user exist in user table in database, , have response json structure: {"response":{"loggedin":"true"}} or {"response":{"loggedin":"false"}} i found example using http-basic authentication on spring security , works fine, issue approach not works me because approach needs , username , password, need username , check if user on database. my question how can authentication spring security using rest service , single authentication user name field? this spring-context.xml <security:http pattern="/login" security="none"> </security:http> <security:http auto-config="true"> <security:intercept-url pattern="/**" access="role_rest" /> <security:http-basic

osx - perl script run from inside launchd failing with "No such file or directory" for 'system' commands -

i've got perl script (which run on linux & windows well) i'm trying run via launchd on osx-10.8.3. i'm inexperienced in writing plist files, i'm hoping silly i've overlooked. should note runs fine via cron on osx, problems i'm encountering specific launchd. however, when attempt run via launchd, erroring out on perl 'system' calls, claiming "no such file or directory". here's plist: <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple computer//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>label</key> <string>launched.sysinv</string> <key>programarguments</key> <array> <string>/usr/bin/perl</string> <string>/users/lfriedman/cuda-stuff/sw/gpgpu/build/scripts/

jQuery Mobile changePage in pagebeforeshow Flicker -

in several of jquery mobile pages, need ensure variables set before allowing page show. such, check these variables in pagebeforeshow event , if not present or correct, call $.mobile.changepage(...) inside pagebeforeshow event , return. in jquery mobile 1.2.1 seemed work perfectly. however, i'm using jquery mobile 1.3.1 i've noticed odd rendering issue. when call changepage inside pagebeforeshow event, causes jquery mobile transition page requested, original page, firing pageshow event, , transitions page did changepage to. while not major issue, inconvenience , causes unnecessary transitions. has else encountered issue , if so, have been able prevent unnecessary transitions , event firing? thanks! example code: $('#conditionalpage').on('pagebeforeshow', function () { if (!somescopedvariable) { $.mobile.changepage('#regularpage'); return; } } $('#conditionalpage').on('pageshow', function () {

javascript - Using transferable objects from a Web Worker -

i have code create web worker: w = new worker("webwork.js"); w.onmessage = function(event) { alert(event.data); } and webwork.js code web worker: self.onmessage = function(event) { //var ss=r; //causes error because of undefined var ss=""; for(var currprop in event) { ss+=("event."+currprop+"="+event[currprop]+"\n"); } postmessage(ss); } now want transfer 128-megabyte arraybuffer code: var r = new arraybuffer(1048576*128); w.postmessage(0, [r]); now have supposedly transferred variable r , how access web worker itself. have tried event.r , r , self.r , other things trying add second function argument array of arraybuffers , nothing works. how can access transferred variable(s) web worker? postmesage(amessage, transferlist) in transferlist must specify transferable objects, contained in amessage : var objdata = { str: "string", ab: new arraybuffer(100),

initial route is not in history -- ember.js location: "history" -

i'm using ember.js location: "history". first route of site loaded (i.e. 1 type url) renders fine. can click linkto anchor second route, when click button return first route (the loaded one), not routed. is there can push initial route history? should need this? my route mapping looks this: app.router.reopen({ location: "history" }); app.router.map(function() { this.resource("foods", function(){ this.route("index", {path: "/"}); }); this.route("fourohfour", { path: "*:"}); }); note: doesn't seem matter whether begin @ http://mysite.example/ or http://mysite.example/foods . in either case, attempting onto loaded route has no effect. i believe perhaps should pushing history don't know how it, nor why should need to. "fourohfour" handler undefined routes, btw. don't think it's related issue. any advice welcome. good catch on one. ran same issue

Key point to keep in mind when writing database interaction layer (DAL) -

what key aspects or points when writing data access layer (dal). do allow higher layers pass "unique" queries dal, ie not standard update, insert , delete...? how 1 allow scalability in such layer? any comments great aiden speaking experience there few key aspects when writing dal. making dal interface pick right level of abstraction keep caching in mind (1) make sure dal interface. allows mock methods might call database testing. if have getitems() function in interface, can implement class goes out database and class mocks data quick unit testing. (2) while you're doing (1) make sure you've picked right level of abstraction. example, i've seen bad dal @ current company used abstract query language each call. as example, 1 call in our dal be: getitems(list filters, int limit, int skip) . instead have liked see: getitems(list ids, int pagesize, int page) . we let details of underlying data source (mongo in case) bleed thr

xml - Using XSLT to replace http:// with https:// -

i trying replace http:// instances href tags , image sources, https:// <xsl:for-each select="item[position()&lt;2 , position()&gt; 0]"><!-- display 1 - skip none --> <article class="395by265-presentation"> <a href="{link}" target="_blank"> <img src="" width="395" height="265" alt="{title}" border="0" class="fbapp"><xsl:attribute name="src"> <xsl:value-of disable-output-escaping="yes" select="enclosure/@url"/></xsl:attribute> </img> <div class="synopsis"><xsl:value-of select="description"/></div> </a> </article> </xsl:for-each> any appreciated. i using xslt 1.0. trying access , replace all instances of http. w

Allow download of KML file created from JavaScript and Google Earth API -

want create web-application running entirely in browser without backend server component creates kml on-the-fly using google earth api clicking "download" button activates normal content download feature of web browser either prompting save file .kml extension or automatically launching google earth way of kml mime type. i can construct "data:" url activate download of kml file created within javascript using google earth api works in chrome. works partially in firefox saved ".part" file extension user must explicitly rename file open in google earth. ignored ie. ie 9, example, doesn't support javascript generated file downloads. i'm looking cross-browser solution chrome + firefox + ie @ minimum. <script type="text/javascript"> var ge; var placemark; google.load("earth", "1"); function init() { google.earth.createinstance('map3d', initcallback, failurecallback); } ... code create kmlobjec

javascript - Jquery in 30 days inquiry -

i watching tutorial video "30 days learn jquery". have question why tutor in video returned variable function. here's code: this in html file binds event handler buttons, calls functions, etc. (function() { slider.nav.find('button').on('click', function() { slider.setcurrent( $(this).data('dir') ); slider.transition(); }); })(); and 1 function i'm interested in (in js file): slider.prototype.setcurrent = function( dir ) { var pos = this.current; pos += ( ~~( dir === 'next' ) || -1 ); this.current = ( pos < 0 ) ? this.imgslen - 1 : pos % this.imgslen; return pos; // <== here }; the thing want figure out why return pos ? tried removing , code still worked. was mistake or there sound logic this? in nutshell, setcurrent function called , setcurrent returns value. why? it's hard know without seeing rest of code, functions set value on object return som

Manufactures Advertised Pricing (MAP) Not Working on Magento ver. 1.7.0.2 -

i have enabled map pricing described via wiki single product test functionality before adding more items, cannot features map pricing "on gesture" show on product page. using customized version of modern theme on magento ver. 1.7.0.2. have checked appropriate css map popup in style.css , enabled in admin/config/sales/map , on manage product page. please let me know if have ideas why wouldn't show on front end. there few solutions on net topic, , ones exist have tried no avail. in advance help.

java - Why is my smaller method giving me an error -

this first class called class circle: public class circle { //circle class begins //declaring variables public double circle1; public double circle2; public double circle3; public double xvalue; public double yvalue; public double radius; private double area; //constructor public circle(int x,int y,int r) {//constructor begins xvalue = x; yvalue = y; radius = r; }//constructor ends //method gets area of circle public double getarea () {//method getarea begins area = (3.14*(this.radius * this.radius)); return area; }//getarea ends public static smaller (circle other) { if (this.area > other.area) { return other; else { return this; } //i'm not sure return here. gives me error( want return circle) } }//class ends } this tester class: public class tester {//tester begins public static void main(string args [])

python - How to set TTL index for collection in MongoKit? -

i want use 'time live' collection feature ( http://docs.mongodb.org/manual/tutorial/expire-data/ ) in app (flask+mongokit). it possible create ttl index documents in collection via mongokit when describe models or need use pymongo instead? thanks you can use pymongo layer create ttl index documents: http://api.mongodb.org/python/current/api/pymongo/collection.html#pymongo.collection.collection.ensure_index exemple assuming have user mongokit model: db.user.collection.ensure_index("name", 300) note ttl deprecated in pymongo 2.3. use cache_for instead.

lookup - MS Dynamics-CRM How can I find GUID of the existing view by "Display Name" using JS? -

i have category 1, category 2, , category 3. cat1 parent of cat2. cat2 parent of cat3. view every category filtered parent. problem: category 3 doesn't filtered if cat2 not specified when cat1 selected. need: in addition existing functionality need able filter grandparent well. my solution : i'm doing -> able create custom view. when on form load or on change of cat1 i'm running script sets default custom view. in scenario - need change view when category 2 specified. (because user can choose category 1 -> category 2 , 3). set default view need provide guid of desired view. question1: way it? question2: how can find guid of existing view "display name" using js? thank actually, don't know why couldn't think of before, need specify second condition in same query. "select cat1=1 , cat2=2

I need help in javascript password validation? -

i working on password validation script. the following code working fine numbers, upper- , lower-case letters. the problem in .press spacebar key, length more 8, display return true. not allowed special characters. $("#password").keyup(function () { var validated = true; if (this.value.length < 8) validated = false; if (!/\d/.test(this.value)) validated = false; if (!/[a-z]/.test(this.value)) validated = false; if (!/[a-z]/.test(this.value)) validated = false; if (!/[@#$%\&^\-\+=!*.?~]/.test(this.value)) validated = false; if (/[^0-9a-za-z@#$%^&+=!*,.?~]/.test(this.value)) validated = false; $('#password_strength').text(validated ? "good" : "too weak"); when checking symbols in password using regex, you'll want escape them they're taken literal character, not regex meaning of character. more information, recommend checking out:

java - Can't see where I'm dividing by 0? -

here code think need able asses problem 1 import.java.util.scanner 2 public class ccattano_sieve{ 3 private boolean [] primes = new boolean [50001]; 4 private int upper; 5 private int lower; 6 7 public ccattano_sieve(){ 8 upper = 50000; 9 lower = 1; 10 (int = 2; < primes.length; i++){ 11 primes[i] = true; 12 } 13 primes[0] = false; 14 primes[1] = false; 15 } 16 17 public void processsieve(){ 18 (int = 2; < math.round(math.sqrt(50000)); i++){ 19 if (primes[i] == true){ 20 (int c = 2; c < (primes.length - 1); i++){ 21 if (c % == 0){ 22 primes[c] = false; 23 } 24 else{ 25 primes[c] = true; 26 } 27 } 28 } 29 } 30

.net - image WriteableBitmap image .Pixels The field, constructor or member 'Pixels' is not defined? -

let image = writeablebitmap(100, 100, 300.0, 300.0, media.pixelformats.bgra32, null); let pixel = image.pixels error 2 field, constructor or member 'pixels' not defined writeablebitmap.pixels property msdn why not defined? is framework issue? or ... scope? or ? thanks pixels property of system.windows.media.imaging.writeablebitmap class silverlight, different system.windows.media.imaging.writeablebitmap class of standard framework. you should reference silverlight version of framework use first class - , have pixels property - writing silverlight application, not standard windows one. to access pixel values using standard framework can use copypixels methods

c# - Initialize an array of a class in a constructor -

i have class garage has property array of type car , class in program. i've tried several iterations , run-time errors on of them. nullrefernceexception whenever try run it. happens in program class try access length property of carlot array. i know has carlot property of garage class being array instead of car . piece missing here array isn't set null when program tries use it? class program { static void main(string[] args) { garage g = new garage(); //this exception occurs g.carlot[0] = new car(5, "car model"); console.readline(); } } public class garage { public car[] carlot { get; set; } public garage() { } //this should able 0 or greater public garage(params car[] c) { car[] cars = { }; carlot = cars; } } public class car { public int vin { get; set; } public int year { get; set; } public string model { get; set; } public car(int _vin, string _mo

c# - An exception of type 'System.Exception' using a converter XAML -

i using ivalueconverter in xaml in windows phone app. code <textblock margin="0,0,10,0" text="{binding score, converter={staticresource secondstominuteshour}}" foreground="{binding deviceid, converter={staticresource fontforegroundconverter}}" fontweight="{binding deviceid, converter={staticresource fontweightconverter}}" grid.column="3" /> however converter raised error an exception of type 'system.exception' occurred in system.windows.ni.dll , wasn't handled before managed/native boundary score type string , converter class follow public class secondstominuteshour : ivalueconverter { public object convert(object value, type targettype, object parameter, cultureinfo culture) { int secs = int.parse(value.tostring()); timespan ts = timespan.fromseconds(secs); return string.format("{0:d2}:{1:d2}:{2:d2}",

activerecord - How can i remove a column from table using rails console -

it possible remove column using rails migration. class someclass < activerecord::migration def self.up remove_column :table_name, :column_name end end i want know if there way remove column table using console. you can run codes in up method directly in rails console : >> activerecord::migration.remove_column :table_name, :column_name if have migration file such " db/migrate/20130418125100_remove_foo.rb ", can this: >> require "db/migrate/20130418125100_remove_foo.rb" >> removefoo.up if want rake db:migrate , try this: >> activerecord::migrator.migrate "db/migrate"

jsf 2 - Rich Faces rich:clientId in Primefaces? -

Image
does know if there equivalent of richfaces rich:clientid in primefaces? example, if want full client id of field: username. '#{rich:clientid('username'), how can in primefaces? because want value of field dynamically. jsf-2 primefaces richfaces share | improve question asked apr 18 '13 @ 4:53 czetsuya 1,765 9 34 74      you can use generic

cocos2d x - libcurl 7.26.0 : garbage at the end of every http response -

i using cocos2d-x game engine develop game. game fetches lot of data server. reduce loading time , data consumption , used gzip encoding. curl_easy_setopt(curl, curlopt_accept_encoding, "gzip,deflate"); but strangely, see garbage @ end of each http response , when don't use gzip , every http response ok , no garbage in end of http response. please suggest can possible reason issue. appreciated. thanks. try curl_easy_cleanup(curl); and curl_global_cleanup(); after finished sending request curl_easy_perform() , see if error still exists.

css - Text area in HTML is showing code instead of being rendered and formatted -

i have done textareas before 1 killing me. text area showing html code , not css'ed properly. in actual window code textarea's element , shows rest of code in well, instead of rendering it. without textarea tag works peachy. <article> <form method="post" name="form9" action="<?php echo $_server['php_self']; ?>"> <label for="firstname">first name <sup>*</sup></label> <input type="text" id="firstname" name="firstname" required /> <label for="lastname">last name <sup>*</sup></label> <input type="text" id="lastname" name="lastname"/> <label for="wrstyle">writing style <sup>*</sup></label> <textarea placeholder="please, briefly describe writing style." type="text" id="wrstyle" name="wrsty

adding deleted file info to a single file [UNIX] -

so have simple problem in order restore files, original directory , filename must stored. create hidden file called ".restore.info". each line of file should contain name of stored file, followed colon, followed original full path , filename. for example, if file f1 inode 1234 removed /home/usr1.name/ directory , file named f1 inode 5432 removed /home/usr1.name/testing directory .restore.info contain: f1_1234:/home/usr1.name/f1 f1_5432:/home/usr1.name/testing/f1 any ideas? ls f* | parallel 'echo {}_`stat -c%i {}`:$pwd/{} >> .restore.info ;mv {} recyclebin/{}_`stat -c%i {}`' hope works +

Python passed values from a list not adding correctly -

in code below having issues 2 things. 1 math in function on lines 40 (exampoints) , 47 (hwkpoints) being passed range of values in list on line 94. should taking scores , adding them reason isn't adding last number on each range passed. ex: myvalues[11:13] being passed numbers 75, 95, , 97 adds first 2 , not last. my code here: from time import asctime time import localtime def findgrade(mygrade): #argument number in range of 1 - 100 or float mynum? if mygrade >= 90: lettergrade = "a" if mygrade >= 80: lettergrade = "b" if mygrade >= 70: lettergrade = "c" if mygrade >= 60: lettergrade = "d" if mygrade < 60: lettergrade = "f" return lettergrade def calculatepointsearned(hwkgrades, examgrades): hwktotal = float(hwkpoints(hwkgrades)) #print hwktotal examtotal = float(exampoints(examgrades)) #print examtotal myaverage = (hwktot

python - How to remove delete icon in one2many tree view -

Image
please advice me on this.need remove delete icon.but need create , edit records. if set readonly unable edit also.so better way implement add delete="false" in tree tag. <tree string="my tree" delete="false"> this remove delete option one2many tree view.

PHP Instagram api getting "code" and refreshing when authenticated -

hi'm trying figure out how authentication works. got instagram authenticated, , redirects me "callback" or "redirect_uri". when redirected works supposed to. ?code=54325114 supposed to. but why when refresh, i'm not authenticated anymore? can't retrieve data. , when go index php (before authentication), redirected again , code changes, , works again, when refresh, doesn't again. what correct way handle situation? thanks, scenario makes sense. i appear bit late party, anyway. when authenticate user ig api, sent auth code. code valid once. when code, must request access token, can use many times. when code, should access token , cache (either session variable or cookie). then, if user reloads page should check if there access token cached , if there should not attempt regenerate it.

debugging - Understanding some C++ coding practice -

i trying understand how following code ( http://pastebin.com/zthurmyx ) works, approach compiling software in debug , using gdb step through code. however, i'm running problem 'step' not tell me going on. particularly unclear me execute {...} cannot step into. how go learning code doing? 1 /* 2 copyright 2008 brain research institute, melbourne, australia 3 4 written j-donald tournier, 27/06/08. 5 6 file part of mrtrix. 7 8 mrtrix free software: can redistribute and/or modify 9 under terms of gnu general public license published 10 free software foundation, either version 3 of license, or 11 (at option) later version. 12 13 mrtrix distributed in hope useful, 14 without warranty; without implied warranty of 15 merchantability or fitness particular purpose. see 16 gnu general public license more details. 17 18 should have received copy of gnu general public license 1

activex - Teechart Multiple box plot for single point -

Image
can plot multiple box polt single point similar in bar chart have multiple bar @ single point. thanks akshay you can have multiple boxseries, example here: http://www.teechart.net/support/viewtopic.php?f=3&t=13048&hilit=boxplot it's delphi example, shouldn't different in activex. update: from comments, understand want have boxes in different x positions, , in groups. here simple example of how play positions achieve same: dim nseries, groupsize integer private sub form_load() dim i, aindex, sindex, lindex, tmpx integer teecommander1.chartlink = tchart1.chartlink 'tchart1.header.text.text = tchart1.version tchart1.aspect.view3d = false tchart1.panel.margintop = 7 tchart1.header.visible = false tchart1.axis.bottom.ticks.visible = false tchart1.axis.bottom.minorticks.visible = false nseries = 8 groupsize = 2 aindex = tchart1.tools.add(tcannotate) tchart1.tools.items(aindex).asannotation.text = "group 1"

cocoa - Mac OSX - Core Animation - how to animate something which is following my cursor? -

so far have seen core animation has code looks this, parameters of animate set in beginning. - (void) starttopleftimageviewanimation{ /* start top left corner */ [self.xcodeimageview1 setframe:cgrectmake(0.0f,0.0f, 100.0f, 100.0f)]; [self.xcodeimageview1 setalpha:1.0f]; [uiview beginanimations:@"xcodeimageview1animation" context:(__bridge void *)self.xcodeimageview1]; /* 3 seconds animation */ [uiview setanimationduration:3.0f]; /* receive animation delegates */ [uiview setanimationdelegate:self]; [uiview setanimationdidstopselector: @selector(imageviewdidstop:finished:context:)]; /* end @ bottom right corner */ [self.xcodeimageview1 setframe:cgrectmake(220.0f, 350.0f, 100.0f, [self.xcodeimageview1 setalpha:0.0f]; [uiview commitanimations]; } however, make animation in graphic follows mouse cursor. means animation receiving mouse-pointer x-y values. is there better alternative doing "manual" animation this, , calling drawrect whenever shift position of m

xmpp - Creating Chat Room In Android Gives Error:"item-not-found(404) -

i developing chat application using asmack. able connect , send messages private chat.however, when trying create chat room error: item-not-found(404) this code using: setconnection(connection); if(connection != null) { try { // smackandroid.init(this); multiuserchat muc=new multiuserchat(connection,"chat1@groupchat.google.com"); muc.create("greatandroid"); log.d("chat room created","successfully created chat room"); form form = muc.getconfigurationform(); form submitform = form.createanswerform(); (iterator fields = form.getfields();fields.hasnext();){ formfield field = (formfield) fields.next(); if(!formfield.type_hidden.equals(field.gettype()) && field.getvariable()!= null){ submitform.setdefaultanswer(field.ge

ios - Lazy Image loading w/ caching -

i not able form question title because question descriptive.but can explain here.this related image cache in ios. my requirement : want create 1 list contain image view , image loaded online. need implement cache image (because every time if loaded fom online take time , network consuming). note: preparing cache key image based on image link. is there other way prepare cache key ? after loading listview can click on row , redirect details page. in detailed page have edit option , can change image. , resubmit server. once complete uploading force close application , open fresh app. in case in server side no change in image link because image link http://www.uigarden.net/english/images/108.jpg now load tableview , images frying load either cache or server. have 2 cases. 1) cache: if there no changing in link , link id available in cache folder load cache. here mu issue : can not able find wether edited or not edited. can not able load newly edited image, because cache

ios - Differences with archiveRootObject:toFile: and writeToFile: -

recently, i'm learning nskeyedarchiver , nskeyedunarchiver. found there 3 ways archive array , i'm trying figure out differences. 1.using archiverootobject:tofile: [nskeyedarchiver archiverootobject:testarray tofile:filepath]; 2.get data archiveddatawithrootobject: , write file nsdata *data = [nskeyedarchiver archiveddatawithrootobject:testarray]; [data writetofile:filepath atomically:yes]; 3.using encodeobject: data nsmutabledata *data = [nsmutabledata data]; nskeyedarchiver *archiver = [[nskeyedarchiver alloc] initforwritingwithmutabledata:data]; [archiver encodeobject:testarray forkey:@"testarray"]; [archiver finishencoding]; [data writetofile:path atomically:yes]; after testing, found ways above work fine , write same content file. q1: what's differences ways above? q2: can use nsdata in 3rd way? the first 1 doesn't give choice of data. go file. use second way to, example, send data across n

iphone - Scroll down uitableview to specific date -

i know if have uitable, title of each table items date , time. may know how code if want table auto scroll down cell specific date e.g. today's date? should code in viewdidload method? here code table, @interface picturelistmaintable : uitableviewcontroller{ iboutlet uibutton*scroll; } @property (strong, nonatomic) nsmanagedobjectcontext *managedobjectcontext; @property (strong, nonatomic) nsmutablearray *picturelistdata; @property (strong, nonatomic) iboutlet uibutton*scroll; - (void)readdatafortable; -(ibaction)scrolldown:(id)sender; @end @synthesize managedobjectcontext, picturelistdata; @synthesize scroll; // when view reappears, read new data table - (void)viewwillappear:(bool)animated { // repopulate array new table data [self readdatafortable]; } // grab data table - used whenever list appears or reappears after add/edit - (void)readdatafortable { // grab data picturelistdata = [coredatahelper getobjectsforentity:@"pictures"

cocoa touch - Objective-C costum drawing with draw: (CGContextRef *)context -

i have home work our professor told make circle, square, , triangle confirm protocol called shape.h : #import <foundation/foundation.h> @protocol shape <nsobject> @required - (void)draw:(cgcontextref) context; - (float)area; @end and use uibotton call different class draw.. i call draw function view controller xyzcontroller.m : - (ibaction)rectbutton:(id)sender { cgrect frame = [myview bounds]; myrect *rectview = [[myrect alloc] initwithframe:frame]; [rectview draw: uigraphicsgetcurrentcontext()]; [myview addsubview:rectview]; } where myview uiview dragged onto .xib and perform draw in myrect class myrect.h : @interface myrect : uiview <shape> i changed super class nsobject uiview... not sure if did correctly.. myrect.m : - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { [self setneedsdisplay]; } return self; } - (void)draw : (cgcontextref) context {

How to SUM value using PHP function for ORACLE -

kindly me. i want create summary raw database. example: id | vessel name | tonnage | 1 abc 1000 2 cde 2000 3 efg 3000 6000 <-- how total value using php , oracle? for information, below code: $conn = ......; $strsql = .....; $objparse = oci_parse ($conn, $strsql); oci_execute ($objparse); while($objresult = oci_fetch_array($objparse,oci_both)) { echo $objresult["id"]; echo $objresult["vslnm"]; echo $objresult["ton"]; } my question: there way using php function sum tonnage value. want grand total tonnage. its trivial, add variable define outside loop: $conn = ......; $strsql = .....; $objparse = oci_parse ($conn, $strsql); oci_execute ($objparse); $total_tonnage = 0; while($objresult = oci_fetch_array($objparse,oci_both)) { echo $objresult["id"]; echo $objresult["vslnm"]; echo $objresult["ton&q

printf - Make fprintf to write to std::stringstream -

function fprintf writes file* . have debugprint function writes stringstream. don't want change function used @ many places , break code. how can pass stringstream fprintf? update : can wrap stringstream file , unwrap back? you can't "pass" ostream fprintf. file structure platform dependent. this not best way, can create evil macro: #undef fprintf #define fprintf my_fprintf and can create 2 my_fprintfs, 1 takes file* , , takes std::stringstream& argument. you can avoid macro calling my_fprintf directly, have modify call site. you can't "wrap stringstream in file*" portably, there system specific ways. if that's after, linux example has fopencookie() take function pointers read/write functions. create functions wrap std::stringstream.

cmd - How do i get a list of folders and subfolders without the files -

i trying print list of folders , subfolders of directory file. when run dir /s/b/o:n > f.txt list of files also. i need folders , sub folders. anyone know possible command line interface? try this: dir /s /b /o:n /ad > f.txt

c# - how to Clear textBox after CompareValidator caught wrong datatype? -

and beginner in using asp.net , c# in visual studio 2008 i have textbox id = limitamount, supposed accepts input of type double, therefore made comparevalidator (comparevalidatoramount) control this, want textbox cleared after invalid input type. thank ! use custom validator: <asp:customvalidator id="customvalidator1" controltovalidate="limitamount" onservervalidate="servervalidation" errormessage="this field requires number" forecolor="red" runat="server"/> in code behind: void servervalidation(object source, servervalidateeventargs args) { double tmp; if(double.tryparse(args.value, out tmp)) { args.isvalid = true; } else { args.isvalid = false; limitamount.text = string.empty; } } if prefer, can validate in javascript clientvalidationfunction

c# - Change groupType of ActiveDirectory Group -

does know, how change grouptype attribute of ad group via c#? after correctly retrieving group, tried following, throws directoryservicescomexception : group.properties["grouptype"].value = activeds.ads_group_type_enum.ads_group_type_global_group | activeds.ads_group_type_enum.ads_group_type_security_enabled; group.commitchanges(); do know way change grouptype property existing group? without knowing exception get, make following suggestion: ensure attempting valid conversion universal -> domain local or global domain local -> universal global -> universal if can't aduc, won't able in programm, double check there.

c++ - Abnormal Output from program -

Image
i have program should print out 2 lists 1 bellow, same list backwards, works first time prints weird output show bellow well. 0123456789 9876543210 however actual output program this: can tell me wrong code please, not sure why getting output. void createfile(){ ofstream myfile; myfile.open ("test1.txt"); for(int x = 0; x < 10; x++){ myfile << x << "\n"; } myfile.close(); } void poparray(int array1[]){ ifstream infile("test1.txt"); int x; while(infile >> array1[x]){ cout << array1[x]; } } void reverselist(int array2[]){ for(int x = 9; x > -1; x--){ cout << setw(2) << array2[x]; } } void checklists(int array1[], int array2[], int sizeofarray){ for(int x = array1[1]; x < sizeofarray; x++){ for(int y = array2[1]; x < sizeofarray; x++){ if(x == y) cout << "palindrome" << endl; else{ cout <&l

asp.net - Cant configure MVC 4 SqlMembershipProvider -

i setting mvc 4 website use sqlmembershipprovider data store sql server express 11.0.21xx i have installed universal providers via nuget pm > install-package microsoft.aspnet.providers when run app , go localhost/accounts/register , submit form, error to call method, "membership.provider" property must instance of "extendedmembershipprovider". at line websecurity.createuserandaccount(model.username, model.password); accounts controller has attribute [initializesimplemembership] set. tables not created due aforementioned error. web.config section updated nuget <profile defaultprovider="defaultprofileprovider"> <providers> <add name="defaultprofileprovider" type="system.web.providers.defaultprofileprovider, system.web.providers, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" connectionstringname="defaultconnection"