Posts

Showing posts from March, 2012

android - ViewPager AutoScroll not Working Properly -

android viewpager autoscroll not working using scheduleatfixedrate. this code,is right ? protected void startautoscroll() { swipetimer=new timer(); swipetimer.scheduleatfixedrate(new timertask() { @override public void run() { new handler(looper.getmainlooper()).post(new runnable() { @override public void run() { if(currentposition==shalombannerslist.size()) { currentposition=0; } viewpager.setcurrentitem(currentposition,true); currentposition=currentposition+1; } }); } }, 100, 4000); } please me. try code : int page=0; public void pageswitcher() { timer timer = new timer(); timer.scheduleatfixedrate(new remindtask(), 1000, 3000); } class remindtask extends timertask { @override public void run() { ...

VBA Excel get values of updated cells -

Image
ok, have been struggling problem time. new vba bear me. what need program grab cell values in workbook updated , push data email. let's range want watch a4:a100. user puts in sales order number a10 , a11. need program take values cells , insert them email when workbook saved. have code @ end of question emails list of people when workbook saved. have email contain id's (column a) of records entered. thank help. private sub workbook_beforesave(byval saveasui boolean, _ cancel boolean) dim answer string answer = msgbox("would save , email notification?", vbyesno, "save , email") if answer = vbno cancel = true if answer = vbyes 'open outlook type stuff set outlookapp = createobject("outlook.application") set olobjects = outlookapp.getnamespace("mapi") set newmsg = outlookapp.createitem(olmailitem) 'add recipients newmsg.recipients.add ("will.smead@cablevey.com") newmsg.recipients.add ("will.smead@cableve...

javascript - How to decide at runtime for which Meteor collection a client will subscribe -

i writing web application dynamically inspect collections (publications) of ddp server. 1 of issues i'm running once meteor collection created sticks around lifetime of app: foo = new meteor.collection("foo"); however, depending on user application, might no longer interested in foo. wasteful have collection linger around, potentially end entire database being stored on client. the issue made worse fact client doesn't know collections going subscribe for. think causes issues how template helpers setup. examples i've seen far show helpers returning results of particular collection, like: return foo.find(); i still getting head around how reactive model works, i'm guessing if reassign foo: foo = new meteor.collection("bar"); ... above helper code not magically update return contents of 'bar'. update: since suggestions revolve around using combination of subscriptions , single collection i'd thought give context why as...

scala - Infinite recursion with Shapeless select[U] -

i had neat idea (well, that's debatable, let's had idea) making implicit dependency injection easier in scala. problem have if call methods require implicit dependency, must decorate calling method same dependency, way through until concrete dependency in scope. goal able encode trait requiring group of implicits @ time it's mixed in concrete class, go calling methods require implicits, defer definition implementor. the obvious way kind of selftype la psuedo-scala: object thingdoer { def getsomething(implicit foo: foo): int = ??? } trait mytrait { self: requires[foo , bar , bubba] => //this fails compile unless dothing takes implicit foo def dothing = thingdoer.getsomething } after few valiant attempts implement trait and[a,b] in order nice syntax, thought smarter start shapeless , see if anywhere that. landed on this: import shapeless._, ops.hlist._ trait requires[l <: hlist] { def required: l implicit def provide[t]:t = required.select[t...

jquery - How to hide flash message after few seconds? -

in application user can post challenge other user. after successful posting challenge displaying 1 flash message same. want hide message after few seconds. wrote following code : $(document).ready(function(){ settimeout(function() { $("#successmessage").hide('blind', {}, 500) }, 5000); }); <div id="successmessage" style="text-align:center; width:100%"> <font color="green" > <%if flash[:alert]=="your challenge posted successfully."%> <h4><%= flash[:alert] if flash[:alert].present? %> <%end%> </font> </div> but code not hiding div "successmessage". you can try : settimeout(function() { $('#successmessage')....

Take screenshot and save as PNG file in Windows using C program -

i want take screenshot of windows pc(7/8.1) , file format should in png format.i've found codes take screenshot in bmp file. but i'm @ png file format,its if know method. anybody knows how take screenshot , save file png using c language? need help. thanks. as screen can considered bmp file, can't take screenshot in png. need convert bmp file png format. here lib convert / png : http://lodev.org/lodepng/

python - Pandas: why pandas.Series.std() is quite different from numpy.std() -

i got 2 snippets code follows. import numpy numpy.std([766897346, 766897346, 766897346, 766897346, 766897346, 766897346, 766897346, 766897346, 766897346, 766897346]) 0 and import pandas pd pd.series([766897346, 766897346, 766897346, 766897346, 766897346, 766897346, 766897346, 766897346, 766897346, 766897346]).std(ddof=0) 10.119288512538814 that's huge difference. may ask why? this issue indeed under discussion ( link ); problem seems algorithm calculating standard deviation used pandas since not numerically stable 1 used numpy . an easy workaround apply .values series first , apply std these values; in case numpy's std used: pd.series([766897346, 766897346, 766897346, 766897346, 766897346, 766897346, 766897346, 766897346, 766897346, 766897346]).values.std() which gives expected value 0.

ios8 - iOS Sharing CSV files with UIActivityViewController -

i have app share csv files from, share other files work both built in options (such mail), , external options such gmail app, or evernote. if attempt share "csv" file, internal mail option works expected, other options, such gmail or evernote share text. if rename csv file "pdf" works in also. is there whitelist of allowed file types can shared? my code faily simple, , looks this: nsarray* activityitems = [nsarray arraywithobjects: customitemattachment, customitemtext, nil]; ... uiactivityviewcontroller *activityvc = [[uiactivityviewcontroller alloc]initwithactivityitems:activityitems applicationactivities:nil ]; to share: nsstring* filename = [[bddata shareddata] adddatetofilename:@"datalog%@.csv"]; nsdata* data = [s datausingencoding:nsutf8stringencoding]; nsstring *filenamelong = [nstemporarydirectory() stringbyappendingpathcomponent:filename]; [data writetofile:filenamelong atomically:yes]; mysharedata* sharedata = ...

ios - SWRevealViewController - How can I make the menu disappear with a tap and/or swipe on FrontViewController -

i developing locator map. how can make menu disappear tap and/or swipe on frontviewcontroller. front view controller map (google map). you can enable use of swipe gestures close menu in swrevealviewcontroller adding pan gesture recognizer view in viewdidload: of view controller. override func viewdidload() { super.viewdidload() view.addgesturerecognizer(myrevealviewcontroller.pangesturerecognizer()) } getting menu respond taps requires handling tap action separately tap gesture recognizer. for example, tap gesture recognizer defined , added view like mytapgesturerecognizer = uitapgesturerecognizer(target: self, action: "closemenu") view.addgesturerecognizer(mytapgesturerecognizer) you close menu function using: func closemenu() { myrevealviewcontroller?.setfrontviewposition(frontviewposition.left, animated: true) } where .left frontviewposition dependent on how have view controllers configured swrevealviewcont...

python - Volume Overlay with Pandas -

Image
i see in context of matplotlib , open-high-low-close, i'm wondering if can add volume overlay within pandas framework. final graph want close first 1 here: ( matplotlib - finance volume overlay ) say have dataframe such: num rolling_30 rolling_10 rolling_60 volume date 2015-06-23 0.000219 0.000149 0.000168 0.000183 2 2015-06-25 0.000489 0.000162 0.000200 0.000188 3 2015-07-01 0.000164 0.000163 0.000190 0.000186 1 2015-07-02 0.000190 0.000166 0.000190 0.000187 1 2015-07-03 0.000269 0.000171 0.000198 0.000180 1 2015-07-04 0.000935 0.000196 0.000282 0.000193 2 2015-07-08 0.000154 0.000196 0.000288 0.000188 1 2015-07-11 0.000274 0.000202 0.000305 0.000190 1 2015-07-13 0.000872 0.000228 0.000380 0.000201 9 how can ['num','rolling_30','...

php - When to use single quotes, double quotes, and backticks in MySQL -

i trying learn best way write queries. understand importance of being consistent. until now, have randomly used single quotes, double quotes, , backticks without real thought. example: $query = 'insert table (id, col1, col2) values (null, val1, val2)'; also, in above example, consider "table," "col[n]," , "val[n]" may variables. what standard this? do? i've been reading answers similar questions on here 20 minutes, seems there no definitive answer question. backticks used table , column identifiers, necessary when identifier mysql reserved keyword , or when identifier contains whitespace characters or characters beyond limited set (see below) recommended avoid using reserved keywords column or table identifiers when possible, avoiding quoting issue. single quotes should used string values in values() list. double quotes supported mysql string values well, single quotes more accepted other rdbms, habit use single quot...

Ruby switch statement always evaluates to default -

if simulate rolling of six-sided die follows, evaluates 6. how fix this? def rolldice() roll = rand() case roll when 0..(1/6) return 1 when (1/6)..(2/6) return 2 when (2/6)..(3/6) return 3 when (3/6)..(4/6) return 4 when (4/6)..(5/6) return 5 else return 6 end end die1 = rolldice() puts die1 this because 1/6 0 . can pass range rand : def rolldice rand(1..6) end

sql server - T-SQL error handling with try catch rollback, error rows were deleted -

i have following construct. noticed erroneous rows error number > 0 being deleted @ end of while loop. don't understand have gone wrong error catching. need second commit in catch section commit update of error number? while @@fetch_status = 0 begin try begin transaction [...insert table here...] set @countrec = @countrec + @@rowcount update alarmtable set success = 0 recno = @recno commit transaction end try begin catch if @@trancount > 0 rollback transaction select @error = error_number() , @errormsg = error_message() update alarmtable set success = @error recno = @recno if @@trancount > 0 commit transaction end catch fetch next listofrecords @recno, @alarmcontent end /* while */ close listofrecords deallocate listofrecords delete alarmtable success = 0 removed commit transaction , error entries don't removed anymore. @kevchadders. ...

android studio : linux, windows, and poor performances -

i starting android application. comfortable .net/mono/visual-studio, , development environment runs under windows. installed android studio on laptop (windows 8.1). when opening project template, android studio took fews minutes indexing files (with lags), , gradle took 3 minutes build "empty" project. now, android studio "scanning files index" (it seems task related file system ?)... disabled "security center" service things same. emulator first start occurs within minutes... (i have acceptable perfs visual-studio) do think android studio have better performances under linux (which distro ?), seems commits lot of operations related file system ? have read ramdisk improve situation. could please advise me readings start android development (blogs, books...) ? android studio best u..there android studio setup available linux,mac , windows.and preparation download androidcookbook pdf.

asp.net mvc - Custom Required attribute - property required depending of parent model value -

i have model productmodel has: * bool isnew property * productdetailsmodel details property public class productmodel { public bool isnew { get; set; } public productdetails details { get; set; } } public class productdetails { public string code { get; set; } public string type { get; set; } public string description { get; set; } public int number { get; set; } } productdetails has other properties eg. code, type, description, number i make description , number property of productdetailsmodel required if isnew of productmodel set true. how it? btw have more properties of custom types within productmodel , can't move properties single productmodel. i found answer here asp.net mvc conditional validation it seems easiest way implement validation in product model.

html - Should I use px or rem value units in my CSS? -

i designing new website , want compatible browsers , browser settings possible. trying decide unit of measurement should use sizes of fonts , elements, unable find conclusive answer. my question is: should use px or rem in css? so far know using px isn't compatible users adjust base font size in browser. i've disregarded em s because more of hassle maintain, compared rem s, cascade. some rem s resolution independent , therefore more desirable. others modern browsers zoom elements equally anyway, using px not problem. i'm asking because there lot of different opinions desirable measure of distance in css, , not sure best. tl;dr: use px . the facts first, it's extremely important know per spec , css px unit does not equal 1 physical display pixel. has always been true – in 1996 css 1 spec . css defines reference pixel , measures size of pixel on 96 dpi display. on display has dpi substantially different 96dpi (like retina displays),...

php - Can't install laravelcollective/html in Laravel 5.1 -

i have problem when install laravelcollective/html in laravel 5.1 install laravelcollective/html document . first, install through composer: composer require illuminate/html message: using version ~5.0 illuminate/html ./composer.json has been updated loading composer repositories package information updating dependencies (including require-dev) but it's version 5.0 remove it. composer remove illuminate/html and install version 5.1 "require": { "laravelcollective/html": "5.1.*" } next, update composer terminal: composer update next, add new provider providers array of config/app.php: 'providers' => [ // ... collective\html\htmlserviceprovider::class, // ... ], finally, add 2 class aliases aliases array of config/app.php: 'aliases' => [ // ... 'form' => collective\html\formfacade::class, 'html' => collective\html\htmlfacade::class, // ... ...

parse.com - Asynchronous messaging with Android Parse push Notification -

i wanted send asynchronous messaging parse, when push notification,client devices may not online wish them receive notifications after being online. when pushed 2 notification client received 1 notification(the last one). is there queue semantic android parse push notification?

jsp - How to print cn.replace("cn=", "") as <input value> using EL -

i turnig jsp code: <% (int = 0; < list.size(); i++) { entry var = (entry) list.get(i); out.println(var.getcn().replace("cn=", "")); string cn = var.getcn(); out.println("<form method=\"get\" action=\"controller\">" + "<input type =\"hidden\" name=\"act1\" value = \"" + cn.replace("cn=", "") + "\">" + "<button type=\"submit\" name=\"act\" value=\"show\" id=\"act\" >show</button>" } into jstl: <c:foreach var="item" items="${list}"> <p> <c:out value="${item.getcn()} "></c:out> <p> <c:set var="item" value="${item.getcn()}"></c:set> <input type ="hidden" name="act1...

javascript - would minimongo cache across subscriptions? -

if have subscription inside tracker.autorun() , publish takes variable selector, means every time, return may vary, minimongo cache docs returned publications? or each time, clears documents , preserve returned docs previous publication? meteor clever enough keep track of current document set each client has each publisher. when publisher reruns, knows send difference between sets. let's use following sequence example: subscribe posts: a,b,c rerun subscription posts b,c,d server sends removed message a , added message d . note not happen if stopped subscription prior rerunning it.

c++ - Recommended values for OpenCV SVM parameters -

any idea on recommended parameters opencv svm? i'm playing letter_recog.cpp in opencv sample directory, however, svm accuracy poor! in 1 run got 62% accuracy: $ ./letter_recog_modified -data /home/cobalt/opencv/samples/data/letter-recognition.data -save svm_letter_recog.xml -svm database /home/cobalt/opencv/samples/data/letter-recognition.data loaded. training classifier ... data.size() = [16 x 20000] responses.size() = [1 x 20000] recognition rate: train = 64.3%, test = 62.2% the default parameters are: model = svm::create(); model->settype(svm::c_svc); model->setkernel(svm::linear); model->setc(1); model->train(tdata); setting trainauto() didn't help; gave me weird 0 % test accuracy: model = svm::create(); model->settype(svm::c_svc); model->setkernel(svm::linear); model->trainauto(tdata); result: recognition rate: train = 0.0%, test = 0.0% update using yangjie's answer: $ ./letter_recog_modified -data /home/cobalt/opencv/sampl...

How can I test Eddystone beacons using the Proximity Beacon API on Android or iOS and are there any dependencies? -

i saw announcement google made regarding eddystone , want start testing on smartphone devices. can please provide links can started , need download particular dependencies? help! here's tutorial wrote on how build basic eddystone-capable app: http://developer.radiusnetworks.com/2015/07/14/building-apps-with-eddystone.html this app run on android phone version 4.3+. dependency need free , open source android beacon library . library documentation includes lots of details on how use all of different eddystone frames , , how program detection of each one . a few other things might find useful: developer kits hardware eddystone beacons can purchased radius networks (my company) here . you can use free android locate app detect , decode of frames transmitted eddystone. you can use same locate app above act free eddystone transmitter

excel - VBA - Loop specific childnodes from XML code -

i'm trying scrape following xml excel sheet. however, want loop through specific childnodes show name , priceeffectivestart , priceeffectiveend , price , , currency each index summary. xml code <indexprices> <indexpricesummary> <id>1</id> <uri>www.example.com</uri> <index> <id>3</id> <name>same day index</name> <uri>www.example.com.xml</uri> </index> <priceeffectivestart>2015-06-26</priceeffectivestart> <priceeffectiveend>2015-06-26</priceeffectiveend> <price> <amount>2.4806</amount> <currency>cad</currency> </price> <duration>1</duration> <quantitytraded> <amount>474</amount> <unit>gj</unit> <contractunit>day</contractunit> </quantit...

c# - Creating multidimensional array at runtime -

i did research on web couldn't find advice how dynamically create multidimensional (rank >1) array (it jagged array). in other words program ask number of dimensions (rank) first, number of elements per dimension (rank) , create array. is possible? multidimensional no, no problem jagged - here simple example: using system; using system.collections.generic; public class program { public static void main() { list<list<list<int>>> myjaggedintlist = new list<list<list<int>>>(); myjaggedintlist.add(new list<list<int>>()); myjaggedintlist[0].add(new list<int>()); myjaggedintlist[0][0].add(3); console.writeline(myjaggedintlist[0][0][0].tostring()); } } each item in first list list , each item in second list list , , each item in third list int . what's problem that? play in fiddle.

c# - Framework code: Fail silently or throw exceptions -

say have method exists in library/framework, want know if methods should throw exceptions or fail silently; example: void performaction(item item) { // throws nullreferenceexception if item null item.dothis(); } void performaction(item item) { //fails silently if(item != null) { item.dothis(); } } which solution better - or bit of subjective question? as stated others, may subjective, , may dependent on context , situation. general rule though, think throwing far preferable option. i simple analogy; naïve may be, makes clear , valid point: boss: hey joe, me favor , run down accounting , deliver these important documents there me? joe: sure, no problem. joe goes down accounting, finds door locked, , out lunch possible follow-up #1: joe returns boss: sorry, office closed. can try again later if want me to, or perhaps have other option getting documents delivered? possible follow-up #2: joe realises can't complete...

php - How to transform the Magento order price in cents? -

i have nasty bug payments in magento , paybox , soap web services, idea following: payment made in cents $36.37 = 3637cents ( paybox - api) what trying transform order price in cents in following way: $cents = $order->getbasegrandtotal() * 100; also have web service soap (strict types) respond $cents amount concerts (int) , magic happens converted amount not expected one, converted result less cent, in case 3736 . $prices = array(39.8699, 12.3299, 11.3211); foreach ($prices $price) { $stuff = round($price, 2) * 100; echo $stuff . php_eol; } echo "after int conversion" . php_eol; foreach ($prices $price) { $stuff = (int) (round($price, 2) * 100); echo $stuff . php_eol; } the result following: 3987 1233 1132 after int conversion 3986 1233 1132 question there way fix bug, seems php bug ? your algorithm summarises this: $price = 39.8699; // 39.869900000000001228 round($price, 2) * 100; // 3986.9999999999995453 (int)3...

javascript - Allow space in textbox -

so have code should allow letters typed in textbox, it's not allowing type space , need it: js : function onlyalphabets(e, t) { try { if (window.event) { var charcode = window.event.keycode; } else if (e) { var charcode = e.which; } else { return true; } if ((charcode > 64 && charcode < 91) || (charcode > 96 && charcode < 123)) return true; else return false; } catch (err) { alert(err.description); } } question : should allow spaces ? space char code 32. so, should add or operator , check charcode == 32 like snippet: if ((charcode > 64 && charcode < 91) || (charcode > 96 && charcode < 123) || charcode == 32) { return true; } else { return false; }

linux - How do I sort alphanumerical keys in Perl? -

i have hash keys aa00, aa01, ab00, ab23, za03, zb45, aa02, da05, aa45, de67, de84, zz99 , need sort them first letter set number minor major. edit: case more complex indeed. letters must read left right , number of digits , letter might change. is, a00 must before aa00 , ab00. b00 must after az99 before ba00. also, if find aa, aaa, aab , aaaa, aaa, aab shall considered subset goes before aa, , aaaa shall before triple letter subset. abaa, example, must after aa. numbers in linear order, 0 before 1, , 1 before 99, there no limit number of digits. 1 might represented 1 or 01 (see zb). ignore spaces, there maintain columns. that is, a 00, aaaa00, aaa 00, aab 00, aa 00, aa 01, aa 02, aa 45, abaa00, ab 00, (first letter change) ab 23, az 99, b 00, ba 00, da 05, (second letter change, first letter restarts a) de 67, de 84, za 03, zb 45, zb 145, zb1145, zz 99, i tried classical for $key ( sort {$a<=>$b} keys %hash) { print "($key)->($ha...

c# - How to get an IntPtr to access the view of a MemoryMappedFile? -

is there way direct intptr data in memorymappedfile? have large data block high frequency change , don't want copy it no, not intptr, doesn't anyway. can byte* , can cast @ access actual data type. , can cast intptr if have to. having use unsafe keyword quite intentional. create memorymappedviewaccessor create view on mmf. use acquirepointer() method of safememorymappedviewhandle property obtain byte*. a sample program demonstrates usage , shows various pointer shenanigans: using system; using system.diagnostics; using system.runtime.interopservices; class program { static unsafe void main(string[] args) { using (var mmf = system.io.memorymappedfiles.memorymappedfile.createnew("test", 42)) using (var view = mmf.createviewaccessor()) { byte* poke = null; view.safememorymappedviewhandle.acquirepointer(ref poke); *(int*)poke = 0x12345678; debug.assert(*poke == 0x78); ...

Line Breaks Not Recognized in Google Script -

i making form , line breaks not working, makes returned information more difficult read. i realized started happening after added replyto mailapp, cannot find way fix problem. tried \n , \r. any suggestions? function initialize() { var triggers = scriptapp.getprojecttriggers(); for(var in triggers) { scriptapp.deletetrigger(triggers[i]); } scriptapp.newtrigger("sendgoogleform") .forspreadsheet(spreadsheetapp.getactivespreadsheet()) .onformsubmit() .create(); } function sendgoogleform(e) { try { // personal info var timestamp = e.values[0]; var username = e.values[1]; var phone = e.values[3]; var preferredcontact = e.values[5]; var affliation = e.values[6]; var articleorbook =e.values[7]; var itemfrom = e.values[8]; var deliverto = e.values[9]; // emails var email = "interlibraryloan@holyfamily.edu"; var useremail = e.values[4]; //book values var book = e.valu...

jsf - Session gets lost in p:media -

i try display *.avi file in primefaces component p:media . in showcase <p:media value ="#{viewscopedbean.content}" player="windows" width="500" height="500"></p:media> when try display movie logged. method viewscopedbean.content calls 4-5 times in 1 request thrid/fourth time in each request logged user session gets lost , causes exception in web application. want no other players in p:media not cause that situation. can me?

php - Communication between android app and web server. Is nodejs a good option? -

i went through several topics on not sure fits needs newbie. i creating android application website. i reckon users can on 800000 online @ same time. users able to: - submit data through application - read news , updates want updates happen in real time.. the question approach or technique should use? in topics mentioned there should on server side php files accept http/post/get requests , return json data feedback. is above-mentioned proper technique serve huge amount of users @ same time(for standards "huge" means around 800000 users @ same time)? i came across node.js. read seems can act service user/ app can request or post data. can give me suggestion or links things clear? how can make sure approach right 1 application? whatever case can describe right way of doing thing? for example: how android chat aplications suchs whatsapp, facebook etc work? how it? i not want post code.. ideas! thanks in advance! if want create app facebook...

android - Flurry analytics -

i have code in application class package com.tmaprojects.sattansikcalculator; import android.app.application; import com.flurry.android.flurryagent; public class myapplication extends application { @override public void oncreate() { super.oncreate(); flurryagent.init(this, "api_key"); } } and in each activity @override protected void onstart() { super.onstart(); flurryagent.onstartsession(this, "api_key"); } @override protected void onstop() { super.onstop(); flurryagent.onendsession(this); } } is right way send analytics ? , how can send more details when user press button , send data in edittexts ?

c# - Build, pack up and deploy for multiple platform targets -

i'm looking forward setup environment/configuration allows me build , deploy custom library multiple platforms / targets, such build configurations and/or .net framework versions. this, i've laid out following structure: myproject.sln src\ file1.cs file2.net30.cs myproject.net40.csproj myproject.net30.csproj myproject.net45.csproj all project files included in solutions , built @ once. each project contains source files framework targets and/or files different .net versions compiled conditionally (using compiler directives, e.g. net35 , net34_or_greater ). additionally, each project file contains following msbuild directives: <outputpath>bin\$(configuration)\$(platform)\$(targetframeworkversion)\$(targetframeworkidentifier)\</outputpath> <baseintermediateoutputpath>obj\$(configuration)\$(platform)\$(targetframeworkversion)\$(targetframeworkidentifier)\</baseintermediateoutputpath> <documentationfile>bin\$(configuration)\$(p...

c# - Adding default role to newly registered user in VS Express 2013 -

i starting default created register.aspx.cs additions made add in firstname , lastname of user. works fine. i want able default new users role of "user" can access appropriate pages. see lots of posts on older versions of vs,,, none seem work here. have added 2 roles aspnetroles table (admin,user). i new vs , c#, missing simple. current code: using microsoft.aspnet.identity; using microsoft.aspnet.identity.entityframework; using microsoft.aspnet.identity.owin; using system; using system.linq; using system.web; using system.web.ui; using webapplication1.models; namespace webapplication1.account { public partial class register : page { protected void createuser_click(object sender, eventargs e) { var manager = new usermanager(); var user = new applicationuser() { username = username.text, firstname = firstname.text, lastname = lastname.text }; ...

c++ - What exactly is in a .o / .a / .so file? -

i wondering stored in .o or .so file results compiling c++ program. this post gives quite overview of compilation process , function of .o file in it, , far understand this post , .a , .so files multiple .o files merged single file linked in static (.a) or dynamic (.so) way. but wanted check if understand correctly stored in such file. after compiling following code void f(); void f2(int); const int x = 25; void g() { f(); f2(x); } void h() { g(); } i expect find following items in .o file: machine code g() , containing placeholder addresses f() , f2(int) called. machine code h() , no placeholders machine code x , number 25 some kind of table specifies @ addresses in file symbols g() , h() , x can found another table specifies placeholders used refer undefined symbols f() , f2(int) , have resolved during linking. then program nm list symbol names both tables. i suppose compiler optimize call f2(x) calling f2(25) instead, still need keep symbol ...

ios - Blur view controller while presenting Uialertview -

Image
i want make button press pop uialertview . know if it's possible blur around uialertview put blur effect on view controller. i've spent 2 hours finding solutions nothing works expected. wanna same thing on picture you need use uiblureffect , uivisualeffectview here how code should looks like: - (ibaction)buttonclicked:(id)sender { // create blur effect uiblureffect *blureffect = [uiblureffect effectwithstyle:uiblureffectstylelight]; // add effect effect view uivisualeffectview *visualeffectview = [[uivisualeffectview alloc] initwitheffect:blureffect]; visualeffectview.frame = self.view.frame; self.alertcontroller = [uialertcontroller alertcontrollerwithtitle: @"alert" message: nil preferredstyle: uialertcontrollerstylealert]; [self.alertcontroller addaction:[uialertaction actionwithtitle: @"cancel...

C++ same object in two different vectors -

i'm working on c++ project , wonder if it's possible store same object in 2 different vector. know how deal in c pointer, reference same object both table, i'm little bit confused in c++. if create object , store in vector , in vector b. c++ copy object or it's same on both vector , if modify one, other modified ? in second case, take more place store twice (for accessibility issues) or it's not way deal ? thanks. cppreference great place check type of questions. let me quote relevant parts of link: void push_back( const t& value ); void push_back( t&& value ); appends given element value end of container. 1) new element initialized copy of value. 2) value moved new element. so yes, storing same element twice in 2 vectors cause copied twice. should use std::vector<t*> if don't want waste memory. , always, should consider smart pointers ( std::shared_ptr / std::weak_ptr ) instead of naked point...

php - Laravel select() don't work with params when they have spaces -

i have simple part of code: $r=input::get('r'); $sql='select * `table` `name`=?'; $dis=\db::connection('old-dis')->select($sql, [$r]); when $r don't has spaces, works corretly. when $r simple teddy bear laravel show me error , doesn't add ' ' text. find next solution: if(strpos($r,' ')) $r="'$r'"; anyone has better way fix it? this should work better. $r=input::get("r"); $results = db::connection('old-dis') ->select( db::raw("select * table name = :variable"), [ "variable"=>$r, ]); dd($results);

ios - How to set specific position for DDPageControl? -

i using ddpagecontrol in project, unable place ddpagecontrol specific position in uiview , have tried initialize initwithframe method still not showing in expected location in main uiview , how set in specified position. in advance. try this [pagecontrol setcenter: cgpointmake(self.view.center.x, self.view.bounds.size.height-30.0f)] ;

xamarin.forms - How to set a foreground color in XAML? -

in xamarin.forms, how can set foreground color textbox in xaml? i tried following: <style targettype="{x:type entry}"> <setter property="backgroundcolor" value="white" /> <setter property="foreground" value="black" /> </style> i've tried: <style targettype="{x:type entry}"> <setter property="backgroundcolor" value="white" /> <setter property="foregroundcolor" value="black" /> </style> when attempt launch application, receive unexpected exception. any thoughts? xamarin forums answered me: <style targettype="{x:type entry}"> <setter property="backgroundcolor" value="white" /> <setter property="textcolor" value="black" /> </style>

ios - AVAudioPlayer playing overtime viewcont. loads [Swift] -

in mainmenuviewcontroller in viewdidload , tell play background song. problem is, when user goes view , goes main menu, starts playing song again, , 2 copies overlap. tried put in viewdidload didn't work if themeplayer.playing == false { themeplayer.preparetoplay() themeplayer.play() } it kind of ignores if condition , plays anyways. how can fix this? -viewdidload run when view loaded. since player still playing song when navigate away mainmenuviewcontroller indicates view controller never being deallocated. try putting if condition in -viewdidappear or -viewwillappear method. override func viewwillappear(animated: bool) { super.viewwillappear(animated); if themeplayer == nil { // either it's first time view loaded, or themeplayer deallocated let soundurl = nsbundle.mainbundle().urlforresource("pres song", withextension: "mp3") themeplayer = avaudioplayer(contentsofurl: soundurl, error: nil) ...

c# - Unity2D collisions and some physics -

i'm making 2d tank shooter game, got problems , questions: i got problems collisions. gif of problem here. go tank collision problem. (i can't post more 2 links because of low reputation, have go images manualy, sorry.) i need make tank not shown above. i'm using rigidbody on empty parent , box collider on tank body. my "tank (root)" in inspector , "tankbody" (hull) in inspector here. tank movement code: using unityengine; using system.collections; public class movement : monobehaviour { public float thrust; public float rotatingspeed; public rigidbody rb; void start () { rb = getcomponent<rigidbody>(); } void update () { if (input.getkey (keycode.w)) { transform.translate (vector2.right * thrust); } if (input.getkey (keycode.s)) { transform.translate (vector2.right * -thrust); } if(input.getkey(keycode.a)) { transform.rotate(vector3.forward, rotatingspeed...

php - how to echo $_SERVER['PHP_SELF'] within a string -

i can't figure out syntax quotes within quotes within quotes.? (edit: not matter of this, had echo should concatenated. see answer below corrected code) this code brings syntax error $stringdata="<?echo'<form method=\"post\" action=\"<? echo$_server['php_self'];?>\"><button type=\"submit\">';?>"; i've tried many combinations of quotes , backslashes. what proper syntax? bad grammar. should work ;) if want echo it: echo '<form method="post" action="'.$_server['php_self'].'"><button type="submit">'; if want keep on variable: $string = '<form method="post" action="'.$_server['php_self'].'"><button type="submit">';

SQL Server - Conditional IN clause -

i trying select transactions table using in clause determined value of varchar parameter "@statuscode". if @statuscode 'all fail' want records status codes 1, 2, 3, or 5. otherwise want records status code equal numeric value of @statuscode. have not found elegant way other wrapping entire select statement in if condition. i tried: select * transactions (@statuscode = 'all failed' , statuscode in (1,2,3,5)) or (isnumeric(@statuscode) = 1 , statuscode = @statuscode) this compiles throws conversion error when pass 'all failed' since conditions aren't evaluated lazily. so tried case: select * transactions case @statuscode when 'all failed' statuscode in (1,2,3,5) else statuscode = @statuscode end but doesn't compile , gives syntax error @ 'in'. is there way this? or stuck with if @statuscode = 'all failed' begin select * transactions statuscode in (1,2,3,5) end else begin select * transactions statuscode...

jquery - fullCalendar dayRender for agendaWeek and agendaDay -

i trying change background color of cell of day. managed change background color in month view . when switching agendaweek , agendaday dayrender callback not getting called. is there workaround in version 2? using fullcalendar v2.3.1 thanks! i had override default fullcalendar css following: .fc-day.fc-today { background-color: blueviolet !important; } by using this, dayrender callback not required.

node.js - Cannot find module 'assetmanager' -

Image
i'm trying run mean stack on windows. i've installed pre-requisites (i think) when try start server via gulp command error: error: cannot find module 'assetmanager'. image: i have tried running npm install assetmanager run fine still error. this first time trying run node on machine (i should have used linux box) go easy on me learning :-). any , appreciated. david i had same problem on linux mint 17.2. the failing way : first project i'd generated , don't think had dependencies installed before ran init command (g++ missing). i tried npm install assetmanager command did , install worked. running gulp after this, got further time missing mongoose . installed couldn't find .../config/env/all sylinked default.js config. running gulp again, errorhandler missing. figured shouldn't hard so... the working way : deleted failure of project , init 'd new 1 , worked. unfortunately i'm not sure if init didn't work f...

Magento Indexing 1.9 -

been having problems reindexing in new install of magento 1.9.1.0. have been re-indexing admin , shell. both seem reindex admin screen immediatley returns 'reindex required'. have checked see if var/locks exists, , doesn't. our data migrated magento 1.8. attributes migrated prefix 'c2c_' meant of attribute names long. manually edited these in database remove 'c2c_' problem? any pointers appreciated.

AngularJS ajax with PHP json return -

i new php , angularjs >< trying using ajax data php fail here's controller angular.module('aa') .controller('expcontroller', ['$scope', 'record', '$http', function ($scope,record, $http) { $scope.trans = []; $scope.trans = record.all(); }]); factory.js angular.module('aa') .factory('record', ['$http',function recordfactory($http){ return{ all: function(){ return $http.get("./php/getdata.php").success(function (response) { return response; }); } } }]); ./php/getdata.php <?php header("content-type: application/json; charset=utf-8"); $response= ' [ {id: 0, title: "help", date: "1288323623009", cost: 20, person:"hard", category:"angu", items:[ {name:"item1"},{name:"item2"},{name:"item3"}]}, {id: ...

java - new JFrame over a Fullscreen Application -

i'm testing java application in fullscreen mode, fullscreen works fine, when user presses button want display new jframe in middle of fullscreen (it has jframe , not jdialog ) , call it: public void actionperformed(actionevent ev) { object source = ev.getsource(); if (source == refresh) { // refresh } else { if (source == plan) { //plan final jframe dialog = new jmodificaciones(); dialog.pack(); dialog.setvisible(true); } else { // exit button device.setdisplaymode(originaldm); system.exit(0); } } } however makes fullscren application out of view , new jframe application background (for example mozilla), , want jframe appear on top of fullscreen application. you can use external jframe fullscreen property , inside of can put jinternalframes center allignment don't need use jdialog

javascript - Accessing Bytes in BinaryJS -

i have implemented nodejs server, using binaryjs . @ moment, can stream audio several clients , store wav file in server. server code of how doing it: binaryserver.on('connection', function (client) { var filewriter = new wav.filewriter('records/' + n + '.wav', { channels: 1, samplerate: 48000, bitdepth: 16 }); client.on('stream', function (stream, meta) { stream.pipe(filewriter); stream.on('end', function () { filewriter.end(); }); }); }); now, want go further. want store streams in memory, use in advantage. that, need able access bytes of stream (right?). how can achieve this? found nothing in binaryjs api. seems need implement buffer . console.log(stream): { domain: null, _events: { close: [ [function], [function: onclose], [function: cleanup] ], data: [function: ondata], end: [ [function: onend], [function: cleanup] ], error: [function: onerror] }, _maxliste...

php - Adding a widget to all blog entries (using the blog module) -

i trying add same widgets of blog entry pages. perhaps add them blog holder page , inherit them on blog entry pages. want widgets automatically assigned blog entry pages without having manually add widgets. is there method pull parent, or there way built blog module achieve this? in advance. i don't know how widgets work since not use theme. if it's saved in relation following out. silverstripe 3.1.x getting values parent or extension/decorator https://gist.github.com/lerni/1e046af2005494636707

import.io - cannot crawl pages having load more... link -

in web pages www.flipkart.com when search results.at bottom of page there link "view more" or "load more". when click it,link redirected same page shows more results.here these pages not infinite.after clicks on "view more" or "load more" page gets terminated. how crawl such pages till end using import.io desktop app? please me problem

c# - Nothing shows up in my log file -

i trying create logger logs stack trace text file, "log.txt". when run code, blank log.txt document created in directory, nothing being written in txt file. my following code following: public void log() { // create file output .txt. stream debugfile = file.create(@"c:\temp\log.txt"); // create textwritertracelistener named "file" textwritertracelistener debugwriter = new textwritertracelistener(debugfile, "file"); // add debug listeners debug.listeners.add(debugwriter); // set callstack shown debug.listeners["file"].traceoutputoptions |= traceoptions.callstack; // set auto-flush debug.autoflush = true; debug.writeline("message: " + environment.stacktrace); debugfile.close(); } make sure 'define debug constant' checkbox checked in project's properties > build section. it's defined consta...