Posts

Showing posts from June, 2013

vb6 Like vs vb.net regex -

i need convert 1 vb6.0 project vb.net project. not familiar .net regular expressions. regular expression in vb.net equivalent vb "*_?#" vb6 'like' syntax : * = 0 or more characters _ = _ character ? = single character # = digit (0-9) .net regex equivalent: .* = 0 or more characters _ = _ character . = single character \d = single digit so regex string '.*_.\d' edit : replaced [0-9] \d

Regex: How can I capitalize the first letter that immediately follows a number EXCEPT for 1st, 2nd, 3rd, etc -

so i'm editing regex code mass mp3 rename tool , hoping there's code capitalize every letter follows number. instance, 2nite > 2nite , 221b > 221b keep 11th > 11th , 2nd > 2nd unchanged. you don't language you're using. here's you'd in perl s/(?<=\d)(?!(?:st|nd|rd|th)\b)([[:lower:]])/\u$1/g where (?<=\d) behind digit (?!(?:st|nd|rd|th)\b) ahead not "st" or "nd" or ... \b word boundary marker, 1st stays intact 1stop becomes 1stop ([[:lower:]]) lower case letter (captured) \u$1 in replacement side, upper case first letter of text in first capturing parentheses

python - How to search for string with beautiful soup -

i'm trying parse below url. output of prices on site. first item £59. i inspected element , found out html looks below. believe best way search class 'sr_gs_rackrate_total' or alternatively title starts "price for". how can in beautiful soup? <strong class="price scarcity_color sr_gs_rackrate_price anim_rack_rate " title="price 1 night £59"> <b> <span class="sr_gs_rackrate_total">total: </span> £59 </b> </strong> http://www.booking.com/searchresults.en-gb.html?label=gen173nr-17caeoggjcalhysdnibw5vcmvmafciaqgyas64aqtiaqtyaqhoaqh4aqs&sid=1a43e0952558ac0ad0061d5b6523a7bc&dcid=1&checkin_monthday=23;checkin_year_month=2016-1;checkout_monthday=24;checkout_year_month=2016-1;&city=-2601889&class_interval=1&csflt=%7b%7d&dtdisc=0&group_adults=7&group_children=0&highlighted_hotels=1192837&hlrd=0&hp_sbox=1&hyb_red=0&inac=0&label_click=un

java - Objects getting jerks when moving camera in downward direction -

