Posts

Showing posts from March, 2010

javascript - How to inherit and add events in child in backbone.js -

i have tried this solustion couldn't working. situation there parent doesn't have event defined. can not make change in parent. can make changes in child modules need have 2 child modules both adding different event both independent of each other. means if install 1 of child modules event should work, if both installed both events should work. but doesn't seem work parent module.paymentscreenwidget = module.screenwidget.extend({ //it has no event defined code here.... https://github.com/odoo/odoo/blob/8.0/addons/point_of_sale/static/src/js/screens.js#l997 }); module 1 function pos_discount_cards_widgets(instance, module){ //module instance.point_of_sale var qweb = instance.web.qweb; var _t = instance.web._t; module.paymentscreenwidgetdsicount = module.paymentscreenwidget.extend({ events: function(){ return _.extend({},module.paymentscreenwidget.prototype.events,{ "change .discount-card-select": "selectcard"...

java - Adding items to ListView in JavaFx... threading? -

i'm trying add string listview in javafx whilst processing, keeps freezing gui. i've tried following threading - can't seem work listview. know how/have example of how can update listview in javafx whilst processing data? new thread(new runnable() { @override public void run() { (int i=1; i<=1000000; i++) { final int counter = i; platform.runlater(new runnable() { @override public void run() { recentlist.getitems().add(integer.tostring(counter)); } }); } }}).start(); using platform.runlater() correct way go. could, also, store string result integer.tostring(counter) in background thread (not ui one). way, should use string.valueof (there thread on stackoverflow talks it). i assume ui freezing because of execution speed of (very simple) loop. you should have @ concurrency in javafx

java - How to configure authentication for access of repository in pom.xml? -

when building project dependencies maven, tried download https://sweb.science.unitn.it/archiva/repository/internal/it/unitn/disi/sweb/sweb-utils/2.3-final/sweb-utils-2.3-final.pom . , access denied server. although have authentication access repository, don't know how configure pom.xml. in below put errors. in advance. [info] scanning projects... [warning] [warning] problems encountered while building effective model it.unitn.disi.sweb.ukc:ukc-dataimport-wordnet:jar:1.0-snapshot [warning] expression ${version} deprecated. please use ${project.version} instead. [warning] [warning] highly recommended fix these problems because threaten stability of build. [warning] [warning] reason, future maven versions might no longer support building such malformed projects. [warning] [info] [info] using builder org.apache.maven.lifecycle.internal.builder.singlethreaded.singlethreadedbuilder thread count of 1 [info] ...

directx - D3DX11CompileFromFile Invalid Arguments C++ -

i'm overlooking simple, compilation of shader compilation call claiming there no instance of overloaded function, despite code working in other projects. //globals idxgiswapchain *swapchain; //pointer swapchain interface id3d11device *dev; //pointer direct3d device interface id3d11devicecontext *devcon; //pointer direct3d device context id3d11rendertargetview *backbuffer; //shaders id3d11vertexshader* pvs; id3d11pixelshader* pps; void initpipeline() { //load , compile shaders id3d10blob *vs; id3d10blob *ps; d3dx11compilefromfile(l"shader.shader", 0, 0, "vshader", "vs_4_0", 0, 0, 0, &vs, 0, 0); d3dx11compilefromfile(l"shader.shader", 0, 0, "pshader", "ps_4_0", 0, 0, 0, &ps, 0, 0); //encapsulate shaders shader objects dev->createvertexshader(vs->getbufferpointer(), vs->getbuffersize(), null, &pvs); dev->createpixelshader(ps->getbufferpointer(), ps->getb...

excel - Getting rid of both #N/A and 0 values in a single cell -

i know function =if(len(vlookup(e1,a2:b10,2,0))=0,"",vlookup(e1,a2:b10,2,0)) blank out cells return vlookup values of 0 and function =iferror(vlookup(e1,a2:b10,2,false),"") same thing #n/a errors, there way in single formula? the data i'm using returning both 0 , #n/a because have account numbers missing account numbers have no information in return column. sorry not posting screen shot reputation not high enough yet i think once-through method it, no need "pretest" answer, use when lookup returns text answers. =vlookup(e1,a2:b10,2,0)&"" =iferror(vlookup(e1,a2:b10,2,0)&"", "") if values numeric, original syntax fine, here merged one: =iferror(if(len(vlookup(e1,a2:b10,2,0))=0, "", vlookup(e1,a2:b10,2,0)), "")

Spring-boot @Value binding Issue -

