Posts

Showing posts from January, 2011

Eloquent Javascript: what is `this` in the following example? -

looking eloquentjavascript , in section of objects interfaces , there example: (outside of function, this refers global scope object. ) (function(exports) { var names = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]; exports.name = function(number) { return names[number]; }; exports.number = function(name) { return names.indexof(name); }; })(this.weekday = {}); console.log(weekday.name(weekday.number("saturday"))); // → saturday what this refers global scope object mean? global scope object here (this)? confused. any comments welcomed. thanks

ios - Draw an SKShapeNode line color-gradient from one color to another -

i'm writing app ipad , ios 10. i'm using objective-c , spritekit. i need draw line starts in 1 color , ends in color (eg. red green). this objective-c code: cgpoint points[2]; points[0] = cgpointmake(100, 100); points[1] = cgpointmake(160, 110); skshapenode *line1=[skshapenode shapenodewithpoints:points count:2]; line1.linewidth = 2.0; line1.zposition = -1; line1.name=@"line"; skshader *myshader=[skshader shaderwithfilenamed:@"shader1.fsh"]; line1.strokeshader=myshader; [self addchild:line1]; and shader: void main(){ float length = u_path_length; float distance = v_path_distance; gl_fragcolor = vec4(1.0*(1-(distance/length)), 1.0*(distance/length), 0., 1.); } when run app error (related metal): failed assertion 'missing buffer binding @ index 1 u_path_length[0].' it looks u_path_length , v_path_distance don't work in ios 10. can solve problem? or can suggest different solution problem? if add prefersopengl key boo...

ios - setHidden not working for UIView -

i have subclass of uiview called invitedview . instantiated in viewdidload this: viewcontroller.m invitedview = [[invitedview alloc] initwithframe:cgrectmake(100, 244, 120, 80)]; invitedview.backgroundcolor = [uicolor colorwithred:156.0f/255.0f green:214.0f/255.0f blue:215.0f/255.0f alpha:0.9f]; [self.view addsubview:invitedview]; [invitedview sethidden:yes]; the class looks this: invitedview.m #import "invitedview.h" #import "appdelegate.h" #import "viewcontroller.h" @class viewcontroller; @interface invitedview() { uibutton *accept; uibutton *decline; uilabel *question; uiview *gray; viewcontroller *myviewcontroller; } @end @implementation invitedview - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { gray = [[uiview alloc] initwithframe:frame]; nsstring *holduser = [(appdelegate*)[[uiapplication sharedapplication] delegate] invitedby]; [self...

javascript - Use local css file if link to online css file is dead -

the problem: i using w3.css (if enter w3schools.com site down maintenance) styling website.the problem here w3schools.com going down times times. then website looks creepy , don't need that. so have local copy of w3.css on computer , server holding website. online: <link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css"> local: <link rel="stylesheet" href="../css/w3.css"> the question: how know when link pointing on w3schools dead,so can use local w3.css file.how can that? 1 )detect if broken 2 )use local css before website has been loaded finally what big companies doing that?if 3-4 webservices go down whole company going down..... i new web developing so..thank you... edit:(i have in mind) loading local(...site in on server,that local mean) , w3schools file , increase site loading... its possible php. haven't tested should work. put inside <hea...

python - How to select records in the case of a many to many relation with ponyorm -

