Posts

Showing posts from March, 2014

mysql - Inserting values from 1 table to another error -

i'm having 2 tables modules_templates and templates in table templates have 75 records . want insert table modules_templates data template_id in modules_templates = template_id templates. created query : insert `modules_templates` (`module_template_id`,`module_template_modified`,`module_id`,`template_id`) values ('','2014-04-14 10:07:03','300',(select template_id templates 1)) and i'm having error #1242 - subquery returns more 1 row , how add 75 rows in 1 query ? try this insert `modules_templates` (`module_template_id`,`module_template_modified`,`module_id`,`template_id`) (select '','2014-04-14 10:07:03','300',template_id templates 1) your query didn't work because inserting value 1 row, last field i.e result of sub query multirow, had put single row values in sub-query returned each row in sub query.

html - Issue with dropdown -

i'm stuck dropdown don't work... i'have php application , , used create file included everywhere in app , contains menu. i forget include files, idk. here <head> <link href="css/bootstrap-responsive.min.css" rel="stylesheet"> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <link rel="stylesheet" href="css/bootstrap.css" /> <link rel="stylesheet" href="css/main.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script src="js/bootstrap.js"></script> so , include jquery lib , css files ,and bootstrap.js.. what's wrong ? notice snippet work in other application, change things links.. that's why suppose have forget :/ h...

java - custom tag support when migrate from struts 1 to struts 2 -

there project developed in struts 1 migrate struts 2. problem application has lot of custom tags written using struts 1. when migrating struts 2 there way can keep custom tag support existing jsps. suppose remove sturts 1.x related jars when migrating struts 2 rewriting custom tags struts 2 huge effort. if using struts1 , remove it, should remove tags dependent on it. however, can use other taglibs, including jstl corresponding jsp specification version.

java - Create a page that asks for user details before the main activity starts -

i want create page asks user input details when first use app. after that, app should start , go straight main activity every time unless want change details. there dropdown menu editdetails. i tried add image here , apparently don't have 10 reputation post images. so user details page ask users name, age, address. , these entries saved database. how can make editdetails activity appear on first use only? current mainactivity.java below import android.app.activity; import android.app.actionbar; import android.app.fragment; import android.os.bundle; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.os.build; public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); if (savedinstancestate == null) { ...

C on Windows vs Linux - differences -

this code works on windows (visual studio), on linux gcc, produces incorrect results. can spot issues? work differently on linux vs windows? is there way of compiling on linux? rather working gcc, if can me spot issues in code act differently on linux, great. - returning this: char output[8]; char *x = output; return x; for one, have plenty of code returns pointers local arrays, not allowed , cause undefined behavior when pointers de-referenced later. if code works in windows, you're being lucky since code not valid. the 2 typical solutions are: have caller pass in pointer (and size_t length value prevent overwrite, of course!) string space called function allowed work. dynamically allocate new memory string inside function , return that. becomes caller's responsibility free() memory when it's no longer needed.

eclipse -vm %JAVA_HOME% in eclipse.ini fails -

i downloaded eclipse adt , there no jre in eclipse folder. so created on windows 8 java_hom environement variable pointing jdk path , added line eclipse.ini -vm %java_home%/bin/javaw.exe but eclipse still looks jre in sub directory. you cannot use environment variables in eclipse.ini (eclipse bug 102239 ), must specify actual full path. you must put -vm , path on separate lines. if there -vmargs entry in eclipse.ini -vm must come before that.

Connect Access Database from c# -

i’m trying open access database. oledbconnection conn = null; oledbdatareader reader = null; conn = new oledbconnection( "provider=microsoft.ace.oledb.12.0; " + "data source=" + @"c:\test.accdb"); conn.open(); but on conn.open, i’m getting exception - unrecognized database format "c:\test.accdb" im’ created db access 2010. so, i’m tried access db using this: http://www.microsoft.com/en-us/download/details.aspx?id=13255 i’m exception „microsoft.ace.oledb.12.0' provider not registered on local machine.” i’m trying this: http://www.microsoft.com/en-us/download/details.aspx?id=23734 , getting unrecognized database format exception. try this oledbconnection con = new oledbconnection(@"provider=microsoft.ace.oledb.12.0;data source=c:\test.accdb");

laravel - Add twitter bootstrap icon to linkRoute -