facing weird issue spring-boot property-resolver. trying simple @value 1 of properties. in debug log, see property being matched,, reporting unable find few lines later. idea on what's going wrong? java code: @configuration public class testappconfig{ @value("${appname}") private string applicationname; } log below 10 jun 2015 18:41:42 org.springframework.core.env.propertysourcespropertyresolver debug {searching key 'appname' in [applicationconfig: [classpath:/config/application-dev.yml]]} 10 jun 2015 18:41:42 org.springframework.core.env.propertysourcespropertyresolver debug {searching key 'appname' in [applicationconfig: [classpath:/config/application.yml]]} 10 jun 2015 18:41:42 org.springframework.core.env.propertysourcespropertyresolver debug {found key 'appname' in [applicationconfig: [classpath:/config/application.yml]] type [string] , value 'testapp'} caused by: java.lang.illegalargumentexception: not resolve ...

php - How to Saveing page views in database -

i have page show 50 images user , user can click on image , load image in page. want save every image view database i.e. counter clicked imageid. i've made far add row table called hits . here show images: $result = $pdo->prepare("select * images order id asc limit $start_from, 50"); $result->execute(); for($i=0; $row = $result->fetch(); $i++) { echo ' <h1><a href="post.php?id='.$row['id'].'">'.$row['title'].'</a></h1> <img src="../upload/'.$row['name'].'" alt=""/>'; } in post.php user see image clicked on have this: if(isset($_get['id']) && is_numeric($_get['id'])) { $id = $_get['id']; $result = $pdo->prepare("select * images id= ?"); if ($result->execute(array($_get['id']))) { ...

sql - How to split a table in 4 groups? -

i have table 2 columns. seq column goes 1 100. part_no seq a23 1 b88 2 c34 3 a43 4 b48 5 e11 6 a87 7 e64 8 ...till seq 100 i want split table below: part_no_a part no_b part_no_c part_no_d a23 b88 c34 a43 b48 e11 a87 e64 i use conditional aggregation modulo function: select max(case when seq % 4 = 1 part_no end) part_no_a, max(case when seq % 4 = 2 part_no end) part_no_b, max(case when seq % 4 = 3 part_no end) part_no_c, max(case when seq % 4 = 0 part_no end) part_no_d databasetable t group ((seq - 1) / 4);

firefox - Why does the expiration date of the request cache lie in the past? -

Image
i working on caching pages , noticed in firebug: so says cache expired 45 years ago. bug or bad data? i have page caching correctly i not understand why saying expires ... 1970 . page won't cache @ on site, though i'm using boost module drupal. if expires header set 0 , browser interprets 1 january 1970, relates unix time aka posix time . because date lies in past, means request not cached. the expires header defined within rfc 7234 , includes paragraph related statement above: a cache recipient must interpret invalid date formats, value "0", representing time in past (i.e., "already expired").

javascript - ExtJS 5: How do I throw an error for repeating rows? -

i'm new extjs , js. hoping tell me if there way check repeated rows of same name when entering string textfield. there similar "allowblank: false" used check if string exists in row? or need validation through series of loops? please tell me if unclear in question. (also first stack overflow post, please let me know if there should have done differently formatting/tagging)

linux - ffmpeg to extract a video one frame per second? -

currently using command line extract pictures video. ffmpeg -i ../m.mp4 -f image2 m.mp4-%04d.bmp this results many frames. i extract pictures video, 1 frame per second of video. preferably multithreading. use -r 1 output option: ffmpeg -i input.mp4 -r 1 %04d.bmp results in 0001.bmp , 0002.bmp , 0003.bmp , etc. the bmp encoder has no threading capabilities shown ffmpeg -h encoder=bmp .

asp.net - RadioButtonList value is null -

