Posts

Showing posts from June, 2015

qt - QDateTime Conversion -

i need convert string variable qdatetime format my code looks qstring date ="thu jun 18 2015"; qdatetime tmp = qdatetime::fromstring(date,"ddd mmm dd yyyy hh:mm:ss"); but result thu jan 1 00:00:00 1970 . later have convert date in foramt yyyy-mm-dd hh:mm:ss , first step have convert string in qdatetime have convert final format, there mistake above code? any appreciated. thanks haris your date string not include time, while mentioned want one, fail @ least in qt 5.4 . don't know though why epoche outputed, maybe dependant on qt version. your date format locale dependent . see example doucmentation "ddd" in qdatetime::fromstring : the abbreviated localized day name (e.g. 'mon' 'sun'). uses qdate::shortdayname(). which unfortunately not clear, while more clear qdatetime::tostring : the abbreviated localized day name (e.g. 'mon' 'sun'). uses system locale localize name, i.e. qlocal

php - CodeIgniter Pagination only shows fixed numbers (1,2,3) -

Image
i did pagination pass data through ajax view. in case skip $config['uri_segemnt'] . here set total number of rows , per page manually. function creates html tags , pagination tags , append them view . working pagination shows 3 numbers every time. seems pagination not calculate total row count ,how can solve this? here function , view. php controller function public function getvoucherajax() { if (!empty($_post)) { $offset = $_post['limit']; $selecttedlist = $_post['listid']; } else { $offset = 0; } $count = $this->gettotalocount($selecttedlist); $vouchercount = $count[0]['vcount']; //$limit = perpage $allvouchers = $this->voucher_model->getallvouchers($this->perpage(), $offset, $selecttedlist); $config = array(); $config['total_rows'] = 56; $config['per_page'] = 10; ////bootstrap config pagin

php - Multiple queries & LastInsertId -

how wrong query? can insert multiple queries that? can use lastinsertid that? $pdo = database::connect(); $dflt = 'default'; $query1 = "insert utilizador(email, pass, nome, dt_registo, tipo, activo) values (:email, '$hashed_password', :nome, :dt_registo, :tipo, :activo)"; $stmt = $pdo->prepare($query1); $stmt->execute(); $insertedid = $pdo->lastinsertid("utilizador"); $query2 ="insert aluno(morada, cd_postal, cidade, utilizador_id) values (:morada, :cpostal, :cidade,'$insertedid')"; $stmt2 = $pdo->prepare($query2); $stmt2->execute(); $hashed_password = hash( 'sha512', $_post['password']); $stmt->bindparam(':email',$_post['email']); $stmt->bindparam(':nome',$_post['nome']); $stmt->bindparam(':dt_registo',$dflt); $stmt->bindparam(':tipo',$dflt);

javascript - AngularJS: Why does $element.find('option') return an empty array when using ng-options? -

in angular 1.4, using ngoptions directive populate <select> tag <option> tags based on object looks this: {black: '#000000', red: '#ff0000', ...} that works fine using ng-options="value key (key, value) in vm.colors" , want add class each option tag matches key (e.g. '.black', '.red'). thought find option elements , use addclass() , i'm having trouble getting elements. (note: i'm not using jquery , avoid adding this.) here jsfiddle. i expect able bind results of $element.find('option') view model , watch using $scope.$watch('vm.options', function() {...}) , when log vm.options console seeing empty array. am using $scope.$watch incorrectly here? issue $element ? elements within scope of ngoptions unreachable controller? or making stupid mistake? any appreciated...thanks in advance! the docs pretty clear dom manipulation should done in directive. use rule of thumb: if find mys

javascript - Google Translate API - No Access Control Origin with Text to Speech -

Image
i posted question on google translate text-to-speech work. google translate api text-to-speech: http requests forbidden i told needed key , enable billing. i've since done that. know billing enabled because, using specified endpoint words-only translations (not narrated speech) ( get https://www.googleapis.com/language/translate/v2?key=insert-your-key&source=en&target=de&q=hello%20world ), i'm able response both in dhc , in application $.get : in original question (above), told if api key, no longer blocked getting text-to-speech. tested request text-to-speech in dhc , postman: https://translate.google.com/translate_tts?key= mykeyhere &ie=utf-8&tl=zh-cn&q=你好 and got 200: excellent. however, in application, make get request: $.get('https://translate.google.com/translate_tts?key='+mykey+'&ie=utf-8&tl=en&q=hello+world', function (returned_data) { i blocked: no 'access-control-allow-o

