Posts

Showing posts from January, 2013

r - Lattice, xyplot, 2 time series on same graph (overlay) -

Image
i want plot 2 time series on same graph, using xyplot. here example of mean using ts.plot() a1 = ts(rnorm(20), start=c(1980,1), freq=4) a2 = a1+3 ts.plot(a1,a2) i have tried xyplot(merge(a1,a2)) which returns error, , have tried xyplot(merge(as.xts(a1),as.xts(a2))) which plots them in different panels, not on same panel. you can combine 2 time series objects using cbind (or, alternatively, ts.union ). set superpose argument in xyplot true : xyplot(cbind(a1, a2), superpose = true) short clarification: there s3 method xyplot handles ts (time series) objects. method ( xyplot.ts ) gets called when x argument xyplot time series object.

php - MYSQL select query returning undesired results -

Image
i have table in mysql; i trying cc_rowid 10 , cc_type in on row 10 query; $stmt = $mysqli->prepare("select max(cc_rowid),max(cc_type) clock_clockings cc_eeno =(select cc_eeno clock_clockings cc_rowid=?)"); it giving me cc_rowid =10 , cc_type=out. i not understanding how improve desired results. appreciate on this. thanks if trying cc_type of max cc_rowid need like: select cc_rowid, cc_type clock_clockings cc_rowid = (select max(cc_rowid) clock_clockings); you same inner join , same subquery. 6 of one, half dozen of other. put further logic in subquery filter out else don't want in max aggregation

Using Scala macro to generate function with returned value depending on argument values -

i want write function gets 1 argument (lets call arg: _), , returns option[tuple2] such if arg has field extends mymarkertrait returned tuple (field_name, field_value): tuple2[string, mymarkertrait]. this easy reflection, want @ compile time using macros. in macro, i'd want return not tuple2[string, mymarkertrait], rather full type of arg second element. if arg is: val arg: mytype mymarkertrait function generated macro should return tuple2[string, mytype mymarkertrait]

r - Extracting dependent variable from lm object -

is there function extract y lm object? i use residual(m) , predict(m) using object internal structures extract y... m = lm(y ~ x1, d) head(m$model$y) [1] -0.791214 -1.291986 -0.472839 1.940940 -0.977910 -1.705539 you use model.frame() , following: # stats::lm documentation ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2, 10, 20, labels = c("ctl","trt")) weight <- c(ctl, trt) lm1 <- lm(weight ~ group) model.frame(lm1)$weight ## [1] 4.17 5.58 5.18 6.11 4.50 4.61 5.17 4.53 5.33 5.14 4.81 4.17 4.41 ## 3.59 5.87 3.83 6.03 4.89 4.32 4.69 if call function on 1 or more of variables in formula, like lm2 <- lm(log(weight) ~ group) you can untransformed values get_all_vars(lm2)$weight ( model.frame() returns transformed values). if want see functions (particularly extractor functions) available particular class, can check using methods(class...

xcode - When do we need button to send argument in Swift? -