i building website multiple choices. page contains 2 radiobuttonlists generate when page loaded. however, when choose item, , click button, selecteditem has null values. code: public partial class webform1 : system.web.ui.page { multiplechoicedbcontext db = new multiplechoicedbcontext(); list<string> questionlist = new list<string>(); list<radiobuttonlist> optionlist = new list<radiobuttonlist>(); list<string> answerlist = new list<string>(); protected void page_load(object sender, eventargs e) { if (!ispostback) { var query = data in db.qas select data; qa question; int = 1; listitem lia; listitem lib; listitem lic; listitem lid; while (i < 3) { question = query.tolist()[(new random()).next(query.tolist().count)]; questionlist.add(question...

github page blog from jekyll needs force reload to show changes with posts -

i'm learning jekyll github pages. when create new post (whatever how - locally , commit github or online via github page) need force reload (ctrl+r) page see changes. normal? my repository url here as github pages content has http response headers cache-control:max-age=600 , expires:wed, 10 jun 2015 16:30:25 gmt (a date ten minutes latter), way avoid page caching setup browser not cache. if read this answer http-equiv meta (read html meta tags vs http response headers paragraph ), understand that, in case, http-equiv meta useless . and cache has nothing jekyll github pages servers setup. 10 minutes cache on personal blog not big. regular user not need refresh every 30 seconds. and developer not supposed develop on production server, on development one, can setup server.

linux - How can I install MONO on Centos 5, without compiling from source -

i install reasonably recent version of mono on centos 5 system. ideally prefer not have build source. i set mono.repo file in yum.repos.d : [mono] name=mono stack (rhel_5) type=rpm-md baseurl=http://download.mono-project.com/repo/centos/ gpgcheck=1 gpgkey=http://download.mono-project.com/repo/centos/repodata/repomd.xml.asc enabled=1 when tried use repo, got error performing checksum . however, found this link . told me install python-hashlib , fixed problem. then ran install command: yum install monodevelop loaded plugins: fastestmirror loading mirror speeds cached hostfile * base: mirror.ubiquityservers.com * epel: mirror.steadfast.net * extras: cosmos.cites.illinois.edu * updates: mirror.tzulo.com setting install process resolving dependencies --> running transaction check ---> package monodevelop.noarch 0:5.9.0.431-2 set updated --> processing dependency: mono-devel package: monodevelop --> processing dependency: xsp package: monodevelop --> process...

mongodb - Updating an element in an array after limiting the fields to the client -

let's have player collection , when in context of game , limits games array include game. meteor.publish('gameplayer', function (playerid, gameid) { check(playerid, string); check(gameid, string); if (roles.userisinrole(this.userid, roles.getallroles().fetch(), gameid)) { return players.find({ _id: playerid, games: { $elemmatch: { id: gameid } } }, { fields: { "games.$": 1 } }); } }); now structure expecting on client. // server > players.findone({ _id: "123456" }); { _id: "123456", battletag: "corvid#1234", games: [{ id: "5678", name: "starcraft ii", class: "zerg", ladder: 23 }, { id: "1234", name: "world of warcraft", class: "shaman", ladder: 123 }] } // client > var params = router.current().params; > meteor.subscribe('gam...

ios - performSegueWithIdentifier method is very slow for modal segue -

i have show registration view controller. screen loaded uiwindow.rootviewcontroller method,which don't solution. after google search found this question, doesn't me @ (problem stays), have ask, there other solutions.my code follows: -(void)viewdidappear:(bool)animated { [super viewdidappear:animated]; if(![class isuserregistered]){ [self performseguewithidentifier:@"" sender:self]; } } registration controller shows after 5-7 seconds (iphone 4, 7.1.2) one possible option use adaptive segue-s, not possible @ moment. i notice, when remove outlets storyboar, view loading faster. any thoughts? try this, dispatch_async(dispatch_get_main_queue(), ^{ //this block of code executed on main thread, ui operations should done on main thread [self performseguewithidentifier:@"" sender:self]; });

What is the explanation for these bizarre JavaScript behaviours mentioned in the 'Wat' talk for CodeMash 2012? -

the 'wat' talk codemash 2012 points out few bizarre quirks ruby , javascript. i have made jsfiddle of results @ http://jsfiddle.net/fe479/9/ . the behaviours specific javascript (as don't know ruby) listed below. i found in jsfiddle of results didn't correspond in video, , not sure why. am, however, curious know how javascript handling working behind scenes in each case. empty array + empty array [] + [] result: <empty string> i quite curious + operator when used arrays in javascript. matches video's result. empty array + object [] + {} result: [object] this matches video's result. what's going on here? why object. + operator do? object + empty array {} + [] result [object] this doesn't match video. video suggests result 0, whereas [object]. object + object {} + {} result: [object][object] this doesn't match video either, , how outputting variable result in 2 objects? maybe jsfiddle wrong. array(16).join("wat...

eloqua - elq is not defined error in javascript -

i trying run following javascript function. while running below script, firebug spots error. below error message, referenceerror: elq not defined elq.dynamic(-57770, 5000, 'replace-me'); code: <div id="replace-me"> </div> <script type="text/javascript"> var _elqq = _elqq || []; _elqq.push(['elqsetsiteid', '5000']); _elqq.push(['elqtrackpageview']); (function () { function async_load() { var s = document.createelement('script'); s.type = 'text/javascript'; s.async = true; s.src = '//img.en25.com/i/elqcfg.min.js'; var x = document.getelementsbytagname('script')[0]; x.parentnode.insertbefore(s, x); } if (window.addeventlistener) window.addeventlistener('domcontentloaded', async_load, false); else if (window.attachevent) window.attachevent('onload', async_load); })(); </script> <script type="tex...

ios - Iphone App locks up at splash screen when i perform build -

i have migrated iphone app 64 bit platform using xcode app builds , able create archive , , passes itunes validation progress !!! however when connect iphone build , test app app opens , loads splash screen , locks up i appreciate assistance in interpreting error code below , advise on need remedy same. relatively new app development references in error message below mean nothing me the error message shown in xcode follows: *** terminating app due uncaught exception 'nsunknownkeyexception', reason: '[<uiapplication 0x15d56930> setvalue:forundefinedkey:]: class not key value coding-compliant key view.' *** first throw call stack: (0x2a46e49f 0x37c24c8b 0x2a46e1a9 0x2b0d4f59 0x2b0e71af 0x2a3be81d 0x2dcee421 0x2dcefd2d 0x2db934eb 0x2db92889 0x2db9d209 0x2db91217 0x30bff0d1 0x2a434d7d 0x2a434041 0x2a4327c3 0x2a3803c1 0x2a3801d3 0x2d9951bf 0x2d98ffa1 0xe86f3 0x381a4aaf) libc++abi.dylib: terminating uncaught exception of type nsexception (lldb)

Can't set microphone mute - Android -

i'm trying mute microphone in android application audiomanager = (audiomanager)getsystemservice(context.audio_service); audiomanager.setmicrophonemute(true); i added permission in manifest <uses-permission android:name="android.permission.modify_audio_settings" /> however, when speak application, logs return me said means microphone not muted. even logs tell me mic should muted. : log.d("muted ? : ", string.valueof(audiomanager.ismicrophonemute())); display log : muted ? : true i don't know problem. have idea ? i tried same, thought problem in devices, devices can mute microphone, tried same solution of answer: setmicrophonemute(boolean) doesn't work on devices i simulate press on mute button on handsfree kit . worked me hope here code: intent buttonup = new intent(intent.action_media_button); buttonup.putextra(intent.extra_key_event,new keyevent(keyevent.action_up,keyevent.keycode_headsethook)); getbaseco...

ios - Deleting causes app to crash -

i trying put first ios app (i'm php dev), , running issue. trying follow tutorial make simple task manager app, , have working except delete functionality. as try delete item, app crashes following error: 2015-06-10 08:33:32.532 tasks[56594:1355112] *** assertion failure in -[uitableview _endcellanimationswithcontext:], /sourcecache/uikit_sim/uikit-3347.44/uitableview.m:1623 2015-06-10 08:33:32.538 tasks[56594:1355112] *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'invalid update: invalid number of rows in section 0. number of rows contained in existing section after update (1) must equal number of rows contained in section before update (1), plus or minus number of rows inserted or deleted section (0 inserted, 1 deleted) , plus or minus number of rows moved or out of section (0 moved in, 0 moved out).' there's throw call stack message afterwards can post too, if need be. here's masterviewcontroller.swif...

c++ - What is the reason for "declaration does not declare anything" error? -

if have class called 'rock', , :- int main() { rock; } why "declaration not declare anything" error ? shouldn't call default constructor , create object @ moment? ofcourse won't able use object , destroyed when go out of scope of function, why not creating @ all? in other programming languages java, variables not compulsory. can new rock() , fine. i know isn't of use want clear confusion. rock name of class. there no variable name declared. call constructor/create object, need declare name of variable: rock r; this creates object on stack destroyed when goes out of scope

eclipse - Error instantiating class:class:null java.lang.reflect.InvocationTargetException -

use selenium junit java + jmeter load testing. in eclipse started test, ok, after make jar file , put in apache/lib/junit directory, starting jmeter choose jar file, , it's crashed error. reading lot of answer on stackoverflow , other siter, nothing find can me. here's log: 2015/06/10 18:10:41 info - jmeter.threads.jmeterthread: thread started: thread group 1-1 2015/06/10 18:10:49 error - jmeter.protocol.java.sampler.junitsampler: error instantiating class:class loadtestguppy.loadtestguppy.apptest:null java.lang.reflect.invocationtargetexception @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) and code: package loadtestguppy.loadtestguppy; import org.junit.after; import org.junit.before; import org.junit.test; import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.firefox.firefoxdriver; import java.util.concurrent.timeunit; import junit.framework.testcase; public class apptest extends testc...

.htaccess - 301 Redirect is not working for Sub Directory and its URLS of Wordpress -

i added 301 redirect site non-www www. working perfectly. now, installed wordpress in www.example.com/directory 301 not working on directory only. as, had many other directories www.example.com/dir1 dir2 dir3 , on. , when added 301 of them working perfectly. the redirect problem coming directory added after added 301 redirect. information may need is:- => site on wordpress. => redirect whole site non-www www added code .htacess rewriteengine on rewritecond %{http_host} ^example\.com$ [nc] rewriterule ^.*$ http://www.example.com%{request_uri} [r=301,l] ( working fine! ) => now, directory not working added redirectmatch 301 ^example.com/technology/.*$ http://www.example.com/technology (which expected change internal links of technology , including technology directory redirect non-www www [after reading existing solutions @ stackoverflow] but, not working. ) guide me kindly may correct mistake. looking response. thank you!

google apps script - Getting ReferenceError: "OAuth1" is not defined when migrating from OAuthConfig -

i'm receiving referenceerror: "oauth1" not defined. when trying migrate code oauthconfig. there library need invoke in resources->libraries? the example code used 1 google developers any appreciated. i managed find official-looking oauth1 implementation here the project id use in description: mb2vpd5nfd3pz-_a-39q4vfxhmjh3sh48 hope it'll migrating applications.

http - Riak - Connection Refused while trying to connect to Riak cluster using Python client library -

i riak newbie. installed riak 2.1.1 source on local machine while following instructions at: https://docs.basho.com/riak/latest/ops/building/installing/mac-osx/ i started 3 nodes , pinged 3 nodes , received 'pong' response. i joined joined 3 nodes create cluster. checking cluster member status: dev1/bin/riak-admin member-status ================================= membership ================================== status ring pending node ------------------------------------------------------------------------------- valid 34.4% -- 'dev1@127.0.0.1' valid 32.8% -- 'dev2@127.0.0.1' valid 32.8% -- 'dev3@127.0.0.1' ------------------------------------------------------------------------------- valid:3 / leaving:0 / exiting:0 / joining:0 / down:0 i looked @ riak.config file in rel/riak/etc/ directory , saw following has been set: ## listener.http.<name> ip address , tcp port riak ## http inter...

I gained this error in my gradle and i don't seem to understand what's happening. My gradle file is printed below -

error:execution failed task ':app:dexdebug'. com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\program files\java\jdk1.8.0_45\bin\java.exe'' finished non-zero exit value 1 blockquote i don't seem understand problem help? kees clean project , rebuild again. works me charm

akka - ActorNotFound Exception trying to run Spark 1.3.1 on windows 7 -

we @ road block trying understand why spark 1.3.1 doesn't work colleague of mine on windows 7 laptop. have pretty same setup , works fine me. i searched error message still didn't find resolution. here exception message (after running spark 1.3.1 vanilla installation prebuilt hadoop 2.4) akka.actor.actorinitializationexception: exception during creation @ akka.actor.actorinitializationexception$.apply(actor.scala:164) @ akka.actor.actorcell.create(actorcell.scala:596) @ akka.actor.actorcell.invokeall$1(actorcell.scala:456) @ akka.actor.actorcell.systeminvoke(actorcell.scala:478) @ akka.dispatch.mailbox.processallsystemmessages(mailbox.scala:263) @ akka.dispatch.mailbox.run(mailbox.scala:219) @ akka.dispatch.forkjoinexecutorconfigurator$akkaforkjointask.exec(abstractdispatcher.scala:393) @ scala.concurrent.forkjoin.forkjointask.doexec(forkjointask.java:260) @ scala.concurrent.forkjoin.forkjoinpool...

google oauth - Error "Invalid token: Cannot parse referred token string" when trying to access to Picasaweb API with oAuth2 from Java -

when trying connect picasaweb api in java, i've got error: com.google.gdata.util.serviceforbiddenexception: forbidden token invalid - invalid token: cannot parse referred token string @ com.google.gdata.client.http.httpgdatarequest.handleerrorresponse(httpgdatarequest.java:605) @ com.google.gdata.client.http.googlegdatarequest.handleerrorresponse(googlegdatarequest.java:564) @ com.google.gdata.client.http.httpgdatarequest.checkresponse(httpgdatarequest.java:560) @ com.google.gdata.client.http.httpgdatarequest.execute(httpgdatarequest.java:538) @ com.google.gdata.client.http.googlegdatarequest.execute(googlegdatarequest.java:536) @ com.google.gdata.client.service.insert(service.java:1409) @ com.google.gdata.client.googleservice.insert(googleservice.java:613) @ com.google.gdata.client.media.mediaservice.insert(mediaservice.java:380) here code: final string[] scopesarray = { "https://picasaweb.google.com/data/" }; final list scopes =...

c# - Matching cell in rows with an input string -

i trying read excel file , find id number in file. right printing of rows match , figuring out why. // input search string value = textbox3.text; // verify input correct format match match = regex.match(value, @".*[0-9].*"); match mymatch = regex.match(value, textbox3.text); console.writeline(value); foreach (datarow row in xlsds.rows) { if (match.success && mymatch.success) { console.writeline(textbox3); console.write(row.itemarray.tostring()); console.writeline("this found"); } } int rowcount = xlsds.rows.count;

css - Float inside an absolute div inside a relative inline-block div -

hope can give me hand this, i've searched can't find same problem. i'm re-jigging menu website , need these .float-columns appear next each other, in set-up appear under each other. .main{ display: inline-block; position:relative;} .content { position: absolute; } .float-column { background: #fff000; float:left; } <div class="main"> <div class="content"> <div class="float-column">column 1</div> <div class="float-column">column 2</div> </div> </div> i can make them appear expected removing position .content or removing position/display .main, unfortunately can't breaks rest of menu. i've had limited success when specifying fixed widths .float-column , .content, ideally i'd leave flexible (so can add many columns needed) is there way around this? missing obvious? cheers! jsfiddle as per requirement, need remove ...

visual studio - How to properly handle /p arguments in MSBuild with cygwin -

currently, trying find way cygwin handle quotations in cmd. if run command in cygwin: msbuild.exe /p:test="foo;bar"\;test2="foo;bar" my.sln bash strip double quotes out each of properties, , msbuild fail error message. msbuild : error msb1006: property not valid. switch: bar escaping double quotes , semicolons command msbuild.exe /p:test=\"foo;bar\"\;test2=\"foo;bar\" my.sln does allow msbuild compile project. however, properties set not expect them be. running /v:diag, there 1 property set: what expected (based on running build cmd): test = foo;bar test2 = foo;bar got: test = "foo;bar";test2="foo;bar" my guess msbuild interpreting quotes , semicolons literally , processing 1 big environment variable. there easy way process semicolons , quotes in cmd? unfortunately, build relies on these environment variables function properly.

c# - ViewModel does not update Model correctly on submit -

i trying use strongly-typed viewmodel , find when replace model class viewmodel, changes not submitted correctly edit template. whereas using straight model class in view, edits happen successfully. model class materialdefinition , viewmodel class materialdefinitionviewmodel shown below. i've updated edit template correctly reference viewmodel editing not work. i'm using vs2013 , mvc4. ideas, someone? first viewmodel class... public class materialdefinitionviewmodel { // properties public materialdefinition definition { get; private set; } // constructor public materialdefinitionviewmodel(materialdefinition def) { definition = def; } } and code view... <div class="editor-field"> @html.editorfor(model => model.definition.mddescription) @html.validationmessagefor(model => model.definition.mddescription) </div> <p> <input type="submit" value="save" /> </p> ...

opencl - Can I use Julia to program my GPU & CPU? -

my system has graphics card. not play games. i want program high performance computing stuff fun. can use julia lang leverage hardware? yes! enter opencl.jl *how install? pkg.add("opencl"); pkg.update() use following link check various opencl compute platforms on hardware https://github.com/juliagpu/opencl.jl/blob/master/examples/performance.jl

Count the occurence of values in Ruby -

i'm trying count numbers of different values in mysql table columns. range of possible values integer , 0-10. following code working, i'm wondering if there more elegant way this? # example data mysql result = [{ :column1 => "2", :column2 => "3", :column3 => "1"},{ :column1 => "2", :column2 => "3", :column3 => "1"},{ :column1 => "1", :column2 => "2", :column3 => "3"}] # init hash final_result = hash.new { |h, k| h[k] = { } } # loop result columns result.each |single_column| # loop single items inside columns single_column.each |single_result| # create column if not exist if final_result[single_result[0]][single_result[1]].nil? final_result[single_result[0]][single_result[1]] = 1 else final_result[single_result[0]][single_result[1]] += 1 end end end puts final_r...

c - How to do a set union of two double floating point arrays but allowing a tolerance of error of 1 microsecond -

i trying calculate union of 2 arrays containing double floating point values (they timestamps in milliseconds), need allow tolerance of +/- 1 microsecond. for example: consider 2 values 2 different lists (or arrays) below: [ref 0 : 1114974059.841] [dut 0 : 1114974059.840] there small delta between above 2 numbers of .001 microseconds. when make new union list, shouldn't both appear unique, should counted 1 item, , should have item first list (in example, ref one, ending in 059.841). more examples of above type: [ref 21 : 1114974794.562] [dut 18 : 1114974794.560] [ref 22 : 1114974827.840] [dut 19 : 1114974827.840] [ref 23 : 1114974861.121] [dut 20 : 1114974861.120] all above should considered one, , hence union list should have 1 item of first list: union list have 3 ref array, , none dut array. now consider example : [ref 8 : 1114974328.641] [dut 8 : 1114974361.921] here, delta between 2 values in list above quite significant respect microseco...

datetime - Merge two time series with offset? -

i have 2 files time series data, this: file_a.csv: t,x,y,z 00:00:00,1,1,1 00:00:01,2,2,2 00:00:02,3,3,3 00:00:03,4,4,4 file_b.csv: t,x,y,z 00:00:00,5,5,5 00:00:01,6,6,6 00:00:02,7,7,7 and merge them in order get: t,x,y,z 00:00:00,1,1,1 00:00:01,2,2,2 00:00:02,3,3,3 00:00:03,4,4,4 00:00:04,5,5,5 00:00:05,6,6,6 00:00:06,7,7,7 basically, want offset "t" of data set n+1 last value of "t" of data set n. how can that? combine_first not want: merges 2 columns. needed guess stuff in question (exact format of time, times sorted, increments fixed), here general idea. starting dataframes: import pandas pd stringio import stringio import numpy np = pd.read_csv(stringio('t,x,y,z\n00:00:00,1,1,1\n00:00:01,2,2,2\n00:00:02,3,3,3\n00:00:03,4,4,4')) b = pd.read_csv(stringio('t,x,y,z\n00:00:00,5,5,5\n00:00:01,6,6,6\n00:00:02,7,7,7')) convert times , sort (possibly can skip last part): a.t = pd.to_datetime(a.t) a.sort(columns=[a.t.name],...

ruby on rails - Thread running in Middleware is using old version of parent's instance variable -

i've used heroku tutorial implement websockets. it works thin, not work unicorn , puma. also there's echo message implemented, responds client's message. works on each server, there no problems websockets implementation. redis setup correct (it catches messages, , executes code inside subscribe block). how work now: on server start, empty @clients array initialized. new thread started, listening redis , intended send message corresponding user @clients array. on page load, new websocket connection created, stored in @clients array. if receive message browser, send clients connected same user (that part working on both thin , puma). if receive message redis, user's connections stored in @clients array. weird thing happens: if running thin, finds connections in @clients array , sends message them. if running puma/unicorn, @clients array empty, if try in order (without page reload or anything): send message browser -> @clients.length 1, me...

java - How to handle multiple fragment interaction listeners in one Activity properly? -

i have 1 activity , 6 different fragments attached it. each fragment has onfragmentinteractionlistener interface , activity implements these listeners in order receive callbacks. looks little messy, i'm interested there patterns/ways simplify , make more elegant? a solution use same onfragmentinteractionlistener fragments, , use 1 param of each listener methods (like tag parameter) identificate fragment sent action. here example: make new class , every fragment use class onfragmentinteractionlistener.java public interface onfragmentinteractionlistener { public void onfragmentmessage(string tag, object data); } in activity: public void onfragmentmessage(string tag, object data){ if (tag.equals("tagfragment1")){ //do 'data' comes fragment1 } else if (tag.equals("tagfragment2")){ //do 'data' comes fragment2 } ... } you can use object type pass every type of data want ( then, in ...

java - RestTemplate encoding issue -

while getting data 1 of web service quote(") coming (?) when use rest template. tested web service in postman on chrome , giving correct characters. tried encoding utf-8, no success. i checked following encoding web service provider : cache-control → private connection → close content-encoding → gzip content-length → 3407 content-type → text/xml; charset=iso-8859-1 date → wed, 10 jun 2015 13:35:53 gmt server → google search appliance vary → accept-encoding x-frame-options → sameorigin x-content-type-options → nosniff x-xss-protection → 1; mode=block here code : resttemplate resttemplate = new resttemplate(); httpheaders headers = new httpheaders(); mediatype mediatype = new mediatype("text", "xml", charset.forname("iso-8859-1")); headers.set("accept", "text/xml; charset=iso-8859-1"); headers.setcontenttype(mediatype); headers.setacceptcharset(arrays.aslist(charset.forname("utf-8"))); ...

c++ - How can I apply only one clang-format action? -

i want use clang-format align comments, nothing else. the option is: aligntrailingcomments (bool) . but when run following: clang-format-3.6 -i -style='{aligntrailingcomments: true}' <file> it performs kinds of other formatting options suppose have default when unspecified. how can execute 1 clang formatting rule on codebase? having of these defaults make difficult see full effect single formatting option has on code. have parse through diff of these other changes , decide if option specified did it. i noticed there disableformat option, no matter how use it, stops formatting happening @ all. clang-format-3.6 -i -style='{aligntrailingcomments: true, disableformat: true}' clang-format-3.6 -i -style='{disableformat: true, aligntrailingcomments: true}' both cause clang-format not make code anywhere. i think clang format not designed this. rules not things applies incrementally, program instead built around, parsing...

JAVA Help : Append file and remove last character -

am still new java, had 1 semester of it. have first internship , isn't programming internship, general internship since first semester. boss not know java, nor in building. knew had basic programming experience , told me take stab @ problem having. has report saved , last line, last character of report character turn symbol, , need remove because giving problems on website. not sure if on right track, @ point doing trial , error. please :d public class removechar { public static void main(string[] args) throws filenotfoundexception { // variables , stuff scanner keyscan = new scanner(system.in); jframe frameone = new jframe ("file name"); scanner filescan = new scanner(system.in); string filename; // ask user file name system.out.print("what file full file name? "); filename = filescan.nextline(); // add .txt if user forgets put in prompt if (!filename.contains(".txt")) filename += "...

ios - AVCaptureVideoPreviewLayer displays correctly except on iPhone6 -

Image
i'm working on implementing view consists of avcapturevideopreviewlayer. view supposed take entirety of screen, except navigation bar @ top (the view embedded in navigation controller). my code below shows how i've set capture session , added front camera input if it's available. //set capture session session = [[avcapturesession alloc]init]; session.sessionpreset = avcapturesessionpresetphoto; //add camera input if have front-facing camera available nsarray *devices = [avcapturedevice deviceswithmediatype:avmediatypevideo]; nserror *error; (avcapturedevice *device in devices) { if ([device position] == avcapturedevicepositionback) { //set our input avcapturedeviceinput *input = [avcapturedeviceinput deviceinputwithdevice:device error:&error]; [session addinput:input]; if (!input) { nslog(@"no input"); } } } below output configured, , camera output view added subview, frame determined view...

python - Git Checkout conflicts when i want to switch to another branch -

i have problem git. when want switch branch eclipse shows me this dialog . and in src folder, have gitignore file these values **/\__pycache__/ **/*.pyc when go source location of these files screenshot, delete them, same thing happens. just because file matched .gitignore won't ignore if somehow added git (incidentally, *.pyc need in .gitignore ). this why not trust git guis in general, or attempt "automatically add changes". you need checkout each branch , git rm file , commit that. if file not in tree current branch need manually delete filesystem if it's present on different branch. additionally, may need make sure ide isn't automatically regenerating .pyc files without requesting run or import program. alternatively, use git filter-branch remove files history. require force push , more complicated.

html - get variable from <a> tag php -

hello problem displaying list of messages mails , when want read full message u need go rmq-demande.php full message appeard : here how list of messages presented need id of each message when clicked on : <?php $sql_rev=mysql_query("select * demande_revision lu='nl' "); $comment_count=mysql_num_rows($sql_rev); ?> <li class="xn-icon-button pull-right"> <a href="#"><span class="fa fa-comments"></span></a> <div class="informer informer-danger"> <?php if($comment_count!=0) { echo "$comment_count nouveau"; }?> </div> <div class="panel panel-primary animated zoomin xn-drop-left xn-panel-dragging"> <div class="panel-heading"> ...