Posts

Showing posts from February, 2013

javascript - Define a unique global function when instantiating a class and pass data to it? -

i'm working api requires global function it's callback. i define callback within class, can instantiated several times on same page. submitform = function(el) { this.el = $(el); }; submitform.prototype.api = function(){ grecaptcha.render(this.el,{ 'sitekey' : '6lfk4sataaaaamskuioobffgclr_teruvbsr3pun', 'callback': callbackfunction }); }; where callbackfunncton references function window.callbackfunction how can i, every instance of class create unique global callback function , pass this.el function? i'm thinking maybe naming function random number, not sure if can pass this.el function somehow. submitform = function(el) { this.el = $(el); this.rand = math.random(); }; submitform.prototype.api = function(){ grecaptcha.render(this.el,{ 'sitekey' : '6lfk4sataaaaamskuioobffgclr_teruvbsr3pun', 'callback': callbackfunction }); }; window[this.rand] = function(this.

asp.net mvc - .Net MVC + UnitOfWork + Async -

please me think through this... i have mvc4 application using fluent nhibernate, ninject, , repository/service , unit of work patterns. app works great. i have sync routine i'd kick off every 30 minutes or so. go out bunch of website, grab content, , stuff database. ** way have execute routine calling webpage ** (ie can't make windows service, batch job executable, etc.). this routine threaded; there multiple "grab-and-stuffs" going on , shouldn't need wait each other. so, had grand idea of making new controller, new method, , kick off of async routine, using waitcallbacks. problem i'm having ioc has wired (d'oh). @ end of day i've got multiple transactions on 1 instance of unitofwork/session. ioc has injected 1 instance of unitofwork 1 instance of service, , that's have work within service that's trying these async transactions. so how can utilize existing web architecture? can short of having manually instantiate sessions

Can I get a specific number of posts per author and order by date in Wordpress? -

i have pretty basic query_posts call: query_posts(array(cat=>3,author=>$userid,posts_per_page=>12)) this getting 12 posts third category set of authors. piece i'm missing want 12 made of 2 posts each of 6 authors. order date fine, don't need grouped author. is there way pull posts way? i wrong, don't think possible 1 query since there isn't (to knowledge) way specify how many posts per author. it add load time little bit, might have split out 6 different queries work. you can using wp_query (your shouldn't use query_posts change main query) , wrapping each query in specific author block: $author1 = new wp_query(array('cat'=>3,'author'=>$author1id,'posts_per_page'=>12)); if($author1->have_posts): while($author1->have_posts()): $author1->the_post(); ?> <!--insert html etc. here--> <?php endwhile; endif; wp_reset_query(); //reset query object

git - How to download gitorious.org file? -

i wanna download files gitorious.org ( https://gitorious.org/sitara-bootcamp/meta-custom ) use git clone command , following error message... know how solve issue? sitara@ubuntu:~/tisdk/sources$ git clone git://gitorious.org/sitara-bootcamp/meta-custom.git -b amsdk-06.00.00.00 cloning 'meta-custom'... fatal: unable connect gitorious.org: gitorious.org[0: 64.13.172.37]: errno=connection refused gitorious.org[1: 2a02:c0:1014::1]: errno=network unreachable gitorious doesn't seem expose repo via git:// protocol, can download via http: mureinik@computer ~/src/git $ git clone http://gitorious.org/sitara-bootcamp/meta-custom.git -b amsdk-06.00.00.00 cloning 'meta-custom'... remote: counting objects: 70, done. remote: compressing objects: 100% (57/57), done. remote: total 70 (delta 21), reused 0 (delta 0) unpacking objects: 100% (70/70), done. checking connectivity... done.

how can I download zosRequestLogging-1.0 for liberty from wasdev.net -

i tried download zosrequestlogging-1.0 liberty wasdev.net. here did. 1) click on download 2) search zosrequestlogging-1.0 3) wasdev.net shows zosrequestlogging-1.0 there no download button in page. thanks david if you're trying install zosrequestlogging-1.0 feature, easiest thing run: wlp/bin/installutility install zosrequestlogging-1.0. however, if want download it, can instead do: wlp/bin/installutility download zosrequestlogging-1.0 --location={somelocation, ex: c:\zosrequestlogging}

javascript - change jquery chosen max_selected option dynamically -