when connecting button in xcode @ibaction func, can choose between arguments: sender or none. when choose sender , when none? well, if action method needs know button triggered it, or can make use of of button's properties, need pass sender (the button) method. a contrived example if have calculator, has '+' , '-' button. both share action method performcalculation(sender: nsbutton ) , method use sender's symbol (this button's title ) perform correct calculation. on other hand, if have button, example clear input on textfield, wire button method clearinput() not need have information button triggered (in fact, having no argument here make easier reuse method elsewhere in code , trigger clearing textfield programmatically). i hope makes sense you. there no clear rules afaik. it's matter of taste guess.

asp.net - RegularExpressionValidator to limit input length and allow empty strings -

i'm bad regex , looking @ question identical can't work need. i use regularexpressionvalidator allow character 255 characters or nothing @ all. tried, validateexpression="^.{255}$" but throws unhanded exception when textbox i'm checking empty. i've tried validateexpression="^.{,255}$" thank rodney did try ^.{0,255}$ ? not sure exception getting though. edit: also, if struggling .net regex, regex hero tester great help. know there other sites, 1 far best, if ask me.

php - Drupal 7 - file.inc - file_put_contents(temporary://fileXXXXXX): failed to open stream -

this question has answer here: file system not writable 3 answers using mac os x yosemite, apache, php 5.5.14, mysql 5.6.19, drupal 7.32 drupal failing write due bad file path. bad file path temporary://filexxxxxx . cannot understand why drupal failing convert temporary:// /tmp . i have configured temporary files directory via drupal admin ui, , confirmed it's modification in db... select * variable name '%temporary_path'; +---------------------+------------+ | name | value | +---------------------+------------+ | file_temporary_path | s:4:"/tmp" | +---------------------+------------+ ...and cleared caches in case; however, no avail. i've confirmed permissions on /tmp in case: drwxrwxrwt . as well, when switching master branch via git and using fresh copy of db (sql dump production) - issue persists. the er...

ios - AVMakeRectWithAspectRatioInsideRect returning correct image but wrong size -

i new ios swift development newer manipulating images. have uiimageview inside of uiscrollview. want user zoom/pan show exact image want capture. have working extent. when user clicks button, capture image , in uiscrollview box, however, size of image not correct. appreciated!! @ibaction func tapsendtoband(sender: uibutton) { var frameinfo = frameforimage(photoimageview.image!, imageview: photoimageview) var imagewidth = photoimageview.image!.size.height var scale:cgfloat = cgfloat(1.0) / (photoimageview.frame.size.height / imagewidth) var visiblerect = cgrect() var pwidth = cgfloat(cgimagegetwidth(photoimageview.image?.cgimage)) var pheight = cgfloat(cgimagegetheight(photoimageview.image?.cgimage)) visiblerect.origin = scrollview.contentoffset visiblerect.size = scrollview.bounds.size visiblerect.origin.x *= scale visiblerect.origin.y *= scale visiblerect.size.width *= scale visiblerect.size.height *= scale var psiz...

mdm - Android password/PIN reset via corporate e-mail without factory reset -

i came across scenario user need have option(button) in lock down page reset android password or pin via corporate mail without doing factory reset. based on request via email admin should have enforce default password or pin in tablet remotely without factory reset. understood google search can factory reset , set password policy using device admin. did faced scenario before? highly appreciate guidance in this!!! thanks :)

java - Android csv file creation and editing -

i have been working on few weeks little bit @ time. android app developing multiple versions of samsung tablets. need create file , add text it. cannot either. have 2 different methods add text using different text writers add text file. here code: public void addtexttofile(string text) { file logfile = new file(environment.getexternalstoragepublicdirectory(environment.directory_podcasts), "myfile.csv"); if (!logfile.exists()) { try { logfile.createnewfile(); } catch (ioexception e) { e.printstacktrace(); } } try { bufferedwriter buf = new bufferedwriter(new filewriter(logfile, true)); buf.append(text); buf.newline(); buf.close(); } catch (ioexception e) { e.printstacktrace(); } } public void write(string data){ outputstream os; outputstreamwriter osw; data += "\n"; try { os = new fileoutputstream(file, true); osw = new outputstreamwriter(os); osw.write(data); osw.flush(); osw.close(); } catch...

phpMyAdmin error 1136 message -

can tell me what's wrong code -- -- database: `mydb1931` -- -- -------------------------------------------------------- -- -- table structure table `former cast` -- create table if not exists `former cast` ( `character` varchar(100), `actor(s)` varchar(100), `duration` varchar(100), ) engine=innodb default charset=utf8; i keep receiving error message #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near ') engine=innodb default charset=utf8' @ line 15 update ok fixed rest of 1064 errors , got few more errors, i'm getting 1 reads #1136 - column count doesn't match value count @ row 11 here entire code -- phpmyadmin sql dump -- version 4.2.9.1 -- http://www.phpmyadmin.net -- -- host: localhost -- generation time: march 04, 2015 @ 15:00 -- server version: 5.6.22-log -- php version: 5.5.15-pl0-gentoo set sql_mode = "no_auto_value_on_zero"; set time_zone = "+00:00"; /*!4...

c++ - Undefined reference to vtable for Compte -

i'm trying build c++ project course i'm following , i'm having lot of troubles. i have header: #ifndef compte_h_ #define compte_h_ #include <string> class compte { public: compte (unsigned int p_nocompte, double p_tauxinteret, double p_solde,const std::string& p_description); virtual ~compte (){} ; void asgsolde (const double p_solde); unsigned int reqnocompte () const; double reqtauxinteret () const; double reqsolde () const; std::string reqdescription () const; std::string reqcompteformate() const; virtual compte* clone() const; virtual const double calculerinteret(); private: unsigned int m_nocompte; double m_tauxinteret; double m_solde; std::string m_description; }; #endif /* compte_h_ */ and corresponding cpp file: #include "compte.h" #include <string> #include <sstream> using namespace std; compte::compte (unsigned int p_nocompte, double p_tauxinteret, double p_...

python - Object is not callable -

why object not callable? know problem? code in main main.py : def average_wind(dia): wind_list=[] area=klass.windpower(dia) print(area) and code in class: class windpower(object): def __init__(self,digit): self.digit=digit def calc_area(self,dia): area=(dia**2*math.pi)/4 return area windpower = windpower(10) klass.windpower object of windpower class, can't instantiate again. think meant call calc_area method? area = klass.windpower.calc_area(dia)

dts - Is DTLS supported by Schannel on Windows 7? -

i have seen conflicting answers question. how activate dtls session using initializesecuritycontext ? dtls present in windows 8 , later. when creating credentials need schannel_cred grbitenabledprotocols include sp_prot_dtls1_0_server or 1 of other dtls values schannel.h you need select correct requirements "required attributes" when creating context (things isc_req_datagram sspi.h). see technet more information.

sql - MySQL query to determine classes remaining or completed -

i have following data in webinar_timing table in mysql database start_time , end_time of type datetime id | webinar_id | start_time | end_time ------------------------------------------------------------------- 1 | 5 | 3/18/2015 6:00:00 pm | 3/18/2015 7:00:00 pm 2 | 5 | 3/19/2015 6:00:00 pm | 3/19/2015 7:00:00 pm 3 | 5 | 3/20/2015 6:00:00 pm | 3/20/2015 7:00:00 pm 4 | 5 | 3/21/2015 6:00:00 pm | 3/21/2015 7:00:00 pm 5 | 5 | 3/22/2015 6:00:00 pm | 3/22/2015 7:00:00 pm 6 | 11 | 3/20/2015 8:00:00 pm | 3/20/2015 9:00:00 pm 7 | 11 | 3/21/2015 8:00:00 pm | 3/21/2015 9:00:00 pm 8 | 11 | 3/22/2015 8:00:00 pm | 3/22/2015 9:00:00 pm 9 | 22 | 3/25/2015 8:00:00 pm | 3/25/2015 9:00:00 pm 10 | 22 | 3/27/2015 8:00:00 pm | 3/27/2015 9:00:00 pm 11 | 22 | 3/29/2015 8:00:00 pm | 3/27/2015 9:00:00 pm basically, ea...

cocoa - NSTableCellView shows nothing if it's a group cell -

i'm trying make simple view-based nstableview groups , regular cells. every cell drawn correct , shows need unless add method nstableviewdelegate/datasource : func tableview(tableview: nstableview, isgrouprow row: int) -> bool { return (tablecontent[row] nsdictionary)["group"] != nil } it works fine, cells become group cells show nothing. i've tried on different cell types, still nothing, semi-transparent gray background. if add like override func drawrect(dirtyrect: nsrect) { nscolor(calibratedred: 0, green: 255, blue: 0, alpha: 1).setfill() nsrectfill(dirtyrect) super.drawrect(dirtyrect) // drawing code here. } to group cell class i'll semi-transparent gray background. i think maybe make same mistake did today. when using func tableview(tableview: nstableview, isgrouprow row: int) -> bool , func tableview(_ tableview: nstableview, viewfor tablecolumn: nstablecolumn?, row: int) -> nsview? no longer provides t...

asp.net mvc - StoredProfileAWSCredentials complains it cannot find the profile in a Web application -

i seeing following error being returned when run storedprofileawscredentials default constructor within web application: system.aggregateexception: 1 or more errors occurred. ---> system.argumentexception: path cannot empty string or whitespace. parameter name: path @ system.io.directory.getparent(string path) @ amazon.runtime.storedprofileawscredentials.determinecredentialsfilepath(string profileslocation) in d:\jenkins\jobs\build-sdkandtools-release\workspace\sdk\src\awssdk_dotnet35\amazon.runtime\awscredentials.cs:line 354 @ amazon.runtime.storedprofileawscredentials..ctor(string profilename, string profileslocation) in d:\jenkins\jobs\build-sdkandtools-release\workspace\sdk\src\awssdk_dotnet35\amazon.runtime\awscredentials.cs:line 300 @ amazon.runtime.storedprofileawscredentials..ctor(string profilename) in d:\jenkins\jobs\build-sdkandtools-release\workspace\sdk\src\awssdk_dotnet35\amazon.runtime\awscredentials.cs:line 270 @ amazon.runtime.storedprofileawsc...

c# - Jump raycasting isGrounded not working properly since Unity 5 -

i asked question while back, regarding raycasting making player jump when , if touching ground, managed receive great , solved issue. since updating project unity 5, player no longer jumps , if statement regarding never run: if(physics.raycast(ray, raydistance, 1 << 8)) i'm not sure why happening , after going last answered question, can't solve issue. if appreciative i'm still relatively new unity , c#. thank you using unityengine; using system.collections; public class playercontroller : monobehaviour { // update called once per frame void fixedupdate() { // creating floats hold speed of plater float playerspeedhorizontal = 4f * input.getaxis ("horizontal"); float playerspeedvertical = 4f * input.getaxis ("vertical"); //vector3 velocity = transform.forward * playerspeedvertical + transform.right * playerspeedhorizontal; //velocity.normalize(); //velocity *= playermaxspeed; //velocity.y = rigidbody.veloci...

vba - Bizarre DateAdd behavior -

can explain following results: ?dateadd("s", 54, 0) = #12:00:54 am# true ?dateadd("s", 55, 0) = #12:00:55 am# false ?dateadd("s", 56, 0) = #12:00:56 am# true update: ross presser's answer provides what: difference has fact binary fractions cannot represent decimal fractions. why floating point offset different when both expressions evaluate same data type ? ?typename(dateadd("s", 55, 0)) date ?typename(#12:00:55 am#) date ?vartype(dateadd("s", 55, 0)) = vartype(#12:00:55 am#) true when i've encountered sort of floating point artifact in past , it's been because result 2 different types, @ least @ point during evaluation. not seem case here. i'm still confused. update 2 : ross's updated answer provided additional insight problem. i've made progress in tracking down. each answer seems raise new questions. appears both dateadd , date literal using double precision, reason dateadd rounding 1...

angularjs - inject ngRoute in requiredjs -

i tring insert angular route in angular project has requiredjs. app.js looks this: requirejs.config({ baseurl: 'lib', paths: { app: '../app', jquery: 'jquery-2.1.3.min', angular: 'angular', route: 'angular-route' }, shim: { 'jquery': { exports: '$' }, 'angular': { exports: 'angular' }, 'route': { deps: ['angular'], exports: 'route' } } }); // start loading main app file. put of // application logic in there. requirejs(['app/main']); main.js looks this: define(['route', "angular", 'app/navcontroller'], function (route, angular, navcontroller) { var app = angular.module('mainframemodule', 'ngroute'); app.controller('navcontroller', navcontroller); }); when try run web ...

database - Creating a Android catalog -

anyone seen android app created app inventor catalog? i want create app static db, when user selects number display item name, details item , image of item. i suggest easy way if you're beginner @ programming in general , know bit of html , javascript. have database in json, database management systems export tables in json format. and here how insert javascript in app inventor http://puravidaapps.com/javascript.php using javascript library make process easier.

ios - What can I do if I deleted few objects from the interface builder by mistake? -

can bring back?? i'm using nib files , deleted nib file few objects in document outline :// please tell me can re:do this...i know should of use version control, start use right away, there way this? help edit > undo. start using version control.

javascript - Getting the value of a js object key -

i need able value of object key. when console.log(event); returned object, getting: messageevent { ports: array[0], data: "{ "event":"playprogress", "data":{ "seconds":0.419, "percent":0.002, "duration":177.813 } }" } i can't seem value of data.percent console.log(event.data.percent) . doing wrong? it looks event.data string, , not nested object. "reasonably modern" browser, can: var data = json.parse(event.data); console.log(data.percent); more discussion on json.parse can seen @ previous stackoverflow answer .

regression - How do I run an exponential nls with seasonal dummies in R? -

i'm having trouble running nls regression seasonal dummies in r. i'm able without seasonal dummies, not with. have far: year=floor(time(lsts)) > month=round(time(lsts)-year,4) > month.f=factor(month) > dummies=model.matrix(~month.f) hotdognls<-nls(lsts~beta1/(1+exp(beta2+beta3*t)),start=list(beta1=2500,beta2=0.5,beta3=-0.5),trace=f) summary(hotdognls) formula: lsts ~ beta1/(1 + exp(beta2 + beta3 * t)) parameters: estimate std. error t value pr(>|t|) beta1 2.030e+03 5.874e+01 34.55 <2e-16 *** beta2 1.146e+00 5.267e-02 21.76 <2e-16 *** beta3 -1.116e-02 7.668e-04 -14.56 <2e-16 *** --- signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 residual standard error: 192.3 on 333 degrees of freedom number of iterations convergence: 8 achieved convergence tolerance: 2.054e-06 how include seasonal dummies? thanks! i don't think dummies implemented nls in glm due fact "formula" nls ...

c++ - Would like to evaluate a comparison between two sockaddr_in structs -

presently in midst of constructing peer-to-peer network architecture , @ stage of creating recieve function accept messages multiple clients on network. when recvfrom function called - address of recent client have sent message main client loaded sockaddr_in struct called fromaddr. program designed loop through vector containing multiple instances of client class (each of hold neccessary information , functionality represent client on network), , find client instance sockaddr_in struct matches of recieved message. in program evaulation looks so: void udpclass::checkid(message* mess, sockaddr_in fraeaddress) { sockaddr_in anaddr; //iterate through vector of clients , find 1 sent message for(int = 0; i<theclients.size(); i++) { anaddr = theclients[i].getaddress(); //if address of recieved message matches address of current client if((anaddr.sin_addr == fraeaddress.sin_addr) && (anaddr.sin_port == fraeaddress.sin_port)) { //update local instance of...

ios - How does UISearchController work? -

how uisearchcontroller does? how transform uisearchbar navigation-bar-like view? how put uisearchbar view hierarchy , restore later? how using uiviewcontroller presentation api? how cover presenting view controller’s view on iphone presented view controllers fullscreen? can make own uisearchcontroller without using private apis?

xml - Android center textview in custom ActionBar using a linearlayout horizontally and vertically -

i'm trying since several hours center title in action bar horizontally. code: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/actionbar" android:layout_width="match_parent" android:layout_height="match_parent" android:baselinealigned="false" android:layout_gravity="center" android:gravity="center"> <textview android:id="@+id/activitytitle" android:layout_height="wrap_content" android:layout_width="wrap_content" android:textsize="20sp" android:textcolor="#ffffff" /> </linearlayout> and oncreate() code in activity : this.getactionbar().setdisplayshowcustomenabled(true); this.getactionbar().setdisplayshowtitle...

javascript - Random Objects in Canvas -

i created canvas , want add ramdomly objects(square, circle, rectangle..) in every 5 second? <body> <canvas id="c" width=400" height="400"></canvas> <script type="text/javascript"> var canvas = new fabric.canvas('c'); var rect = new fabric.rect({ left: 50, top: 50, fill: 'green', width: 40, height: 80 }); var circle = new fabric.circle({ radius: 20, fill: 'red', left: 100, top: 100 }); canvas.add(rect); canvas.add(circle); </script> take @ fiddle example , think need. http://jsfiddle.net/tornado1979/w1bg4bdj/ the code this: var canvas = new fabric.canvas('c'); var myobjects = ['circle','square','rectangle','arc']; var posx; var posy; setinterval(function () { var pointer = myobjects.length * math.random(); posx = canvas.width * math.random(); posy = canvas.height * math.random(); ...

arraylist - Efficient way to split a number in Java -

this question has answer here: how separate digits of int number? 21 answers i'm struggling finding efficient way split digits of number list. for example, number: 23464646237 and arraylist <integer> vector; i want insert in each position of array, digit number, therefore obtaining following output: vector = {2,3,4,6,4,6,4,6,2,3,7} how can in clean , efficient way in java ? thanks in advance the parseint not needed, for(int = 0; < numberasstring.length(); i++) vector.add((int)numberasstring.charat(i) - 48); this retrieve ascii value of number @ position, subtract 48 value of 0 in table. number -127 127 cached believe efficient method (note i'm not 100% sure). anyway, tried give way saving parseint call asked most efficient.

iphone - Trying to play a Random Sound using SimpleAudioEngine, no sound -

so app going produce made 1 sound upon swiping up. code was [[simpleaudioengine sharedengine] playeffect:@"swoosh.mp3"]; ccmoveto *moveto=[ccmoveto actionwithduration:0.50 position:ccp(currentskewed.position.x, [uiscreen mainscreen].bounds.size.height+300)]; ccscaleto *scalto=[ccscaleto actionwithduration:0.30 scale:0.5]; ccsequence *seq=[ccsequence actionone:moveto two:[cccallfuncn actionwithtarget:self selector:@selector(removesprite:)]]; [currentskewed runaction:seq]; [currentskewed runaction:scalto]; [skewdarray removeobject:currentskewed]; currentskewed=nil; i decided want there 3 sounds randomly play upon each swipe rather one. here's did. nsstring *soundname; int randsound = arc4random() % 3; switch (randsound) { case 0: soundname = @"swoosh1.mp3"; break; case 1: soundname = @"swoosh2.mp3"; break; case 2: soundname = @"swoosh3.mp3"; break; } [[simpleaudioengine sha...

Write to Mifare sector NFC RFIDIOT Python -

i'm trying write number sector 10 / block 40 on mifare 4k classic card any ideas on how can working? here code: block = 40 key = 'ffffffffffff' type = 'aa' import rfidiot import re card = rfidiot.card if card.select(): 'card selected uid: ' + str(card.uid) if card.login(block, type, key): if card.readmifareblock(block): print card.mifaredata data = card.readableprint(card.tobinary(card.mifaredata)) id = re.findall('\d+', data)[0] print id if card.writeblock(block, '1234567'): print 'write success' else: print 'error %s %s' % (card.errorcode , card.iso7816errorcodes[card.errorcode]) else: print 'read failed' else: print 'login failed' ouput+ error message: card selected uid: dbf93873 3333373535333400000000000...

ios - html video javascript play method not working in mobile Safari -

this question has answer here: can autoplay html5 videos on ipad? 6 answers i have video element in ember.js app i'm setting src of window.url.createobjecturl(file) generate preview before uploading. after capturing video file input, rendered html looks this: <video class="video-review" controls="1" autoplay="1" src="blob:http://66efcd0.ngrok.com/bb427ce0-af04-4763-bb59-3be85b936895"> </video> // * ngrok port forwarding util testing the video shows fine, , plays fine if manually tap on it. i need video play after has loaded. the problem autoplay not work, , can not video play javascript. in console (after video has loaded vid.load() ) tried: vid = $('video.video-review').get(0) vid.play() this not work. however, if manually tap on video , play it, (and give focus) calling vid.play() conso...

ios - Get device specifications from UDID -

is possible device's specifications udid? instance, if it's ipad or iphone. or udids random? you can't udid of device, see link however, can device's specifications (ios version, model name...) uidevice instance: var mydevice = uidevice.currentdevice() about device type (iphone/ipad): ios < 8, can check if (ui_user_interface_idiom() == uiuserinterfaceidiompad) with ios>= 8, can retrieve info uitraitcollection, property userinterfaceidiom

How do i do this with hover effect with javascript/jquery? -

so new js , jquery, know html , css well. want know if possible do. i have html code nav in info area. have set , have calls function on mouseover, function turns color of link white. , mouseout turns black again. know can css need practice js/jquery. wrote code , works , instead colors colors white , blends in, test code , see. there way choose selected button , color one. maybe array or something?? dont need know if there way css, need habit of using js/jquery. code: function colorlink() { $(".infonav nav ul li a").css("color", "white"); } function colorlinkout() { $(".infonav nav ul li a").css("color", "black"); } * { margin: 0px; padding: 0px; } .header-wrap { position: fixed; } .fixed { position: fixed; top: 0; left: 0; width: 100%; background-color: transparent; } body { background: #ccc; width: ...

c# - How to return the Task<T> from HttpResponseMessage.Content.ReadAsStringAsync().ContinueWith() method? -

i trying get/post using httpclient class , facing following issues do not know how return task httpresponsemessage.content.readasstringasync().continuewith() method. for reason, keep on cancelling automatically private static task<t> httpclientsendasync<t>(string url, object data, httpmethod method, string contenttype, cancellationtoken token) { httprequestmessage httprequestmessage = new httprequestmessage(method, url); retrydelegatinghandler retrydelegatinghandler = new retrydelegatinghandler(); retrydelegatinghandler.preauthenticate = true; retrydelegatinghandler.credentials = credential; retrydelegatinghandler.proxy = null; httpclient httpclient = new httpclient(retrydelegatinghandler); httpclient.timeout = new timespan(constants.timeout); if (data != null) { byte[] bytearray = encoding.ascii.getbytes(helper.tojson(data)); memorystream memorystream = new memorystream(bytearray); httprequestmessa...

apache - I can't add a second url rewrite in my .htaccess file -

i have following code, , working fine, , need add 1 more section options +followsymlinks -multiviews -indexes rewriteengine on rewritebase / rewritecond %{the_request} ^[a-za-z]{3,}\s/+coinshowpage\.php\?coinshow=([^\s]+) [nc] rewriterule ^ http://www.example.com/%1? [r=301,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^/]+)/?$ coinshowpage.php?coinshow=$1 [qsa,l] i need add redirect page. tried adding code @ bottom, , not working id field being used below string , 1 above numeric if makes difference. rewritecond %{the_request} ^[a-za-z]{3,}\s/+dealerpg\.php\?id=([^\s]+) [nc] rewriterule ^ http://www.example.com/%1? [r=301,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^/]+)/?$ dealerpg.php?id=$1 [qsa,l] i not getting 404 error, seems not passing id variable. totally lost, , appreciated.

Prestashop how to know when a new user makes register in the store -

i using prestashop 1.6. wanted know how can know when user makes register in store? there kind of hook or that? , suggestions appreciable. thanks there's hook , it's called right after customer has been succesfully registered website. hook name actioncustomeraccountadd , can call in custom module function hookactioncustomeraccountadd($params){ ... } , , registering $this->registerhook('actioncustomeraccountadd') the code of hook found inside authcontroller : hook::exec('actioncustomeraccountadd', array( '_post' => $_post, 'newcustomer' => $customer )); as can see have access full $_post of registration form + new customer object created it. if need example on how use hook can see code of blocknewsletter module, uses actioncustomeraccountadd hook, right need it.

node.js - if input maybe undefined how to use swig date filter -

i use swig in nodejs project,when use date filter,i found this: {{t.updateat|date('y-m-d h:i:s',-480)}} nan-nan-nan nan:nan:nan because t.updateat undefined, when time need date filter output ''. so, how can do? {% if t.updateat %} {{t.updateat|date('y-m-d h:i:s',-480)}} {% endif %}

git - Can't type password when I want to push file to github -

i new git , github. followed google told me how push file github, starts making file itself, using git add , commit, , when type git push origin master, asked me type username , password. it's okay username, can type not password. what's happened? when type password cursor won't move on command-line. type password, press enter.

Aptana rails error on Ubuntu 14.4 -

i installed ruby , rails , git following instructions form link . tried install aptana rails. after extarcting package , running 2 problems , 1 - "showing startup page" an internal error has occurred. no more handles [unknown mozilla path (mozilla_five_home not set)] i tried solve issuse using stackoverflow none of solutions work me. 2- gems wont install auto-install sqlite3-ruby. tried install terminal , worked, aptana rails not identifying update. same goes gem "ruby-debug-ide" , "ruby-debug-base" i went down rabbit hole on one, problem solved installing version 3: http://www.aptana.com/products/studio3/download.html the rabbit hole included not limited to... openjdk vs. sun jdk (you have remove open jdk ... mean rm -rf), , kinda derby database ... anyway after pain , suffering, think it's bug aptana can't change jdbc url derby without code. fixed in 3, apparently.

javascript - add jQuery click event to code behind generated button -

this question has answer here: click event doesn't work on dynamically generated elements [duplicate] 20 answers a button(replybtn) created onclick in code behind. --default.aspx.cs-- protected void reloadthepaneldetails_click(object sender, eventargs e) { litresultdetails.text = litresultdetails.text + "<button id='replybtn' onclick='replyfunc(this); return false;'>reply thread</button><br />"; } --default.aspx-- click on replybtn using javascript <script type = "text/javascript"> function replyfunc(obj1) { document.getelementbyid(obj1.id).click(); } </script> use jquery click event replybtn <script> $(document).ready(function () { $('.replypanel').css({ "display": "none" }); //div default no display $("#replybtn").click(fun...

php - Reusing prepared statements between dbs with identical schema -

i have multi tenant php application using 1 database per tenant. when switching between tenants in pdo using $db->query("use $tenant"), can prepared statements reused between databases identical structure? or tied specific database? happen if tried execute prepared statement after switching database on same connection?

c# - How to Check conditions in Order By clause using LINQ? -

can me check value parameter in order clause. my code below. public list<tablename> functionname(keyvalue){ return mylist.orderby(keyvalue=="name"?x=>x.name:x=>x.college); } please me. thank you. most appropriate way make orderby(parametername) method accept name of parameter want order by. can write own extension method or use this extension method. using extension method must located in static class. public static class extensionmethods { public static ienumerable<t> orderby<t>(this ienumerable<t> list, string sortexpression) { sortexpression += ""; string[] parts = sortexpression.split(' '); bool descending = false; string property = ""; if (parts.length > 0 && parts[0] != "") { property = parts[0]; if (parts.length > 1) { ...

java - Can Anyone Tell me How to get system date in Jtextfield? -

t2=new jtextfield(5); this.add(t2); t2.setbounds(450,50,100,20); this query !! knows answer? try like: date date = new date();//you use calander , formatter if need date in particular format. t2.settext(date.tostring());

c# - HttpClient - A task was cancelled? -

Image
it works fine when have 1 or 2 tasks throws error "a task cancelled" when have more 1 task listed. list<task> alltasks = new list<task>(); alltasks.add(....); alltasks.add(....); task.waitall(alltasks.toarray(), configuration.cancellationtoken); private static task<t> httpclientsendasync<t>(string url, object data, httpmethod method, string contenttype, cancellationtoken token) { httprequestmessage httprequestmessage = new httprequestmessage(method, url); httpclient httpclient = new httpclient(); httpclient.timeout = new timespan(constants.timeout); if (data != null) { byte[] bytearray = encoding.ascii.getbytes(helper.tojson(data)); memorystream memorystream = new memorystream(bytearray); httprequestmessage.content = new stringcontent(new streamreader(memorystream).readtoend(), encoding.utf8, contenttype); } return httpclient.sendasync(httprequestmessage).continuewith(task => { ...

visual c++ - can anyone explain following opengl code? -

can 1 explain how glvertex3fv works when function call glfloat v[][8][3]={{{-1.5,-1.5,-1.0}, {-1.3,-1.5,-1.0}, {-1.3,-1.3,-1.0}, {-1.5,-1.3,-1.0}, {-1.6,-1.6,1.0}, {-1.4,-1.6,1.0}, {-1.4,-1.4,1.0}, {-1.6,-1.4,1.0}} , {{-1.3,-1.5,-1.0}, {-1.1,-1.5,-1.0}, {-1.1,-1.3,-1.0}, {-1.3,-1.3,-1.0}, {-1.4,-1.6,1.0}, {-1.2,-1.6,1.0}, {-1.2,-1.4,1.0}, {-1.4,-1.4,1.0}} , {{-1.1,-1.5,-1.0}, {-0.9,-1.5,-1.0}, {-0.9,-1.3,-1.0}, {-1.1,-1.3,-1.0}, {-1.2,-1.6,1.0}, {-1.0,-1.6,1.0}, {-1.0,-1.4,1.0}, {-1.2,-1.4,1.0}} , {{-1.5,-1.3,-1.0}, {-1.3,-1.3,-1.0}, {-1.3,-1.1,-1.0}, {-1.5,-1.1,-1.0}, {-1.6,-1.4,1.0}, {-1.4,-1.4,1.0}, {-1.4,-1.2,1.0}, {-1.6,-1.2,1.0}} , {{-1.3,-1.3,-1.0}, {-1.1,-1.3,-1.0}, {-1.1,-1.1,-1.0}, {-1.3,-1.1,-1.0}, {-1.4,-1.4,1.0}, {-1.2,-1.4,1.0}, {-1.2,-1.2,1.0}, {-1.4,-1.2,1.0}} , {{-1.1,-1.3,-1.0}, {-0.9,-1.3,-1.0}, {-0.9,-1.1,-1.0}, {-1.1,-1.1,-1.0}, {-1.2,-1.4,1.0}, {-1.0,-1.4,1.0}, {-1.0,-1.2,1.0}, {-1.2,-1.2,1.0}} , {{-1.5,-1.1,-1.0}, {-1.3,-1.1,-1.0}, {-1.3,-0.9,-1.0}, {...

css - Bootstrap - Fluid navbar items -

Image
i'm newbie bootstrap user, want create fluid navigation bar, when shrink browser navigation bar becomes weird. before shrinking: after shrinking further: as can see, second image pretty bad.. 1 possible way thought separate words 2 lines (e.g. line 1 - goto, line 2 - hello_world!). can give me better approach issue? in advance. current html code: <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mynavbar"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand logo-container" href="#"><img class="logo" alt="logo" ...

javascript - Ionic angularjs change returned null of $scope value? -

my html <input ng-model="query" ng-change="change(text)" type="text" placeholder="search"> my js $scope.query = null; $scope.change = function() { console.log($scope.query); // null? $timeout(function() { $http.get('example.com/' + $scope.query ).then(function(result){ $scope.tracks = result.data.items; }); }, 1000); } why $scope.query got null within change function?

list - Display Triggered JavaScript Events -

i working on website uses masonry. know masonry rebuilds when window width changes , want able trigger rebuilding @ will, when 1 of elements' height changed. problem don't see event listeners related window's width can copy code from. there way can see events being triggered @ moment? in chrome developer tools (press f12 within chrome), go sources tab. in right hand pane, expand > event listener breakpoints , tick ones want break on. alternatively, if using jquery event handling, can install jquery debugger extension chrome devtools, , gives jquery events tab in right hand column on elements tab. shows events bound using jquery selected element. try selecting <html> tag or <body> tag , see if can find there. one final option search in js using string "resize".

ios - Can interact with views under my custom view -

i create custom view using .xib. add programatically view. here code init view inside custom view: - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { // load .xib [[nsbundle mainbundle] loadnibnamed:@"customview" owner:self options:nil]; // add sub view [self addsubview:self.view]; } return self; } here code add custom view view: customview *desview = [[customview alloc] init]; [self.view addsubview:desview]; [self.view bringsubviewtofront:desview]; however, custom view on top of other views still can interact these views. had tried bring front no use. how can disable interaction views can still interact custom view? thanks lot helping. set when want disable user interaction of view want. [self.view setuserinteractionenabled:no]; or if want disable desview , [desview setuserinteractionenabled:no];

Reflection method to Draw shape in C# winform -

i have blank method void drawshape(graphics g, int x, int y){ } i want pass "method body" string on runtime, draw shape code, ex: y =0; while(x<100){ x++; g.drawrectangle(rec1, x,y); } and method execute like: void drawshape(graphics g, int x, int y){ y =0; while(x<100){ x++; g.drawrectangle(rec1, x,y); } } it's wonderful, don't know how that. appreciated look @ dynamically compiling code, need pass entire class definition (including using statements). codedomprovider cdp = codedomprovider.createprovider("c#"); compilerparameters cp = new compilerparameters(); cp.generateinmemory = true; cp.generateexecutable = false; cp.includedebuginformation = false; // add assemblies if required: // e.g. cp.referencedassemblies.add(...) compilerresults cr = cdp.compileassemblyfromsource(cp, new string[] { sourcecode }); if there no errors ( cr.errors ) can access dynamically generated types: assembly = c...