Posts

Showing posts from July, 2014

javascript - Make anchor tags behave like checkboxes and radio buttons -

i have unordered list like: <ul class="list-one"> <li><a href="#">hip hop</a></li> <li><a href="#">country</a></li> <li><a href="#">pop</a></li> <li class="selected"><a href="#">religious</a></li> </ul> i want anchors behave checkboxes. have similar list , want checkboxes there behave radio buttons. is there way using jquery? searched google couldnt find anything. you can work jquerys parent() , siblings() methods. check jsfiddle demo radios ! jquery radio: $(".list-one a").click(function(){ $(this).parent().addclass("selected").siblings().removeclass("selected"); }); jquery checkboxes : $(".list-one a").click(function(){ $(this).parent().toggleclass('selected'); }); if need radios form, can use label instead of

compilation - Building Vim .debs on Ubuntu -

from vim site: sudo apt-get install mercurial libssl-dev sudo apt-get build-dep vim hg clone http://hg.debian.org/hg/pkg-vim/vim cd vim hg checkout unstable debian/rules update-orig dpkg-buildpackage -i -i cd .. it looks there no commands called debian/rules on system. the wikia vim tips site not complete , ignores hard work of packagers of vim. standard way build debian or ubuntu binary package source package. using source packages far better solution people. pkg_basics.en.html#s-sourcebuild the upstream site https://code.google.com/p/vim/ indeed hosted mercurial , there github clone https://github.com/b4winckler/vim few people need bleeding edge sources. build-deps pretty significant. the debian vim maintainers use mercurial maintain packaging per debian/readme.source @ http://hg.debian.org/hg/pkg-vim/vim , debian developers commit access can packaging uses quilt maintain patches @ url ssh://hg.debian.org/hg/pkg-vim/vim information debian binary packages

gfortran - Breakpoints are not hit when debugging Fortran using Eclipse. -

i have problem when debugging fortran using eclipse (i use gfortran compiler). can't set breakpoints, or, more precisely, "parallel breakpoints" type available (the green ones). when start debugging, program executed (whereas want stop, of course, whenever breakpoint hit). i'm used programming in matlab have started learning fortran, faster; got crazy debugging issue (matlab lot easier debug; doble-click set breakpoint , press f5, or f11 if want step in). it bug in ide, see bug 384187 . using latest photran version? @ how set breakpoints using photran ide in eclipse? claimed bug has been fixed. if works (which should), debugging in eclipse easy in matlab. fortran has long history in numerical computations why have such vast amount of legacy fortran code. however, if started learning new programming language either learn c or c++.

tcl - Can't pack a widget inside a sibling toplevel -

i'm trying pack (or place ) widget child of root toplevel . inside toplevel, child of . itself. is, % toplevel .tl .tl % frame .f .f % pack .f -in .tl can't pack .f inside .tl however, i've found code almost works: % frame .tl .tl % frame .f .f % pack .f -in .tl % wm manage .tl i said almost , because .f not visible. it's bit strange, because if put button inside .f , such as button .f.b -text foobar pack .f.b i see empty space reserved geometry manager, no widget visible. i'm sure i'm doing wrong, don't know , why, , pack , grid , place man pages don't help. edit: details i'm doing i'm trying build snit widget automates toplevel creation stuff. 1 thing putting ttk::frame inside every toplevel create, , managing using pack ... -fill both -expand true command. my snidget should it, i'd hide user perspective, change implementation wouldn't break existing code. the simple way this snit::widget toplevel

jquery - How to pass event to named function on.('click')? -

i have following trigger in jquery: $('.text').on('click', '.readless', contract); in contract, want use event.preventdefault() doesn't work in firefox, need pass event contract. how do this? you can this: $(function () { // attach event // new way (jquery 1.7+) - on(events, selector, handler); $('.text').on('click', '.readless', contract); function contract(e) { e.preventdefault(); alert(e.type); } // create elements dynamically $('.text').append('<div class="readless">click me</div>'); }); after adding reference of function contract on() method, event or e variable automatically passed function first argument. fiddle

iphone - IMvxResourceLoader: How to use it (MvvmCross v2) -