R, ggplot2, facetted histogram, decending order, factor x-axis labels -

Image
i have interesting problem need produce facetted histogram series want put in decending order each panel. below code replicates problem. library(ggplot2) set.seed(1) ngroup = 10; nsample = 10 df <- data.frame(group=rep(1:nsample,ngroup), category = factor(sample(letters, ngroup*nsample, replace=true), levels=letters), amount = runif(ngroup*nsample)) ggplot(df,aes(x=category,y=amount)) + geom_bar(stat='identity') + facet_wrap(~group,scales='free_x') + labs(title="some random histogram facets") which produces below output: i have tried following: library(ggplot2) set.seed(1) ngroup = 10; nsample = 10 df <- data.frame(group=rep(1:nsample,ngroup), category = factor(sample(letters, ngroup*nsample,

html5 - PHP getting enter from textarea to send email -

i created form users key in recipient, subject name, , message send mail via phpmailer. problem i'm facing textarea in form. i typed textarea: hi john, how's day? regards, best friend but right now, showing in email: hi john, how's day? regards, best friend any ideas on how format how user enters in text area? current script just $body= $_post["msg"]; i read should use nl2br isnt output? in advance what need add break each line. $text = trim($_post['textareaname']); // remove last \n or whitespace character $text = nl2br($text); // insert <br /> before \n if dont try this:(you may need play it.) //trim off excess whitespace off whole $text = trim($_post['textareaname']); //explode separate lines array $textar = explode("\n", $text); //trim lines contained in array. $textar = array_filter($textar, 'trim'); $str=''; //loop through lines foreach($textar $line){ $str .= $line."&

c - Is there a way to restrict a pointer from being modified by specific functions? -

this builds off of previous question: is appropriate use of const qualifiers in c? in vector.h : typedef struct _vector vector; vector* vector_init(const uint32 size); void* vector_get(const vector *v, uint32 idx); void vector_add(vector *v, void* const elem); void vector_set(vector *v, const uint32 idx, void* const elem); ...etc in vector.c: struct _vector{ uint32 used; uint32 size; void** arr; }; vector* vector_init(const uint32 size){ vector* v = malloc(sizeof(vector)); v->used = 0; v->size = size; v->arr = malloc(size*sizeof(void*)); return v; } void* vector_get(const vector *v, const uint32 idx){ if ( idx >= v->used ) exitaterror("vector","array out of bounds"); return v->arr[idx]; } void vector_add(vector *v, void* const elem){ if( v->used == v->size ) vector_resize(v); v->arr[v->used++] = elem; } ...etc i want prevent void** arr in _vector bei

ios - Swipe Left and Right to load item -

i had array contains 10 items 1,2,3,4,5,6,7,8,9,10. when load page item @ 3. when user swipe left go 4 , swipe right go 2. may know how it? newsid=[[nsmutablearray alloc]init]; [newsid addobject:@"1"]; [newsid addobject:@"2"]; [newsid addobject:@"3"]; [newsid addobject:@"4"]; [newsid addobject:@"5"]; [newsid addobject:@"6"]; [newsid addobject:@"7"]; [newsid addobject:@"8"]; [newsid addobject:@"9"]; [newsid addobject:@"10"]; uiswipegesturerecognizer * swipeleft= [[uiswipegesturerecognizer alloc]initwithtarget:self action:@selector(swipeleft:)]; swipeleft.direction=uiswipegesturerecognizerdirectionleft; [self.view addgesturerecognizer:swipeleft]; uiswipegesturerecognizer * swiperight= [[uiswipegesturerecognizer alloc]initwithtarget:self action:@selector(swiperight:)]; swiperight.direction=uiswipegesturerecognizerdirectionright; [self.view addgesturerecognizer:swiperight];

Android Retrofit - Callback vs no call back -

i analyzing retrofit on android , had question on callbacks vs not using them. under impression callbacks used success , failure responses client might desire. otherwise omit it. here example of retrofit interface without callback: public interface githubservice { @get("/users/{user}/repos") list<repo> listrepos(@path("user") string user); } and here example callback (i hope have right): public interface githubservice { @get("/users/{user}/repos") list<repo> listrepos(@path("user") string user,callback<repo> cb); } im confused on 2 things: the return value in interface list me should void because retrofit use gson convert json response repo pojo. have create repo pojo expect last piece of code instead: public interface githubservice { @get("/users/{user}/repos") void listrepos(@path("user") string user,callback cb); } what purpose of return value? my seco

api - Images are not loading on the live website -

Image
i have created website http://moviesnight.club using this api working fine on localhost, when have uploaded hosting movie posters being loaded , error on console [failed load resource: server responded status of 403 (forbidden)]. other thing ok. there suggestion how make work? this how looks on hosting (moviesnight.club) this how looks on localhost you not adding api key request from omdb website usage url needs be http://img.omdbapi.com/?apikey=[yourkey]& the website provides link obtain api key http://beforethecode.com/projects/omdb/apikey.aspx

html - Is there a way to prevent browsers from upscaling images? -

on webpage, use images 720px 480px. if @ them in firefox or ie (latest version) scaled up, considerably larger on screen original version in lightroom. if @ dimensions of picture on web though, says 720x480. if want files big should be, have set width-property 600px, think odd.. webpage uses bootstrap 3.3.4. there may styles being applied bootstrap or else, causing issue. if in inspector of browser, show of rules apply given element. also, browser may zoomed. shortcut reset default ctrl-0, though there option listed in menus.

node.js - How do I decod node-hid data buffer from a&d scale -

i have a&d scale monitoring input using node-hid. reading input, can't figure out how decode binary data. appreciated. this code using: var hid = require('node-hid'); var devices = hid.devices(); var device = new hid.hid('usb_0dbc_0005_14400000'); device.on("data", function(data){ console.log(data); }); and gets spat out when scale @ zero. <buffer 00 00 53 00 00 00 00 00> <buffer 00 00 00 00 00 00 00 00> <buffer 00 00 57 00 00 00 00 00> <buffer 00 00 00 00 00 00 00 00> <buffer 00 00 62 00 00 00 00 00> <buffer 00 00 00 00 00 00 00 00> <buffer 00 00 62 00 00 00 00 00> <buffer 00 00 00 00 00 00 00 00> <buffer 00 00 62 00 00 00 00 00> <buffer 00 00 00 00 00 00 00 00> <buffer 00 00 62 00 00 00 00 00> <buffer 00 00 00 00 00 00 00 00> <buffer 00 00 62 00 00 00 00 00> <buffer 00 00 00 00 00 00 00 00> <buffer 00 00 63 00 00 00 00 00> <buffer 00 00 00 00

r - Paste the elements of two columns -

this question has answer here: speedy/elegant way unite many pairs of columns 3 answers i have data.frame of following kind set.seed(12) d = data.frame(a=sample(5,x=1:9), b=sample(5,x=1:9), c=sample(5,x=1:9), d=sample(5,x=1:9), e=sample(5,x=1:9), f=sample(5,x=1:9)) d # b c d e f # 1 1 1 4 4 2 3 # 2 7 2 7 9 7 5 # 3 8 5 3 8 1 2 # 4 2 9 8 7 5 9 # 5 9 6 2 1 9 4 i take first 2 columns, convert integer characters , paste 2 elements of same row together. repeat process each successive pair of columns. here script job correctly: bar = function (twocols) {sapply(1:nrow(twocols), fun=function(x) {paste(twocols[x,], collapse="")} )} count = 0 out = matrix(0, ncol=ncol(d)/2, nrow=nrow(d)) (i in seq(1,ncol(d), 2)) { count = count+1 out[,count] = bar(d[,i:(i+

scala - What's the type of a class inside an object inside a trait -

this problem of pattern matching inside recieve of akka actor. i have code: class actorreservation(reservation: reservation) extends actor { import entry._ import customer._ def receive: actor.receive = messages def messages: receive = { case entry.get.result(obj) => // process entry case customer.get.result(obj) => // process customer } def test: receive = { case e => println(s"classname -> ${e.getclass.getname}") println(s"isinstanceof[genericmessages#get] -> ${isinstanceof[genericmessages[appany]#get]}") } } object entry extends genericmessages[entryentity] object customer extends genericmessages[customerentity] trait genericmessages[a <: appany] { case class get(id: int) object { case class result(obj: option[a]) } } //trait trait appany case class entryentity(id: int) extends appany case class customerentity(id: int) extends appany my actor receive 2 messages: entry.get.result , custo

jquery - Getting Check_Box to have a default value of nil with Bootstrap Switch -

http://www.bootstrap-switch.org/examples.html i'm using indeterminate switch (which keeps checkbox between true , false). issue switch defaults true. basically want field submit nil unless user selects true or false. jackson need? same use toggles. <label> <input type="checkbox" checked> checked </label> <br><br> <label> <input type="checkbox" unchecked> unchecked </label>

java - How do you add a mouseListener to a jscrollbar? -

i have mouseentered , mouseexited events cause jpanel content change changes size of jpanel. upon mouseentered, content grows , scrollable. upon mouseexited, content shrinks , not scrollable. the problem hovering mouse on scrollbar triggers mouseexited event jpanel, when user wants drag scrollbar's knob, disappears when go click on it. if add mouselistener scrollbar itself, imagine keep content shrinking. i've never added mouselistener scrollbar. how can trigger event on mouseentered/exited on scrollbar? yes, can attach mouselistener scrollbar. it's necessary when content changes on mouseentered/mouseexited wrt jpanel because hovering on jpanel's scrollbar triggers mouseexited. must implement 2 aspects in order keep content if hovered on jpanel: mouseentered/mouseexited , mouseclicked/mousereleased. reason because mouse can hover off scrollbar when scrollbar's knob being dragged, , don't want content change mid-scroll. all need is, add

ios - PFImageView not displaying on screen -

i having trouble parse's pfimageview in ios app. i have custom uitableviewcell of class mainprofiletableviewcell in uitableview. uitableviewcell has uiimageview property called profilepicture. trying use parse's pfimageview, have download current user's profile picture, , have uitableviewcell's profilepicture pfimageview (i using storyboards). the issue when run app , go uitableview happening, there nothing there profile picture should be. help? (by way, uitableview has 1 cell right now, custom uitableviewcell.) - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { mainprofiletableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"mainprofile" forindexpath:indexpath]; cell.selectionstyle = uitableviewcellselectionstylenone; pfimageview *profileimage = [[pfimageview alloc] init]; profileimage.image = [uiimage imagenamed:@"lincoln"]; profileimage.file =

jqGrid get row data on select -

i need peices of data row on select, can send off. getting 'false' on teacher , student vars. teacherid id column grid. onselectrow: function () { var $grid = $("#student-grid"); var rowdata = $grid.jqgrid('getrowdata', 'selrow'); var teacher = $grid.jqgrid('getcell', rowdata, 'teacherid'); var student = $grid.jqgrid('getcell', rowdata, 'studentid'); alert('student num is: ' + student + ' , teacher num is: ' + teacher); } edit add more info: colmodel: [ { name: 'studentid', index: 'studentid', key: false, hidden: true }, { name: 'teacherid', index: 'teacherid', key: true, hidden: true }, ... (other columns) ] yes using loadonce: true , both using datatype json.

javascript - $window in angular.js throws exception when using $window.open -

i error thrown: error: error: [$parse:isecwindow] referencing window in angular expressions disallowed! when try using $window.open/window.open in angularjs. generate.html <div class="print-report-footer" ng-show="vm.clicked"> <button type="button" class="btn btn-primary" ng-click="vm.downloadfile('pdf')">pdf</button> <button type="button" class="btn btn-primary" ng-click="vm.downloadfile('xls')">xls</button> <button type="button" class="btn btn-primary" ng-click="vm.downloadfile('csv')">csv</button> </div> generate.ctrl.js function downloadfile ( filetype ) { var path = '/images/reports/districtschoolreport.' + filetype; return $window.open( path ); } self.downloadfile = downloadfile; this code have used. need avoid error thrown everytime

c# - An unhandled exception of type 'System.StackOverflowException' occurred in EntityFramework.dll -

i getting exception ( unhandled exception of type 'system.stackoverflowexception' occurred in entityframework.dll ) when tried query large data using linq. code throwing error is, if (codelist != null && codelist.count > 0) { list<string> codes = codelist.select(x => x.deptcode).distinct().tolist(); namelist = db.legacycodedetails.where(x => x.legacyidentifier.contains(identifier) && x.columnabr != null && x.columnabr.equals("name") && (codes.where(y => x.legacyidentifier.contains(y)).count() > 0) ) .select(x => new nameandvalue { name = x.value, value = x.legacyidentifier }).distinct().tolist(); list<string> namestodisplay = namelist.sele

Ruby: undefined method `<<' for nil:NilClass on model -

i have been stuck @ few days now. appreciated. keep getting nomethoderror following code: band.rb (error apparently @booked_gigs << set.gig) def booked_gigs @booked_gig = [] hired_gigs = self.bandlists.filled hired_gigs.each |set| if set.gig.date >= date.today @booked_gigs << set.gig end end end _booked.html.erb: <% @booked.each |booked| %> <%= render "shared/gig_full", gig: booked %> <% end %> dashboard_controller.rb: class dashboardcontroller < applicationcontroller before_filter :authenticate_user!, only: [:dashboard] def dashboard if current_user.role == "venue" set_venue_dash render "venue_dashboard" elsif current_user.role == "musician" set_band_dash if @band.nil? redirect_to new_band_path else set_band_session set_booked_gig set_applied_gig render "band_dashboard

uk sort code regex with string -

i have string input uk sort code. (ex: "my uk sort code 873492"). customer types , agent has respond "my uk sort code ******". forum posts here regex doesn't how mask uk code , leave string is. please help! thanks! as sort codes have 6 digits , formatted 3 pairs of numbers (e.g. 12-34-56 ) try match that, need like: var sortcode = document.getelementbyid("sortcode"); var result = document.getelementbyid("result"); sortcode.oninput = function(e){ var match = sortcode.value.match(/\d{6}|\d{2}\s*?\-\s*?\d{2}\s*?\-\s*?\d{2}/); if(match == null) result.innerhtml = "there no sort code in input"; else result.innerhtml = sortcode.value.replace(/\d{6}|\d{2}\s*?\-\s*?\d{2}\s*?\-\s*?\d{2}/g, "******") }; <input type="text" id="sortcode" placeholder="enter sentence sort code"/> <div id="result"></div> note

javascript - mocha test when callback is run -

i testing api has callback inside callback @ end of function. want wrap in test verify object correct doesn't seem working. callbackend() gets called that's it. in library on script load success: function callback() { // populate gpt object if(typeof callbackend === 'function') { callbackend(); } } mocha.js test: "use strict"; (function() { describe("callback success", function() { function callbackend() { console.log('callbackend() called'); it('gpt returned advars', function() { expect(object.keys(someobj).length).to.begreaterthan(0); console.log('gpt loaded successfully, ' + object.keys(someobj).length); }); } }); })(); there goes, describe -> -> custom callback function -> done(); "use strict"; (function() { describe("callback success", function() { it('gpt returned advars', function(done)

c++ - Output MySql table to Console Output -

is there way display mysql table standard console name , without creating new file? have path, don't know how display table. it's referred sql_table_name in code. in advance. mysql --host=localhost --user=fred7 --password=opensesame dbname < "/fullpath/myscript.sql" write select statement inside myscript.sql you can output txt file > outfile.txt

arrays - Itertools Groupby Questions -

i struggling understand how itertools.groupby works. have excel spreadsheet has delivery dates in first column followed destination lat in column 2 , destination lon in column 3. earlier able grouping dates same subarrays of larger array holds them. here code it. with xlrd.open_workbook(file_location) workbook: sheet = workbook.sheet_by_index(0) dates = (sheet.cell_value(i,0) in range(sheet.nrows)) day = [list(group) key, group in itertools.groupby(dates)] now need take step further , group lat 1 array , lon array, group them day. i've tried combining the code listed above something this, not know how incorporate lat , lon variables itertools groupby function. with xlrd.open_workbook(file_location) workbook: sheet = workbook.sheet_by_index(0) in range(sheet.nrows): lat = (sheet.cell_value(i,2) in range(sheet.nrows)) deliveryx = [list(group) key, group in itertools.groupby(dates)] lon = (sheet.cell_value(i,3) in range(sheet.nro

css - Transitions when switching from top to bottom position -

if there's better way of doing i'm ask, please let me know, far best come with i want have set of divs contain sliding div inside of them. sliding divs contain content pulled latest post. might not same height. the start position have title showing, have whole div show when parent hovered over. the problem i'm having using bottom position when screen gets thin, more title shows up. using top, lose of title, i'm willing sacrifice that. so instead decided use both top , bottom, , flip auto in order make complete div show. (i don't want have sliding div same height containing div) when though, transition doesn't work. tried using top, bottom, , in transition, it's same result - no transition. can please explain a) why isn't working b) make work without going jquery. html: <div class="innerleftposts"> <div class="mainposthome"> <div class="postslidecover"> <h3>h

javascript - Using D3 zoom in JavaFX Webview -

i have javafx webview renders graph (using d3). want implement 'zoom on mouse scroll' on graph in javafx application (when mouse hovered on top of webview). able on web-browser using following d3 js code var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height) .call(d3.behavior.zoom().on("zoom", zoomhandler)) .append('g'); function zoomhandler() { svg.attr("transform", "translate(" + d3.event.translate + ")" + " scale(" + d3.event.scale + ")"); } but if similar inside javafx application's webview, graph rendered in webview on scroll, disappears , reappears if bring mouse scroll initial position (when application started) the following code how use webview render graph final url urlloadmaingraph = getclass().getresource("html/maingraph.html");

Need to understand a Javascript Function -

i python programmer , know least javascript. can please explain function (test) means in javascript? thank function test(var1) { var var_str=""+challenge; var var_arr=var_str.split(""); var lastdig=var_arr.reverse()[0]; var mindig=var_arr.sort()[0]; answer=answer+subvar2; return answer; } split reverse sort , math.pow , etc pre defined functions used in javascript. google learn more these. more over, if in programming, these math equations. you can console.log or alert console.log(var_arr); alert(var_arr); after each line , see result gives. example fiddle

javascript - dc.js - Selecting Columns in csv to Render Chart -

so assume have .csv formatted this: agegroup state gender score1 bin1 score2 bin2 18-25 tx f .15 1 .20 3 18-25 fl f .34 4 .11 7 65+ ca m .72 3 .33 9 46-54 tx m .90 6 .08 1 46-54 tx f .15 1 .11 7 right now, can create 2 bar charts columns, bin1 , bin2. have display sum score1 , score2. however, add more scores , bins, don't want create more , more bar charts , displays each column added. if new csv looks this: agegroup state gender score1 bin1 score2 bin2 score3 bin3 score4 bin4 18-25 tx f .15 1 .20 3 .51 2 .23 6 18-25 fl f .34 4 .11 7 .79 1 .64 4 65+ ca m .72 3 .3

c# - Error Prompt modifying cells using EpPlus -

i used code below allow me modify cell [j10] using epplus] modify code work sucessfully when try open excel file prompted error we found problem content in 'test.xlsx'. want try recover as can? if trust source of workbook, click yes . may ask how go past error fileinfo newfile = new fileinfo(filelocation); excelpackage pck = new excelpackage(newfile); //add content sheet var ws = pck.workbook.worksheets.firstordefault(); //headers ws.cells["j10"].value = "test tis"; pck.save(); system.diagnostics.process.start(filelocation);

does bootstrap apply special font application rules across elements? -

i added bootstrap.css reference existing site. changed font-family , font-size @ body level roboto google web font. font application looked good. however, bootstrap reference broke other functionality in site removed bootstrap reference. however, when did this, font application did not good. font style did not applied textbox. when experimented different font sizes textbox, overall not when site had bootstrap.css reference. based on experience, i'm assuming bootstrap refs have sort of intelligence optimize application of font across site. correct? if can somehow apply functionality of bootstrap without adding full bootstrap reference? or there other specialized 3rd-party libs can add website without additional bootstrap overhead , potential conflicts? textarea, , inputs don't inherit font , other css properties...so should this: textarea, input { font-family: whichever-you-want; } hope helps

regex - Extract all numeric values in Columns in R -

i working large data set using r. so, have column called "offers". column contains text describing 'promotions' companies offer on products. trying extract numeric values these. while, cases, able using combination of regex , functions in r packages, unable deal couple of specific cases of text shown below. appreciate on these. "buying ensures savings of $50. online credit worth 35$ available. buy soon!" 1a. want both numeric values out in 2 different columns. how go that? 1b. problem have solve, need take value associated credit. case texts above, second numeric value in text, if exists, 1 associated credit. "get 50% off on 3 night stay along 25 credits, offer available on 3 december 2016" (how should take value associated credits?) note: efficiency important because dealing 14 million rows. i have tried looking online solution have not found satisfactory. i not 100% sure want may you. a <- "do

java - buffered reader in managed bean -

in web app, beans have serializable. i'm wanting open couple of streams, input , output device, in @postconstruct , leave them open. however, streams aren't serializable. so, if bean serialized, happens streams? if make them transient, have restore them when bean deserialized? if so, simple checking stream null , reopening them if null? or, better open , close them every time read or write? probably better approach customise serialisation, i.e. in writeobject flush buffers/close streams/write additional state/etc, in readobject restore original object state.

linux - Use Xargs to wait for enter key -

so, have list of files want use generate new set of groups of files. want open these groups (multiple files) @ once. edit them. go terminal, hit enter, , open next group of files. i've got working, i'm using temporary file so cat failingall | awk '{print $2}' | xargs -i {} -l 1 sh -c "find {} | grep xml | xargs echo;" | perl -pe "s/^(.*)$/open \1;read;/g" > command.sh ; sh command.sh is possible xargs? really, mean without temporary file. tried this cat failingall | awk '{print $2}' | xargs -i {} -l 1 sh -c "find {} | grep xml | xargs open ; read;" but not pause in between groups, opens them @ once (and crashes xml editor.) try , quit editor when finish editing each group of files? while ifs= read -r dir; files=() while ifs= read -r -d '' xmlfile; files+=("$xmlfile") done < <(find "$dir" -name "*.xml" -type f -print0) open -w "${

javascript - JS - passing by reference an object -

given code below create object called foo , want make 'a' equal true function called maketrue(obj). var foo = {a: false, b: false, c: false} function maketrue(obj) { obj = true; } maketrue(foo.a); // want make 'a' true function console.log(foo.a); why return false still? i have looked @ similar questions worked passing object method doesn't pass reference. you're not passing object argument (that passed reference), you're passing in boolean value of object's property (pass value). if want work: var foo = {a: false, b: false, c: false} function maketrue(obj, val) { obj[val] = true; } maketrue(foo, 'a'); // want make 'a' true function console.log(foo.a);

javascript - Continuous motion in an image slider -

i have image slider uses sliding dividers. i'm trying manipulate when click button (previous/next) switch continuous, if dividers switching one. in current slide, when clicking on button, other divider comes replace current divider far position. idea on how make single movement? while keeping same motion in code (left right/right left). html: <div id="wrapper"> <div id="nav"> <button id="prev" disabled>&lt;&lt;&lt;</button> <button id="next">&gt;&gt;&gt;</button> </div> <div id="mask"> <div id="item1" class="item"> <a name="item1"></a> <div class="content"> <img id="image1" src="http://placehold.it/350x150"/> <img id="image2" src="http://placehold.it/350x150"/> <img id="image3&qu

c# - Where would the code produced by the JIT would reside -

an article clr via c# jeffery ritcher. "when calling virtual instance method, jit compiler produces additional code in method, executed each time method invoked. code first in variable being used make call , follow address calling object." my question additional code generated jit reside. the jit compiler uses internal code heap allocate memory store generated code. ultimately, code heap manager uses virtualalloc function allocate memory.

gcc - How to override C compiler aligning word-sized variable in struct to word boundary -

i have structure specified following member 1, 16 bits member 2, 32 bits member 3, 32 bits which shall reading file. want read straight file struct. the problem c compiler align variables m1, m2 , m3 word boundaries @ 32 bits since working on arm cortex m3 following struct declaration: typedef struct { uint16_t m1; uint32_t m2; uint32_t m3; }something; reading directly file put wrong values in m2 , m3, , reads 2 bytes too. i have hacked around , using following works fine: typedef struct { uint16_t m1; struct { uint16_t lo; uint16_t hi; }m2; struct { uint16_t lo; uint16_t hi; }m3; }something; however, looks dirty hack. cannot wishing cleaner way force compiler put halves of m2 , m3 in different words, sub-optimal may be. i using arm-none-eabi-gcc. know bit packing, unable work around optimisation. edit: turns out didn't know enough bit-packing :d what looking packed attrib

css - Laravel Set tab active in foreach -

how set tab page class 'active' in dynamical created list? i have link 'toon alle' show records, when ik click link display different view. active tab remains on first link. <ul class="nav nav-pills sort-source" data-sort-id="portfolio" data-option-key="filter"> <li data-option-value="*" class="active"> <a href="#" ng-click="getallrequests(1)">toon alle</a> </li> @foreach ($categories $categorie) <li data-option-value=".{{$categorie->namen}}" class=""> <a href="#" ng-click="getrequests({{$categorie->id}})" data-id="{{$categorie->id}}">{{$categorie->namen}} </a> </li> @endforeach </ul> you can using custom facade or html macro if using laravel 4 . example assumes using named routes. y

c++ - program linked to SFML dlls wont start, returns 0xC000007B or missing __gxx_personality_v0 -

i trying compile example sfml page http://www.sfml-dev.org/tutorials/2.3/start-cb.php (at bottom) i dowloaded version gcc 4.9.2 dw2, set needed (linker, directories) , compiled without errors. when application starts says needs .dll files copied them sfml/bin directory. says the procedure entry point __gxx_personality_v0 not located in dynamic link library libstdc++-6.dll (libstdc++-6 there copied mingw/bin) or the pro... _zst24__throw_out_of_range_fmtpkcz in same dll on sfml page there note: there multiple variants of gcc windows, incompatible each other (different exception management, threading model, etc.). make sure select package corresponds version use. if unsure, check of libgcc_s_sjlj-1.dll or libgcc_s_dw2-1.dll files present in mingw/bin folder. if mingw installed along code::blocks, have sjlj version. if feel version of gcc can't work precompiled sfml libraries, don't hesitate build sfml yourself, it's not complicated. i tried compile li

Converting Integer number into hexadecimal number in delphi 7 -

write program convert integer number hexadecimal representation without using inbuilt functions. here code, not working. can tell mistake? it giving error: "project raised exception class eaccessviolation message 'access violation @ address 00453b7b in module 'project.exe'.write of address ffffffff'.process stopped.use step or run continue." unit unit1; interface uses windows, messages, sysutils, variants, classes, graphics, controls,forms, dialogs; type tform1 = class(tform) end; function hexvalue(num:integer):char; var form1: tform1; implementation {$r *.dfm} function hexvalue(num:integer):char; begin case num of 10: result:='a'; 11: result:='b'; 12: result:='c'; 13: result:='d'; 14: result:='e'; 15: result:='f'; else result:=chr(num); end; end; var intnumber,hexnumber,actualhex:string; integernum:integer; i,j,k:byte;

STRING EXTRACTION/TRUNCATE from a given character in java -

hi doing ui project in java. truncate string or sequence of character given string example: if 000101 user input output of string 101. p.s: occurrence of 0's before 1 may anything. please me!! i'm sure there many ways this, , encourage figure out way on own. here's 1 answer question: why not try take user input , keep cutting off first character of string until reach nonzero number? for example, let's have string called "userinput". while(userinput.substring(0,1).equals("0")) userinput = userinput.substring(1);

c# - Datagridview column not hide -

i have problem @ datagridview hide column.. i don't know why code doesn't work.. this code.. private void kodesatuanlist() // 1 { connection.sqlconnection.close(); connection.connector(server, database, user, password); adapterkodesatuan = new sqldataadapter( "select id,kosat,keterangan kosat", connection.sqlconnection); datatablekodesatuan.clear(); datagridview1.clearselection(); adapterkodesatuan.fill(datatablekodesatuan); dataviewkodesatuan = datatablekodesatuan.defaultview; datagridview1.columncount = 3; datagridview1.columns[0].visible = false; //this..column id, set false.. datagridview1.columns[0].name = "id"; datagridview1.columns[0].headertext = "id"; datagridview1.columns[0].datapropertyname = "id"; datagridview1.columns[1].name = "kode"; datagridview1.columns[1].headertext = &