i new ponyorm. suppose have these 2 classes , many-to-many relation among them: class student(db.entity): id = primarykey(str) name = required(str) courses = set("course") class course(db.entity): id = primarykey(str) name = required(str) semester = required(int) students = set(student) and want select courses followed particular student. is: student = student.select(lambda s: s.id == id).get() courses = course.select(lambda c: c.students == student).get() and error: incomparable types 'set of student' , 'student' in expression: c.students == student what correct way this? thanks i don't know exact library think issue c.students specifies set of students testing equality doesn't make sense. you might want change second line (i didn't test though): course.select(lambda c: student in c.students).get() this leaves me wondering if there better way this. if trying retrieve courses specific s...

sql - Mysql INSERT INTO error #1064 -

i'm getting erro : #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'insert especimes (nome_individual, data_de_nascimento) values ('amalia', '1' @ line 7 while trying run this: insert especimes (nome_individual, data_de_nascimento) values ('amalia', '15/05/1998'); here table: create table especimes ( nome_individual varchar(64), data_de_nascimento varchar(64), primary key(nome_individual) ) the query provided right .... have sequence of sql command? .. check if before of query have missed ; previous command eg: create table especimes ( nome_individual varchar(64), data_de_nascimento varchar(64), primary key(nome_individual) ) ; /* add */ insert especimes (nome_individual, data_de_nascimento) values ('amalia', '15/05/1998'); nb use of proper data better . (date ) instead of varchar .. not origin of error

facebook - How to set up progressive jpegs using fresco in android -

i have started using fresco , have followed steps in documentation. have been able load uris simpledraweeview within listview adapter , trying implement progressive jpegs(images increase in quality load). problem code have given in site not working expected. uri being loaded, not progressively(the image not gradually increasing in quality loads). there missing or have forgotten add? here build dependency: compile 'com.facebook.fresco:fresco:0.13.+' i have added in application class: //for fresco fresco.initialize(this); here xml <com.facebook.drawee.view.simpledraweeview android:id="@+id/tag_iv_tu" android:layout_width="@dimen/tu_tag_side" android:layout_height="@dimen/tu_tag_height" android:layout_centerinparent="true" android:layout_gravity="center_horizontal" fresco:placeholderimage="@drawable/abc_ic_menu_s...

java - How to insert the data from the object into the jTable? -

i have object person . object in list. want insert data vorname , nachname , alter jtable . how can this? public mainform() { eintragenbutton.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { personlist = personanlegen.personanlegen( textfieldvorname.gettext(), textfieldnachname.gettext(), textfieldalter.gettext() ); string[] spaltenueberschrift = {"vorname", "nachname","alter"}; string[][] inhalt; (int = 0; < personlist.size(); i++) { inhalt[i][i] = personlist.get(0).getvorname(), personlist.get(0).getnachname(), personlist.get(0).getalter(); } tablepersonen = new jtable(); scrollpane.setviewportview(tablepersonen); defaulttablemodel tablemodel = new defaulttablemodel( inh...

javascript - Native Menus not showing OS X Electron -

i used electron-quick-start create electron app, , want native menu show 'edit' menu, usual suspects inside. however, after searching , exhausting relevant google results 'electron menu not working', i'm @ loss. my current main.js file: const {app, menu, browserwindow} = require('electron') // keep global reference of window object, if don't, window // closed automatically when javascript object garbage collected. let mainwindow; app.setname('mathulator'); function createwindow () { // create browser window. mainwindow = new browserwindow({width: 900, height: 550}) // , load index.html of app. mainwindow.loadurl(`file://${__dirname}/index.html`) // in file can include rest of app's specific main process // code. can put them in separate files , require them here. const template = [ { label: 'mathulator', submenu: [ { role: 'quit' } ...

python - Most Performant Way To Do Imports -

from performance point of view (time or memory) better do: import pandas pd or from pandas import dataframe, timeseries does best thing depend on how many classes i'm importing package? similarly, i've seen people things like: def foo(bar): numpy import array why ever want import inside function or method definition? wouldn't mean import being performed every time function called? or avoid namespace collisions? this micro-optimising, , should not worry this. modules loaded once per python process. code imports need bind name module or objects defined in module. binding extremely cheap . moreover, top-level code in your module runs once too, binding takes place once. import in function binding each time function run, again, cheap negligible. importing in function makes difference 2 reasons: won't put name in global namespace module (so no namespace pollution), , because name local , using name faster using global. if want improve ...

windows - Does anybody know how the powershell certificate provider paths map to certmgr.msc folders? -

when using powershell investigate certificate provider noticed paths seem similar not same folder structure within certmgr . seems pretty clear that: certs:\localmachine ~= certificates (local computer) certs:\currentuser ~= certificates - current user i'm guessing that: root ~= trusted root certification authority ~= personal webhosting ~= webhosting ... but have been unable find sort of official reference (or sensible explanation) give me warm fuzzy i'm looking for... my intent test https wcf service locally (both server , client side). can generate self signed certificate needed server using new-selfsignedcertificate . however, if try point client (also .net) @ service fails connect given service serves non-trusted certificate. i have found various out-dated references (like this one ), showing how use combination of makecert (now deprecated), , certmgr generate certificate authority, use sign cert https service, install certificate authority cert tr...

c - I am working on this code to allocate some memory and return pointer, but I am getting segmentation fault error -

i working on code allocate memory , return pointer, getting segmentation fault error. please me figure out. #include <stdio.h> #include <stdlib.h> #include "memalloc.h" int total_holes,sizeofmemory; void* start_of_memory; void setup( int malloc_type, int mem_size, void* start_of_memory ) { /** * fill code here * **/ sizeofmemory=mem_size; //initionlize memory start_of_memory = (int *) malloc(mem_size*sizeof(int)); if(malloc_type==0) { //first of printf("first fit"); void firstfit(); } else if(malloc_type==1) { //first of printf("best fit"); void bestfit(); } else if(malloc_type==2) { //first of printf("worst fit of"); void worstfit(); } else if(malloc_type==3) { //first of printf("buddy system"); void buddyfit(); } } void *my_malloc(int size) { /** * fill co...

html - Skew bottom background css -

i want reproduce mockup : http://imgur.com/zsr88fe but don't know how skew background image, @ bottom. nom try transform skew image skewed , top of page ugly : http://imgur.com/tkugppw what can fix ? thanks in advance to make bottom skew image css, you're gonna need few wrappers: content div text image wrapper create skew , hide skewed area image div contains nothing hero picture then need apply opposite skew image div make not distorted. after have mess around positioning ensure of image visible , top skew hidden. maybe there's more clever solution, use hardcoded pixel values. here's demo , , here's important bits: html <div class="hero"> <div class="bg-img-wrapper"> <div class="bg-img"></div> </div> <div class="hero-content"> <h1>cool company slogan</h1> <p>catchy subslogan</p> </div> </div> scss (y...

Return value in Python for Loop -

hi want return value after loop. code - def asd(): data.append("a") data.append("b") in range(0,2): value = data[i] return value i expecting return both , b when calling function returning b. there other method. in advance unless have pressing reason doing things way, example can simplified def asd(): return 'a', 'b'

javascript - Replace all the text in a div with class name - only js -

i'm trying text in div class name: <div class="something..."> and replace text something. no, don't want use jquery. should straight forward var elements = document.queryselectorall('.something'); ( var i=elements.length; i--; ) { elements[i].textcontent = "something else"; } <div class="something">soft</div> <br> <div class="something">kitty</div> <br> <div class="something">warm</div> <br> <div class="something">kitty</div> <br> <span class="something" style="color:green">little ball of fur ...</span>

Facebook Graph API (v2.8): Pagination in JavaScript? -

i'm trying figure out how scrape/access comments in very, long thread (about 1,035 comments). best way go make fb app , use graph api (the raw html opaque! :) ) my problem can control fields receive on first page of results, after i'm missing fields. is there way control fields see on subsequent pages, using javascript? after logging in, etc, ask first page of comments using code: fb.api( '/168...etc', // hard coding bad, know, // right i'm figuring out 'get', { "fields": "message,type,comments.limit(3){message,like_count,from}", }, processnominationthread ); this works fine - response object processnominationthread function handles well. specifically, each comment object has fields i'm interested in. response object contains fields this: response: object comments: object data: array[3] paging: object a typical comment object looks this: from...

xaml - Get the listview selected index? -

i creating uwp project. in using listview display content. dynamically adding content listview , done it. have issue when selecting content selectedindex value in -1. <listview name="mylistview" isitemclickenabled="false" selectionmode="single" selectionchanged="mylistview_selectionchanged_1"> <listview.itemtemplate> <datatemplate> <listviewitem height="80" width="290" tapped="listviewitem_tapped" margin="-10,0,-10,0"> <stackpanel orientation="horizontal" margin="-10,0,-24,0" horizontalalignment="right" width="288" > <border background="#e94f08" height="75" margin="0,0,0,0" width="288" cornerradius="50" > ...

php - Mysql bulk insert not inserting all data -

i have insert many data excel table (about 4000 rows ) throught ajax inside loop use : $query = "insert ignore ".$params["table"]." (".$colonnes_string.") values (".$row.")"; this query works fine insert 1000 rows of 4000, may insert have error why set ignore statement, still not insert above 1000 rows. how can skip insert error , continue query ? thank you. please use insert... on duplicate key update syntax instead of ignore here's link similar question https://softwareengineering.stackexchange.com/questions/238472/how-to-insert-update-a-large-amount-of-data-into-mysql-using-php

C# Array not clearing in listbox -

i'm new programming, , have trouble clearing listbox how want. happens user able enter value, , stored array, added listbox. user can clear both array/listbox @ anytime. after entering value e.g. 123 , being displayed on listbox, using clear button. again entering value e.g. 555, instead of 555 being first number in lisbox is: 0, 155. if again clear add number e.g. 1123, output is: 0, 0, 1123. etc. seem have cleared previous elements , placing number next index. how empty array/listbox add numbers first index , not 0000...n displaying in listbox. button clear: private void btnclear_click(object sender, eventargs e) { array.clear(numarray, 0, numarray.length); lstholdvalue.items.clear(); } the issue may not resetting index value 0 when clear clicked. think in code clears numarray, setting values 0 or creating array, remember index still whatever before clearing. if not post clearing code , can help. i saw clearing code , reason. add ...

How to fix download from server bug in Android -

i want download file server , use code: class downloadfilefromurl2 extends asynctask<string, string, string> { /** * before starting background thread * show progress bar dialog */ @override protected void onpreexecute() { super.onpreexecute(); showdialog(progress_bar_type); } /** * downloading file in background thread */ @override protected string doinbackground(string... f_url) { int count; try { file sdcardroot = environment.getexternalstoragedirectory(); file directory = new file(sdcardroot, "/raz/"); url url = new url(f_url[0]); urlconnection conection = url.openconnection(); conection.connect(); // useful can show tipical 0-100% progress bar int lenghtoffile = conection.getcontentlength(); ...

r - Split line into 5 columns -

2016-11-02 09:38:53 , 22822 , 33067 , 6.79 , abc, cedfgh pqrst 12abc i want read above-given data 5 columns of data frame. last column i.e column 5 can have delimiter character should ignored , consider 1 whole string in r. hence put in r terms: data.frame(var1 = "2016-11-02 09:38:53", var2 = "22822", var3 = "33067", var4 = "6.79", var5 = "abc, cedfgh pqrst 12abc") just read 6 columns , do: df$var5 <- paste(df$var5, ",", "df$var6") you'll data.frame you've shown in expected output.

Python Tkinter - How to make a description pop up for a button -

i don't know start, don't have code. know way make description pop when hover on button, or widget matter? def button_description(button, text, self): event = none self.del_search_description = lambda event=event: del_search_description(self) self.search_description = lambda event=event: search_description_delay(self, text, button) button.bind("<enter>", self.search_description) button.bind("<leave>", self.del_search_description) def del_search_description(self, event=none): try: self.search_description_top.destroy() except attributeerror: pass return event def search_description_delay(self, text, button, event=none): button.after(500 , search_description(self, text, button ,event)) def search_description(self, text, button, event=none): self.search_description_top = toplevel() self.search_description_top.wm_overrideredirect(true) self.search_description_top_label = labe...

CentOS Atomic Host Cockpit kubernetes -

after installation cockpit & cockpit-kubernetes on centos 7 web dashboard contains "machines", "dashboard" , "cluster" tabs. on centos atomic firt 2 present. how setup cockpit/kubernetes container? cockpit/ws #atomic run cockpit/ws "all-in-one kubernetes installs still supported, red hat no longers supports kubernetes clusters." source

C++ - Basic garbage collector using reference counting -

ok, i'm trying implement garbage collector in c++ (a basic one) using concept of reference counting, , works there don't understand. have 2 classes: class called gc, incrementing , decrementing reference counter class named tobject plays role of smart pointer(i overloaded * , -> operators, , = operator) here code below: gc.cpp #include <iostream> using namespace std; class gc { public: gc(){ this->refcount = 0;//initialisation du compteur à 0 } void incrementref(){ this->refcount++;//incrémentation du compteur de references } int decrementref(){ return this->refcount--;//décrementation du compteur de references } int getcounter(){//getter du compteur de references return refcount; } ~gc(){} private: int refcount; //compteur de references }; tobject.cpp: #include <iostream> #include "gc.cpp" using namespace std; template <class t> class tobject...

java - How do I make sure that the user enters a number between 0 and 10 only? -

i have made array subjects called subjectname. goal of code make sure user enters valid numbers (between 1.0 , 10.0). don't know how that. created if statement , make return if subjectname isn't between 0 , 10 doesn't work. not sure how can tackle this. edit: subjectname names of each subject string. subjectgrade double. both arrays. forgot mention that. this code: for (int = 0; < subjectname.length; i++) { scanner input = new scanner(system.in); system.out.print("what grade for: " + subjectname[i] + "? "); subjectgrade[i] = input.nextdouble(); if ( subjectgrade[i] < 0.0 || subjectgrade[i] > 10.0) { return; } you should use while loop. ask question while grade invalid. while(subjectgrade[i] < 0.0 || subjectgrade[i] > 10.0) { system.out.print("what grade for: " + subjectname[i] + "? "); subjectgrade[i] = input.next...

java - How to Parse GSON data into ArrayList<E> -

i have done following, arraylist<arraylist<gamemodel>> list = gson.fromjson(response, new typetoken<arraylist<arraylist<gamemodel>>>() {}.gettype()) its giving me error message. error creating evaluation class loader: com.intellij.debugger.engine.evaluation.evaluateexception: method threw 'java.lang.nullpointerexception' exception. although response have data, able parse data in java objects doing following, unable pass in arraylist gamemodel gammodel= gson.fromjson(response, gamemodel.class); kindly guide me how pass data in arraylist

Rewrite ERROR constant in C++ -

when trying compile following c++ code snippet (using microsoft visual studio 2015): namespace ns { const int error = -1; }; it returns following error: c:\workspace\x.hpp(141): error c2143: syntax error: missing ';' before 'constant' c:\workspace\x.hpp(141): error c2059: syntax error: 'constant' the constant error defined somewhere, since if 1 makes line comment, error can still printed (it returns 0 matter). i thought type of collision avoid defining namespace. how can 1 defined his/her own constant error?

ios - Storing input from field as variable with swift 3 -

i realize question has been asked numerous times before, can't quite solutions work, copying , pasting them, , suspect swift documentation spans 3 versions since swift's release. i'm attempting simple storing variable field input , not having luck. import uikit class viewcontroller: uiviewcontroller { @iboutlet var usernumber: uilabel! @iboutlet var userfield: uitextfield! @ibaction func userbutton(_ sender: uibutton) { let userinput = userfield.text //some action } override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } } you should check whether have set textfield's delegate respect parent view controller. go storyboard. select textfield. right click on it. set delegate textfield view controller

android - Encapsulating SMS sending and receiving in a class -

i want create class take phone number, send sms number , wait answer specific number. planned this: public class smartsocket extends broadcastreceiver { private string mphonenum; private smartsocketmessagelistener mlistener; public smartsocket(string phonenum, smartsocketmessagelistener l) { mphonenum = phonenum; mlistener = l; } void requeststatus() { smsmanager smsman = smsmanager.getdefault(); smsman.sendtextmessage(mphonenum, null, "status", null, null); } public void onreceive(context context, intent intent) { //.... process received intent, extract phone number if (phonenumfrom == mphonenum) { //... we've got answer, process mlistener.statusmessagereceived(messagetext); } } } but not possible because android needs empty constructor class , creates new instance every time message received. there way around or pattern achieve need? want avoid a...

jframe - how to import image to JLabel? -

here code should display image , button below it jframe frame = new jframe("frame title"); frame.getcontentpane().setlayout(new gridlayout(2, 3)); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.pack(); frame.setvisible(true); jlabel label = new jlabel(); label.seticon(new imageicon("green.png")); frame.add(label); frame.add(new jbutton("spin")); project layout i've done far, no image appears on jframe. picture in package. replace label.seticon(new imageicon("green.png")); by label.seticon(new imageicon(yourmainclassname.class.getresource("green.png"))); this code tries load image relative project, instead of directory, running from. see how use icons section in java tutorial more information. this code become better, if following fix applied: jframe frame = new jframe("frame title"); frame.getcontentpane().setlayout(new gridlayout(2, 3)); frame.setdefaultcloseoperation(jframe....

XCode 8, Swift 3 and iOS 9.3 Base SDK -

i have looked around relevant xcode questions/answers couldn't find a solution. what need have project in xcode 8 & swift 3 , build base sdk of ios 9.x. what have done: downloaded xcode 7 , copied on relevant ios 9.x sdks xcode 8. created new basic project in xcode 8 (swift 3). changed base sdk ios 9.3. hit run button. the error is: <unknown>:0: error: swift not support sdk 'iphoneos9.3.sdk' command /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/swiftc failed exit code 1 can conclude can't have base sdk ios 9.3 in xcode 8?

html - Change caret color only if hovered or focused -

i trying have caret color black if not hovered or focused , white if hovered or focused. have tried using :hover , :focus on caret seem have no effect. html: <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> menu caret<i class="caret"></i></a> <ul class="dropdown-menu"> <li> <a href="#"> sub menu </a> </li> </ul> </li> </ul> css: .navbar .nav li.dropdown > .dropdown-toggle .caret { border-top-color: #fff; border-bottom-color: #fff; } @media (max-width: 767px) { .navbar-default .navbar-nav > li > { background-color: #fff; color: #333333 !important; } .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus { color: #fff !important; background: #2d3335; } .n...

python - Matplotlib Scatterplot Marker Size proportional to axis value - why is the number of pixels for the x and y axis different for aspect='equal'? -

my question far see closely related this post . i need plot data marker size strictly proportional value of axes. (already asked question here ). my approach following: create empty scatterplot pixel reference scatter 2 points on lower left , upper right corner limit axes these 2 points use transdata.transform pixel values of 2 points get pixel distance difference in pixel number of these 2 points (now have distance-to-pixel-ratio, scatter data s=(size*dist_to_pix_ratio)**2; not important right now.) problem is: when i've described, 2 different values pixel number y-axis , x-axis. here minimal code: import matplotlib.pyplot plt fig = plt.figure(figsize=(7,7)) ax1 = fig.add_subplot(111, aspect='equal') #setting empty scatterplot pixel reference xedges=[0.0, 1.0] yedges=[0.0, 1.0] emptyscatter=ax1.scatter(xedges, yedges, s=0.0) #set axes limits ax1.set_xlim(0.00,1.00) ax1.set_ylim(0.00,1.00) # calculating ratio of pixel-to-unit upright = ax1.tra...

laravel - Homestead with hhvm:true,but doesn't use hhvm? -

i have last vagrant+homestead installation. nginx+laravel+php7 i've addedd hhvm: true yaml file this - map: example.local to: /home/vagrant/code/example/public hhvm: true and issued vagrant reload. no error messages on startup. however when show phpinfo() on page in example.local still see php version 7.0.8-2 it's there else do? i removed php config in nginx block. in /etc/nginx/sites-available/example.local, config starting location ~ \.php$ {... was pointing fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; i removed whole part , replaced include hhvm.conf; and restarted nginx

c++ - Failing to return a unique_ptr -

hpp: class camera { public: camera(float fov, float nearplane, float farplane); std::unique_ptr<glm::mat4x4> getprojectionmatrix(); private: std::unique_ptr<glm::mat4x4> projectionmatrix; }; cpp: camera::camera(float fov, float nearplane, float farplane) { float aspectratio = displaymanager::displaywidth / displaymanager::displayheight; projectionmatrix = std::make_unique<glm::mat4x4>(); *projectionmatrix = glm::perspective(fov, aspectratio, nearplane, farplane); } std::unique_ptr<glm::mat4x4> camera::getprojectionmatrix() { //std::unique_ptr<glm::mat4x4> projectionmatrix = std::make_unique<glm::mat4x4>(); //*projectionmatrix = glm::perspective(90.0f, 1.333f, 0.1f, 1000.0f); return std::move(projectionmatrix); } look @ 2 commented lines. program compile whether commented out or not, if are, data corrupted. how can write getter returns unique_ptr private member of class? how set unique_ptr in cons...

html - Bootstrap Col-sm- take effects in Medium devices -

i have code class <div class="col-md-8 col-sm-8 col-sm-offset-2" id="wrapper-middle"> problem when use medium devices class col-sm-8 col-sm-offset-2 take effects , when remove class col-sm-8 col-sm-offset-2 code work correctly . this code bellow : <div class="row"> <div class="col-md-8 col-sm-8 col-sm-offset-2" id="wrapper-middle"> <div id="carousel-generic" class="carousel slide" data-ride="carousel"> <!-- indicators --> <ol class="carousel-indicators"> <li data-target="#carousel-generic" data-slide-to="0" class="active"></li> <li data-target="#carousel-generic" data-slide-to="1"></li> <li data-target="#carousel-generic" data-slide-t...

php - Designing multiple client to single server UDP loggin system -

i'm looking build network around 500 devices send in data central server sort , process data submitted. clients written in .net whilst server written in php. from i've read udp appears ideal allows data sent clients server no handshaking etc, packets processed received in whatever order received. there no specific requirement send data client server. looking @ examples on web appears udp datagrams either need fixed length. case ? or can terminated @ either end specific character script can determine start , end of each message? each client sending in message consisting of information different number of objects - information 1 object, other times 5 or ten. having fix length of datagram mean having send message each object. i'd rather send information on objects in 1 message. given number of clients expect server portion need multi-threaded. in case presumably need script listen on specific port , open connection on port ? this replace existing system th...

angular - Ionic2 array access in template -

i'm trying show data in template coming json in controller. all alternatives found refers using ngfor , don't want iterate items, because want show 1 of them. getservicio(servicioid: number) { let getservicio = 'services?id=' + servicioid; this.http.getrequest(getservicio) //returns json .then( res => { this.services = res[0]; } ) .catch( error => console.log(error) ); } and in template write: {{services.id}} it gives me error: cannot read property 'id' of undefined isn't there alternative it? or in way, passing data template , getting array index like: {{services[0].id}} thanks in advance! the problem trying display data ( services.id ) before arrives (http requests asynchronous) - means services.id undefined @ time template rendered. simplest solution use safe navigation operator ( ? ) "pr...

kendo ui - JQuery Remove() doesn't actually delete the row(s) from grid -

i been working on removing rows grid , after searching able remove rows grid. yahoo moment lasted brief few seconds because went double check row deleted , noticed isn't deleted per say, hidden. i found out using filter have in grid , when filtered 1 of removed rows data, appeared again, , once cleared filter deleted rows appeared again. so confused on number of things, why rows hidden , not removed , how remove rows grid without having use ajax delete row rebind table again, , reason why wouldnt because data in grid lost , have reentered again. because looking @ now, if hiding row when go take data grid , add database i'm going have issue because have rows being removed reason. i created basic dojo here show saying happening. $(document).ready(function() { var junkdata = [{ "discountid": 1, "dealerdiscount": "15" }, { "discountid": 2, "dealerdiscount": "16" }, ...

c++ - string rotation by r places -

i'm trying rotate string 'r' places facing problem.the following code(function).please help. eg: hello coding. after r=3 should become ng.hello codi . void fnc(){ char a[100],key; int n,r,i,t=1,total=0,count,x; cin>>n; //no. of test cases while(t<=n){ cin>>r; //no. of rotations cin.get(); cin.get(a,100); for(i=0; a[i]!= '\0'; i++){ //cout<<a[i]; total++; } cout<<total; for(i=0; i<r; i++){ key = a[total-1]; cout<<"key: "<<key<<endl; for(i=total-2; i>=0; i--){ a[i+1] = a[i]; } a[0] = key; } for(i=0; a[i]!= '\0'; i++){ cout<<a[i]; } ///cout<<a<<endl; t++; } } here way of doing using iterators: #include <string> #include <iostream> using namespace std; int mod(int a, unsigned in...

Oracle APEX 5 Mobile Application Development - How to add link columns to reports? -

i'm creating mobile application , want create report link column. know how in report types web applications can't figure out on column toggle report. seems little info on apex 5 mobile application development online can't find anywhere relevant his. anyone know how please?

php - how to submit ajax form on same page in wordpress -

i'm new wordpress, want customize form, created form user can input data front end. when submit form, if successful, within <div id="feedback"></div> , whole page has been shown again. because of "data" in ajax success or error function. how can data in echo?? <?php /* template name: complain */ get_header(); ?> <?php if($_post['submit']) { global $wpdb; $complain_name = $_post['complain_name']; if($wpdb->insert( 'wp_complain', array( 'name'=>$complain_name ) )==false) { echo 'database insertion failed'; } else { echo 'database insertion successful'; } } else { ?> <form action="" method="post" role="form" class="form-horizontal"> name <input type="text" id="complain_name...

Unable to find segmentation fault error in c++ -

i have 3 c++ files, instrument.h, percussion.h, , instrumentapp.cpp . instrument.h base class , percussion.h inherits it. percussion objects defined , implemented in instrumentapp.cpp class. whenever run instrumentapp.cpp , segmentation fault error. i have managed trace cause of error overloaded << operator function in percussion.h calling method of base class instrument.h . reason, code unable call methods of base class , don't know why. can please me? here instrument.h class #ifndef instrument_h #define instrument_h class instrument{ private: std::string name; std::string sound; std::string lowrange; std::string highrange; public: instrument(std::string name, std::string sound, std::string lowrange, std::string highrange){ this->name = name; this->sound = sound; this->lowrange = low...

curl - How to generate a query that retrieves the count of test cases in a test cycle? -

we have number of test cycles contain many test cases each.i need exact count of test cases in particular test cycle . have following query : curl -v -u username:password -h "content-type: application/json" -x 'https://jira.domain.com:port/rest/api/2/search?zql=project = "abc" , fixversion = "6.5" , cyclename in ("spcc-p1.4.2")' the result of above query in json gives field "total" displays number of times test cycle executed. need number of test cases in test cycle. appreciated thanks to retrieve count of test cases in test cycle, might have use zapi jira add-on . test cases or executions called in jira cannot retrieved query mentioned far know. please refer : zapi doc /rest/api/2/project : give project id of projects. /rest/api/2/project/"projid"/versions : fetch version id's /rest/zapi/latest/cycle?projectid="projid" : fetch test cycles id's. finally /rest/.../latest/cyc...

javascript - Why is it that my Materialize collapsible menu doesn't work after updating with f:ajax (JSF)? -

Image
i working jsf 2.2 , materialize. need update collapsible dynamic list when user sends 1 basic form h:form , h:commandbutton , f:ajax labels. this code form sent user: <h:form> ... <h:commandbutton value="send!" action="#{...}"> <f:ajax render="@form pgmenu" execute="@form"/> </h:commandbutton> </h:form> and code represents menu updated: <h:panelgroup id="pgmenu"> <ul class="collapsible mylist"> <h:panelgroup rendered="#{not empty bean.variable}"> <li class="bold item-li"><a class="collapsible-header item-a">new</a> <div class="collapsible-body"> <ul> <a href="page1.xhtml"><li class="li-izquierda">new 1</li></a> <a href="...

ruby - rails: User Net::Http post json to reply review google app develop api -

i want reply review google app. this link document: https://developers.google.com/android-publisher/api-ref/reviews/reply i use net::http post data. my method reply review def self.reply_review(package , access_token, review_id, text ) uri = uri("https://www.googleapis.com/androidpublisher/v2/applications/#{package}/reviews/#{review_id}:reply?access_token=#{access_token}") puts "https://www.googleapis.com/androidpublisher/v2/applications/#{package}/reviews/#{review_id}:reply?access_token=#{access_token}" http = net::http.new(uri.host, uri.port) http.use_ssl = true params = { "replytext" => text } request = net::http::post.new( uri.request_uri, 'content-type' => 'application/json' ) request.body = params.to_json response = http.request(request) puts response puts(response.body) response end but response => => #<net::httpbadrequest 400 b...