Posts

Showing posts from March, 2012

haskell - Get the minimum value -

i have function 'getmin' should return minimum value. function uses function 'urvalfun' in order determine minimim value. here demonstration of 'urvalfun' get1:: (string,string,double ) -> string get1 (x,_,_ ) = x get2 :: (string,string,double)-> string get2 (_,x,_) = x get3:: (string,string,double)->double get3 (_,_,x) = x distdiff:: string-> string->[(string,string,double)] ->double distdiff b dimat = sum [z |(x,y,z)<- dimat, (x == && y /= b) || (y == && x /= b) ] urvalfun:: int -> (string,string,double)->[(string,string,double) ]->double urvalfun size triple dimat = ((fromintegral size)-2)*(get3 triple) - ( (distdiff (get1 triple) (get2 triple) dimat ) + (distdiff (get2 triple) (get1 triple) dimat )) its not necessary understand chunck of code, thing important if evaluate: urvalfun 3 ("a","b",0.304) [("a","b",0.304),("a",&qu

php - Issue: Google Apps Script Execution API -

i absolute beginner of web development , use google apps script execution project. so followed documentation in https://developers.google.com/apps-script/guides/rest/quickstart/php. however, struggling error "caught exception: error calling post https://script.googleapis.com/v1/scripts/ {i put myscriptid here}:run: (403) caller not have permission" i have looked answer solve issue long time, haven't gotten clue. has ever followed same documentation me , had same problem? if have, let me know how solve this? english not first language, if post not make sense or need more information, let me know well. advice appreciated! in advance!

ios - Delegate method not working correctly when trying to delete a character from a secured textField text -

i have problem when trying delete character secured textfield text. i want capture text in textfieldshouldchangecharactersinrange delegate method, problem secured textfields there problem. when tap on secured textfield , delete on character textfield's text, visually textfield text disappears (this default secured text fields). the problem text returned in textfiledshouldchangecharactersinrange not empty text, text without removed character. problem visually there no text left in text field, text returned delegate method mentioned above not nil, or empty. i want ask if there possibility capture correct text. if not clear please ask , respond. thank much! try func textfield(textfield: uitextfield, shouldchangecharactersinrange range: nsrange, replacementstring string: string) -> bool { if let swrange = textfield.text!.rangefromnsrange(range) { let newstring = textfield.text!.stringbyreplacingcharactersinrange(swrange,withstring:string)

python - import error: No module named trajoptpy -

'em running python code, in python code 'em facing problem these lines of code import trajoptpy import trajoptpy.kin_utils ku trajoptpy.check_traj import traj_is_safe, traj_collisions import trajoptpy.math_utils mu actually main error importing trajopt as importerror: no module named trajoptpy i have downloaded github package of trajopt after compiling don't know pythonpath making problem or other dependency in pc have set path as mudasser@mudasser-pc:~$ export pythonpath=$pythonpath:/home/mudasser/trajopt mudasser@mudasser-pc:~$ export pythonpath=$pythonpath:/home/mudasser/trajopt/build/lib now while ctest , running python code making problem me. ctest error given as test project /home/mudasser/trajopt/build start 1: arm_to_joint_target.py 1/10 test #1: arm_to_joint_target.py ............. passed 5.10 sec start 2: arm_to_cart_target.py 2/10 test #2: arm_to_cart_target.py ..............***failed 2.46 sec start 3: fullbody_plan.py 3/

r - Maximum number of parallel processors in clusterR function? -

i using clusterr() function predict randomforest model on huge data set. therefore use cluster 100+ cores. code looks this: library(randomforest) library(raster) library(parallel) r <- stack("...some/multilayer/raster...") rfo <- # load calculated randomforest object begincluster(100) rpred <- clusterr(r, predict, args = list(model = rfo)) i expected 100 initialized processors used. however, when @ top in bash, 20 - 30 processes running @ full speed. others on sleep. when getcluster() cluster 100 sockets running. is there limitation maximum number of processors in clusterr function or parallel backend? is there possibility determine maximum number of processors used in clusterr ?

ruby on rails - Undefined Method 'underscore' -

i'm trying hand @ sti using thibault's tutorial: https://samurails.com/tutorial/single-table-inheritance-with-rails-4-part-3 it's been working fine till dynamic paths part 'undefined method `underscore' nil:nilclass' snippet def format_sti(action, type, post) action || post ? "#{format_action(action)}#{type.underscore}" : "#{type.underscore.pluralize}" end routes: resources :blogs, controller: 'posts', type: 'blog' resources :comments, except: [:index, :show] end resources :videos, controller: 'posts', type: 'video' resources :posts post controller: before_action :set_post, only: [:show, :edit, :update, :destroy] before_action :set_type def index @posts = type_class.all end ... private def set_type @type = type end def type post.types.include?(params[:type]) ? params[:type] : "post" end

c++ - Non-type template parameter for polymorphic lambda? -

is possible write this? [](std::index_sequence<std::size_t ...i> s) { }; or this? []<std::size_t ...i>(std::index_sequence<i...> s) { } how syntax in c++14 or c++17? or not possible @ all? basically, want have i template parameter pack, , lambda serves way that. alternatively, there syntax achieve following? std::index_sequence<std::size_t ...i> x = std::make_index_sequence<10>{}; // local template parameter pack gcc provides latter syntax as extension , it's not standard: template <typename... ts> void foo(const std::tuple<ts...>& t) { auto l = [&t]<std::size_t ...i>(std::index_sequence<i...> s) { std::initializer_list<int>{ (std::cout << std::get<i>(t), 0)... }; }; l(std::index_sequence_for<ts...>{}); } live demo

php - Get name of a repository var in Symfony -

i have function checks if user has access repository. public function getacl($repository, $granted){ if (false === $this->authorizationchecker->isgranted($granted, $repository)) { $this->get('log')->writelog('access denied.', __line__, 3); return new jsonresponse(array( 'result' => 'error', 'message' => 'not allowed' )); } return true; } the call /* client */ $client = $em->getrepository('appbundle:client')->find($request->get('clientid')); /* acl */ $this->get('global_functions')->getacl($client, 'view'); what i'd get i see name of repository user has been denied to, this: $this->get('log')->writelog('access denied $repositoryname.', __line__, 3); in case $repositoryname should appbundle:client or client is @ possible? there way t may so $this->get(&

spring - How to rewrite jdbcTemplate query using JDK8 features? -

here's code. let's there many large images in db want keep 1 in memory @ time. how write using jdk 8 features lambda , streams? i started using kept failing ( https://spring.io/guides/gs/relational-data-access/ , www.jooq.org/java-8-and-sql ) , using resultsetextractor working intendent, there way without resultsetextractor? jdbctemplate.query( "select id,image,mimetype images", new resultsetextractor(){ @override public list extractdata(resultset rs) throws sqlexception, dataaccessexception { while(rs.next()){ createthumbnail( new imageholder(rs.getint("id"), rs.getbytes("image"), rs.getstring("mimetype") )); } return null; } } ); this nice looking stream/lambda version works holds many things in memory , gives oome sooner

asp.net mvc - Kendo Grid multi column group based on object array -

Image
i relatively new mvc (and kendo ) have managed setup grid contains multi column headers using columns.group functionality. @(html.kendo().grid<result>() .name("mygrid") .columns(columns => { columns.bound(c => c.resultdatetime).title("date time"); foreach (lot lot in (lot[])viewbag.lots) { columns.group(group => group .title(lot.lotnumber) .columns(info => { info.bound(lot.result.count.tostring()); info.bound(lot.result.mean.tostring()); info.bound(lot.result.sd.tostring()); })); } columns.bound(c => c.standardcomment.description).title("comment"); columns.bound(c => c.reviewcomment

Excel dates - converting different date formats into a single format -

Image
have large raw data dump , trying format dates consistent format. as can see screenshot, there 2 main formats, 1 custom mm-dd-yyyy hh:mm am/pm , mm/dd/yyyy hh:mm:ss. 1 stored general, while other custom value. i've tried =left(a2,8) , converting via text() , using text columns, can't bring values consistent value. it appears windows regional settings short date dmy or similar. data dump in mdy format. why a2 , a4 being converted "real dates" (although incorrectly), , a3 not since excel not know month = 13. note a2 1-dec-2015 , suspect in original data 12-jan-2015. edit : expand bit on explanation. when looks date or time entered excel cell, excel tries change result date, parsing input according windows regional short date format. has undesireable outcome. example, if windows format mdy date input dmy, input days <=12 converted incorrectly, , input days > 12 retained text. behavior cannot "turned off" , causes many compl

javascript - get and set css style into var -

i begginer. trying font size of element variable. after set font size of element using variable. i have been looking solution 12 hours , found nothing. grateful tips. in advance. my code below. jquery(window).scroll(function() { var oldfont = jquery('.mhmainnav').find('li').find('a').css("font-size"); var windowtop = jquery(window).scrolltop(); if (windowtop > 280) { jquery('.mh-main-nav').find('li').find('a').css("font-size", "12px"); } else { jquery('.mh-main-nav').find('li').find('a').css("font-size", oldfont); } }); the thing change moving old font outside scroll, otherwise when change font-size 12px, oldfont overwritten next time scroll. maybe cache anchor selector better performance also check mhmainnav selector - change mh-main-nav var anchors = jquery('.mhmainna

python - How to set parameters of the Adadelta Algorithm in Tensorflow correctly? -

Image
i've been using tensorflow regression purposes. neural net small 10 input neurons, 12 hidden neurons in single layer , 5 output neurons. activation function relu cost square distance between output , real value my neural net trains correctly other optimizers such gradientdescent, adam, adagrad. however when try use adadelta, neural net won't train. variables stay same @ every step. i have tried every initial learning_rate possible (from 1.0e-6 10) , different weights initialization : same. does have slight idea of going on ? thanks much short answer: don't use adadelta very few people use today, should instead stick to: tf.train.momentumoptimizer 0.9 momentum standard , works well. drawback have find best learning rate. tf.train.rmspropoptimizer : results less dependent on learning rate. algorithm very similar adadelta , performs better in opinion. if want use adadelta, use parameters paper: learning_rate=1., rho=0.95, epsilon=1e-6 . bi

mysql - Matched Rows From Two Table and Display Them As New Row -

suppose, i've data in table table 1 follows: quesid quesname 1 question 1 2 question 2 3 question 3 4 question 4 in table 2 , follows: id quesid mainquesid 1 4 1 2 2 2 i want have following output: quesid quesname 1 question 1 1 question 4 2 question 2 2 question 2 3 question 3 4 question 4 is possible sql? tried following return questions if not match id (order mainquesid): select m.quesid , m.quesname table_1 m group m.quesid ,m.quesname union select k.quesid , m.quesname table_2 k i assume, result posted, entries table_2 listed mainquesid . select * ((select t1.quesid, t1.quesname table_1 t1) union (select t2.mainquesid quesid, t1.title quesname table_2 t2 join table_1 t1 on t1.quesid = t2.quesid)) union_table order union_table.quesid the table_2 joined table_1 question title each qstnid. then both

asp.net web api - Json deserialize error c# mvc -

controller { namespace webapplication10.controllers { public class default1controller : apicontroller { [responsetype(typeof(weatheritem))] public weatheritem post(wcall call) { string apikey = //myapikey; string url = string.format("http://api.openweathermap.org/data/2.5/forecast/daily?q={0}&units=metric&cnt=1&appid={1}", call.city1, apikey); webclient a1 = new webclient(); string dataweather = a1.downloadstring(url); weatheritem a2 = jsonconvert.deserializeobject<weatheritem>(dataweather); string przyklad = a2.list.pressure; return a2; } } } } class { namespace webapplication10.models { public class weatheritem { public list list { get; set; } public string cod { get; set; } public string message { get; set; } public int cnt { get; set; } //public list<city> city { get; s

Mysql insert into bad table -

i'm using old db many historic tables. insert values table zprava . therefore tried doing this: insert zprava (id_sekce, datumcasod, nazev, id_zdroj, anotace, obr300x160, url) values (12915, 'test', 'test', 1061, 'test', '/img.jpg', 'http://www.test.cz') but after insertion there record written in different table select * `zpravasekce` id_zprava = 470442 | id_zprava | id_sekce | | 470438 | 11018 | while tested behaviour insertions other table zpravasekce seem happen randomly. think trigger or stored function. i'm connect root db , there no triggers, functions or sth that. on testing server cron jobs turned off. any advices try? lot

Wit.ai Integration with Facebook Messenger -

hi i'm trying integrate messenger bot created using node.js wit.ai based on https://github.com/wit-ai/node-wit code pretty similar this. i've been reading documentation i'm having hard time understanding how integration works executing it. can provide step-by-step guide or similar? have looked @ articles referenced here: https://wit.ai/docs/recipes#integrate-with-facebook-messenger

python - Train model using queue Tensorflow -

i designed neural network in tensorflow regression problem following , adapting tensorflow tutorial. however, due structure of problem (~300.000 data points , use of costful ftrloptimizer), problem took long execute 32 cpus machine (i don't have gpus). according this comment , quick confirmation via htop , appears have single-threaded operations , should feed_dict. therefore, adviced here , tried use queues multi-threading program. i wrote simple code file queue train model following: import numpy np import tensorflow tf import threading #function enqueueing in parallel data def enqueue_thread(): sess.run(enqueue_op, feed_dict={x_batch_enqueue: x, y_batch_enqueue: y}) #set number of couples (x, y) use "training" model batch_size = 5 #generate data y=x+1+little_noise x = np.random.randn(10, 1).astype('float32') y = x+1+np.random.randn(10, 1)/100 #create variables model y = x*w+b, w , b should both converge 1. w = tf.get_variable('w', sh

How to split string at fixed numbers of character in clojure? -

i'm new in clojure . i'm learning splitting string in various ways. i'm taking here: https://clojuredocs.org/clojure.string/split there no example split string @ fixed number of character. let string "hello welcome here" . want split string after every 4th char, output (after split) should ["hell" "o ev" "eryo" "ne w" "elco" "me t" "o he" "re"] . note white space consider char. can tell me, how can this? thanks. you use re-seq : user> (def s "hello welcome here") #'user/s user> (re-seq #".{1,4}" s) ("hell" "o ev" "eryo" "ne w" "elco" "me t" "o he" "re") or partition string, treating seq: user> (map (partial apply str) (partition-all 4 s)) ("hell" "o ev" "eryo" "ne w" "elco" "me t" "o

html - I want to make Drop left rather then drop down -

i want make drop left rather drop down in bootstrap drop down button. i'm trying make happen can't able this, can guide me this? here code <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" /> <div class="col-sm-4 col-sm-offset-4"> <div class="btn-group"> <button class="btn btn-default btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> small button <span class="caret"></span> </button> <ul class="dropdown-menu "> <button class="btn btn-primary">action 1</button> <button class="btn btn-danger">action 2</button> </ul> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js&quo

c++ - Change size of dialog by defining height and width in pixels -

how can change size of dialog box 512 x 424 pixels? know mapdialogrect() converts dialog units pixels there no api in reverse? how fix size of dialog want in pixels? beginner in programing, code helpful. thank you. this resource kinect 2 sdk depth basics , idd_app dialogex 0, 0, 512, 436 style ds_setfont | ds_fixedsys | ws_minimizebox | ws_clipchildren | ws_caption | ws_sysmenu exstyle ws_ex_controlparent | ws_ex_appwindow caption "sample" class "depthbasicsappdlgwndclass" font 8, "ms shell dlg", 400, 0, 0x1 begin control "",idc_videoview,"static",ss_blackframe,0,0,512,424 ltext "",idc_status,0,425,412,11,ss_sunken,0 defpushbutton "screenshot",idc_button_screenshot,422,424,90,12 end

spring - mongo java driver 2.14.0. Change Deprecated code -

i upgrading mongo java driver jar 2.14.0. old code working fine following code showing deprecated classes , constructor need compatible code without deprecated classes , constructor mongo-java-driver.jar 2.14.0. public mongotemplate getmongotemplate() { simplemongodbfactory simplemongodbfactory = null; try { mongooptions opts = new mongooptions();//depricate opts.threadsallowedtoblockforconnectionmultiplier = getthreadsallowedtoblockforconnectionmultiplier();//depricate opts.connectionsperhost = getconnectionsperhost();//depricate serveraddress addr = new serveraddress(gethost(), getport()); mongo mongo = new mongo(addr, opts);//depricate simplemongodbfactory = new simplemongodbfactory(mongo, getdatabasename());//depricate if (mongotemplate == null) { mongotemplate = new mongotemplate(simplemongodbfactory); } } catch (unknownhostexception e) { logger.error(

dependencies - Dependency conflicts in asp.net core on mac -

i new .net , don't know how debug these kind of troubles when comes dependencies. trying run dotnet core application in mac, below can see output of terminal when execute dotnet restore , later can see project.json . not sure kind of information helpful here. appreciated. thanks. log : restoring packages /users/dimitris/develop/justbringcore/src/justbringcore/project.json... log : restoring packages tool 'microsoft.aspnetcore.razor.tools' in /users/dimitris/develop/justbringcore/src/justbringcore/project.json... error: package microsoft.dotnet.projectmodel.loader 1.0.0-preview2-003121 not compatible netcoreapp1.0 (.netcoreapp,version=v1.0). package microsoft.dotnet.projectmodel.loader 1.0.0-preview2-003121 supports: netstandard1.6 (.netstandard,version=v1.6) error: package microsoft.dotnet.cli.utils 1.0.0-preview2-003121 not compatible netcoreapp1.0 (.netcoreapp,version=v1.0). package microsoft.dotnet.cli.utils 1.0.0-preview2-003121 supports: error: - net451 (.n

c# - Decrypt message with private key RSA -

i have problem how can find private key windows 2008 server. first encrypt data public key extracted url https this: public static string encrypt(string data) { try { var crypto = new rsacryptoserviceprovider(2048); var rsakeyinfo = crypto.exportparameters(false); rsakeyinfo.modulus = publickeybyte(); crypto.importparameters(rsakeyinfo); var bytesdata = encoding.unicode.getbytes(data); var bytescyphertext = crypto.encrypt(bytesdata, false); var cyphertext = convert.tobase64string(bytescyphertext); return cyphertext; } catch (exception ex) { return null; } } private static byte[] publickeybyte() { uri u = new uri("https:\\domain.com"); servicepoint sp = servicepointmanager.findservicepoint(u); string groupname = guid.newguid().tostring(); httpwebrequest req = htt

c# - How to make secure request to REST, having signed Certificate with Public key, and Private Key generated with Certificate Request -

i need make https request restapi. before, made certificate request , private key, using openssl. after, certificate request had been signed provider , took certificate. have certificate , private key. question: how make secure request using certificate, private key , .net features. provide code, wrote of intuition(note: used bouncycustle read pem files): static void main(string[] args) { try { x509certificate certificate = getcertificate("c:/xxx/certificate.pem"); asymmetrickeyparameter privatekey = getprivatekey("c:/xxx/key.pem"); httpwebrequest webrequest = preparewebrequest("https://xxxx", "get", certificate, privatekey); webresponse webresponse = webrequest.getresponse(); } catch(exception e) { console.writeline("exception: {0}", e.message); console.write("stack trace: {0}", e.stacktrace); } console.readkey(); } private

c# - ComboBox not autoselecting initial value -

i have combobox bound list of people in simple viewmodel . selectedperson set in constructor of viewmodel, when run application, combobox not set initial value. doing wrong? notice 2 instances of myperson class should considered equal when have same id. important: cannot modify myperson override equals (it's third party). the option i've seen far user adapter pattern wrap instances of class , implement custom equals method there. i feel there should better method native wpf match items list kind of "key". in case, list of items , selected item come different sources, , that's why have id property acting primary key. please, take @ code, i've played selectedvalue , selectedvaluepath, nothing works. <window x:class="test.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.micro

vectorization - Why doesn't this C vector loop auto-vectorise? -

i trying optimise code use of avx intrinsics. simple test case compiles tells me loop not vectorised number of reasons don't understand. this full program, simple.c #include <math.h> #include <stdlib.h> #include <assert.h> #include <immintrin.h> int main(void) { __m256 * x = (__m256 *) calloc(1024,sizeof(__m256)); (int j=0;j<32;j++) x[j] = _mm256_set1_ps(1.); return(0); } this command line: gcc simple.c -o1 -fopenmp -ffast-math -lm -mavx2 -ftree-vectorize -fopt-info-vec-missed this output: simple.c:11:3: note: not vectorized: unsupported data-type simple.c:11:3: note: can't determine vectorization factor. simple.c:6:5: note: not vectorized: not enough data-refs in basic block. simple.c:11:3: note: not vectorized: not enough data-refs in basic block. simple.c:6:5: note: not vectorized: not enough data-refs in basic block. simple.c:6:5: note: not vectorized: not enough data-refs in basic block. i have gcc versio

regex - Remove part of string before last "/" -

i want remove before /query .. e.g i have no idea regular expressions doing difficult me note : reference should /query link mentioned below may have different patterns - www.abcd.wsd/asd/asdcd/asrr/query=xyz www.html.com/query=abcd should result query = abcd a generic regex solution extract query appearing after last / , followed characters other / is s <- c("www.abcd.wsd/asd/asdcd/asrr/query=xyz","www.html.com/query=abcd","www.cmpnt.com/query=fgh/noquery=dd") sub("^.*/(query[^/]*).*$", "\\1", s) ## => "query=xyz" "query=abcd" "query=fgh" see this r demo the regex is ^.*/(query[^/]*).*$ see regex demo details : ^ - start of string .* - match 0+ characters many possible last / - literal forward slash char (query[^/]*) - capture group 1 matching query substring followed 0+ characters other / (see [^/]* negated character class * quantifier) .* -

php - How can i get First table records on base of third table by using laravel 5 eloquent model -

requested tables listed below: **user table** id, name 1, vehicle person name 2, renter person name **vehicle table** id, user_id, vehicle_name 1, 1, car **booking table** id, renter_id, vehicle_id 1, 2, 1 user model public function renter() { return $this->hasmany(booking::class, 'renter_id'); } public function vehiclebook() { return $this->hasmanythrough(booking::class, vehicle::class); } booking model public function user() { return $this->belongsto(user::class, 'renter_id'); } vehicle model public function user() { return $this->belongsto(user::class); } my controller $renters = auth::user()->renter()->get(); $owners = auth::user()->vehiclebook()->get(); // in loop $renter->user->name; // renter person name $owner->user->name; // vehicle person name result on base of booking table want renter person , vehicle person name using laravel 5 orm. i have done using 2 calls wa

javascript - Calculating height of absolute positioned nested childs -

i've stuck @ problem .autoheightparent { width: 500px; /* example */ position: relative; } .absoluteposchild { /* absolute required make pretty drag , drop transitions interpolating left property */ position: absolute; display:flex; flex-direction: column; border: 1px solid green; } .absoluteposchild div { width: 100%; } <div class="autoheightparent" style="height:170px;"> <div class="absoluteposchild" style="left: 0px; width: 100px;"> <div> child content </div> </div> <div class="absoluteposchild" style="left: 100px; width: 150px;"> <div> child content nesting </div> <!-- !! nesting --> <div class="autoheightparent"> <div class="absoluteposchild" style="left: 0px; width: 50px;"> <div> don't know

garbage collection - Managed and Unmanaged resources in .Net -

i confused between managed , unmanaged resources in .net programming. developing vb.net application. read in microsoft website that, if use managed resources garbage collector dispose , if use unmanaged resources need call dispose. didn’t answer following questions anywhere. how can differentiate resources used code “managed” , “unmanaged”? can have list of resources belonging managed , unmanaged resources? whether resources used/allocated before creation of objects or after creation of objects? in case of unmanaged resources whether resources disposed once scope gets closed or should dispose after closing of scope? if class inherits idisposable unmanaged or contains unmanaged not sure mean, @ ctor, creation of object, cant before, consider ctor after? (o.c. unless stated otherwise) best practice inheriting idisposable anywhere use managed code, .net having gc unless somehow lock unmanaged res. should ok.

javascript - Set a full background color to the canvas in chartjs 2.0 -

basically question similar 1 asked here how set full length background color each bar in chartjs bar it has desired jsfiddle link http://jsfiddle.net/x73rhq2y/ but not work chartjs 2.* (i using chart.min.bundle.js v2.1.6) i trying extend bar chart display multiple stacked bar chart. along need separate out bar chart background. chart.defaults.groupablebar = chart.helpers.clone(chart.defaults.bar); var helpers = chart.helpers; chart.controllers.groupablebar = chart.controllers.bar.extend({ calculatebarx: function (index, datasetindex) { // position bars based on stack index var stackindex = this.getmeta().stackindex; return chart.controllers.bar.prototype.calculatebarx.apply(this, [index, stackindex]); }, hideotherstacks: function (datasetindex) { var meta = this.getmeta(); var stackindex = meta.stackindex; this.hiddens = []; (var = 0; < datasetindex; i++) { var dsmeta = this.chart.getdataset

c# - How to Open an database with the File.Open method -

i have form button , datagridview, know can open database oledb connection, problem may have search database (a ".mdb" file) on computer. is there way button open file.open (to search database) , show on datagridview ? you have connect database data providers, not open text file. thread might useful you: how connect ms access file (mdb) using c#?

javascript - Show picture while hovering over DropDownList items ASP.NET -

edit apparently can not thought of, found no solution problem. i learning asp.net, , associate picture every item asp:dropdownlist. using c# programming language, , asp.net webform. example of trying do: when user opens dropdownlist, , hovers through items, in sort of picturebox i'd show every item's associated image. imagine dropdownlist containing: dog ,cat ,lion. when user opens dropdownlist , hovers on these items, either dog or cat or lion shown next dropdownlist. i not wish use selectedindexchanged event of dropdownlist, because triggered after option selected. thank you! one more thing, know supposed use jquery or/ , css, please specific if have solution. you can this... in code-behind add items dropdownlist , loop through them add custom attribute imagename: dropdownlist1.items.insert(0, new listitem("dog", "dog", true)); dropdownlist1.items.insert(1, new listitem("cat", "cat", true)); dropdownli

MySQL CREATE TABLE 'You have an error in your SQL syntax' error -

this question has answer here: error creating table: have error in sql syntax near 'order( order_id int unsigned not null auto_increment, user_id ' @ line 1 [duplicate] 2 answers i pulling hair out on this. have connected mysql server , trying create table on it: create table order ( order_id int, order_is_overnight bit, order_quantity int, order_amount double, order_timestamp datetime ); when run get: error: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'order ( order_id int, order_is_overnight bit, order_quantity int, order_amou' @ line 1 sqlstate: 42000 errorcode: 1064 this world's vaguest error message, akin java exception says " whoops, went wrong somewhere in code! " any ideas i'm going awry?! have checked, , rechecked

Java, fill CSV File with integer casted to String -

i have integer value long exported , displayed correctly in csv file. the value diaplyed this: 1,13364e+12 instead of this: 08136677950770 i use bufferedwriter write file, , code looks this: writer.write(data[0].tostring()); writer.write(";"); i've tried this: writer.write("\'"+data[0].tostring()+"\'"); writer.write(";"); but displays this: '08136677950770' how can display value without quotes? 08136677950770 i recommend using biginteger , works string representation. to value use simple tostring() method. biginteger bi = new biginteger("1234567890"); string str = bi.tostring();

Use of spring security jstl tag <sec:authority access="hasPermission(#domain, 'permission')> inside a jstl core loop -

i'm using facelets (jsf2.1) , i'm trying like: <c:foreach var="domainobject" items="#{mb.listofdomainobjects}"> <sec:authorize access="haspermission(#domainobject,'permission_x')"> hello world </sec:authorize> </c:foreach> i've tried changing #domainobject @domainobject , #{domainobject} , $domainobject , lot of other combinations same result: domainobject not processed correctly. error saying page cannot constructed, others domainobject null. it's scope tag c:foreach puts variable domainobject not scanned sec:authorize find it. i've tried force use of scope using tag <c:set ... scope="view"/> . i've tried use <ui:repeat> same results, considering tag sec:authorize jstl one, suppose executed in build time (like c:foreach ) , not in render time (like ui:repeat ) , think must use c:foreach , not ui:repeat . any chance solve problem?

xamarin.ios - I want to add my own image to switch Control in ios using Xamarin forms -

i tried add own image switch control in xamarin forms using rendering concept unable override existing image.below code. in shared project added code this switch switcher = new extendedswitchnew(); and in ios [assembly: exportrenderer(typeof(extendedswitchnew),typeof(switchrenderernew))] namespace test.ios { public class switchrenderernew :switchrenderer { protected override void onelementchanged(elementchangedeventargs<switch> e) { base.onelementchanged(e); if (control != null) { uiimage imgon = uiimage.fromfile("images/switchon.png"); uiimage imgoff = uiimage.fromfile("images/switchoff.png"); control.onimage = imgon; control.offimage = imgoff; } } } } help me.thanks in advace.

c# - Unable to find private void generic function with GetMethod -

i have function following signature: private void foo<tpoco>(icontext context, list<tpoco> pocos, datetime modifieddatetime) tpoco : myabstractclass and cannot find function in getmethods(). based on post ( getmethod generic method ), have tried these binding flags: gettype().getmethods(bindingflags.public | bindingflags.nonpublic | bindingflags.instance | bindingflags.static | bindingflags.flattenhierarchy ) and finds 14 other methods in class, not one. does find method: protected void bar<tcontext, tpoco>(list<tpoco> pocostopersist, tcontext context) tcontext : icontext, new() tpoco : myabstractclass so difference access level - can see other private functions. even if change binding flags simpler (which, understand, shouldn't make new items visible): gettype().getmethods(bindingflags.nonpublic | bindingflags.instance ) i still don't see function. as comments on post point out, code sh