what steps need followed use imvxresourceloader (mvvmcross v2) in our project. tried follows public class aboutviewmodel : baseviewmodel, imvxserviceconsumer { private const string filename = "html/aboutapp.html"; public aboutviewmodel() { var resourceloader = this.getservice<imvxresourceloader>(); string helptext = resourceloader.gettextresource(filename); } } but failed. if remove lines inside aboutviewmodel(), app working fine. if use these lines, not able display view model. any suggestion? in advance. in addition this i trying initialise "resourceloader" plugin as private void initialiseplugins() { cirrious.mvvmcross.plugins.location.pluginloader.instance.ensureloaded(); cirrious.mvvmcross.plugins.phonecall.pluginloader.instance.ensureloaded(); cirrious.mvvmcross.plugins.sms.pluginloader.instance.ensureloaded(); cirrious.mvvmcross.plugins.email.pluginloader.instan

database design - SQL - Linking two tables -

i have 2 tables, specifically, contain standard , specific parameters respectively. table1: pkparameter name unit 1 temperature k 2 length mm 3 pressure bar table2: pkspecparam name unit 1 weight kg 2 area m2 pkparameter ans pkspecparameter primary keys i combine these 2 tables third table keep track of primary keys can reference of parameters, regardless of table from. for example: pkcombined pkparameter pkspecparameter 1 1 null 2 2 null 3 3 null 4 null 1 5 null 2 now use pkcombined primary key reference parameter maybe there better way this, i've started meddling databases. select a.pkparameter , a.name,a.unit,b.pkspecparam , b.name,b.unit table1 outer join table2 b o

python - What is this dictionary assignment doing? -

i learning python , trying use perform sentiment analysis. following online tutorial link: http://www.alex-hanna.com/tworkshops/lesson-6-basic-sentiment-analysis/ . have taken piece of code mapper class, excerpt of looks this: sentimentdict = { 'positive': {}, 'negative': {} } def loadsentiment(): open('sentiment/positive_words.txt', 'r') f: line in f: sentimentdict['positive'][line.strip()] = 1 open('sentiment/negative_words.txt', 'r') f: line in f: sentimentdict['negative'][line.strip()] = 1 here, can see new dictionary created 2 keys, positive , negative, no values. following this, 2 text files opened , each line stripped , mapped dictionary. however, = 1 part for? why required (and if isn't how removed?) the loop creates nested dictionary, , sets values 1, presumably use keys way weed out duplicate values. you use sets instead , av

c++ - How to test lambda in C++11 -

normally, test if pointer points function, use std::is_function enough. however, cannot work lambda. since lambda object operator() . now have use both is_function , is_object check if 1 works function, below: std::is_function<decltype(f)>::value || std::is_object<decltype(f)>::value so i'm wondering if there better way test if 1 lambda or not? edit: related code: template<typename func> void deferjob(func f, int ms=2000) { if(! std::is_function<decltype(f)>::value && ! std::is_object<decltype(f)>::value){ qdebug()<<"not function!"; return; } qtimer* t = new qtimer; t->setsingleshot(true); qobject::connect(t, &qtimer::timeout, [&f, t](){ qdebug()<<"deferjob"; f(); t->deletelater(); }); t->start(ms); } edit2: similar question: c++ metafunction determine whether type callable

java - Spring data JPA - Exclude ID column from one entity parameter -

i have 2 entities : @entity public class car { @id private long id; @onetoone private engine engine; } and other 1 : @entity public class engine { @id private long id; @column private string value1; @column private string value2; } in jparepositoy interface, : public interface carrepository extends jparepository<car, long> { public car findbyengine(engine engine); } but method doesn't return entity stored, because created engine doing : engine engine = new engine("somevalue", "somevalue"); without setting engine's id stored in database. so know if possible exclude column id ? if no, way : @query("select c car c c.engine.value1 = :value1 , c.engine.value2 = :value2") findbyengine(@param("value1") string value1, @param("value2") string value2) ? related question : if have onetomany relationship instead of onetoone, like @entity public class car

java - Android dynamically add custom component to LinearLayout -

i want add custom component on linearlayout whenever touch button. this code: layoutinflater vi = (layoutinflater) getapplicationcontext().getsystemservice(context.layout_inflater_service); linearlayout root = (linearlayout) findviewbyid(r.id.layout_cartelle_immagini); view custom = vi.inflate(r.layout.custom_list_folder, null); textview textview = (textview) custom.findviewbyid(r.id.label_pathfolder); textview.settext(pathdirectory); spinner spinnerlevel = (spinner) custom.findviewbyid(r.id.spinner_level); try{ root.addview(custom); }catch(throwable e) { log.e("burgerclub", "mex: " + e.getmessage()); e.printstacktrace(); } in way, first custom component added, why? thanks edit: i've modified code: linearlayout.layoutparams params = new linearlayout.layoutparams( linearlayout.layoutparams.wrap_content, linearlayout.layoutparams.wrap_content); ((viewgroup) root).addview(custom, mycount, params); this custom component: <relative

Multiple Internet Explorer Installer/Folder Trick? -

awhile co-worker had shown me how run multiple versions internet explorer (6,7,8,9) versions on pc (windows 7) by swapping them installed ie version. from remember, method consisted of similar to: uninstall current ie install ie6 copy ie6 folder , store somewhere else. repeat step 2 & 3 ie 7,8,9 (you had in order since ie doesn't allow install previous versions on newer versions) after installing versions needed, when wanted switch different ie version, swap folders copied installed folder. the end result opening internet explorer application run version swapped in. actually, can't remember if step #3 folder needed store or maybe install file needed save , drag on when wanted switch. but, remember being able switch between ie versions replacing current ie folder whatever saved each installed version. i tried searching everywhere , couldn't find guide. has ever come across trick or use trick? if so, can share how reproduce it? note: yes, know

java - How to get locale within JSTL with dash as separator? -

pagecontext.request.locale return locale "en_us" but current javascript library (dojo) seeking 'en-us', 'es-es'..etc is there api use other customized javascript function so? the locale class has tolanguagetag() method want: http://docs.oracle.com/javase/7/docs/api/java/util/locale.html#tolanguagetag()

Javascript Summation -

i'm attempting create autosummation tool not count blank cells. it's counting 1, count more later. returns nan number entry. var _num1 = document.getelementbyid('num1'); var _sum = document.getelementbyid('sum'); _num1.onblur = function summation(){ _sum.value = 0; _sum.value = (parseint(_sum.value,10) + (isnan(_num1) ? 0 : _num1.value)); }; html num 1: <input type="text" id="num1" name="num1" value=""><br/> sum: <input type="text" id="sum" name="sum" value=""> please try this: var _num1 = document.getelementbyid('num1'); var _sum = document.getelementbyid('sum'); _num1.onblur = function summation(){ _sum.value = 0; var num1 = parseint(_num1.value, 10); _sum.value = isnan(num1) ? '0' : num1; };

express - Expressjs Invalid JSON when data is just a string -

Image
searching has proven difficult, since people asking have object have serialized (incorrectly). i sending string . not object, string . here request right before it's fired off. json.parse can handle payload fine. string double quoted, per the spec . express js gives simple error: error: invalid json . need send string payload? by default express.bodyparser() , based on connect json middleware operates in strict mode . strict mode parse objects or arrays, sticking strictly json spec. json built on 2 structures: a collection of name/value pairs. in various languages, realized object, record, struct, dictionary, hash table, keyed list, or associative array. an ordered list of values. in languages, realized array, vector, list, or sequence. if want non-strict version, can optionally using option use json.parse , ok parsing string representation of raw json value 'true', '"stackoverflow"', '42', , on. ap

java - How to store and read a String out of a fixed-length byte array? -

i have byte array of fixed length, , want store string in it. like: byte[] dst = new byte[512]; string foo = "foo"; byte[] src = foo.getbytes("utf-8"); (int = 0; < src.length; i++) { dst[i] = src[i]; } but when want read string value out of dst, there's no way know string terminates (guess there's no notion of null terminators in java?). have store length of string in byte array, read out separately know how many bytes read byte array? 1. length + payload scenario if need store string bytes custom-length array, can use first 1 or 2 bytes notion of "length". the code like: byte[] dst = new byte[256]; string foo = "foo"; byte[] src = foo.getbytes("utf-8"); dst[0] = src.length; system.arraycopy(src, 0, dst, 1, src.length); 2. 0 element scenario or can check array, until find 0 element. there's no guarantee first 0 -element find 1 need. byte[] dst = new byte[256]; string foo = "foo&qu

wso2 - wso 2 API manager: how to configure multiple user store -

i follow guide: http://docs.wso2.org/wiki/display/am140/multiple+user+stores , add new userstoremanager,but issue exception , can not work [2013-08-07 23:59:33,668] info - agentholder agent created ! [2013-08-07 23:59:33,715] info - agentds deployed agent client [2013-08-07 23:59:37,910] error - databaseutil table "um_role" not found; sql statement: select um_id um_role um_role_name=? , um_tenant_id=? [42102-140] org.h2.jdbc.jdbcsqlexception: table "um_role" not found; sql statement: select um_id um_role um_role_name=? , um_tenant_id=? [42102-140] @ org.h2.message.dbexception.getjdbcsqlexception(dbexception.java:327) @ org.h2.message.dbexception.get(dbexception.java:167) @ org.h2.message.dbexception.get(dbexception.java:144) ... ======================================================================== anybody know how correct configure it? i believe have defined multiple jdbc user stores,by following wiki doc[1]. if,y

.net - QTAgent32.exe has stopped working -

i have vs2012/.net4.5 solution huge number of unit tests when running unit tests solution randomly getting "qtagent32.exe has stopped working" error message , unit tests hangs @ point. my unit tests mstest , run them using resharper menu vs. resharper edition 7.1.3, not sure if matters. vs 2012 sp 3 eventually found reason one piece of code written incorrectly , under curcumstances caused endless recursion , stack overflow. if getting same error " qtagent32.exe has stopped working " try check call stak @ point.

asp.net - form control values are not reloaded on postback -

i in process of migrating user controls 1 version of project new version. there errors in project while trying change version, created new project , started copying pages , controls. have got of controls copied over, , in process of copying on pages. testing go. with being said, working on control , noticed having problems required field validators. these fields not dynamic, there. fields failing tests required validators had data in them. there 3 having problems. 3 text fields. able convert 2 of validators custom validators , able them working, third still not work. the custom validator not working fails because value page not reloaded in control. when check posted form using control's unique id, data exists. cause disconnect? understand controls supposed reloaded post data before control's events fired. appears process broken. happening? the fields in question txttitle, txtdescription, , txtsendnoticeto. html: <%@ control language="vb" autoeventwire

Import statement doesn't work as expected with Python 3.3 -

i ported django application python 2.7 python 3.3 django1.6b1. my import statements wouldn't work anymore custom module imports (user, views...) , had add dot before these imports. why ? example : import emailuser #worked python 2.7 doesn't work 3.3 import .emailuser #works not bug; python 3 forces explicit relative imports. from docs : the acceptable syntax relative imports from .[module] import name . import forms not starting . interpreted absolute imports. ( pep 0328 )

Linux C Serial Port Reading/Writing -

i'm trying send/receive data on usb port using ftdi , need handle serial communication using c/c++. i'm working on linux (ubuntu). basically, connected device listening incoming commands. need send commands , read device's response. both commands , response ascii characters . everything works fine using gtkterm but, when switch c programming, encounter problems. here's code: #include <stdio.h> // standard input / output functions #include <stdlib.h> #include <string.h> // string function definitions #include <unistd.h> // unix standard function definitions #include <fcntl.h> // file control definitions #include <errno.h> // error number definitions #include <termios.h> // posix terminal control definitions /* open file descriptor */ int usb = open( "/dev/ttyusb0", o_rdwr| o_nonblock | o_ndelay ); /* error handling */ if ( usb < 0 ) { cout << "error " <<

Loop through JSON Array into android sql lite database by tag? -

i have function gets json. here format question of json. [{"chapternum":"1","courseid":"37","chapterid":"30"}, {"chapternum":"2","courseid":"37","chapterid":"31"}, {"chapternum":"3","courseid":"37","chapterid":"32"}] i want take "chapternum" value , store android sqlite database. i confused how loop through , put db... for previous db entry this. public long addstudentinfotodb(string stuid,string stufname, string stulname) { contentvalues student_info = new contentvalues(); student_info.put(stu_id, stuid); student_info.put(stu_fname, stufname); student_info.put(stu_lname, stulname); return mdb.insert("student", null, student_info); } so thinking like public long addchapterstodb() { contentvalues chapter_info = new contentvalues();

php - If IDs from two different tables are equal, display name from another table -

i'm writing code little admin panel, , since i'm not advanced of coder, i'm experiencing troubles getting name using 2 different tables. here's code far: <?php session_start(); if(!session_is_registered(myusername)){ header("location:main_login.php"); } include 'db_connect.php'; $sql = "select * $tbl_name is_dead='0'"; $result=mysql_query($sql); ?> <title>title</title> <center><img src="header.png"></center> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td> <table width="400" border="1" cellspacing="0" cellpadding="3"> <tr> <? include 'menu.php';?> </tr> <tr> <td align="center"><strong>id</strong></td> <td align="center"><strong>unique id</strong></td&g

date - PHP days difference -

hello i'm trying make php script compares date 1 of database records , todays date, if difference in days greater 3, come out true. example: $todays_date = date("y-m-d"); <-- todays date $deal_date = $data["deal date"]; <-- date database $interval = date_diff($todays_date, $deal_date); <--difference if($interval >= 3) { (something) } but every time try error "date_diff() expects parameter 1 datetime, string given" know use date_diff both arguments have datetime, i'm not sure how today's date in date , how convert date database datetime. correct syntax is: <?php $datetime1 = date_create('now'); $datetime2 = date_create($data["deal date"];); $interval = date_diff($datetime1, $datetime2); $diff = $interval->format('%a'); if($diff >= 3) { (something) } ?>

how to get job counters with sqoop 1.4.4 java api? -

i'm using sqoop 1.4.4 , java api run import job , i'm having trouble figuring out how access job counters once import has completed. see suitable methods in configurationhelper class, getnummapoutputrecords, i'm not sure how pass job them. is there way @ job sqooptool or sqoop objects? my code looks this: sqooptool sqooptool = new importtool(); sqoopoptions options = new sqoopoptions(); options.setconnectstring(connectstring); options.setusername(username); options.setpassword(password); options.settablename(table); options.setcolumns(columns); options.setwhereclause(whereclause); options.settargetdir(targetdir); options.setnummappers(1); options.setfilelayout(filelayout.textfile); options.setfieldsterminatedby(delimiter); configuration config = new configuration(); config.set("oracle.sessiontimezone", timezone.getid()); system.setproperty(sqoop.sqoop_rethrow_property, "1"); sqoop sqoop = new sqoop(sqooptool, config, options); string[] n

php - bloginfo() executing out of order? -

i have following code in wordpress header.php file. printing dynamic title in html: <title> <?php if (is_page_template('page-home.php')){ echo 'home - ' . bloginfo('name'); } </title> the rendered html looks this: <title>my cool bloghome - </title> i believe should this: <title>home - cool blog</title> my question is: why echo , bloginfo() execution seem reversed? echoed text seems printing after bloginfo(). try using get_bloginfo instead. bloginfo() runs, , echos out when it's called. get_bloginfo() returns value, can include in echo statement. currently, bloginfo printing out value out it's called; echo statement echoed out.

jquery - Kendo Grid : disable row edit -

i have editable grid , want make rows non editable depending on conditions. can please advice how can this. thanks out of box, there no feature allows controlling edition per row based. can exit edition when row tried edit. there 1 event edit fired once cell enters in edition mode. can close cell detect conditions true. example: have grid following schema definition: schema : { model: { fields: { id : { type: 'number' }, firstname: { type: 'string' }, lastname : { type: 'string' }, city : { type: 'string' } } } } and don't want allow edition of rows city seattle . edit handler should defined as: var grid = $("#grid").kendogrid({ datasource: ds, editable : true, edit : function (e) { // e.model contains model corresponding row being edited. var data = e.model; if (data.city === "seatt

javascript - Toggle Between two Divs -

i facing problem in making toggle effect jquery between 2 divs . @ poor level on jquery. , knowledge failed make toggle between 2 divs . current code in js fiddle : http://jsfiddle.net/wscbu/ i have 3 divs class name blue , gray , orange . trying make : when page loads 2 div blue , gray show , when click text "show" on gray div gray div hide , orange div show . , when click "hide" text in orange div orange div hide , again show gray div . may can done toggle function ? not sure how . hope experts may easy 1 ! thankful if show me process . here html <div class="blue"></div> <div class="gray"> <p> show --> </p> </div> <div class="orange"> <p> -- hide </p> </div> css .blue{ height:100px; width:250px; background:#1ecae3; float:left; } .gray{ height:100px; width:100px; background:#eee; float:left; } .orange{ height:100px; width:150px; backg

objective c - Replace occurrences of two characters with each other in a string -

i have problem need invert 2 characters within string. example, if string "a*b/c" , want replace occurrences of * / , / *. want resulting string "a/b*c". using method stringbyreplacingoccurrenceofstring: doesn't work because don't want first round of replacements affect second: string = @"a*b/c"; [string stringbyreplacingoccurrencesofstring:@"*" withstring:@"/"]; [string stringbyreplacingoccurrencesofstring:@"/" withstring:@"*"]; this results in "a*b*c", not want. know efficient way of accomplishing this? string = @"a*b/c"; [string stringbyreplacingoccurrencesofstring:@"*" withstring:@"&"]; [string stringbyreplacingoccurrencesofstring:@"/" withstring:@"*"]; [string stringbyreplacingoccurrencesofstring:@"&" withstring:@"/"];

sql - Access deletes query after macro exports to excel "Query must have at least one destination field" -

ms access randomly deletes sql query's content when non-vba macro exports query contents excel. initial export works , data exported excel correctly, (about 50% of time...) sql underlying query goes missing. definitely triggered export (one can before , after comparison of query). the following site references problem , talks vba solution automaticaly rebuilds sql query. i'd prefer prevent happening rather fixing post-mortem. this forum post on bytes.com discusses issue. suggested solution not relevant. the problem database designed in access 2007 , being used in access 2010. queries , macros involved in issue created using access 2007. these components stable in access 2007. leads me believe problem not contained within sql. sql queries simple select statements, there no inserts, drop or make table commands. did try using expression builder represent query in access language? double click 'criteria' in query design window, , build expression. fo

.net - how to convert parent object with child object list into xml file using c#? -

i have parent table class , child table subject. have created objects of these classes , child objects added list in parent class. want read parent table data using linq , convert xml file using xml serialization. here's code classmaster cls = new classmaster();list<classmaster> clslist = cls.findall().where(t => t.classsymbol == "i").tolist(); var serializer1 = new xmlserializer(cls.findall().gettype()); classmaster cls = new classmaster(); var stringwriter = new system.io.stringwriter(); var serializer = new xmlserializer(cls.gettype()); serializer.serialize(stringwriter, cls); but throwing exception in line 3 "cannot serialize member 'school.objects.classmaster.classsubjectlist' of type 'system.collections.generic.ilist`1[[school.objects.classwisesubject, school.objects, version=1.0.0.0, culture=neutral, publickeytoken=null]]'" public class classmaster : genericrepository<classmaster> { public

.net - The server tag is not well formed error after migrating the code to ASP.NET 4.0 -

i have following piece of code works fine on vs2008 , .net3.0, fails after migrating vs2010 , .net 4.0 i getting error: server tag not formed below code, please advice! <td valign="top" align="center" class="crmtdlabelsinglecolnobold"> <input id="radcustomaudittype" name="<%#"audittype"%>" type="radio" runat="server" value="<%#databinder.eval(container.dataitem, "audit_type_code") & "," & if(databinder.eval(container.dataitem, "custom_audit_survey_id") isnot dbnull.value, databinder.eval(container.dataitem, "custom_audit_survey_id").tostring(), "") %>" "<%# iif(databinder.eval(container.dataitem, "audittype") = true , checkboxcustomaudittype = true, " checked=""true""", "")%>" "<%# iif(checkboxcustomaudittype = false or databin

Unable to save array to NSUserDefaults -

this first attempt @ using nsuserdefaults. i've read every question & answer posted in stackoverflow regarding subject, still can't work. must missing basic. array (allcontacts) merely contains few names , phone numbers. unless i'm misunderstanding what's happening, both fields nsstrings. or pointers strings? if that's case, how convert them actual nsstrings? here's code save array: - (bool)savechanges { nsmutablearray *mutablearray = [[nsmutablearray alloc] initwitharray:allcontacts]; [[nsuserdefaults standarduserdefaults] setobject:mutablearray forkey:@"allcontacts"]; [[nsuserdefaults standarduserdefaults] synchronize]; return 1; } here log: 2013-08-07 15:48:17.568 imok[5515:907] *** -[nsuserdefaults setobject:forkey:]: attempt insert non-property value '( "brad pitt, 1-917-297-1234", "marilyn monroe, 9179291234" )' of class '__nsarraym'. note dictionaries , arrays in property

c++ - why simple grammar rule in bison not working? -

i learning flex & bison , stuck here , cannot figure out how such simple grammar rule not work expected, below lexer code: %{ #include <stdio.h> #include "zparser.tab.h" %} %% [\t\n ]+ //ignore white space from|from { return from; } select|select { return select; } update|update { return update; } insert|insert { return insert; } delete|delete { return delete; } [a-za-z].* { return identifier; } \* { return star; } %% and below parser code: %{ #include<stdio.h> #include<iostream> #include<vector> #include<string> using namespace std; extern int yyerror(const char* str); extern int yylex(); %} %% %token select update insert delete star identifier from; zql : select star identifier { cout<<"done"<<endl; return 0;} ; %% can 1 tell me why shows error if try put "select * something" [a-za-z].*

c# 4.0 - Passing strongly-typed data from a View to a Controller -

i've got stringly-type view defined using @model mynamespace.customer form created using html.beginform( "newcustomer", "customerreg", formmethod.post ) helper. the newcustomer action on customerregcontroller controller looks [httppost] public viewresult newcustomer( mynamespace.customer objcustomer ) i "filling" model-bound fields on page portion of customer fields. when submit correct action, objcustomer initial values. though pass strongly-typed data way; doing wrong? the fact view typed @model mynamespace.customer doesn't mean model somehow automagically posted action when form submitted. need have input fields each property want retrieve inside form if want property passed post action. also make sure customer object poco default (parameterless) constructor each property retrieve has public getters , setters. otherwise default model binder never able deserialize request model. ideal solution problem use view model cla

.net - WPF Handedness with Popups -

Image
i moved pc windows 8 windows 7 , while running our wpf application noticed our wpf popups and/or tool tips in lower-left default instead of normal lower right. has noticed this? know can specify location on each tooltip in xaml, have lot of tool tips , popups. want know if there way specify default location globally in wpf app. google hasn't yielded many results on subject. have reason keep them in same original default position (some popups have content relative start position). windows 8: (lower left) windows 7: (lower right) same code! standard "tooltip" xaml attribute. any ideas? resolved , posted comments ok, have found issue. has tablet pcs/touchscreens. (left handed.. right handed preference) other link provided reason. working on solution resolve now. ill post details soon! windows 8 popup location thanks @traviswhidden solution. implemented improved version of listens staticpropertychanged event, i'll paste in here beca

ruby - How to execute view code stored in string in run time with eval in rails 3.2 erb? -

what trying store chunk of erb code in string , execute code in run time . here test did : 1. take out chunk of code working erb file and, 2. rewrite erb file eval. here chunk of erb code taken out: <tr> <th>#</th> <th><%= t('date') %></th> <th><%= t('project name') %></th> <th><%= t('task name') %></th> <th><%= t('log') %></th> <th><%= t('entered by') %></th> </tr> <% @logs.each |r| %> <tr> <td><%= r.id %></td> <td><%= (r.created_at + 8.hours).strftime("%y/%m/%d")%></td> <td><%= prt(r, 'task.project.name') %></td> <td><%= prt(r, 'task.task_template.task_definition.name') %></td> <td><%= prt(r, :log) %