i've 2 select option, class , class_attr class has 2 options: , b class_attr has many options: aa, bb, cc, dd, ee, ... my question is, how implement if user choose a, chosen max_selected 5 options, , if user change b, chosen max_selected 3 options. i'm trying this: $(".class").change(function(){ var code = $(this).val(); if(code == 1){ $(".class_attr").chosen({max_selected_options: 5}); } else{ $(".class_attr").chosen({max_selected_options: 3}); } $(".class_attr").trigger("liszt:updated"); }); but seems can't work, option list class_attr set once (the first class max_selected_options value selected, whether 5 or 3) , never updated max_selected_options after first time. thank you~ try this: $('.class').chosen().change(function () { var code = $(this).val(); var maxoptions = code == 1 ? 5 : 3; $(

c# - why does parse function return o? -

i new c# programming , bumped 1 problem looks pretty basic.i store string value sv_1 in variable lastserviceno , split using split function , result stored in string array called index.basically index[1] has numeric value bt string. want convert string int. in following code , behaves expected until parse function encountered.i not understand why parse function returning 0 index[1] has numeric value in it. can point problem please?? public string generateserviceno() { dataaccesslayer.dataaccesslayer dlobj= new dataaccesslayer.dataaccesslayer(); string lastserviceno = dlobj.getlastserviceno(); string[] index = lastserviceno.split('_'); int lastindex = int.parse(index[1]); return "sv_"+(lastindex++).tostring(); } int.parse(string s) throws exception if number bug in terms of data size or string "s" not in correct numerical format. the format method accepts " [ws][sign] number [ws] " where: [ws] optional 1 or

java - First key event jumps over the process -