i have been making game in there number of objects in negative 'y' had taken arraylist , moving main character in downward direction.but when camera move character objects not moving smooth, getting jerks after interval of time.the code following @override public void create() { camera = new orthographiccamera(480, 720); camera.position.set(480 / 2, 720 / 2, 0); batch = new spritebatch(); int i; this.baloonarrlist = new arraylist<baloon>(); (i = 0; < 3000; += 300) { baloon baloon = new baloon(200, i); baloonarrlist.add(baloon); system.out.println(baloon.balloon_y); } texture1 = new texture(gdx.files.internal("data/sheet_final.png")); textureregion1 = new textureregion(texture1, 561, 156, 115, 101); } @override public void render() { glcommon gl = gdx.gl; gdx.gl.glclearcolor(1, 1, 1, 1); gl.glclear(gl10.gl_color_buffer_bit); camera.position.y += 4; camera.update(); b

javascript - jQuery AJAX jsonp calling intervally cause memory leak -

i try intervally ajax calling using jquery ajax function using settimeout() in ajax complete callback, cause memory leak. i think everytime callajax called, ajax object in jquery created , there recursive reference, created object cannot free. what can avoiding memory leak? var count = 0; var ajax = $.ajax; function callajax() { ajax({ url: "http://192.168.137.1:8080/data.json", datatype: "jsonp", jsonpcallback: "abc", success: function(data) { document.getelementbyid('result').innerhtml = json.stringify(data, null, 4) + '<br>' + count; }, error: function(e) { console.error(e); }, complete: function() { count++; settimeout(callajax, 1000); // maybe cause memory leak } }); } thanks answer.

java - Cons of using setters during construction of classes? -

please note: i'm asking cons not whether or not pros out weigh cons of vice-versa not opinion based. i working though java tutorial , tutorial recommend not using setters during construction (even if setter logic make sense in construction of instance). wondering why bad idea. tutorial made rather vague mention inheritance issues latter on. also if setter validation take out validation separate function , able call function in constructor without having same issues using setter directly? the major point (which tutorial trying @ inheritance) when you're constructing object if you're calling methods if setters overridden in subclass can cause problems. overridden version call subclass code subclass may not initialized yet (since subclass initializers , constructor haven't run yet), initialization may fail or have unexpected consequences. if limit calling of instance methods during construction call final methods can avoid issue. there people put valida

matlab - Finding imperfect straight lines in an image -

Image
my task find out green shoots random bush 1 using color segmentation , blob analysis have obtained contour plot of image. find shoots contour plots used hough transforms end giving number of false positives. have tried tuning parameters of both hough lines , peaks either results in number of false positives or false negatives different images. here code snippet [h,theta,rho] = hough(bw,'theta',-90:1:89,'rhoresolution',1); p = houghpeaks(h,100,'threshold',ceil(0.3*max(h(:))),'nhoodsize',[21 21]); lines = houghlines(bw,theta,rho,p,'fillgap',15,'minlength',100); this output : can point me better way ? i had idea, it's long me throw comment. you identify , label connected components in contour plot image , check different components see if it's long , thin or more blob-like. there bunch of ways test that. first comes mind comparing connected component line runs diagonally across component's bounding rec

apache - How to visualize Apdex score on Kibana? -

i have elasticsearch+logstash+kibana stack running , visualize apdex score website. i writing python script gets response times apache logs , calculates apdex score , can't quite figure out how send data kibana or visualize on kibana. ideas appreciated. tells me wouldn't need script , should able simple querying, again can't wrap head around it. while parsing apache logs, can add appdex component per each document stored in elastic. can base score on whatever condition want implement apdex calculation. in kibana, display average of value in time-series graph server apdex graph.

Streaming OSX audio input channel to iOS -

i'm trying create app records audio input device on mac , streams iphone , plays it. i've messed around core audio few days , have managed record audio device , save file on mac. however, haven't found way encode audio stream , replay on ios. i know how handle network part of sending data phone i'm unsure how record format acceptable sending , playing buffer out on iphone. any hints on look, example code, or projects similar appreciated.

javascript - Troubles with offline messages using mqtt.js and Mosca -

i'm trying learn how send offline messages using mqtt.js , mosca based on author's demo , other instructions . below attempted, i'm not sure why listening client works online, not when subscription process includes offline configuration (qos, clientid, clean). 1.start standalone mosca broker using: npm install mosca bunyan -g mosca -v | bunyan 2.run following scripts (listed below) sequentially: node subscribe.js // user8 subscribes topic called channel-01 qos=1, closes connection node send.js // txuser sends message on channel-01 node listen.js // user8 reconnects , should see txuser's message 3.attempt identify why listen.js not receive txuser's message. here scripts: subscribe.js user8 subscribes topic called channel-01 qos=1 , closes connection. var mqtt = require('mqtt'); var client = mqtt.connect({ servers: [{ host: 'localhost', port: 1883 }] , clientid:"user8" , clean:false });

hadoop - Facing an error when using TotalOrderPartitioner MapReduce -

i have written below program. have run without using totalorderpartitioner , has run well. don't think there issues mapper or reducer class such. but when include code totalorderpartitioner i.e. write partition file , put in distributedcache, getting following error: clueless how go it. [train@sandbox totalorderpartitioner]$ hadoop jar totalorderpart.jar average.averagejob counties totpart //counties input directory , totpart output directory 16/01/18 04:14:00 info input.fileinputformat: total input paths process : 4 16/01/18 04:14:00 info partition.inputsampler: using 6 samples 16/01/18 04:14:00 info zlib.zlibfactory: loaded & initialized native-zlib library 16/01/18 04:14:00 info compress.codecpool: got brand-new compressor [.deflate] java.io.ioexception: wrong key class: org.apache.hadoop.io.longwritable not class org.apache.hadoop.io.text @ org.apache.hadoop.io.sequencefile$recordcompresswriter.append(sequencefile.java:1380) @

ios - How to use NOT IN with Realm Swift -

i have list of realm objects (let's user) , want retrieve of them "john", "marc", "al' med" , on. i tried following: var namesstr = "" user in unwantedusers { namesstr += "'" + user.name + "', " } namesstr = string(namesstr.characters.droplast().droplast()) let predicate = nspredicate(format: "not name in {%@}", namesstr) let remainingusers = uirealm.objects(user).filter(predicate) i tried nspredicate(format: "name not in {%@}", namesstr) crash (exception raised). and second thing , how suppose escape names in nspredicate. if 1 of names has ' character, won't work. edit thanks le sang, here's functional result: var userarr: [string] = [] user in unwanteduser { userarr.append(user.name) } let predicate = nspredicate(format: "not name in %@", userarr) let remainingusers = uirealm.objects(user).filter(predicate) according realm docume

problems acessing php files in wampserver -

i installed wampserver , thought did correctly not sure did. wampserver icon green , created project in phpmyadmin. when type in localhost in browser address bar, can see project listed on wampserver page listed under projects. created php file under c:/wamp/www/new document.php when try run test retrieve php file error: not found requested url /webapp/init.php not found on server. apache/2.4.9 (win64) php/5.5.12 server @ localhost port 80 can me access php file? i'm trying follow tutorial , can't beyond step. that's better not use spaces in file names. please try replace spaces in file names, underscores( _ ) . also according given error, have maybe used 1 of these php functions: include() include_once() require() require_once() fot init.php file, address not exist. please try check relative path file.

asp.net mvc - Kendo MVC Grid ClientTemplate will lead to "Field not defined" -

i have kendo mvc grid read action can done successfully @(html.kendo().grid<mymodel>() .name("name") .autobind(false) .columns(columns => { ... columns.bound(c => c.itemcode).clienttemplate("#= itemcode #").title("item").width(300); }) .pageable(page => { page.enabled(true); }) .scrollable(s => s.height(400)) .sortable(s => s.enabled(false)) .editable(ed => ed.mode(grideditmode.popup).templatename("materialformeditor").window(w => { w.title(""); w.width(700); }).displaydeleteconfirmation(false)) .datasource(datasource => datasource .ajax() .pagesize(20) .model(model => model.id(p => p.jobno)) .read(read => read.action(...) .serveroperation(true) ) ) public class mymodel { public string itemcode; } (above code simplified, clienttemplate content field value itself, yet problem stil

c# - What if the UI metadata is stored in Database? What scenarios I need to consider before designing this type of application? -

i working on .net application , storing our ui elements in database(ui interface metadata). can guide me scenarios need consider in terms of maintenance, performance, deployment, upgrades of application while designing? what trade offs in storing ui metadata in xml , ui metadata in database? i think define examples of metadata storing. some things think of when metadata ui: values of dropdowns. list of states example. dynamically created ui elements. can add textbox form via database. colors, fonts, alignments, etc. "a red button aligned left" each has pros , cons being in database. from experience, when putting ui information in database, application becomes hard reason about. you'll render ui , won't right. spend half day going through code , database trying figure out why. you'll flip few bits in database , render ui again , wonder why didn't work. also there ton of boilerplate code generated when storing information ui in data

activerecord - Not Equal to Comparison in Codeigniter Active records -

i quite confused error receiving code $this->db->order_by('uid','desc')->where('type!=',"admin")->get('user_profile',$config['per_page'], $this->uri->segment(3)); here error error number: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near ''admin' order `uid` desc limit 10' @ line 3 select * (`user_profile`) `type!=` 'admin' order `uid` desc limit 10 filename: c:\wamp\www\proposal\system\database\db_driver.php line number: 330 try query this. use single commas admin instead of double commas. , <> instead of != $this->db ->where('type <>','admin') ->order_by('uid','desc') ->get('user_profile',$config['per_page'], $this->uri->segment(3));

aar support in Android.mk.. the apk contain no R.java which packageName is aar -

i doing android custom rom development. app need aar , reference aar support in android.mk , edit android.mk use 'mm -b' build app successfully. but force close when run apk, packagename com.demo.android. caused by: java.lang.classnotfoundexception: didn't find class "com.demo.aar.r" "com.demo.aar" packagename aar/library. "com.demo.android" packagename app. i use aar on androidstudio 1.5, demo app run successfully. then compare apk between android-studio , android.mk. finally, find apk built android.mk has no 'com.demo.aar.r' class, apk built androidstudio has. (they both has 'com.demo.android.r' class.) so bug of android.mk , or need more config in android.mk?? the solution use: local_aapt_flags += --extra-packages {aar package name}. 2 r file. has content. one's package main package, other aar package.

css - Stopping a CSS3 Animation on last frame -

i have 4 part css3 animation playing on click - last part of animation meant take off screen. however, goes original state once has played. know how can stop on last css frame (100%) , or else how rid of whole div in once has played. @keyframes colorchange { 0% { transform: scale(1.0) rotate(0deg); } 50% { transform: rotate(340deg) translate(-300px,0px) } 100% { transform: scale(0.5) rotate(5deg) translate(1140px,-137px); } } you're looking for: animation-fill-mode: forwards; more info on mdn , browser support list on caniuse .

php - Laravel validation OR -

i have validation requires url or route there not both. $this->validate($request, [ 'name' => 'required|max:255', 'url' => 'required_without_all:route|url', 'route' => 'required_without_all:url|route', 'parent_items'=> 'sometimes|required|integer' ]); i have tried using required_without , required_without_all both past validation , not sure why. route rule in route field i think easiest way creation own validation rule. looks like. validator::extend('empty_if', function($attribute, $value, $parameters, illuminate\validation\validator $validator) { $fields = $validator->getdata(); //data passed validator foreach($parameters $param) { $excludevalue = array_get($fields, $param, false); if($excludevalue) { //if exclude value present validation not passed return false; } } r

visual studio 2010 - Getting Error.. Could Not Load File or Assembly 'System.Drawing,Version 4.0.0.0, Culture=natural...' error while converting from .net 4.0 to .net 3.5 -

i new windows desktop application development. i have created application using visual - studio 2010 in have used 1 form data entry. 1 form report viewer control , report(.rdlc) file report drawn. my problem want make application compatible dot net framework 3.5. that, have changed target framework 3.5 'advanced compile options...' project properties. getting error when run application after changing target framework 3.5 : could not load file or assembly 'system.drawing, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' or 1 of dependencies. system cannot find file specified. line 123, position 5. c:\users\amir\desktop\bill_system\bill_system\bill_system\my project\resources.resx billing_system how tackle error? please help. in advance. it ratty problem resources, can tell exception message, take dependency on framework version. not changed changing target version of project. open resources.resx file in text editor, notepad

.net - Execute powershell scripts through nuget command line -

i made native package includes native dlls. package sqlservercompact.4.0.8852.1.nupkg . when install package through gui 'manage nuget packages ...', fine , native dll copied debug/release folder. copying native dlls done script similar in sqlsercompact. and have following .bat file automate packaging procedure of myproject : ..\..\tools\nuget\bin\nuget.exe install myproject\packages.config -o packages\ ..\..\tools\nuget\bin\nuget.exe install myprojecttest\packages.config -o packages\ ..\..\tools\nuget\bin\nuget update myproject.sln msbuild /m /p:configuration=release /p:platform="x64" myproject.sln ..\..\tools\nuget\bin\nuget pack myproject.nuspec the above script runs myproject.nupkg (compiling needs .net dlls). nuget install not execute copy script in dependency packages -- compiling myprojecttest fine, when executing exe there no native dll in debug/release folder. my question why powershell script not executed when installing packages command li

How to change the group of the tasks added by third party plugins in Gradle? -

i added few plugins pmd, checkstyle , findbugs in gradle project. come under group others. is possible create separate groups them? e.g. pmd group tasks defined in pmd plugin etc. it possible configure task's group property. done so: tasks.withtype(pmd).each {task -> configure(task) { group = "pmd" }} this snippet should added script's root. gets tasks pmd type , set them new pmd group.

ios - RestKit how to map an array inside an array -

here's response: { "status": true, "statuscode": 200, "result": [ { "name": "abc", "date": "2015-01-30", "documents": [ { "id": 1, "name": "doc1", "status": "complete", }, { "id": 2, "name": "doc2", "status": "complete", }, { "id": 3, "name": "doc3", "status": "complete", } ], "message": "hello world", "status": 3 } ] } i want map , "document" inside array keyed "result" , don't need other objects / mappings. need documents. how can done / declared in response descriptors automatically match these documents m

actionscript 3 - Flash restart functions after completion -

i have made code works fine - problem @ end wish make start over. when started making intent was, .swf movie loop when ended - not happen. figured try , make sort of "restart" function in code reset timer , strings.. have googled around , tried couple of things myself - no luck @ all.. first tried reset variable i. tried remove timer eventlisteners. no succes. what best way go getting code start on again? import flash.utils.timer; import flash.events.timerevent; import com.greensock.*; import com.greensock.easing.*; var str_one:string = 'på fredag udkommer metroxpress, som du kender den, sidste gang... '; var i:uint = 0; var timer_one:timer = new timer(50); timer_one.start(); timer_one.addeventlistener(timerevent.timer, gotime); var str_two:string = 'på fredag udkommer metroxpress, som du kender den, sidste gang... fra 2. april bliver du mødt af en helt ny avis, med det bedste fra den gamle, tilsat en masse nyt.'; var timer_two:timer = new time

.net - unable to send Byte[] from webform client project to web api service project using c#.working fine with webservice -

i have c# webform clientproject , web api service project. i'm sending 1 file c# webform clientproject web api service project using byte[] @ web api service project i'm getting null byte[] same code working fine webservice code-is-here winform c# project code private void button1_click(object sender, system.eventargs e) { filestream objfilestream = new filestream("c:\\mytext.dll",filemode.open,fileaccess.read); int len = (int)objfilestream.length; byte[] mybytearray = new byte[len]; objfilestream.read(mybytearray,0,len); // call service using rest sharp var restclient = new restclient("http://localhost:51737/"); restsharp.restrequest restrequest = new restrequest("api/values", method.get); restrequest.addparameter("docbinaryarray", mybytearray); restrequest.addparameter("docname", sfile.remove(0, sfile.lastindexof("\\"

php - How do I simulate the default Bucket for local app engine launcher on localhost? -

on gae cloud platform can use through file_put_contents('gs://#default#/hello.txt', 'hello'); or return bucket name cloudstoragetools::getdefaultgooglestoragebucketname() how simulate cloud storage bucket in localhost app launcher? the development server automatically simulate cloud storage using local file system. buckets don't need created first done automatically first time write them. difference on local development server cloudstoragetools::getdefaultgooglestoragebucketname() return string 'app_default_bucket' while in production default bucket name 'your-app-id.appspot.com', practical purposes makes no difference. the following code work same way on both dev , prod: // default bucket name $defaultbucket = cloudstoragetools::getdefaultgooglestoragebucketname(); // write default bucket file_put_contents('gs://' . $defaultbucket . '/some_file.txt', 'hello world'); // read file echo file_get_conte

c# - Overload is the only way to add different parameter to the same function? -

i have 2 functions same exact operation; since underlying api has overloaded fuction accept either string or int. since using function, need call function either string or int. overloading way so? replicate code, beside signature of function; , seems waste of code. public void taketwo(int value1, int value2) { // other operations happen here baseapi.getvalues(value1, value2); } public void taketwo(string val1_str, string val2_str) { // other operations happen here baseapi.getvalues(val1_str, val2_str); } i recall generic function; not sure if apply in case; never used them in past, , before dive in, thought worth ask around first. you could use dynamic typing here: // don't recommend - see later public void taketwo(dynamic value1, dynamic value2) { baseapi.getvalues(value1, value2); } the overload resolution call getvalues performed @ execution time. however: there's no compile-time checking call taketwo valid it less efficie

sql server - Are dates consecutive -

i have simple table representing customer number , when made purchase. need know when given customer has made purchase on consecutive dates , dates were. number of consecutive dates irrelevant. so in example +----------+--------+ | customer | date | +----------+--------+ | 123 | 21-jan | | 123 | 24-jan | | 345 | 21-jan | | 345 | 23-jan | | 345 | 24-jan | | 123 | 26-jan | | 123 | 27-jan | +----------+--------+ i need return following: +----------+--------+ | customer | date | +----------+--------+ | 123 | 26-jan | | 123 | 27-jan | | 345 | 23-jan | | 345 | 24-jan | +----------+--------+ this modified gaps , islands problem. 1 solution use row_number : with cte as( select *, grp = dateadd(day, -row_number() over(partition customer order date), date) tbl ), ctefinal as( select *, cnt = count(customer) over(partition customer, grp) cte ) select customer, date ctefinal cnt

How to fix java warning for "The value of the local variable is not used " -

how avoid java warning says the value of local variable not used for variable declared private ? you have multiple choices: remove field. unused, shouldn't there. comment out field, e.g. using // todo temporary hiding of warning until write code using field. suppress warning using @suppresswarnings("unused") . disable warning in ide settings. eclipse, in window > preferences java > compiler > error/warnings unnecessary code > unused private member select option ignore for #3 , #4, though, although can, why want to?

How to manually import RandomColorSwift github project to XCode project? -

i trying manually import randomcolorswift github file xcode project, confused directions below: manually if need support ios 7.x, need add library manually project since dynamic framework not supported ios 7. clone repo , throw source files under randomcolor folder project use it. what mean "add library manually" , "clone repo"? want me download zip file? is "source files" randomcolor folder contains colordefinition.swift, hue.swift, etc?

javascript - loading in variable states with ui-router in angular -

i have scenario 1 of 2 default states (let's call them foo , bar ) displayed after login, depending on user's permissions. have function runs on $statechangestart uses user's permissions redirect them correct screen. foo permissions -> mybrokenapp.com/foo/dashboard bar permissions -> mybrokenapp.com/bar/dashboard this works when user enters via login page. if user signed in (cookie set) , visits root url ( mybrokenapp.com ) redirection doesn't work more. i have debugged point i'm 99% error caused currentrole not being set when $statechangestart runs. the routing code: $stateprovider .state('app', { templateurl: '/path/app.html', url : '', resolve: { authenticated: ['authservice', function(authservice){ return authservice.authenticationstatus(true); }] }

build - How do I specify a custom directory layout for an sbt project? -

how specify custom directory layout sbt -based project? i've been looking @ online sbt material, i'm struggling find information... what did find in documentation default locations: sources in base directory sources in src/main/scala , src/main/java tests in src/test/scala , src/test/java data files in src/main/resources , src/test/resources unmanaged jar-files in lib/ how override these in build.sbt file? my project structure follows: source in: [workspace]/sandbox-scala/src/sbt/myfirst/ libraries in: [workspace]/java-lib/common/lib/ any appreciated. one can override number of sbt's default directory locations. here's example overrides directory sbt expects find "unmanaged" dependencies/jar files: unmanagedbase := basedirectory.value / "custom-jars-directory" (more examples related depndencies in the sbt documentation .) you can configure directories specific particular "task"... e.g., set dire

jasper reports - Change Data Adapter password for MS SQL server database in Jaspersoft studio -

i have created project in jaspersoft studio sometime before. recently, have changed ms sql server login password. onwards; when i'm trying create dataset, getting below error: com.microsoft.sqlserver.jdbc.sqlserverexception: login failed user 'sa'. i searched in google, not relevant , proper url suggest on how do. can please me on this! found solution. navigate repository explorer go required data adapter password needs change change password there. done.

php - Getting Session error on live site -

this question has answer here: how fix “headers sent” error in php 11 answers i have started session in config.php file & have included file on every page on site, site works fine in localhost, but when have done live it,it shows error this, warning: session_start() [function.session-start]: cannot send session cache limiter - headers sent any suggestions... thanks, check don't send content before calling session_start. make session_start first thing in php file. <?php session_start(); ?>

regex - python re.search matches too much -

this question has answer here: my regular expression matches much. how can tell match smallest possible pattern? 4 answers import re text = '"dimensionsdisplay" : ["size","color"], ' r = '"dimensionsdisplay" :(.*)?,' s = re.search(r,text) print s.group(1) the output : ' ["size","color"]' although answer want , think it's should be: ' ["size",' i puzzled this. there tell why ? r = '"dimensionsdisplay" :(.*?),' you need make quantifier non greedy . ? after (.*) makes optional.but consume till last , greedy

javascript - OnClick is not working when i do OnClientClick="function(); return false" -

i have 5 asp:buttons want change css class on when click them "marked". javascript , works fine. want store variable in code behind onclick. my problem is, when click asp:button refresh page. solved ;return false after onclientclick. when have return false, buttons onclick doesnt fire. need getting these both things work @ same time: page not refreshing when pressing asp:button, same time as onclick needs fire also. html <asp:button id="button1" runat="server" text="1" onclick="button1_click" onclientclick="change_select(this); return false;" cssclass="button black"/> javascript function change_select(objs) { $('.darkgray').removeclass('darkgray').addclass('black'); objs.classname = "button darkgray"; } code behind int[] answerarray = new int[28]; int answer = 0; int currentq = 0; protected void button1_click(object sender, eventar

list - Filtering random-outcomes from maplist/3 result -

i wish filter out list list=['f1',a1,a2,' lf2',a1,a2] predicate is_upper/2 , maplist/3 below is_upper(elem,res) : if elem uppercase atom, assigned res i'd put uppercase atom list list_upper i try ; ?- maplist(is_upper,list,list_upper). list_upper = ['f1',_a,_b,'f2',_c,_d,'f3',_e,_f] ? ; how can filter outs-random _a,_b... expcted result : list_upper = ['f1','f2','f3'] regards include/3 collects elements of true resulte , exclude/3 falses | ?- include(is_lower,['functor1','arg1','arg2','functor2','arg3','arg4','functor3','arg5','arg6'],list_lower). list_lower = [arg1,arg2,arg3,arg4,arg5,arg6] ? ; no

python - sqlalchemy truncated labels -

i trying pass dictionary returned sql-alchemy query twisted perspective broker, following error: unpersistable('unpersistable data: instance of class sqlalchemy.sql.elements._truncated_label deemed insecure') and while investigating found out query returns following: <class 'sqlalchemy.sql.elements._truncated_label'> labels can explains me how avoid ? here 1 of table declarations: module_tbl = table( "module", metadata(), column("id", integer(), primary_key=true), column("name", string()), column("description", string()), column("context", integer()), column("scope", integer()), column("send_body", boolean()), column("direction", integer()), column("level", integer()), column("incoming_order", integer()), column("outgoing_order", integer()), column("created_at", datetime()),

forms - innerHTML not working inside event handler function (Javascript) -

i have created function, updateprice, have tied "click" event on checkbox , radio buttons in html form. each checkbox , radio represents item, it's price value property of these <input> elements. when check or uncheck box, function fires, loops through elements in form, , updates total price of checked items div element have below form, id tag "priceoutput". the following code works perfectly, printing out: price of item $(price of item). function updateprice() { var price = 0 (i=0;i<=form.length;i++) { var element = form[i] if(element.checked) { price+=parseint(element.value) } document.getelementbyid("priceoutput").innerhtml = "the price of item $" + price + "." } } but, if switch the last line around, line not printed @ all: function updateprice() { var price = 0 (i=0;i<=form.length;i++) { var element = form[i] if(element.checked) { price+=parseint(element.val

java - Spring JavaConfig properties in bean is not getting set? -

i looking @ using spring javaconfig property files properties in bean not getting set?in bean not getting set? here webconfig: @configuration @enablewebmvc @propertysource(value = "classpath:application.properties") @import(databaseconfig.class) @importresource("/web-inf/applicationcontext.xml") public class webmvcconfig extends webmvcconfigureradapter { private static final string message_source = "/web-inf/classes/messages"; private static final logger logger = loggerfactory.getlogger(webmvcconfig.class); @value("${rt.setpassword}") private string rtpassword; @value("${rt.seturl}") private string rturl; @value("${rt.setuser}") private string rtuser; @bean public viewresolver resolver() { urlbasedviewresolver url = new urlbasedviewresolver(); url.setprefix("/web-inf/view/"); url.setviewclass(jstlview.class); url.setsuffix("

oauth - Oauth2 authentication failed -

i'm trying use spring oauth2sso in application (client) oauth2 provider have installed. client configured in oauth2 provider , clientid, clientsecret, accesstokenuri , userauthorizationuri configured in client, when user authenticated , authorize client , after redirection, client show me error of authentication failed because springoauth2sso library not user details. whitelabel error page application has no explicit mapping /error, seeing fallback. thu jan 21 10:28:28 cet 2016 there unexpected error (type=unauthorized, status=401). authentication failed: not obtain user details token i tested provider other oauth2 libraries , pretty i'm not sure happened in case. this error can have lot of different meaning wrapper invalidtokenexception . your token can invalid, expired or there might problem client or problem when retrieving userdetails. to more info problem recommend debugging , placing debugging point straight source of error oauth2clientauthe

bash - Git: merge hides certain changes -

Image
we work through visual studio 2015 git. have had central repository (gitlab) single branch 'master'. 2 people have cloned repository. first guy have added "test-new-file-v.txt" file in solution. have changed solution file (.sln) , have changed string "visualstudioversion = 14.0.23107.0". commit in local repository , push commit in central repository (gitlab). after that, have watched commit in central repository (gitlab): second guy have added "testgit.txt" file in solution. have changed solution file (.sln) too, didn`t change string visualstudioversion. want pull central repository (gitlab) before push. second guy has had conflict. merge through visual studio 2015 , see different guy have made mistake in changing "visualstudioversion = 14.0.24720.0" on "visualstudioversion = 14.0.23107.0". second guy want leave string "visualstudioversion = 14.0.24720.0" unchanged. chose local state "visualstudioversion

openxml - Creating Pivot Table in Excel using Open XML and C# -

i used store data datatable , wants create pivot table using data. i have gone through many posts , read microsoft's documentation on creating pivot table through open xml couldn't solution. can please post code create pivot table. thanks in advance. install open xml sdk , contains tool called open xml sdk productivity tool. how use it: open excel , create file containing pivot table. save , open productivity tool. in tool option 'reflect code', way can see how create same excel using c# code.

clojure - Is there a good way to check return types when refactoring? -

currently when i'm refactoring in clojure tend use pattern: (defn my-func [arg1 arg2] (assert (= demo.core.record1 (class arg1) "incorrect class arg1: " (class arg1)) (assert (= demo.core.record1 (class arg2) "incorrect class arg2: " (class arg2)) ... that is, find myself manually checking return types in case downstream part of system modifies them don't expect. (as in, if refactor , stack-trace don't expect, express assumptions invariants, , step forward there). in 1 sense, kind of invariant checking bertrand meyer anticipated. (author of object oriented software construction , , proponent of idea of design contract ). the challenge don't find these out until run-time. nice find these out @ compile-time - stating function expects. now i know clojure dynamic language. (whilst clojure has 'compiler' of sorts, should expect application of values function come realisation @ run-time.) i want pattern make refactoring eas

node.js - Do you need Node installed in your hosting environment for React projects -

i building react apps , starting think process of hosting. media temple, apache based hosting, , on (gs) grid server plan, can tell doesn't support installing node. i wondered, react apps need node on server? if do, alternatives hosting options be? many :) if you're doing universal rendering, you'll need node server support this. but if it's static one-page application, not install node on hosting environment. using webpack example, can create single js bundle of vendors , sources files, css one, , index.html, leaving 3 static files.

git - What is the correct file permissions for .gitignore -

Image
i'm work on new project , .gitignore file accessible web bit of security leak. the .gitignore files permissions 644 i.e. -rw-r--r-- . project on bitbucket.org, perhaps requires file accessible web? i set .git once before project below permisions drwxr-xr-x 8 www-data www-data 4096 jan 13 09:58 .git -r-------- 1 www-data www-data 622 dec 17 10:52 .gitignore so i'm wondering correct permission should on these? in research i've come across info on setting git config's filemode & permissions on hooks. so i'm wondering correct permission should on these since file configuration file tell git ignore files locally on repository, can set permissions to. .gitignore published in source code if wish "ignore" files in repo without adding them .gitignore if afraid publish data on web, can use flag: you can try , use assume-unchanged flag https://git-scm.com/docs/git-update-index --[no-]assume-unchanged when flag

javascript - How to do autocomplete dropdown as a grid in angularJS? -

Image
here created sample autocomplete, working fine , need modification on this.currently works this but need need show dropdown grid view. can 1 on this?.. thanks var app = angular.module('app', ['ui.bootstrap']); app.controller('typeaheadctrl', function ($scope, $http, limittofilter, filterfilter) { $scope.sample_data = [{ "name": "nelson", "designation":"senior developer", "company": "acme", "companydisplay": "abc" }, { "name": "suresh", "designation":"developer", "company": "acme", "companydisplay": "def" }, { "name": "naresh", "designation":"developer", "company": "acme", &q