Posts

Showing posts from September, 2015

how to run a query SQL in node.js mysql -

i have syntax problem in module, fail sql query. i initialize module database in file.js, responds console.log 'connected database', sends data module in database.newdata(data), when enters in runquery nothing happens, no errors or result, nothing! i in runquery if query ok , if this, think happens there error in logic of node, idea connect database , use runquery run query pass. file.js var db = require('./modules/database'); var database = new db(); database.newdata(data); database.js var mysql = require('mysql'), queries = require('./queries'), connection; var db = function(){ var db_config = { host: 'localhost', user: 'diegoug', password: 'qwertyuiop', database: 'test' }; connection = mysql.createconnection(db_config); connection.connect(function(err) { if(err) { console.log('error when connecting database:', err);

Forcing .NET framework 3.5 in Microsoft Visual C# 2012 -

Image
because of compatibility reasons, need compile project under .net 3.5. microsoft visual c# 2012 not offer option. i'm getting compiler error: the type 'system.action' defined in assembly not referenced. must add reference assembly 'system.core, version= 3.5.0.0 for code: powertrader.powerstartedcallback = delegate { emergencymode(false); }; powertrader.powerstoppedcallback = delegate { emergencymode(true); }; this available selection in ide: what should do? portable class libraries .net 4+ only. not support .net 3.5. you have create normal class library project instead.

windows - Input validation Javascript -

in windows 8 javascript app i'm trying validate user's input , keep results on screen after user presses apply using following: <form> <input id="test" type="number" min="1" max="10" /> <button id="button" type="button">apply</button> </form> but when click apply validation doesn't work. works if replace type="button" type="submit" . problem submit refreshes page , results disappear. can do? here example of i'm trying do: jsfiddle update: i changed code this: <buton id="button" type="submit" onsubmit="dotest(); return false;">apply</button> but still refreshes page. form validation not fire until onsubmit event fires, behavior designed. one thing set have "onsubmit" event, change button submit type, in onsubmit function call event.stoppropigation stop page doing full postback.

python 2.7 - Trying to extract from the deep node with scrapy, results are bad -

Image
as beginner i'm having hard time, i'm here ask help. i'm trying extract prices html page, nested deeply: second price location: from scrapy.spider import spider scrapy.selector import selector mymarket.items import mymarketitem class myspider(spider): name = "mymarket" allowed_domains = ["url"] start_urls = [ "http://url" ] def parse(self, response): sel = selector(response) titles = sel.xpath('//table[@class="tab_product_list"]//tr') items = [] t in titles: item = mymarketitem() item["price"] = t.xpath('//tr//span[2]/text()').extract() items.append(item) return items i'm trying export scraped prices csv. export being populated this: and want them sorted in .csv: etc. can point out faulty part of xpath or how can make prices sorted "properly" ? it

ios - Saving pictures to parse -

my project save data parse , while can pick image library cannot open camera. found tutorial not compatible code. link tutorial here: tutorial . using .storyboard , tutorial .xib, not know if change anything. my .m file here: #import "newrecipeviewcontroller.h" #import <mobilecoreservices/utcoretypes.h> #import <parse/parse.h> #import "mbprogresshud.h" @interface newrecipeviewcontroller () - (ibaction)save:(id)sender; - (ibaction)cancel:(id)sender; @property (weak, nonatomic) iboutlet uiimageview *recipeimageview; @property (weak, nonatomic) iboutlet uitextfield *nametextfield; @property (weak, nonatomic) iboutlet uitextfield *preptimetextfield; @property (weak, nonatomic) iboutlet uitextfield *ingredientstextfield; @end @implementation newrecipeviewcontroller - (id)initwithstyle:(uitableviewstyle)style { self = [super initwithstyle:style]; if (self) { // custom initialization } return self; } - (void)viewdidload {

javascript - Send Custom HTTP Body with AJAX POST request -

how send custom http body post ajax request in plain javascript (not jquery)? trying send json file in body. can set custom header fields can't find how set http body. below code function calculateorder() { document.getelementbyid("finalize").style.display = "inline"; url1 = "https://ethor-prod.apigee.net/v1/stores/"; url2 = "/orders/calculate?apikey=wsgbv9pe8ajhdoi17vvtux1nlaceuxg7"; url = url1 + store_id + url2; var xmlhttp; xmlhttp = new xmlhttprequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { alert(xmlhttp.responsetext); } } xmlhttp.open("post", url, true); xmlhttp.setrequestheader("content-type", "application/json"); xmlhttp.send(json.stringify(calculate)); } when used same headers , json file rested (a osx http client) works perfectly add par

codenameone - EDT violation on Codename One -

with code: protected void second_buttonaction(component c, actionevent event) { connectionrequest cn = new connectionrequest(); cn.seturl(theurladdress); cn.setpost(false); cn.addargument("name", "this"); networkmanager.getinstance().addtoqueueandwait(cn); cn.getresponsedata(); } i keep getting following: edt violation detected! com.codename1.impl.javase.javaseport$edtviolation: edt violation stack! @ com.codename1.impl.javase.javaseport.checkedt(javaseport.java:344) edt violation detected! edt violation detected! edt violation detected! @ com.codename1.impl.javase.javaseport.isnativeinputsupported(javaseport.java:2459) @ com.codename1.ui.display.isnativeinputsupported(display.java:2306) @ com.codename1.ui.textarea.settext(textarea.java:406) @ com.codename1.ui.textarea.<init>(textarea.java:328) @ com.codename1.ui.textarea.<init>(textarea.java:257) @ com.codename1.ui.dialog.show(dialog.java:771) @ com.codename1.ui.dialog.show(di

Instagram api access toke is pulling incorrect user content -

my instagram client , access token pulling wrong username, , before ask yes client id , username correct, user photos pulling feed has user name _ @ end yet pulls photos site via access token , client id (how possible). i can not contact instagram there no sufficient correspondents outlined on sites. i not want change user name , need looked @ instagram, please assist.

javascript - Jquery - append image to auto slide -

hey there created little slider : http://jsfiddle.net/jtec5/379/ when hover throw "stop slide", autoslide stop´s: var stopped=false; $("#slideshow > div:gt(0)").hide(); setinterval(function() { if(!stopped){ $('#slideshow > div:first') .fadeout(1000) .next() .fadein(1000) .end() .appendto('#slideshow'); } }, 2000); $('#stopslide').mouseover(function(){ stopped=true; // how append new picture here? }) $('#stopslide').mouseout(function(){ stopped=false; }) my question how append new image #stopslide while there mousover, wrote in code.. me in case? greetings!! check out updated fiddle @ http://jsfiddle.net/jtec5/381 i've added following in mouseover callback template = $('<div></div>') .hide() .append( $('<img>').attr({ src : imageurl }) ) $("#slideshow").append(template); the code creates div , appe

Ocaml: error type -

can explain why have error in code ? it take 2 list a1, a2, a3 ... , b1 b2 b3 ... produce a1, b1, a2, b2, a3, b3 ... but error appears error: expression has type int expression expected of type int list example of use: append [1; 2; 3] [4; 5; 6];; code: let rec append b = if list.length == 0 && list.length b == 0 [] else (list.hd :: list.hd b) :: append (list.tl a) (list.tl b);; this should work properly, doesn't... how can fix ?? thanks! this precedence problem. can't write this: (1 :: 2) :: [] the right hand operand of :: must list. you have write this: 1 :: (2 :: []) if remove parentheses around (list.hd :: list.hd b) should past problem. as side comment, more idiomatic use pattern matching list.length, list.hd, , list.tl. what code supposed if lists different lengths?

javafx - JavaFx2 OutOfMemoryError:Java heap space -

i creat simple javafx application fxml , css in order change ui theme @ runtime. there 3 button , 1 label in scene. define different css label , "-fx-background-image"(png format, size 1.23m) borderpane in css file. application can switch ui theme click "style" button. mem usage raise , don't free when click 1 of "style" button. application outofmemoryerror after switch theme 30 times. don't know how fix it.someone can me? java.lang.outofmemoryerror: java heap space @ java.awt.image.databufferint.<init>(databufferint.java:75) @ java.awt.image.raster.createpackedraster(raster.java:467) @ java.awt.image.directcolormodel.createcompatiblewritableraster(directcolormodel.java:1032) @ java.awt.image.bufferedimage.<init>(bufferedimage.java:359) @ com.sun.prism.j2d.j2dtexture.<init>(j2dtexture.java:46) @ com.sun.prism.j2d.j2dresourcefactory.createtexture(j2dresourcefactory.java:72) @ com.sun.prism.impl

javascript - Issue with speedometer highcharts dynamically update guage range -

Image
i have use case need modify guage range dynamically, when highcharts graph behaves weirdly , range goes out of bounds. please @ image below this happens after 7th iteration (value 0.007) . can find code on jsfiddle @ http://jsfiddle.net/s6ltl/ my highcharts speedometer code (jsfiddle) can me how resolve issue? on each iteration, adding new plotband, not removing old ones: chart.yaxis[0].removeplotband('red'); chart.yaxis[0].removeplotband('green'); chart.yaxis[0].addplotband({ id: 'red', from: newval - 0.005, to: newval - 0.001, color: '#df5353' // red }); chart.yaxis[0].addplotband({ id: 'green', from: newval - 0.001, to: newval + 0.005, color: '#55bf3b' //green }); updated fiddle .

ruby on rails - How to stub using any_instance in Rspec feature spec with Capybara? -

i have following in feature spec: it "shows page" project.any_instance.stub(:price_all) login_user gso = create(:gs_option) gso.gs_collector.collector.project.update(user_id: @user.id) visit edit_gs_option_path(gso) end yet, fails because price_all method on project not being stubbed. failure trace contains following: # ./app/models/project.rb:430:in `price_all' how stub price_all method on project class? i've tried stub(:price_all).with(anything()) , stub(:price_all).with(any_args()) , doesn't change failure message. here's full failure: 1) gs options page shows page failure/error: visit edit_gs_option_path(gso) nomethoderror: undefined method `id' nil:nilclass # ./app/models/collector.rb:435:in `price_item' # ./app/models/gs_collector.rb:279:in `price_out' # ./app/models/collector.rb:260:in `price_out_all' # ./app/models/project.rb:430:in `price_all' # ./app/controllers/application_con

java - How do I store objects created into an ArrayList and return it? -

i'm asked create method called listofworkers in create objects of each type of 3 workers have reading data file "workers.txt" , store objects arraylist of type worker , return it. have managed make objects of each type of 3 workers reading data file, don't know how store them arraylist. guys? class i'm coding in right now import java.util.*; import java.io.*; public class workerbenefits { public arraylist<worker> listofworkers() { try { file ifile = new file("worker.txt"); scanner scan = new scanner(ifile); while (scan.hasnextline()) { string line = scan.nextline(); stringtokenizer st = new stringtokenizer(line,","); string jobs = st.nexttoken(); jobs jobtype = jobs.valueof(jobs); //engineer object type if (jobtype == jobs.electrical_engineer || jobtype == jobs.mechanical_engineer) { s

javascript - d3.js cinemetrics animation based chart -

Image
i've developed kind of cinemetrics based chart using d3.js. i've added spectrum of data control motion speed, there appears conflict tweening animation between different data updates , segment animations. the tweening , motion animations conflict - if possible add transition end callback trigger motion animations. potential create colour gradient/colour strips opposed full filled segments https://vimeo.com/26584083 the latest code http://jsfiddle.net/nyeax/217/ spike: function () { //console.log("spike ready", data); var = this; var timescale = d3.scale.linear() .domain([1, 5]) .range([900,3500, 8000]) //larger movement values have smaller durations ; function throb(d, i) { var dur = timescale(d.movement); var p = d3.select(this); if (!p.classed("moving") ) { p.transition() .duration(dur)

sql - MySQL Queries, using multiple table fields with the same name in a where clause -

i have select statement multiple joins, each 1 of them has column name called 'created_on' there way make portion of query check 3 tables? here actual query made select * household_address join catchment_area on catchment_area.household_id = household_address.household_id join bhw on catchment_area.bhw_id = bhw.user_username join master_list on master_list.person_id = catchment_area.person_id join house_visits on house_visits.household_id = household_address.household_id catchment_area.household_id in ( select household_address.household_id demo.household_address join catchment_area on catchment_area.household_id = household_address.household_id join previous_cases on catchment_area.person_id = previous_cases.person_id join active_cases on catchment_area.person_id = active_cases.person_id join ls_report on ls_report.ls_household = household_address.household_name date(created_on) between '2014-03-01' , '2014-03-31' ) the joins talking join

Complete binary tree with n = 2^k-1 nodes. describe an algorithm to do this with O(lg n) worst case time complexity -

could please me solve question? suppose there computer network topology complete binary tree n = 2^k-1 nodes k 1. assume transmission of data packet 1 node 1 of children (if any) in tree takes constant amount of time, i.e., o(1) time. also, assume there no packet loss. given that, need transmit 1 data packet root every node in network worst case time complexity of o(lg n). 2 nodes in tree can transmit packet simultaneously if use different edges. after receiving packet parent, left , right childern have separate copies of packet. also, there separate communication link between arbitrary pair of parent , child said before. how can write algorithm algorithm o(lg n) worst case time complexity how can prove worst time complexity of algorithm o(lg n) ? i have tried 1 algorithm found online gives complexity o(n). not able send guys image have created solve problem because of low reputation. assumptions: transmission of data packet 1 node 1 of children (if any) in tree takes c

actionscript 3 - How to Use Parent in an Array? -

i want set coordinates of movieclips. it's shows movieclips based on their own origins. think have use "parent". here's code: ... d2: { piece: wp1_txt, pieceloc: { parent.x: "147", parent.y: "297" } }, ... addchild(squarearr.d2.piece); squarearr.d2.piece.x = squarearr.d2.pieceloc.parent.x; squarearr.d2.piece.y = squarearr.d2.pieceloc.parent.y; tweenlite.to(currentpiece, 0.3, {x:squarearr[newsquare].pieceloc.parent.x, y:squarearr[newsquare].pieceloc.parent.y, ease:linear.easenone, oncomplete:ismovingfunction}); above code (without parent) moving textfield out of stage. when set x , y 0, textfield remaining it's own position instead of appearing on top left. try localtoglobal function http://help.adobe.com/en_us/as2lcr/flash_10.0/help.html?content=00001320.html coords of child relative parent. if want use global coords localtoglobal/globaltolocal option.

java - GWT Google Visualization Column Chart using style roles -

Image
i've made column chart gwt project, , having trouble finding way change colours of columns. there 1 serie , looking use call style roles. know how in javascript shown here , having trouble doing in gwt? what have: what want: in order different colors, should have different series. try (not tested) private datatable createtable() { datatable data = datatable.create(); data.addrows(4); data.addcolumn(columntype.string, "metal"); data.addcolumn(columntype.number, "density"); data.setvalue(0, 0, "copper" ); data.setvalue(1, 0, "silver"); data.setvalue(2, 0, "gold"); data.setvalue(3, 0, "platinum" ); data.setvalue(0, 1, 9);// 9 value of density data.setvalue(1, 1, 11 ); data.setvalue(2, 1, 19); data.setvalue(3, 1, 21); return data; } } private opti

android - OpenGL Causing Native Crash on Nexus 7 -

we have started beta testing our game through play store. nexus 7 users reporting crash on start, i'm not sure how debug it. stacktrace in dev console shown below. i finding particularly tricky debug 2 reasons, i don't have physical access nexus 7 the stacktrace appears show crash occuring libglesv2_tegra.so, not giving me line of java code start from. can give me hints on how debug this? the game 100% java, no ndk, , rendering done opengl es 2.0 signal 11 (sigsegv), code 1 (segv_maperr), fault addr 000002c8 r0 d4e9d9e1 r1 671371c0 r2 00000068 r3 00000004 r4 67103008 r5 687a95d8 r6 687a953c r7 671371c0 r8 68843f98 r9 687a9680 sl 67103008 fp 6b2a4b24 ip 00000000 sp 6b2a48a0 lr 00000000 pc 686190e8 cpsr 600d0010 d0 0000000000000000 d1 0000000000000000 d2 0000000000000000 d3 0000000000000000 d4 000000003e97b426 d5 39da740e3f800000 d6 3f80000000000000 d7 0000000000000000 d8 3b80000000000000 d9 4316000040a5846a d10 0000000000000000 d11 0000000000000000 d12 000000000

c# - Using the Microsoft Exchange Services Managed API, what happens when there are more than 512 items to sync? -

given following code: exchangeservice service = exchangeserviceutilities.createexchangeservice(s, u); changecollection<folderchange> folderchanges = null; { folderchanges = service.syncfolderhierarchy(propertyset.idonly, u.watermark); // update synchronization u.watermark = folderchanges.syncstate; // process changes. if required, add getitem call here request additional properties. foreach (var foldercontentschange in folderchanges) { // example prints changetype , itemid console. // lob application apply business rules each changecollection<itemchange> changelist = null; { string value = u.syncstates.containskey(foldercontentschange.folderid) ? u.syncstates[foldercontentschange.folderid] : null; changelist = service.syncfolderitems(foldercontentschange.folderid, propertyset.firstclassproperties, null,512, syncfolderitemsscope.normalitems, value); u.syncstates[foldercontentschange.folderid] = changelist.syncstate

c++ - Persisting std::chrono time_point instances -

what correct way persist std::chrono time_point instances , read them instance of same type? typedef std::chrono::time_point<std::chrono::high_resolution_clock> time_point_t; time_point_t tp = std::chrono::high_resolution_clock::now(); serializer.write(tp); . . . time_point_t another_tp; serializer.read(another_tp); the calls write/read, assume instance of type time_point_t, can somehow converted byte representation, can written or read disk or socket etc. a possible solution suggested alf follows: std::chrono::high_resolution_clock::time_point t0 = std::chrono::high_resolution_clock::now(); //generate pod write disk unsigned long long ns0 = t0.time_since_epoch().count(); //read pod disk , attempt instantiate time_point std::chrono::high_resolution_clock::duration d(ns0) std::chrono::high_resolution_clock::time_point t1(d); unsigned long long ns1 = t1.time_since_epoch().count(); if ((t0 != t1) || (ns0 != ns1)) {

Pandas text matching like SQL's LIKE? -

is there way similar sql's syntax on pandas text dataframe column, such returns list of indices, or list of booleans can used indexing dataframe? example, able match rows column starts 'prefix_', similar where <col> prefix_% in sql. you can use series method str.startswith (which takes regex): in [11]: s = pd.series(['aa', 'ab', 'ca', np.nan]) in [12]: s.str.startswith('a', na=false) out[12]: 0 true 1 true 2 false 3 false dtype: bool you can same str.contains (using regex): in [13]: s.str.contains('^a', na=false) out[13]: 0 true 1 true 2 false 3 false dtype: bool so can df[col].str.startswith ... see sql comparison section of docs. note: (as pointed out op) default nans propagate (and hence cause indexing error if want use result boolean mask), use flag nan should map false. in [14]: s.str.startswith('a') # can't use boolean mask out[14]: 0 true 1

html - Javascript play function query to stream live videos -

i trying stream live videos in internet explorer have used object tag in html using active plugin supported in ie. problem i'm facing function have used stream gives error: unable value of property 'add': object null or undefined @ [ var id=players[0].playlist.add(url,opts); ] following code: <script type="text/javascript"> function playvideo() { var players=document.getelementsbyname("vlc"); var opts = new array(""); url="https://www.youtube.com/watch?v=3u1fu6f8hto"; var id=players[0].playlist.add(url,opts); players[0].playlist.playitem(id); } </script> <object classid="clsid:9be31822-fdad-461b-ad51-be1d1c159921" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" width="640" height="480" name="vlc" events="true"> <param name="src"

asp.net - Use AsyncFileUpload in a grid view in update panel -

i want use asyncfileupload in grid view , each record must have asyncfileupload individually. in addition user must able upload his/her file each record. how can access asyncfileupload in grid view , check if has file or not? common file upload have used below cod: ((fileupload)gridview1.rows[idx].cells[0].findcontrol("fileupload1") fileupload).hasfile however, not acceptable in situation. there way access ajax controller in grid view? on asyncfileupload bind onuploadedcomplete event method onuploadedcomplete = "fileuploded" code: protected sub fileuploded(object sender, eventargs e) dim fu ajaxcontroltoolkit.asyncfileupload dim row gridviewrow = ctype(fu.namingcontainer, gridviewrow) dim idx = row.rowindex fu = ctype(sender,ajaxcontroltoolkit.asyncfileupload) if fu.hasfile --do something-- end if end sub c#: protected void fileuploded(object sender, eventargs e) { asyncfileupload fu = (ajaxcontroltool

escaping - Escape single quote in R variables -

i have table names in 1 column. have r script read table , write.table csv file further processing. script barfs when writing table if encounters name apostrophe (single quote) character such "o'reilly" in matrix library(rcurl) library(rjsonio) dir <- "c:/users/rob/data" setwd(dir) filename <- "employees.csv" url <- "https://obscured/employees.html" html <- geturl(url, ssl.verifypeer = false) initdata <- gsub("^.*?emp.alleployeedata = (.*?);.*", "\\1", html) initdata <- gsub("'", '"', initdata) data <- fromjson( initdata ) table <- list() for(i in seq_along(data)) { job <- data[[i]][[1]] name <- data[[i]][[2]] age <- data[[i]][[6]] sex <- data[[i]][[7]] m <- matrix(nrow = 1, ncol = 4) colnames(m) <- c("job", "name", "age", "sex") m[1, ] <- c(job, name, age, sex) table[[i]

c++ - How to debug this code for splitting an array by space? -

i need write program sentence , split words delimiter(space);so i've wrote code below doesn't seem working properly. idea's how debug code? in advance help. here's come far: #include <iostream> using namespace std; const int buffer_size=255; int main() { char* buffer; buffer=new char[255]; cout<<"enter statement:"<<endl; cin.getline(buffer,buffer_size); int q=0, numofwords=1; while(buffer[q] != '\0'){ if(buffer[q]==' ') numofwords ++; q ++; } char** wordsarray; wordsarray= new char* [numofwords]; int lenofeachword=0, num=0; int* sizeofwords=new int [numofwords]; for(int i=0;i<q;i++){ if(buffer[i]==' ') { sizeofwords[num]=lenofeachword; wordsarray[num]=new char[lenofeachword]; num++; }else{ lenofeachword++; } } sizeofwords[num]=lenofeachwor

c# - How can i use binary Serialization for a List<objects> -

public class profile { public string name { get; set; } public string camerainfo { get; set; } // , many other properties describing profile class } i have list of objects of same class list channels=new list() , there string holds file name. have put both dictionary: dictionary<string, list<profile>> dchannellist = new dictionary<string, list<profile>>(); so every time user creates new profile want append same file. , distinguish each filename. kind of serialization suggested?

java - Fragment not attached to Activity, in onResume -

i have fragment works fine basically. in onresume method perform api call fresh data when ever user gets activity/fragment. public void onresume(){ super.onresume(); //in pseudo async call success callback update ui failure callback update ui } this works fine of time. experience problem when user navigates parent activity, before update ui method has finished. update ui sets text views. e.g. when user navigates activity , fragment above onresume called. users goes parent activity. async call , update ui isn't finished yet , get: fatal exception: main process: com.project.foobar, pid: 4405 java.lang.illegalstateexception: fragment mydetailfragment{41ebb478} not attached activity this thrown in update ui method after success callback. use square's retrofit manage api calls. , again, happens when update ui has not finished. when wait finish , go fine. any ideas might wrong? either abort asyn

Python double inheritance -

Image
i'm trying find suitable inheritance configuration following problem: my base class agent class has 3 abstract methods: class agent(): __metaclass__ = abc.abcmeta def __init__(self): @abc.abstractmethod def bidding_curve(self): @abc.abstractmethod def evaluate_bidding_curve(self): @abc.abstractmethod def action(self): an agent can either simulated using executable (dymo) or using fmu (a zip file of c-source code). created 2 different types of agents inherit base agent , implement way of communicating simulation. here implementation of dymo simulation environment same goes fmu. class dymoagent(agent): def __init__(self, power, dymo): """ agent based on dymosim simulation environment. @param dymo: dymo needs run """ super(dymoagent, self).__init__() self.dymo = dymo def bidding_curve(self): pass def evaluate_bidding_curve(self, priority):

ios - gldrawelements bad access in xcode when used outside of GLKViewController -

i'm pretty new opengl es, i'm trying draw indexed vertices using gldrawelements in character class. i've gotten work before inside of glkviewcontroller class, when tried creating character class perform own rendering, got nothing bad_access. here character class: #import "character.h" @interface character() { gluint _vertexbuffer; gluint _indexbuffer; gluint _vertexarray; } @property(nonatomic, weak) glkbaseeffect *effect; @end typedef struct { float position[3]; float color[4]; } vertex; const vertex vertices[] = { {{1, -1, 0}, {1, 0, 0, 1}}, {{1, 1, 0}, {0, 1, 0, 1}}, {{-1, 1, 0}, {0, 0, 1, 1}}, {{-1, -1, 0}, {0, 0, 0, 1}} }; const glushort indices[] = { 0, 1, 2, 2, 3, 0 }; @implementation character - (id)initwitheffect:(glkbaseeffect *)effect { if (self = [super init]) { self.effect = effect; [self setupgl]; } return self; } - (void)setupgl { glgenvertexarraysoe

directory - Using git without history -

so want have sort of directory syncing without using history of git. so want able add file repository, commit it. able delete repo, won't take more space. @ sort of directory sync tool. whatever try, doesn't seem work. filter-tree option don't results want because file seems stay in repository. isn't there sort of init option enable repository keep head revision , work way? so question: is there way use git, without history? thanks sounds git-annex may you're looking for. http://git-annex.branchable.com/

android - How yo add glowing effect on button with background? -

i have taken button in xml , set background img1 on click of button want white glow around button edges . have refereed links http://developer.android.com/guide/topics/ui/controls/button.html android imagebutton selected state? standard android button different color you can add white border button. please enter question see how add border: android - border button store xml in res/drawable/filename.xml and can access this: in java: r.drawable.filename in xml: @[package:]drawable/filename

android - Cannot create emulater in AVD -

Image
i downloaded sdk 'arm eabi v7a system image'and tried create emulater(nexus 4) shown in below url but ok button not responding. restarted system after installing 'arm eabi v7a system image'. can 1 me ? unfortunately have not found solution how make work in ide. avd works me when start using command line. to start command line go sdk/tools folder , run next command android avd

asp.net - Can't retrieve image from SQL Server using Generic Handler c# -

whenever retrieve image using generic handler, retrieve either empty image or broken image. here code. aspx file: using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; //imports using dheltassys.modules; using system.data; using dheltassys.audittrail; namespace dheltassys { public partial class evaluateoffense : system.web.ui.page { disciplinemodulebl discipline = new disciplinemodulebl(); dheltassysaudittrail audit = new dheltassysaudittrail(); protected void page_load(object sender, eventargs e) { string position = session["position"].tostring(); if (session["employeeid"] == null) { response.redirect("login.aspx"); } else if(position != "hr manager") { response.redirect("accessdenied.aspx"); }

wireshark - Use Tshark to view json data -

when use tshark decode capfile this tshark -v -r test.cap -y 'http>0' i got ... javascript object notation: application/json object member key: "ret" number value: 99 member key: "message" string value:test question how can json data use tshark ... {"ret":99,"message":"test"} had similar problem. failed solved wireshark/tshark options only. below workaround extracting raw json , xml cap files. # 1. convert pdml disabled json , xml dissectors tshark -r "wireshark.cap" -2 -r "http" --disable-protocol json --disable-protocol xml -v -t pdml > "wireshark.cap.pdml.xml" # 2. hex encoded raw data media.type pdml element # 3. perform hex decode i used groovy script steps 2 , 3 import groovy.xml.* ... def string hexdecode(string s) { if ( null == s || 0 == s.length() ) { return null } def res = &

javascript - NodeJS Session Authentication -

i'm trying setup logged in session pages should login-restricted redirect login screen. unfortunately, app.get seems acting weird , not triggering cases. for example, authentication function: function authenticate(req,res) { var pass = false; if (req.session.loggedin) pass = true; console.log(pass); if (pass) { next(); } else { res.redirect("/html/login.html"); } } and server.js: app.use(express.static(__dirname)); app.use(express.json()); app.use(express.urlencoded()); app.use(express.cookieparser()); app.use(express.session({secret: 'secretkey'})); //not real key //gets app.get("/oneplayer",authenticate); app.get("/",authenticate); app.get("/logout",function(req,res) { req.session.destroy(); res.redirect("/"); }); the / gets authenticated, can see in terminal, /oneplayer not trigger @ all, , can page without logging in. notes: /oneplayer directory. mai

android - Error in populating data to listView -

i trying access data sqlite , try populate on listview. got error the following java code: package com.example.cmas; import java.util.arraylist; import org.w3c.dom.text; import android.app.activity; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.button; import android.widget.listview; import android.widget.textview; import android.widget.toast; import static com.example.cmas.mysqliteopenhelper.*; public class surveyresult extends activity{ //listview lstsurvey; sqlitedatabase profile; cursor cur; arraylist<candidate> candidates; @override protected void oncreate(bundle savedinstancestate) { setcontentview(r.layout.surveylist_main); initilizer(); super.oncreate(savedinsta