wondering how add icon linkroute. {{ html::linkroute('edit_data', 'edit', $data->id) }} i want edit show: <span class="glyphicon glyphicon-edit"></span> i tried this, didn't work: {{ html::linkroute('edit_data', '<span class="glyphicon glyphicon-edit"></span>', $data->id) }} this won't work , can use html tags instead of function or create custom macro this: html::macro('ilinkroute', function($name, $title = null, $parameters = array(), $attributes = array(), $html = ''){ $url = route($name, $parameters); if (is_null($title) || $title === false) $title = $url; return "<a href = '$url'>$html.$title</a>" ; }); then use this: {{ html::ilinkroute('user.show.profile', 'profile', ['username' => 'heera'], [] , '<span class="glyphicon glyphicon-edit"></span...

asp.net - How to Use Target="_Blank" in Respnse.redirect() in c# -

i creating website in added paypal button. want on same page after success of payment. want payment processing should done in new tab.my written code follows:- protected void button7_click(object sender, eventargs e) { string business = "rajpadwa@gmail.com"; string itemname = "funds"; int itemamount = int32.parse(dropdownlist1.selecteditem.value); string currencycode = "usd"; stringbuilder pphref = new stringbuilder(); pphref.append("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick"); pphref.append("&business=" + business); pphref.append("&item_name=" + itemname); pphref.append("&amount=" + itemamount.tostring("#.00")); pphref.append("&currency_code=" + currencycode); response.redirect(pphref.tostring(), true); } can u please tell me how paypal transaction in new tab while using response.redirect() method... you canno...

ios - AudioToolbox to play nsdata in download -

i'm trying play audio audiotoolbox in xcode. search documentation little. want play nsdata while download internet. link: http://www.cocoawithlove.com/2008/09/streaming-and-playing-live-mp3-stream.html , apple developer documentation can't understand have cast nsdata (that not complete because in download) in data audiotoolbox can read. apple documentation understand strutture must allocate: typedef struct myaqstruct { audiofileid maudiofile; audiostreambasicdescription mdataformat; audioqueueref mqueue; audioqueuebufferref mbuffers[knumberbuffers]; sint64 mcurrentpacket; uint32 mnumpacketstoread; audiostreampacketdescription *mpacketdescs; bool mdone; }myaqstruct; and callback function have call play, of variabile in struct rapresent data? maybe think audiostreambasicdescription. or audiofileid? , how ca...

Exe's compilation on Solaris 11 env using gcc -

i on solaris 11 environment , gcc-3.4.6 installed on it. problem not able compile exe's there, error is -sh: gcc: gcc: cannot execute [invalid argument] even if write gcc gives same error. kindly help. unlike in solaris 10, on solaris 11 gcc not installed default. fear not. by far easiest use ips install using commands below (while being root or other superuser): pkg install pkg://solaris/developer/build/gnu-make pkg install pkg://solaris/developer/build/make pkg install pkg://solaris/developer/gcc-45 pkg install pkg://solaris/system/header pkg install pkg://solaris/developer/build/autoconf pkg install pkg://solaris/developer/build/automake-110 this give tools typically need build various open source software packages. note of packages have version number in package name itself, e.g. gcc-45. may able find later versions in package repository, example solaris 11.2 beta you'll find have choice of gcc 4.5, 4.7 or 4.8. same applies automake a...

sql - Performance impacts on specifying multiple columns in inner join -

i want select records 2 tables based on matching values of 2 columns. have got 2 queries same, out of these 1 contains join on 2 columns as: select * user_master um inner join user_location ul on um.customer_id=ul.customer_id , um.created_by=ul.user_id and same results can achieved following query having single column join as: select * user_master um inner join user_location ul on um.created_by=ul.user_id um.customer_id=ul.customer_id is there difference in performance of above queries? as concerning performance answer is: depends. in general engine smart enough optimize both queries, i'm not surprised if both produce same execution plan. in fact must run both queries few times , study execution plan determine if both run same time and using same amount of cpu, io , memory. (remember performance not running fast, smart use of resources). ...

Analyzers in ElasticSearch not working -

i using elasticsearch store tweets receive twitter streaming api. before storing them i'd apply english stemmer tweet content, , i'm trying use elasticsearch analyzers no luck. this current template using: put _template/twitter { "template": "139*", "settings" : { "index":{ "analysis":{ "analyzer":{ "english":{ "type":"custom", "tokenizer":"standard", "filter":["lowercase", "en_stemmer", "stop_english", "asciifolding"] } }, "filter":{ "stop_english":{ "type":"stop", "stopwords":["_english_"] }, "en_stemmer" : { "type" : "stemmer", "name" : "...

Vertical lines/borders in generated table is not continous (R+Latex+Sweave+xtable) -

Image
i creating report in latex using r , sweave. table generated using xtable. following code used generate table <<echo=false, results=tex>>= tabulatedval <- getstattablemacro(portfolio, normalizingrow) createdxtable <- xtable(tabulatedval, digits = 2) align(createdxtable) <- "l|l|c|" rws <- seq(1, nrow(tabulatedval), by=2) col <- rep("\\rowcolor{blue!10}", length(rws)) print(createdxtable, booktabs=true, add.to.row=list(pos=as.list(rws), command=col), include.rownames=false, size="\\small") @ the values generated fine vertical lines separating columns (as borders) not continuous. i tried remove colors , seems better still has gaps between vertical lines/borders <<echo=false, results=tex>>= tabulatedval <- getstattablemacro(portfolio, normalizingrow) createdxtable <- xtable(tabulatedval, digits = 2) align(createdxtable) <- "l|l|c|" rws <- seq(1, nrow(tabulatedval), by=2) print(crea...

c# - Keep getting Error: redirect_uri_mismatch using youtube api v3 -

hi hope can me out here. i have web application (asp.net) on local machine, trying upload video youtube using sample https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video i have set client id , secret web application in google console when try upload video browser tab opens select 1 of google accounts , once sig in redirect_uri_mismatch response details on page below: cookie_policy_enforce=false scope=https://www.googleapis.com/auth/youtube.upload response_type=code access_type=offline redirect_uri=http://localhost:55556/authorize/ pageid=[some page id removed here security reasons] display=page client_id=[some unique id removed here security reasons].apps.googleusercontent.com one interesting thing redirect_uri=http://localhost:55556/authorize/ different 1 set in google console , 1 in client_secrets.json each time error page port number changes. redurect urls , origins set follows in google console think have added combinations in case: authori...

javascript - If Statment depending on screen width -

i have created js if-statment, should detect screen width , change css properties depending on screen width. if screen wider 700px, #header_menu should extended. if resolution below 700, #menu should extended (by clicking trigger). all in function working, first time resize window. not sure mistake ... thanks ;) $(document).ready(function(){ $(window).on('load resize', function checkposition(){ if (window.matchmedia('(max-width: 700px)').matches) { $("#menu_trigger").click(function(){ $("#menu").css('width', '90%'); $("#closer, #header").css('margin-left', '90%'); $("#closer, #header").css('margin-right', '-90%'); }); } else { $("#menu_trigger").click(function(){ $("#header_menu").css('width', 'auto'); }); } ...

c++ - What is this so called lookup in namespace function definition? -

§3.4.1/9 in c++11 standard says: name lookup name used in definition of friend function (11.3) defined inline in class granting friendship shall proceed described lookup in member function definitions. if friend function not defined in class granting friendship, name lookup in friend function definition shall proceed described lookup in namespace member function definitions. my interpretation of paragraph friend functions defined in class granting friendship follow rules in previous paragraph (3.4.1/8). next case, i.e., friend function not defined in class granting friendship? this, called lookup in namespace function definition? paragraph 6? i'm not sure. yes, refers 3.4.1§6. quoting leading sentence of paragraph: a name used in definition of function following function's declarator-id member of namespace n ... (emphasis mine)

c++ - Multiple classes with the same name causing vtable problems -

i have interesting problem crept , wondering why gcc/g++ doesn't catch , throw kind of error. apologies how many files takes, i've reduced problem as possible. interface.h class baseclass { public: virtual void hello() = 0; }; void rememberclass(baseclass* foo); void callfunc(); interface.c #include "interface.h" namespace { typedef void (baseclass::*memfunptr)(); memfunptr func; baseclass* obj; } void rememberclass(baseclass* foo) { func = &baseclass::hello; obj = foo; } void callfunc() { (obj->*func)(); } class1.h class class1 { public: class1(); }; class2.h class class2 { public: class2(); }; class1.c #include "interface.h" #include "class1.h" #include <iostream> class helloclass : public baseclass { public: helloclass() {} void hello() { std::cout << "calling hello" << std::endl; } }; class1::class1() { helloclass* foo = new helloclass(); re...

javascript - Instafeed Script Not Working -

i've been developing website requires instagram feed. unfortunately, can't work! here's i've done. <script type="text/javascript"> feed = new instafeed({ clientid: '99808b1edfc140eda1cfa2dca4b4fe4c', accesstoken: '201047212.467ede5.1072e8c882e34a8fb7975f725e7b3ba8', get: 'user', userid: 201047212, resolution: 'standard_resolution', links: 'false', template: '<div id="instafeed-caption">{{caption}} <br>&hearts; {{likes}} on <a href="{{link}}" class="sky">instagram</a></div><div id="instafeed-container"><img src="{{image}}" /></div>', mock: true, custom: { images: [], currentimage: 0, showimage: function () { var result, image; image = this.options.custom.images[this.options.custom.currentimage]; result = this._maketemplate(this.options.tem...

sql server - SQL query unknown rows into columns -

i asked question , marked duplicate of how pivot unknown number of columns & no aggregate in sql server? , answer doesn't me. i have table of data looks this, unknown number of rows , values. recid name value 1 color red 2 size small 3 weight 20lbs 4 shape square i need query return data this, building out column each row. cannot hard code except column headers 'name' , 'value'. color size weight shape red small 20lbs square here have far partly working: insert @table values (1,'color' ,'red'), (2,'size' ,'small'), (3,'weight','20lbs'), (4,'shape' ,'square') ;with mycte ( select rn,cols,val (select row_number() over(order name) rn, name, value @table) src1 unpivot (val cols in ( [name], [value])) unpvt ) select * (select rn,cols,val mycte) src2 pivot ( max(val) rn in ([1...

Increase value + 1 within for loop in CoffeeScript? -

i tried this: posts = posts.find({},   sort:     position: 1 ).fetch() post in posts = 1 posts.update post._id, $set: position: i++ but posts end position 1. want 1, 2, 3, 4, etc. what i'm doing wrong? you can force i evaluated (rather referenced) @ right time using do . fine manual : when using javascript loop generate functions, it's common insert closure wrapper in order ensure loop variables closed over, , generated functions don't share final values. coffeescript provides do keyword, invokes passed function, forwarding arguments. this situation you're facing. can let coffeescript handle loop counter using for e, in ... form of for : for post, in posts (post, i) -> posts.update post._id, $set: position: + 1

tdd - How to Measure Code Coverage Rspec-Puppet -

i measure code coverage rspec-puppet implementing following example . i have added at_exit { rspec::puppet::coverage.report! } end of ./spec/classes/init_spec.rb file. init_spec.rb require 'spec_helper' describe "vim" let(:facts) { { :operatingsystem => 'ubuntu' } } { should contain_class('vim::ubuntu')} end at_exit { rspec::puppet::coverage.report! } running rspec results in: /etc/puppet/modules/vim/spec/classes/init_spec.rb:12: uninitialized constant rspec::puppet::coverage (nameerror) rake spec results in: rake aborted! no such file load -- ace /usr/lib/ruby/vendor_ruby/rake/application.rb:357:in `require' /usr/lib/ruby/vendor_ruby/rake/application.rb:357:in `standard_rake_options' /usr/lib/ruby/1.8/optparse.rb:1298:in `call' /usr/lib/ruby/1.8/optparse.rb:1298:in `parse_in_order' /usr/lib/ruby/1.8/optparse.rb:1254:in `catch' /usr/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order' /usr/lib/ruby/...

delphi - TChart axis increment actual value -

i'm using tchart standard, version 8, , trying find actual tchartaxis.increment value. doc: "axis increment minimum step between axis labels... if there not enough space labels, tchart calculate bigger one". problem find appropriate minortickcount value, or rather coordinate actual increment. because default minorticks value (3) can looks strange if increment 5, instance (in case it's more natural have 5 minor ticks). thanks. for instance, set increment 1 , minortickcount 0, tchart increases increment 5. if knew that, set minortickcount 4. you can achieve calcincrement method, example: uses series; procedure tform1.formcreate(sender: tobject); begin chart1.align:=alclient; chart1.addseries(tlineseries).fillsamplevalues(); trackbar1.max:=10; trackbar1.position:=2; end; procedure tform1.chart1afterdraw(sender: tobject); var tmpincr: double; begin tmpincr:=chart1.axes.bottom.calcincrement; if chart1.axes.bottom.minortickcount<>tmp...

asp.net - Loging page doesn't load completely -

i developing web application,i branched 3 separated projects trunk after each week merging trunk. i created 2 website on iis 7 named staging , devel, staging main version developer , support teams can work on , tests, devel published version developer team can publish each resolved issue on it. staging , devel websites working have similar iis configuration except connectionstring. all things working these websites, have decided create website named demo customers' tests there strange problem iis or maybe codes, iis configuration same these 3 websites, when want view demo loging page doesn't load (css , js), template , images doesn't load reason think problem's reason authentication mode or application pools on iis can't main reasons because 3 website have same configurations, disabled forms authentication , changed application pool checked security on each staging,devel , demo's folders loging page demo doesn't load want. iis authentication conf...

jquery - Webservice not found by Ajax-Request -

i have ajax-request webservice: js: $.ajax( { type: "post", url: "getprocess.asmx/getprocessid", data: "{}", contenttype: "application/json; charset=utf-8", datatype: "json", async: true, success: function (response) { //much code here, not needed here codebehind(getprocess.asmx): [webservice(namespace = "http://tempuri.org/")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] [system.componentmodel.toolboxitem(false)] [system.web.script.services.scriptservice] public class getprocess : system.web.services.webservice { [system.web.services.webmethod] [system.web.script.services.scriptmethod(responseformat = responseformat.json)] public static classes.progress getprocessid() { classes.progress progress = new classes.progress(); //alot of code here also. dont think has todo problem. } } a little part of error, full can find here: http:/...

r - ggplot: line with different widths -

Image
with ggplot2, easy plot line 2 colours, based on value of "col" variable, possible plot line left part 1 width , right part 1 ? you different width lines if use size= argument inside aes() , set variable divides data. the of plot depend on variable divides data in groups. if variable factors gap between parts of lines. df1<-data.frame(x=1:10,y=1:10,z=rep(c("a","b"),each=5)) ggplot(df1,aes(x,y,size=z))+geom_line() if variable numeric there no gap. df2<-data.frame(x=1:10,y=1:10,z=c(1,1,1,2,2,2,3,3,4,4)) ggplot(df2,aes(x,y,size=z))+geom_line()

git - Subtree merge into multiple directories -

i have 2 repositories , 1 of them ( shared ) contains shared libraries used code in other 1 ( main ). main +--- foo | +--- shared | +... +----bar | +--- shared . +... i have added shared remote local main working copy , i'm trying merge master branches using subtree strategy: git merge --squash -s subtree shared/master this command automagically finds appropriate directory , merge. however, when there more 1 place shared branch should merged into, merges 1 place (looks it's taking first 1 in alphabetical order). is there way force continue , merge matching places?

c - Linking with ld/gcc doesn't produce same result (error/sucess) -

i have problem, after compilation wan't link using ld when error lets see do: make i386 gcc -g -c -i. -i/usr/include -o p_test.o.i386 pkcs11test.c ld -o p_test.i386 p_test.o.i386 -g -ldl ld: p_test.o.i386: référence au symbole non défini «fflush@@glibc_2.0» //lib/i386-linux-gnu/libc.so.6: error adding symbols: dso missing command line make: *** [i386_p_test] erreur 1 so ld got error when try gcc make i386 gcc -g -c -i. -i/usr/include -o p_test.o.i386 pkcs11test.c gcc -o p_test.i386 p_test.o.i386 -g -ldl i got no error , executable do know how can make ld work linking program ? thanks ! when start gcc gcc -o p_test.i386 p_test.o.i386 -g -ldl , adds lot internal libraries ld command. can see arguments adding -v option gcc. 1 of "internal library" glibc ( -lc ). for example, here gcc verbose mode output explanation can see collect2 program used link executable. there -lgcc -lgcc_eh -lc -lgcc -lgcc_eh libraries added run , several crt runt...

php - Trouble with loading javascript into IE8 -

i'm stuck on problem. have index.php include html code following user log on. for exemple if user defined "demandeur", index.php load "demandeur.php". there jquery script file , css file loaded "demandeur.php". loaded , work correctly firefox on ie8 impossible load correctly because error "is null or not object." each time. resume : index.php whith[debug.js, bootstrap.js, jquery.js] --> include (demandeur.php [demandeurscript.js, demandeur.css]) when demandeurscript.js call function inside debug.js exemple error "debug null or not object." index.php <!doctype html> <html lang="fr"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=...

Jquery ui .sortable() enable-disable -

first of all, let me explain page structure, can idea how working. i've got number of quick-button blocks. can sorted jquery ui .sortable() method, after pressing settings button (which allows quick buttons sortable). later, order of buttons saved or canceled. need through 3 conditions fired click event. problem is, on first time ok, on second time when i'm trying press button settings - sortable() method not working anymore. you can see js below: $('#tune-hot-links').click(function () { //click "settings" button $(".sect-hot-links-inner").sortable(); $(".sect-hot-links-inner").disableselection(); }); $('.button-editgroup button.button-save').click(function () { //click "save" button $(".sect-hot-links-inner").sortable('disabled'); $(".sect-hot-links-inner").enableselection(); }); ...

php - Checking external session variable on each page before loading, with javascript -

i've created php login system saves username session variable, on server php hosted. i need check session before loading pages within stand alone phonegap (html, css & javascript) project hosted separately. is there javascript call can make @ start of each page check , redirect if aren't logged in? you should not that, turn off javascript , bypass check. instead, normal php check on eatch page. can put check separate file (say, check.php) , put on etach page require ('check.php'); edit (reply comment/question edit): a) how make own session: as simple session_start(); b) how pair remote session: if (!isset($_session['remoteid'])) $_session['remoteid'] = sesion id recived response prom remote php server. once again, can not html, css & javascript. javascript can turned off. need php/python/ruby/etc... needless add javascript can not persistent, since not executed on server.

maven override profile from parent in child -

i have multi-module maven project. parent-module-->child-submodule1 \->child-submodule2 children both submodules , children of parent-module. child-submodule1 has build profile my-profile specific should shared sibling (submodule 2) setup environment both. i moved "my-profile" parent. when build activating profile executed 3 times, build fails (as profile specific things here). i needed profile executed once in parent, , being skipped in children. tried removing parent-children relationship , way woud work, have other problems solve (dependencies carried out parent). how can it? can override profile in children deactivating it? you cannot deactivate profile in children or prevent run. you set <inherited>false</inherited> on executions in my-profile in parent.

hibernate - spring-data-jpa @OneToMany fails with lazy init -

i trying create parent-child relationship using spring-data-jpa, hibernate, spring-data, h2 (for tesitng), , postgress (production). here tables defined in h2.sql: create table if not exists menu ( menuid bigint(11) not null auto_increment, displaytext varchar (100) default not null, displayorder int default null ); create table if not exists menuitem ( menuitemid bigint(11) not null auto_increment, displaytext varchar (100) default not null, path varchar (50) null, tooltip varchar (500) default not null, displayorder int default null, calltype varchar (50) default not null ); i have 2 simple entities: @entity public class menu { @id @generatedvalue(strategy = generationtype.auto) private long menuid; @onetomany(fetch = fetchtype.lazy, mappedby = "menu") private list<menuitem> menuitems = new arraylist<menuitem>(); private string displaytext; private int displayorder; and @entity public c...

javascript - Very odd behavior when returning a prototypical function from a module function -

i'm writing boilerplate new site , found myself interesting problem. want set module returns interface can extended. using prototypical inheritance should make easy task, right? though returning new instance of function, isn't extensible. have feeling monday morning mixup... var somemodule = somemodule || (function($) { /*initalize page*/ init(); ///////////////////// // public methods // ///////////////////// var api = function() { } api.prototype.example = function() { alert("hi!"); } ////////////////////// // private methods // ////////////////////// function init() { ... } return new api(); })(jquery); somemodule.prototype.newfunct = function() { ... } //causes exception because somemodule object, not function typeof(somemodule); // "object" to answer own question, here's way prototypical inheritance working design. question becomes, design in first place? var somemodule = somemodule |...

java - Class defined in another plugin cannot be found by the main plugin - Eclipse Product -

i exported plugin project product , when run product (eclipse application), main plugin ( org.example.framework.core ) cannot find class defined in plugin ( org.example.abc ) implements extension extension point provided main plugin. class 1 of elements defined in extension. however, when run project in eclipse, runs fine! here log ( atvste.ppt.ptfwdescription.abc.decoderinfo package in org.example.abc plugin ): 0 [worker-2] error org.example.framework.core.ptfw.codec.decode.msgdecoderinfo org.example.framework.core.ptfw.codec.decode.msgdecoderinfo.createinstance(msgdecoderinfo.java:114) : can not create class :atvste.ppt.ptfwdescription.abc.decoderinfo.msgdecoderinfoabc atvste.ppt.ptfwdescription.abc.decoderinfo.msgdecoderinfoabc cannot found org.example.framework.core_1.0.0.201404111439 java.lang.classnotfoundexception: atvste.ppt.ptfwdescription.abc.decoderinfo.msgdecoderinfoabc cannot found org.example.framework.core_1.0.0.201404111439 @ org.eclipse.osgi.internal....

r - Function to Change "List" objects into "numerics" -

i have matrix containing several "list" vector. transform them numerics. have read should use as.numeric(x) - since have several values use function goes through matrix , checks each vector of matrix if list , returns numeric. i have thought use like: if typeof(matrix$vector1)=="list" then as.numeric(matrix$vector1) can me out how create such function? i'd appreciate kind of help! kind regards, try this: if (is.list(matrix$vector1)) sapply(matrix$vector1,as.numeric) is.list check whether input list, if true sapply 'apply' function as.numeric every element of list

java - How do I link a View class to the XML screen? -

i still learning java , how use eclipse have xml main activity file (the graphical layout) , java file named mainscreen extends activity. inside mainscreen file have class named myview extends view , can display on device screen calling setcontentview(new myview(this)); mainscreen oncreate method. how make can have myview view within xml file? i can change setcontentview(r.layout.activity_main_screen); and sets xml file how have both displayed. i want display screen if following setcontentview(r.layout.activity_main_screen); layout have myview displayed inside seperate view on screen. have tried setting setcontentview(r.id.view1); if being honest not 100% sure doing still learning. can please point me in right direction or me out? have been googling trying figure out , i'm little lost. thanks edit: added code below xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools...

javascript - Meteor - layoutTemplate in RouteController.extend in package.js -

i have problem iron-router controllers in package. code: router.map(function() { this.route('registration.index', {path: '/registration'}); }); registrationindexcontroller = routecontroller.extend({ layouttemplate: 'intranetlayoutsimple' ... }); layouttemplate not working if you're creating new route controllers inside package , want use them in main app, remember export it, e.g.: api.export('registrationindexcontroller', ['client', 'server']); in package.js

ios - Multiline UILabel with auto layout does not work -

Image
i'm trying set constraints multiline label in static table view cell, apparently not work me, label still in 1 single line. i've set numberoflines property 0 , height constraint greater or equal. , i'm setting height cell correctly in tableview:heightforrowatindexpath . please have @ screenshot see settings in ib. in comments above mentioned you're not setting preferredmaxlayoutwidth . property tells label should lay out text on width of property's value. in uilabel.h: if nonzero, used when determining -intrinsiccontentsize multiline labels in other words, if don't set that, label's intrinsic content size whatever width label needs draw text. if set property label's bounds, start drawing on next line (or else cut text off if numberoflines 0). in case, in tableview:willdisplaycell:forrowatindexpath: .

Is there any shortcut to I select the entire text in Dragon NaturallySpeaking's Advanced Scripting editor? -

Image
i select the entire text in dragon's advanced scripting editor. ctrl + a doesn't work. there shortcut it? i use dragon naturallyspeaking 12.5 professional on windows 7 x64 sp1. franck, approach cumbersome. here shorter solution want 2 simple shortcuts. sub main ' generalized solution selecting entire contents of text or text box when ctrl-a not work sendkeys "^{home}", true 'to go beginning of document, press ctrl-home sendkeys "^+{end}", true 'to select everything, press ctrl-shift-end end sub

javascript - Emulating private methods with closures vs public methods in objects -

as mdn states closures used emulate private methods module pattern : var counter = (function () { var privatecounter = 0; function changeby(val) { privatecounter += val; } return { increment: function () { changeby(1); }, decrement: function() { changeby(-1); } }; }()); however, instead of using module pattern can create class instead. advantage of creating class on using module pattern? function counter() { var privatecounter = 0; function changeby(val) { privatecounter += val; } this.increment = function() { changeby(1); }; this.decrement = function() { changeby(-1); }; } var counter = new counter(); what advantage of creating class on using module pattern? the advantage of creating class on using module pattern can create several instances of class: var counter1 = new counter; var counter2 = new counter; each inst...

python - List to str adding backslash \ to string using str() -

i trying extract file paths txt file. file says c:\logs. use with open(pathfile, "r") f: pathlist = f.readlines() to produce list path in, , then path1 = str(pathlist) to produce line string. list sees line in th efile, te second command puts in backslash: c:\logs. i os.chdir(path1) to @ path , error windowserror: [error 123] filename, directory name, or volume label syntax incorrect: "['c:\\logs']" why this? how can prevent it? i looking have many paths in file , have script search each path individually. best way it? thank much. the backslash see "escape" character, how representation of string disambiguates existing backslash. it's not 2 backslashes the problem pathlist list , , you're forcing str . instead, take first element of pathlist: path1 = pathlist[0] you may have line break @ end (another use of escape: \n or \r ). solve that, use .strip() path1 = pathlist[0].strip()

python - Exclude the last delimited item from my list -

i want remove last string in list i.e. library name (delimited '\'). text string have contains path of libraries used @ compilation time. these libraries delimited spaces. want retain each path not till library name, 1 root before it. example: text = " /opt/gcc/4.4.4/snos/lib/gcc/x86_64-suse-linux/4.4.4/crtbegint.o /opt/gcc/4.4.4/snos/lib/gcc/x86_64-suse-linux/4.4.4/crtfastmath.o /opt/cray/cce/8.2.5/craylibs/x86-64/no_mmap.o /opt/cray/cce/8.2.5/craylibs/x86-64/libcraymath.a /opt/cray/cce/8.2.5/craylibs/x86-64/libcraymp.a /opt/cray/atp/1.7.1/lib/libatpsighandler.a /opt/cray/atp/1.7.1/lib/libatpsighcommdata.a " i want output - output_list = [/opt/gcc/4.4.4/snos/lib/gcc/x86_64-suse-linux/4.4.4, /opt/gcc/4.4.4/snos/lib/gcc/x86_64-suse-linux/4.4.4, /opt/cray/cce/8.2.5/craylibs/x86-64, /opt/cray/cce/8.2.5/craylibs/x86-64, /opt/cray/cce/8.2.5/craylibs/x86-64, /opt/cray/atp/1.7.1/lib, /opt/cray/atp/1.7.1/lib] and want remove duplicates in output_list list look...

visual studio 2013 - Resharper "Namespace Provider" option does not appear for my folders -

Image
when click folder in solution, expecting see namespace provider option in properties window, want set false (to avoid resharper warning). this option not appear of folders in solution. appear 2 of colleagues, not me , 1 other colleague. we using same solution, on vs2013 (12.0.30110.00) r# 8.2 (8.2.0.2160). could there r# setting may have turned on disables functionality? edit 1: to clarify, selecting actual folders opposed "solution folders" . edit 2: screenshot of brand new solution: do have teamcity plugin installed in visual studio? teamcity plugin known root of evil such case http://youtrack.jetbrains.com/issue/tw-35714 . , fixed in new version of teamcity plugin. possible solution - uninstall teamcity plugin.

multithreading - Is it legal that the index for !$omp atomic different from its host's loop index variable? -

i came across question when learning how avoid data conflict multiple threads potential reading , writing using openmp directive !$atomic. shown in text below code snippet made question. wondering if legal in fortran use different index (here j ) !$atomic loop index variable i , 1 following directive !$omp parallel private(a,b) ? thanks. program main ... integer :: i,j integer, dimension(10000) :: vx,vy,va,vb ... va=0 !$omp parallel private(j) i=1,10000 j=merge(vx(i),vy(i),mod(i,2)==1) !$omp atomic update va(j)=va(j)+vb(j) end !$omp end parallel ... end program furthermore, ok loop on atomic directive? program main ... integer :: i,j integer, dimension(10000) :: vx,vy integer, dimension(12,10000) :: va,vb ... va=0 !$omp parallel private(j,k) i=1,10000 j=merge(vx(i),vy(i),mod(i,2)==1) k=1,12 !$omp atomic update va(k,j)=va(k,j)+vb(k,j) enddo end !$om...

c# - ComboBox Array Selection Display -

hi created array of student , grades question how make if select student sam index 0 , display first array of grades inside combobox. code write tie them together. if me thankful. private void form1_load(object sender, eventargs e) { string[] student = { "sam", "dean", "nick", "shara", "kat" }; cbostudent.items.addrange(student); cbostudent.selectedindex = 0; string[] s1grade = { "math: 78", "english: 56", "bio: 94", "art: 67", "science: 64", "pe: 85", "social: 89" }; cbogrades.items.addrange(s1grade); string[] s2grade = { "math: 45", "english: 84", "bio: 56", "art: 67", "science: 78", "pe: 45", "social: 76" }; cbogrades.items.addrange(s2grade); string[] s3grade = { "math: 68", "english: 34", "bio:...