i have been trying find info on bug, couldn't find relevant past several hours. i'm using key event handling method in controller class. onkeypressed lies in fxml file, on root borderpane. main class standard. this method part of calculator app, extracts char keycode , passes other method. and problem is, seen during debugging, on first key press doesn't try generate string returned, jumps straight end of method. other keys pressed processed normally. if printf before last curly brace, it's printed on console on first key press only. here problem method: public void handlekeys() { container.setonkeypressed(key -> { string returned = key.getcode().tostring().tolowercase(); char chr = '0'; switch (returned) { case "add": chr = '+'; break; default: if (character.tostring(returned.charat(returned.length() - 1)).matches("\\

c++ - OpenCV 2.4.9 - Traincascade problems -

Image
i use osx 10.11. i'm new opencv , i'm trying train simple (and surely weak) cascade classifier detect object. have read several answers, posts, guide, docs , tutorials cascade classifier have problems. referred guide: guide that follow opencv doc. have 8 jpg interest object , 249 background images (i know it's poor dataset it's attempt). when call opencv_createsamples noticed author of guide generate 1500 samples , it. means generate 1500 samples 8 positive images? perl bin/createsamples.pl positives.txt negatives.txt samples 1500 "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40" note in sample folder have 7 img*.jpg.vec file. not 1500? after when call: g++ `pkg-config --libs --cflags opencv` -i. -o mergevec mergevec.cpp cvboost.cpp cvcommon.cpp cvsamples.cpp cvhaarclassifier.cpp cvhaartraining.cpp -lopencv_core -lopencv_calib3d -lopencv_imgproc -lopencv_highgui -lopencv_objdetect

java - Eclipse Plugin development: How to jump to Marker in the Source View from Problems View? -

i'm developing editor own language. add error marker source view code: private void displayerror(interval interval, string message) { int startindex = interval.a; int stopindex = interval.b + 1; annotation annotation = new annotation("org.eclipse.ui.workbench.texteditor.error", false, message); annotations.add(annotation); annotationmodel.addannotation(annotation, new position(startindex, stopindex - startindex)); iworkspace workspace = resourcesplugin.getworkspace(); imarker marker; try { //create marker display syntax errors in problems view marker = workspace.getroot().createmarker(markerid); marker.setattribute(imarker.severity, imarker.severity_error); marker.setattribute(imarker.message, message); marker.setattribute(imarker.char_start, startindex); marker.setattribute(imarker.char_end, stopindex); marker.setattribute(imarker.priority, imarker.priority_high); //ma

java - Why does drawImage fail when I am using it inside a Jpanel -

i doing initial section of simple platform game in java. have created class called entity extends jpanel , added window. import javax.swing.*; import java.awt.*; /** * created bw12954 on 27/05/16. */ public abstract class entity extends jpanel { private final spritesheet sprites; private point location; private dimension dimensions; public entity(int x, int y, int w, int h, spritesheet sprites) { location = new point(x, y); dimensions = new dimension(w, h); this.sprites = sprites; } public entity(int x, int y, int w, int h) { this(x, y, w, h, null); } @override public dimension getpreferredsize() { return dimensions; } public void setlocation(int x, int y) { location.setlocation(x, y); } /* code removed here brevity */ @override public void paintcomponent(graphics g) { super.paintcomponent(g); g.drawimage(sprites.get(),

My website is being redirected to http://guide.domain-error.com/ -

i created website html, css, js, jquery , got domain name @ http://dot.tk . the name of website http://onlinehtmleditor.tk . browser taking me http://guide.domain-error.com/search9870798707.php?keyword=onlinehtmleditor.tk/&uri=&uid=57499c974fcbe... i searched google results solutions remove domain-error not http://guide.domain-error.com/ . so how prevent this? it means dns records have not been updated yet. page see provider-specific, see other page when visiting website. dns ("domain name system") used ip address domain. when register domain, dns records have actualized, domain , server's ip have added. i assume have set server , assigned domain (otherwise have in domain management panel first). if so, have wait little. if haven't assigned server yet, first , check again little time after this. i hope help.

ruby on rails - RoR: Param is missing or the value is empty -

Image
i getting error when try update prop(which article). can create prop when go edit following error: this props controller: class propscontroller < applicationcontroller attr_accessor :user, :answer, :choice, :prop def index @props=prop.all end def show @prop = prop.find(params[:id]) end def new @prop = prop.new @user = user.find(session[:user_id]) end def edit @prop = prop.find(params[:id]) @user = user.find(session[:user_id]) @answer = @user.answers.update(prop_params) end def create @prop = prop.new(prop_params) @user = user.find(session[:user_id]) @answer = answer.new if @prop.save redirect_to @prop else render 'new' end end def update @user = user.find(session[:user_id]) @prop = prop.find(params[:prop_id]) @answer = @user.answers.update(answer_params) if @prop.update(prop_params) redirect_to @prop else render 'edit'

ios - How to use protocol extension to provide auto-generated identifier for classes? -

i want provide auto-generated identifier each custom uitableviewcell subclass. try following code, compiler says type 't' has no member 'autoreuseidentifier' protocol autoreusable: class { static var autoreuseidentifier: string { } } extension autoreusable { static var autoreuseidentifier: string { return "\(self)" } } extension uitableviewcell: autoreusable {} func printclassname<t: uitableviewcell>(type type: t.type) { print(t.autoreuseidentifier) } it's okay implement protocol in extension uitableviewcell, prefer implement in protocol extension. how fix this? the generic t in printclassname(...) not know conforms autoreusable protocol (even if you, developer, knows uitableviewcell so), knows uitableviewcell och uitableviewcell subclass object. you redeem adding ... t: autoreusable> in generic type constraint of printclassname(...) func printclassname<t: uitableviewcell t: autoreusa

masking - How to do a masked query in Elasticsearch? -

for example, storing user passports in elasticsearch. stored consecutive letters , digits of following format: aaddddddd . 2 alphabet , 7 digits. user interested in search mention specific values specific positions. example, want search passport numbers have 'a' @ beginning, '7' in third position , '0' in last position. this: a-7----0 how generate efficient query this? need create custom analyzer this? so far i've done inserted space in between characters , searching index position, seems costly operation me. how efficient query need? if data not big can try regexp query https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html other suggest use document array of symbols , places. ex. { 'code' : [ {'pos':1, 'symbol':a},{'pos':2, 'symbol':b}, ... ] } then can use bool filter, , efficiently use filter cache

preg match - PHP get div that contains a word -

i'm trying divs contain [release] @ bottom of page http://mpgh.net/forum/175-crossfire-hacks-cheats/ . <?php $text = file_get_contents("http://mpgh.net/forum/175-crossfire-hacks-cheats/"); $check_hash = preg_match('#<div class=\"inner\"> <h3 class=\"threadtitle\"> <a href="\.*?\" id=\".*?\"><img class=\".*?\" src=\".*?\" alt=\"go first new post\" title=\"go first new post\"></a> <img src=\".*?\" alt=\".*?\" border=\"0\" title=\".*?\"> <span class=\"prefix understate\"> <span style=\".*?\"><b>(.*?)</b></span> </span> <a class=\"title threadtitle_unread\" href=\"(.*?)\" id=\".*?\">(.*?)</a> </h3> <div class=\"threadmeta\"> <div class=\"author\"> <span class=\"label\

How copy() php works ? overwritting contents or adds? -

i think don't understand how copy() works... it overwritting contents of orginal file in destination file or adds content ? $originale = '/var/www/sito/pagina.php'; $copia = '/var/www/sito_backup/backup_pagina.php'; copy($originale,$copia); the doc copy() says: warning if destination file exists, overwritten. if need different behavior have @ fopen() , $mode parameter.

python - How to get parameter arguments from a frozen spicy.stats distribution? -

frozen distribution in scipy.stats can create frozen distribution allows parameterization (shape, location & scale) of distribution permanently set instance. for example, can create gamma distribution ( scipy.stats.gamma ) a , loc , scale parameters , freeze them not have passed around every time distribution needed. import scipy.stats stats # parameters particular gamma distribution a, loc, scale = 3.14, 5.0, 2.0 # general distribution parameterized print 'gamma stats:', stats.gamma(a, loc=loc, scale=scale).stats() # create frozen distribution rv = stats.gamma(a, loc=loc, scale=scale) # specific, parameterized, distribution print 'rv stats :', rv.stats() gamma stats: (array(11.280000000000001), array(12.56)) rv stats : (array(11.280000000000001), array(12.56)) accessible rv parameters? since parameters not passed around result of feature, there way values frozen distribution, rv , later on? accessing rv frozen parameters

android - Translucent dialog with margin -

i need create translucent dialog, 100dp margin top. in code, add this: dialog dialog = new dialog(getactivity(), android.r.style.theme_translucent_notitlebar); dialog.setcontentview(r.layout.transparent_progress_bar); and transparent_progress_bar : <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:layout_width="match_parent" android:layout_margintop="100dp" > <progressbar android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:layout_gravity="center" android:background="@android:color/transparent" android:indeterminate="true" android:indeterminatedrawable="@drawable/rotate_progress_bar" android:indeterminateonly="true

android - Mute Phone with exception -

is possible mute device, allow sounds & notifications app running? can make exception ringer_mode_silent state (for 1 specific app)?

jquery - Select options without value attribute -

is correct or invalid markup (when option has no value)? expected jquery behaviour .val() when there no value="" assigned? <select id="select_id"> <option></option> <option>name</option> <option>recent</option> </select> if use $("#select_id").val(); "name"/"recent", if option had value, value's content. i know there .text() "name" , "recent" in example. confused why .val() gives me .text() when there no value assigned. fiddle (notice different result of alerts) this has nothing jquery. that's how browser handles it. http://jsfiddle.net/jdw8n/1/ $("#select_id").change(function () { var val = $("#select_id option:selected")[0].value; alert(val); // somevalue or recent }); reference: http://www.w3.org/tr/html5/forms.html#attr-option-value the value attribute provides value element. va

javascript - Convert an ImageData object (not a canvas) to image dataURL -

i create dataurl imagedata object (i.e. width, height, data). realize canvas has this, want avoid distortions canvas use has (alpha premultiply mainly) .. i.e. want avoid obvious canvas.putimagedata step. from this post can make arraybuffer/typedarray/dataview base64. dont know how canvas dataurl adds width/height uint8 data portion of base64 string. nor know how png conversion done. (i'd ok raw data image type don't think there 1 .. png , jpg) possible approaches: load imagedata canvas putimagedata. fails, distorts data. create image img.src = base64 data. fails, has canvas dataurl. other? anyone know how construct image dataurl raw width, height, data imagedata?

javascript - Retry when no response from website -

i use recursive function below, in order reopen website if httpstatus != 200 : retryopen = function(){ this.thenopen("http://www.mywebsite.com", function(response){ utils.dump(response.status); var httpstatus = response.status; if(httpstatus != 200){ this.echo("failed website, retry"); this.then(retryopen); } else{ var thisnow = hello[variable]; this.evaluate(function(valueoptionselect){ $('select#the_id').val(valueoptionselect); $('select#the_id').trigger('change'); },thisnow); } }); } the problem retryopen function not go far callback function(response){} . then, script freezes. i wonder how 1 change function able recursively try open website again if there no response website (not error code 404 or something)? in other words, how rewrite retryopen function reruns when function

How can I get the lowest values in a MongoDB collection? -

i have mongodb collection called product has following documents seen below. { "product" : "milk", "barcode" : 12345, "price" : 100, "store" : "bestbuy" }, { "product" : "milk", "barcode" : 12345, "price" : 100, "store" : "walmart" }, { "product" : "milk", "barcode" : 12345, "price" : 130, "store" : "target" }, { "product" : "milk", "barcode" : 12345, "price" : 500, "store" : "game" } i wish query collection , return documents have lowest price e.g { product: "milk", barcode: 12345, price: 100, store: "bestbuy" } { product: "milk", barcode: 12345, price: 100, store: "walmart" } but when run aggregat

ios - Do I need to set the Trailing/Leading constraint space to -20 in order for a UIElement to sit on the edge of the screen? -

Image
is proper way set constraints map view touch edges of screen? instead of -20 this uncheck constrain margins : if constraint exists, can select constraint , change behavior afterwards well:

javascript - Does mousemove Event Fire When Assigned -

i need setup initial state using cursor position when user presses button, update state when cursor moves. curiously, it seems difficult cursor position outside event . i have following code: // here set initial state don't know how coordinates thing.addeventlistener('mousemove', function (e) { // here update based on new e.clientx , e.clienty }); the above seems work without setting initial state. seems mousemove event fired assigned it, though perhaps has not moved since click. does know if intentional behavior can rely on? according tests on windows 7, mousemove event not triggered automatically on button click in 2 situations: on firefox, mentioned in post: what if "mousemove" , "click" events fire simultaneously? when button has focus , pressed space bar (in ie, chrome , firefox) as say, getting mouse position outside of event handler, , before actual mouse action, seems impossible task.

WPF Vb.net Copyto not working? -

i tyring fire event copies program startup folder. not understand going wrong? keep on getting exception message. file being copies not in use. try dim desktoplink string = environment.getfolderpath(environment.specialfolder.desktop) dim startupfolder string = environment.getfolderpath(environment.specialfolder.startup) dim info new fileinfo(startupfolder) info.copyto(desktoplink + "\doessomething.bat") catch ex exception messagebox.show("error: can not copy startup folder") end try right now, you're creating fileinfo folder , not file . this should be: dim info new fileinfo(path.combine(startupfolder, "doessomething.bat")) info.copyto(path.combine(desktoplink, "doessomething.bat")) or, easier: dim source = path.combine(startupfolder, "doessomething.bat") dim target = path.combine(desktoplink, "doessomething.bat") file.copy(source, target)

html - How do I create a 3x3 grid via CSS? -

given 9 div s 1 after another, want create grid 3x3 via css. how do that? .cell { height: 50px; width: 50px; background-color: #999; display: inline-block; } .cell:nth-child(3n) { background-color: #f00; /* property should use line break after element? */ } /* doesn't work; @ least not in safari */ .cell:nth-child(3n)::after { display: block; } <div class="grid"> <div class="cell"></div> <div class="cell"></div> <div class="cell"></div> <div class="cell"></div> <div class="cell"></div> <div class="cell"></div> <div class="cell"></div> <div class="cell"></div> <div class="cell"></div> </div> note: don't want float/clear solution. focus on css , not h

python - trouble trying to show an image from my static folder in a django template -

im trying show image in template if profile haven't picture. have code in template {% if not profileform.avatar %} <img src="{% static 'img/empty-profile-picture.png' %}" alt="" /> {% endif %} and obtain error template error: in template /home/jaime/djcode/urgencias/templates/usuarios/profile_edit.html, error @ line 68 invalid block tag: 'static', expected 'elif', 'else' o 'endif' you've got typo - keyword static , not satic .

javascript - Angular js: an arrray from one file to another -

i new angular js.i have included 2 files , both files works fine separately - can add names array , delete or update them, idea able array 1 file , other dynamically. because when swich views arrays still stored (until refresh) how can connect 2 .js files because 2 modules in 2 separate files , 2 views make both array string names. want call function(getalldepartments) employee module , array of names of departments department module. , know cant use require or include don't need save data database best other approach here? have code: p.s. i've tried dependency inject department factory in employee module since doesn't know factory comes useless - , can't reference script inside script... employees.js 'use strict'; angular.module('myapp.employees', ['ngroute']) .config(['$routeprovider', function($routeprovider) { $routeprovider.when('/employees', { templateurl: 'employees/employees.html', controller:

jsp - how to use struts form fields (s:textfield, s:password) and style them using materializecss framework? -

<form class = "col l12 s12"> <div class = "row"> <div class="input-field col l6 s6"> <input id="firstname" type="text" class="validate"> <label for="firstname">first name</label> </div> </div> </form> i want apply struts2 on above code value of firstname . how should that? edit (whole jsp code registration form): <%@ page contenttype="text/html;charset=utf-8" language="java" %> <%@taglib prefix="s" uri="/struts-tags" %> <html> <head> <!--import google icon font--> <link href="http://fonts.googleapis.com/icon?family=material+icons" rel="stylesheet"> <!--import materialize.css--> <link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="

java - Splitting InsnList into basic blocks -

in asm tree api, have insnlist, containing list of instructions in method. i want split basic blocks: sequence of instructions such each instruction except last 1 has 1 successor, , such no instruction except first 1 can target of jump. how accomplish this? in java 7+ stack frames included in method opcodes. iterate through method's insnlist , make blocks split each frameinsn. example: list<insnlist> l = lists.newlist(); insnlist il = new insnlist(); (abstractinsnnode ain : method.instructions.toarray()) { if (ain.gettype == abstractinsnnode.frame){ l.add(il); il = new insnlist(); } else { il.add(ain); } }

c# - Class Events Triggering Actions in Main Program -

i have used solution stated in question . i want reuse timer methods in several different forms , have been trying create class keep number of methods in various forms minimum. new programming , using classes , events , don't quite think approaching correctly. below class far. can , event in class trigger , event in main program? should using class? using system; using system.timers; namespace tmp_erp { class timer { int milliseconds; system.windows.forms.timer querytimer; public timer() { } //revokes timer if not revoked public void revokequerytimer() { if (querytimer != null) { querytimer.stop(); querytimer.tick -= querytimer_tick; querytimer = null; } } public void restartquerytimer() { //start or reset pending query if (querytimer == null) {

checkbox - prestashop multiple checkboxes do not save values -

i can't figure out why checkbox values not saved in database using helpers. trying save customers ids module's setting : the array : $custs = customer::getcustomers(); foreach ($custs $key => $value) { $options[] = array( 'id_customer' => (int)$value['id_customer'], 'infos' => $value['firstname'].' '.$value['lastname'].' | '.$value['email'] ); } the checkboxes : 'input' => array( array( 'type' => 'checkbox', 'label' => $this->l('customers'), 'desc' => $this->l('select customers.'), 'name' => 'my_module_customers', 'values' => array( 'query' => $options, 'id' => 'id_customer', 'name' => 'infos',

iOS how to structure helper class -

i have 2 classes: 1 primary 1 , 1 helper class. helper class subclasses uitableviewcontroller , has no purpose outside of implementing functionality primary class. unsure how structure this. coming java background, natural approach think of inner class reading other posts doesn't exist in ios. proper way structure this? declare helper class own standalone class in separate .h/.m files implicit understanding helper class? there no inner or nested classes in objective-c. need make helper separate top-level class. you can put helper in own .h / .m files, or, since primary class needs see it, can put entirely in primary class's .m file. is, can this: // in primary.m #import "primary.h" @interface primaryhelper : uitableviewcontroller // primaryhelper interface declarations here @end @implementation primaryhelper // primaryhelper implementation here @end @implementation primary // primary implementation here @end however, if helper class implemen

c# - Save user input -

this question has answer here: best way save per user options in c# 5 answers so basically, have openfiledialog working displays chosen dir in textbox. i'm wondering how save users input when restart application stay in textbox? wouldn't have on every time. understand might stupid question, i've been googeling time , found nothing this. thanks. public form1() { initializecomponent(); if(file.exists(@"path.txt")) textbox1.text = file.readalltext(@"path.txt"); } private void button1_click(object sender, eventargs e) { if(file.exists(@"path.txt") == false) file.create(@"path.txt"); file.writealltext(@"path.txt", textbox1.text); } just write in file, don't forget include system.io in references.

c++ - Cannot get templates to compile under Visual Studio and clang -

i have following minified code. line // vs compiles on vs not on clang, , line // clang compiles on clang not on vs. correct? more importantly, how make equivalent line compile on both? versions tested clang 3.7.0, , vs 2015. #include <functional> #include <tuple> template<typename... args> class c { struct b { std::function<void(args...)> func; b(std::function<void(args...)> func) : func(func) { } }; template<typename t> struct d : b { using b::b; template<size_t... i> void call(t &t, std::index_sequence<i...>) { func(std::get<i>(t)...); // vs b::template func(std::get<i>(t)...); // clang } }; d<std::tuple<args...>> d; public: c(std::function<void(args...)> func) : d(func) { } void call() { std::tuple<args...> t; d.call(t, std::make_index_sequence&

vector - How should I multiply two matrices in C++? -

note: i'm using standard library c++, , storing matrices multidimensional vectors (see example below). i'm having trouble finding proper function multiply 2 matrices in c++. clarify i'm trying do: a = | a1 a2 | b = | b1 | | a3 a4 | | b2 | result = | (a1 * b1 + a2 * b2) | | (a3 * b1 + a4 * b2) | obviously using simple algorithm i'm trying find if there's function this. my specific example in c++: #include <vector> std::vector<std::vector<double>> a; a.push_back({ 0.96, 0.56 }); a.push_back({ 0.01, 0.41 }); std::vector<std::vector<double>> b; b.push_back({ 1.331749 }); b.push_back({ 1.0440705 }); result = (a * b); where " result " be: | 1.8631586 | | 0.4413864 | how should go doing above? no, there no functions in c++ library vector multiplication. there building blocks, std::for_each , std::copy , , std::transform , can used implement them, it's implement complete algorith

google maps - How to accept only certain special characters while accepting a location address in PHP? -

i want accept address of place , enter database. if send address parameter following function remove initial , end spaces along special characters public function sanitizestring($string){ $sanitized_string = htmlentities(mysqli_real_escape_string($this->conn, trim($string))); return $sanitized_string; } but know in addresses 1/a grand trunk road, kolkata - 31 there few special characters '/', '-', ',' has accounted for. i want store address of places in database , convert them latitudes , longitudes using google maps geocoding api , use markers mark them on google map. can suggest me way on how sanitize address keeping special characters intact or other way store addresses of places ? edit for asking, use pdo prepared statements when dealing database queries. here instance public function getuserbyemailandpassword($email, $password){ $stmt= $this->conn->prepare("select * users email= ? , status=1&

azure - Updating a Virtual Machine Scale Set to add a secret fails with VHD error -

i've deployed virtual machine scale set (vmss) azure part of service fabric cluster. when try redeploy template, enhanced update vmss additional secret, following error. i've verified parameters i'm using correct. "type": "microsoft.compute/virtualmachinescalesets", // ... "osprofile": { // ... "secrets": [ { "sourcevault": { "id": "[parameters('sourcevaultvalue')]" }, "vaultcertificates": [ { "certificatestore": "[parameters('certificatestorevalue')]", "certificateurl": "[parameters('certificateurlvalue')]" }, { // ******* added ******* "certificatestore": "[parameters('certificatestorevalue')]", "certificateurl": "[parameters('sslcertificateurlvalue')]" } // *******

Laravel php tinker command to show tables and structures? -

what command within laravels' php artisan tinker shows tables and/or structure of tables? to tables, use this: $tables = \db::select('show tables'); . to columns of table, use this: $columns = \schema::getcolumnlisting('<table_name>');

android - RecyclerView is not being populated with items -

i trying send volley request populate recyclerviews reason can fathom, recyclerview not populated. data fetched quite alright, can see logcat. after loading see blank page, blank , empty page. these codes: sample jsoup { "found": 4, "site_id": 1, "comments": [ { "id": 26934, "post": { "id": 194784, "type": "post", "title": "lorem ipsum dummy text", }, "author": { "email": false, "avatar_url": "http://1.gravatar.com/avatar/af61ad05da322fccae2bd02f7062e357?s=96&d=wavatar&r=g", }, "date": "2016-05-28t02:54:35+01:00", "content": "<p>it long established fact reader distracted readable content of page when looking @ layout</p>\n", "status": "approved", }, {