Posts

Showing posts from September, 2015

How to set a border for android Imageview in Longpress? -

in android application want set border imageview when long pressed. want remove same(border) when user releases view. please anyone, me in this? @override public boolean ontouchevent(motionevent event) { switch (event.getaction()) { case motionevent.action_down: { mtouchdownx = (int) event.getx(); mtouchdowny = (int) event.gety(); break; } case motionevent.action_move: { int x = (int) event.getx(); int y = (int) event.gety(); if (mdraggeditem >= 0) { setdraggeditemposition(x, y); int index = getindexfromcoordinates(x, y); if (index == mdraggeditem || index < 0) break; if (index < mdraggeditem) { (int = index; < mdraggeditem; i++) { moveviewtoposition(i, i+1); } (int = mdraggeditem-1; >= index; i--) { ...

java - Cast from Object to List<String>: CastClassException -

i'm using touchdb ektorp in android app access couchdb the json document i'm accessing has array of categories: categories: ['cat1', 'cat2'] in view query i'm trying access array classcastexception when trying convert result object list: public void map(map<string, object> document, tdviewmapemitblock emitter) { object dateadded = document.get("dateadded"); object expirydate = document.get("expirydate"); boolean expired = false; if(expirydate!=null){ expired = comparedate.isitemexpired(expirydate); } list<string> test = (list<string>)document.get("categories"); the .get() method works fine single json fields. ideas? document declared map<string, object> so when .get() - return object. there's no direct mapping (list<string>) exception saying need cast object rather list. you ch...

c++ - Linux and Windows millisecond time -

i want milliseconds time of system (i don't care if it's real time, want accurate possible). method it? #ifdef win32 unsigned long long freq; unsigned long long get_ms_time() { large_integer t; queryperformancecounter(&t); return t.quadpart / freq; } #else unsigned long long get_ms_time() { struct timespec t; clock_gettime(clock_monotonic, &t); return t.tv_sec * 1000 + t.tv_nsec / 1000000; } #endif how can wrap value signed int? tried doing , negative values (on linux, don't know on windows): ~ start -2083002438 ~ 15 seconds after.. -2082987440 ~ 15 seconds after.. -2082972441 i this. ~ start x ~ 15 seconds after.. x + 14998 ~ 15 seconds after.. x + 29997 where x positive number. (i want output positive , increasing) i in code... timespec specstart, specstop; // start time ( unix timestamp ) in seconds... clock_gettime( clock_monotonic_raw, &starttime ); int starttimeint = starttime.tv_se...

what is actual difference between NSString and NSMutable String in objective C with the help of example? -

this question has answer here: what purpose of having both nsmutablestring , nsstring? 4 answers what difference between nsstring , nsmutablestring? [duplicate] 4 answers what actual difference between nsstring , nsmutable string in objective c? have searched lot not getting answer..i understand nsstring immutable object , nsmutablestring mutable object want understand difference between them of example..please me.. now question has solved.. immutable string..... nsstring *str1 = @"hello testing"; nsstring *str2 = str1; replace second string str2 = @"hello hehehe"; and list current values nslog(@"str1 = %@, str2 = %@", str1, str2); //logs below //str1 = hello testing, str2 = hello hehehe mutable strings setup 2 var...

android - Proguard: Blank screen after exiting webview or browser -

i enabled proguard using following info tried both popular answers enabling proguard in eclipse android . when hit button webviewactivity or browser (started intent in application), app shows blank screen, if disable proguard behaviour normal. note: happens when hit button, webview or content shown properly. if project uses webview js, uncomment following , specify qualified class name javascript interface class: -keepclassmembers class fqcn.of.javascript.interface.for.webview { public *; } from auto generated proguard-project.txt file.

ios - Change camera and device orientation -

i have application view , when user click button, camera visualization starts. i want allow orientations when camera isn't showed, when camera showed, need force application portrait mode because if isn't on portrait, video rotated. when camera closed, app may rotate again. do know if can solve problem video orientation? or how can force app portrait mode? know on earlier ios version, can use [uidevice setorientation:] , it's deprecated lastest ios. how can ios 5 , ios 6? i've tried with: [self presentviewcontroller:[uiviewcontroller new] animated:no completion:^{ [self dismissviewcontrolleranimated:no completion:nil]; }]; and in shouldautorotatetointerfaceorientation method: if (state == camera) { return (interfaceorientation == uiinterfaceorientationportrait); }else{ return yes; } it works ok , force app portrait. when camera closed, doesn't work properly, doesn't rotate well. i mean, when camera closed happens: ...

jquery - Perform action in series -

i trying perform action in series here in code alert message printed firat though have written after action. this fiddle have tried . http://jsfiddle.net/wggua/635/ $(document).ready(function() { var a=1; settimeout(function() { $('#dvdata').fadeout(); }, 2000); if(a==1) { alert("value s 1"); } else { alert("value 0"); } }); please help, your code says: "run fade out function in 2 seconds. alert something." if want alert appear after fade out function runs, need put code inside function runs in 2 seconds too.

jquery - How to use bootstrap tooltip? -

i have used bootstrap tooltip not working <a href="#" data-original-tittle="test" data-placement="right" rel="tooltip" target=" _blank"> hover me </a> or need use jquery? try add tooltip like <script type="text/javascript"> $(function(){ $('[rel="tooltip"]').tooltip(); }); </script> or can directly select as $('a').tooltip(); or try it <a href="#" data-toggle="tooltip" data-original-title="tooltip on right">hover me</a> and script like $(function() { $('a').tooltip({placement: 'right'}); }); my ultimate fiddle here

analysis - Cloudera Navigator Performance evaluation -

i wanted know performance analysis of cloudera navigator based on below aspects: 1) can add multiple cloudera navigator server installed in cluster load balancing. 2) there limit on number of events handled navigator server/queue. happened if queue flooded events. 1) cloudera navigator based on solr, open source search tool. solr has ability load balancing believe cloudera navigator too. tool bit new still i'd assume might run few hiccups when trying this, should possible. 2) believe limitation here space metadata stored navigator takes up. ran issue filling small (<2 gb) drive moved larger drive. cut , paste metadata , again searchable through navigator.

templates - C++: Conversion from T to unsigned T -

we excessively use templates , cannot tell signedness of type @ hand, need techniques hide warnings optimized out. have simple assert(condition) macro throws if condition not evalutes true. the goal check range of t typed count value. need @ least zero, @ max of size_t . template<typename someintegral> someintegral zero() { return someintegral(0); } template<typename t> class c { public: void f(t count) { std::vector<std::string> ret; assert(count>=zero<t>()); // check #1 assert(count<std::numeric_limits<size_t>::max()); // check #2 ret.reserve(size_t(count)); // needs check #1 , #2 succeed. // ... } // ... }; the #1 check compiles without warning, #2 check says comparison between signed , unsigned integer expressions , because in particular case count has signed type. if assert((unsigned t) count < std::numeric_limits<size_t>::max()) or similar somehow... converting unsigned t safe in situation...

CSS Classes vs Grouped IDs Performance -

searched high , low. quite familiar css classes vs ids (vs selectors) performance, there lots of literature, including in these forums regarding topic. i ask whether better use css class or group ids, either performance or other advantage. example; the html; <p class="para-format">you know something?</p> <p class="para-format">this good</p> .... <p class="para-format">the last paragraph</p> vs <p id="para-format-01">you know something?</p> <p id="para-format-02">this good</p> .... <p id="para-format-0n">the last paragraph</p> the css; .para-format {color: #000000; margin: 0 auto; ...} vs #para-format-01, #para-format-02, ..., #para-format-0n {color: #000000; margin: 0 auto; ...} i know isn't best example i'm asking. thanks , regards, - botrot there no measurable difference between two, , since purpose o...

jquery - PHP five star rating - stars don't remain clicked -

i have used 5 star rating system(based on jquery , php) provided in link 1 of clients. now, want if user rates product many number of stars should remain highlighted in current scenario, once user moves out mouse stars no longer remain highlighted. i have tried lot mouseout functions conflicts click function. far, i'm using : html <div id="r1" class="rate_widget"> <div class="star_1 ratings_stars" id="1"></div> <div class="star_2 ratings_stars" id="2"></div> <div class="star_3 ratings_stars" id="3"></div> <div class="star_4 ratings_stars" id="4"></div> <div class="star_5 ratings_stars" id="5"></div> <div class="total_votes">vote data</div> </div> js - have tweaked bit on own no success. $(document).ready(function() { $(...

android - Unable to launch My first App on AVD -

i installed eclipse, created avd , able launch perfectly. tried launch first app using run -> 1 android application. there no response either eclipse or avd i accidentally used activity_main.xml instead of mainactivity.java , tried run it. so, didn't have response. problem solved.

javascript - access scope variable from directive by name, avoiding using eval -

i'm new angularjs , currently working example(fiddle) doesn't feel right. when try blur field should increment event.times , doing $apply on line 10, i'm asking there better way achieve ? maybe var times = scope.$get(attrs.timesfield); , scope.$apply(function(){ times += 1; }); whenever directive not use isolate scope , specify scope property using attribute, , want change value of property, use $parse : <input custom-field times-field="event.times" ng-model="event.title" type="text"> link: function (scope, element, attrs){ var model = $parse(attrs.timesfield); element.bind('blur', function(){ model.assign(scope, model(scope) + 1); scope.$apply(); }); } fiddle

Link tables/rows in sqlite -

in database have 3 tables, 1 customers, 1 orders , 1 products. customer can have number of orders , order can have number of products. how can implement relationship between 3 tables? information stored in database: customer: social security number, name, address, phone number order: order number, date product: product id, category, price ok here's start. first need id each table (an id unique identifier, if want customer x, there won't 2 customer x in table) customer u can use social security number (or create column called customer_id ) a customer can have number of orders, should put column in order know order belongs customer. in order add column called customer_id references customer_id in table customer so these 2 orders belong customer customer_id = 1: order_number date customer_id 1 1/1/2013 1 2 2/1/2013 1 customer_id in orders called foreign key the same goes rest. (ps : cha...

Use Eclipse to generate the java Classes corresponding to a ASN.1description -

i installed asn.1 editor plugin in eclipse , wrote code editor http://asneditor.sourceforge.net -- created: mon may 06 19:38:15 cest 2013 asn-module definitions automatic tags ::= begin client ::= sequence { lientnumber integer} server ::= sequence { lientnumber integer, serverstring string } end but don't found how use editor generate java classes corresponding asn.1 description you need use asn compiler that. can try one: http://sourceforge.net/projects/jac-asn1/

define global params in android -

want define global const parameters (arrs , int etc..) in 1 java file activity can reach them , use them. tried define them globaly in activity , import activity isn't work. in level_1_general: public int number_of_words=50; the import: import com.example.freeenglish.level1_general; what right way that? a common pattern create costants class private constructor in put every costants app need. eg public class costants { public static final int number_of_words=50; private costants() {} } then able access variable with costants.number_of_words

xslt - Running footer not visible on first page -

i using below xslt generate report running footer, first page of ther report doesn't have running footer, please advice needs changed <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:fo="http://www.w3.org/1999/xsl/format" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:my-scripts"> <xsl:template match="/" > <fo:root xmlns:fo="http://www.w3.org/1999/xsl/format"> <!-- defines layout master --> <fo:layout-master-set > <fo:simple-page-master master-name="first" page-height="290mm" page-width="210mm" margin-top="0mm" margin-bottom="10mm" margin-left="20mm" margin-right="0mm"> <fo:region-body margin-top=...

Is resident textures possible in OpenGL ES 1.1? -

is resident textures possible in opengl es 1.1 have in opengl? no; none of texture memory functions (e.g., glaretexturesresident , glprioritizetextures , etc.) included in version opengl es.

Weekly event manager code not working in javascript -

i have create weekly event manager in javascript . went wrong. code not working . please solve fault.whats wrong in ????? var plan=prompt("hello , made week plan. type week name add event"); var week = ["saturday" , "sunday" , "monday" , "tuesday"]; var saturday; var sunday; var monday; var tuesday; if( plan == "saturday" ) { var saturday=prompt("what in saturday?"); } else if ( plan == "sunday") { var sunday=prompt("what in sunday?"); } else if (plan == "monday") { var monday=prompt("var getknow=prompt(""what in monday?"); } else if (plan == "tuesday" ) { var tuesday=prompt("what in tuesday?"); } var getknow=prompt("do want cheack schedule? type week name"); if ( getknow == saturday) { alert(saturday); } else if (getknow == sunday ) { alert(sunday); } else if (getknow == monday) { alert(monday); } else if (getk...

permissions - How can I deploy an asp.net mvc2 app developed on SharpDevelop (windows 7 64bit) to the local iis 7.5? -

i'm using sharpdevelop , can test/see app using "use iis express web server" selected in project property. when try change "use local iis web server" , hit "create application/virtual directory", error message show said: filename: redirection.config error: cannot read configuration file due insufficient permissions at end, need deploy mvc 2 app iis server, first local server , remote server. the problem can solved running sharpdevelop admin.

.net - Microsoft.NET WS client: all operation and types, but no members -

i'm trying generate .net ws client wsdl + xsd. i've tried 2 ways same result: add web reference , wsdl.exe i've tried different framework versions, ide versions , different approaches (wcf , old style wss). the tools generate 2 interfaces correct operations , type defined in xsd schemas, none of types contain members defined in schema. my wsdl + xsds work on java platform (jax-ws via cxf, axis) , can produce clients , publishers. the published services can consumed via soapui, generate correct requests (with members defined in schemas). the same result given tools if use published wsdl url instead of local files. update : i've tried avoid wsdl:import , built valid single file wsdl. same result. one more consideration thie issue use type inheritance xsd:extension . there issues generating .net ws client feature? following suggestion answer question (not th 1 marked correct, 1 i've upvoted @ wsdl.exe error: unable import binding '......

javascript - customizing file upload to look same in all browsers -

this question has answer here: how customize <input type=“file”>? 14 answers how customize file upload, <input type="file" /> to same in browsers? want invoke file browser on clicking on custom styled button. you can overload style on upload button setting opacity of file upload 0 , putting div on top style want. e.g. <input style="opacity:0; position: fixed;" onchange="openfile(event)" type="file"> <div class="icon">open</div>

SSIS Package Conditional Split doesn't work -

i'm creating ssis package using visual studio 2008...i added conditional split isn't working. i'm selecting items oracle , need filter records. filter uses column "cod_check_point" , there 3 possible values column. tried not working. trim(cod_check_point) == (dt_wstr,3)168 || trim(cod_check_point) == (dt_wstr,4)9626 || trim(cod_check_point) == (dt_wstr,4)9627 with conditional query, other records have "cod_check_point" different possible values selected. if gets records "cod_check_point" equal 9626: trim(cod_check_point) != (dt_wstr,4)9626 i don't know happening , why it's happening. searched on internet , think i'm doing right i'm not getting successful. can me? thanks. update frikozoid, here print screens asked me: https://docs.google.com/file/d/0b1jl47_dxuimanb5uknxzuxpvk0/edit?usp=sharing p.s.: can't upload image in posts yet because don't have reputation. thanks!

How can I get highcharts Donut chart to auto calculate percentages -

how donut chart in highcharts auto calculate precentages of data sent . example data can data: [50.85, 7.35, 33.06, 2.81] , want know how can charts calculate inner pie chart (of donut chart) show or render percentages? use: this.percentage example jsfiddle : datalabels: { formatter: function() { return '<b>'+ this.point.name +':</b> '+ this.percentage +'%'; } } api: http://api.highcharts.com/highcharts#plotoptions.series.datalabels.formatter http://api.highcharts.com/highcharts#tooltip.formatter

ios - Increase height of UITableViewCell separator -

i have subclassed , colored tableview cells in tableview on view image. need increase height of cell separators. know has been asked before, difference cannot add view @ bottom of cells because need area transparent can see image under tableview. each cell populated data coredata. is there way increase height of tableview separators without creating blank 'filler' cell between each populated cell, or creating new section footer each cell? basically, need new cell separator style similar uitableviewcellseparatorstylesingleline more single line. possible? typically, add image view background view of table cell. example of image is: 3 pixel height image, 2 pixel transparent , 1 pixel black, stretched separator.

jQuery Mobile modification of header not persistent -

i have simple jquery mobile site has button in header. code is: <div data-theme="a" data-role="header" id="theheader"> <a href="/useradd" data-icon="puls" data-theme="b" data-iconpos="notext">a</a> <h1>header</h1> <a href="/usershow" data-icon="star" data-theme="b" data-iconpos="notext" id="notifybutton">x</a> </div> now have ajax changes data-theme of notifybutton like: setinterval(function () { $.get("/ajaxchecknotifications", function(data){ if (data != "0"){ $("#notifybutton").buttonmarkup({theme: 'c'}); }else{ $("#notifybutton").buttonmarkup({theme: 'b'}); } }); }, 2500) this works fine when load page (f5). but new page loaded through ajax loader th...

Can We Use PHP Session To Protect Files (Video, PPT, PDF, etc)? -

basically, want protect contents, videos, can watched online. (streaming) i know whatever can watched can recorded. but, let's put aside first... what want know is... there mechanism, method or algorithm use php session (username or password) open file stored in specific , hard-to-find folder, though file being stolen, thief won't anything. because don't have php session id (username , password). and, we're talking here web based environment means i'm not using desktop software protect files. is possible that? put file in folder above webroot. instead of accessing movie, have them access php file sends content-type header , readfile('path/to/file.movie'); in php file, check authorized session.

postgresql - Do text_pattern_ops comparators understand UTF-8? -

according postgresql 9.2 documentation, if using locale other c locale (en_us.utf-8 in case), btree indexes on text columns supporting queries select * my_table text_col 'abcd%' need created using text_pattern_ops so create index my_idx on my_table (text_col text_pattern_ops) now section 11.9 of documentation states results in "character character" comparison. these (non-wide) c characters or comparison understand utf-8? good question, i'm not totally sure tentative understanding is: here postgresql means "real characters" (eventually multibyte), not bytes. comparison "understands utf-8" always, or without special index. the point that, locales have special (non c) collation rules, want follow rules (and call respective locale libraries) when doing comparisons ( < , > ...) , sorting. don't want use collations posix regular matching , patterns. hence existence of 2 different types of indexes text.

backbone.js - ToDo backbone LocalStorage is file:// -

i have backbone todo app running locally , trying delete entries. "x" 's don't work. , if delete local storage through chrome dev tools , still reappear after reload. says "file://" in list hash value, cant find file. shouldn't work after delete reference anyway.whats going on here cant figure out? mike

ios - Updating cells with UIImageView to show currently selected item -

Image
i using sliding view controller holds main controller on top , slide left menu controller. the controller on left works menu facebook/pintrest apps etc. uitableview on left. here setup: cellforrowatindexpath static nsstring *cellidentifier = @"mainmenucell"; uitableviewcell *cell = (uitableviewcell *)[tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; uiview *topsplitterbar = [[uiview alloc] initwithframe:cgrectmake(0, 0, cell.bounds.size.width, 1)]; topsplitterbar.backgroundcolor = [uicolor colorwithred:62.0/255.0 green:69.0/255.0 blue:85.0/255.0 alpha:1]; [cell.contentview addsubview:topsplitterbar]; uiimage *arrowimage = [uiimage imagenamed:@"selectedarrow"]; self.arrowselectedview = [[uiimageview alloc] initwithframe:cgrectmake(240, 10, arrowimage.size.width, arrowimage.size.height)]; se...

c# - .Net application to use powershell active directory cmdlets in Windows7 machine -

i creating .net application (c#) active directory actions(restoring deleted objects). , application restores deleted objects when run application on domain controller. if run application on windows7 machine connected domain, not working , not getting error. there registered programmatically run power shell commands in windows7 machine other remote server administration tools?

php - AJAX post to external url -

this question has answer here: how send cross-domain post request via javascript? 17 answers i trying post data ajax external url following code: $(document).ready(function(){ $('.submit_button').click(function() { $.ajax({ type : 'post', url : 'http://site.com/post.php', datatype : 'text', data: $("#infoform").serialize() }).done(function(results) { alert(results); }); event.preventdefault(); }); }); but getting following error: xmlhttprequest cannot load http://site.com/post.php . origin null not allowed access-control-allow-origin. i have added the following line htaccess file on server header set access-control-allow-origin * would able tell me doing wrong , how can post data external...

.net - System.Windows.Forms.Timer is not Working in my WCF service -

i have created restful wcf service.whenever client calling service method have started timer interval below var timer = new timer(); timer.interval = convert.toint32(attempt); timer.tick += new eventhandler(timer_tick); var tempattempt = new tempattempt { alertinformationid = currentalertid, attempt = getattemptid(attempt), status = false, timerid = "timer" + currentalertid.tostring() }; if (createnewattempt(tempattempt)) { timer.tag = tempattempt.timerid; timer.enabled = true; timer.start(); } private void timer_tick(object sender, eventargs e) { //blah blah timer t = (timer)sender; } after starting timer tick not happened after particular interval.how can resolve this? my service [webinvoke(method = "post", requestformat = webmessageformat.json, bodystyle = webmessagebodystyle.bare, responseformat = webmessageformat.json, uritemplate = "/pushnotification")] [operationcontract] void pushnotificat...

SQL Server CE query error (unhandles exception). Executed from c# -

string query = "create table " + name + " (manpower_name nvarchar(50), instance int, start nvarchar(30), end nvarchar(30));"; i make of connection string in c# sql server ce database (a .sdf file). getting error, follows: there error parsing query. [ token line number = 1,token line offset = 77,token in error = end ] executed function: public void create_proj_table(string name) { string query = "create table " + name + " (manpower_name nvarchar(50), instance int, start nvarchar(30), end nvarchar(30));"; //open connection if (this.openconnection() == true) { //create command , assign query , connection constructor sqlcecommand cmd = new sqlcecommand(query, connection); //execute command cmd.executenonquery(); //close connection this.closeconnection(); } } end reserved word in sql. string query = "create table " + name + ...

Connecting 2 virtual devices android in eclipse -

i trying connect 2 virtual devices in localhost in eclipse test server-client chat unsuccessful , different versions android api too. o though problem didn't had configuration. when tried use commands connect 2 devices appears: c:>telnet localhost 5554 telnet localhost 5554 c:>'telnet' not recognized internal or external command, operable program or batch file. to integrate cmd.exe in eclipse used tutorial: http://www.avajava.com/tutorials/lessons/how-do-i-open-a-windows-command-prompt-in-my-console.html?page=1 i don't know i'm doing wrong, appreciate if you're using windows 7 telnet.exe not installed default. you have add manually.

code first - Updating entity framework entity with many to many relationship -

i have (2) entities, follows: [table("user")] public class user { [key] [databasegeneratedattribute(databasegeneratedoption.identity)] public int userid { get; set; } [required] [maxlength(20)] public string name { get; set; } public icollection<role> roles { get; set; } public user() { this.roles = new collection<role>(); } } [table("user")] public class role { [key] [databasegeneratedattribute(databasegeneratedoption.identity)] public int roleid{ get; set; } [required] [maxlength(20)] public string name { get; set; } public icollection<user> users { get; set; } public role() { this.users = new collection<user>(); } } this creates 3 tables in database, user, role , userrole. i leveraging generic repository, add , update following: public virtual void add(tentity entity) { _dbset.add(entity); } public virtua...

android - Pause activity and go back to previous activity -

i have 2 activities. activity starts activity b when button pressed. activity b loads data on create. when press button activity b being destroyed want pause , activity a. tried: @override public void onbackpressed() { movetasktoback(true); } but gets me home screen, not activity a. if want bring activitya front, this: @override public void onbackpressed() { intent intent = new intent(this, activitya.class); intent.addflags(intent.flag_activity_reorder_to_front); startactivity(intent); } this rearrange activity stack on top (showing) , b behind it. when user clicks in activitya, default behaviour finish activitya , return activityb.

Can't get Intern to run Node.js Module -

i trying test intern see if fit testing framework. trying test following code in intern. var helloworld; helloworld = (function () { function helloworld (name) { this.name = name || "n/a"; } helloworld.prototype.printhello = function() { console.log('hello, ' + this.name); }; helloworld.prototype.changename = function(name) { if (name === null || name === undefined) { throw new error('name required'); } this.name = name; }; return helloworld; })(); exports = module.exports = helloworld; the file located in 'js-test-projects/node/lib/helloworld.js' , intern located @ 'js-test-projects/intern'. using 1.0.0 branch of intern. whenever try include file , run test don't output after "defaulting console reporter". here test file. define([ 'intern!tdd', 'intern/chai!assert', 'dojo/node!../lib/helloworld' ], function (tdd, assert, helloworld) { console...

c# - Customizing WCF validation / providing more context when a SerializationException occurs -

i working on wcf service rest binding expected accessed systems not developed in .net , have no access c# data contract. result, entirely possible caller create valid xml cause serializationexception. instance, integer or date field might left blank or set null (i:nil="true"). i able return error message user additional context, telling them part of xml not deserialized. there clean way this? unfortunately, serializationexception provides no context whatsoever. can think of extracting schemas teh data conrtact , validating incoming xml schema before attempting deserialize. require me implement custom serialization. there better way? an obvious caveat of schema approach leaves out json.

javascript - select2 - clear all items not working when targeting by class -

i have select2 combobox, want clear out items. if target select id, works: $("#clearid").click(function(){ $("#list").empty(); }); however, if target select class, removes select dom: $("#clearclass").click(function(){ $(".list").empty(); }); this can seen in following demo: http://jsfiddle.net/nvrzu/ i need able target select via class. the dynamically added parent of select gets .list class when plugin wraps original select, you're not removing options in select, select well, you're emptying parent element. excluding wrapper added plugin should solve problem : $("#clearclass").click(function(){ $(".list").not('.select2-container').empty(); }); fiddle

java - Installing unknown web application on tomcat server -

i've downloaded web application repository , want try it. have tomcat installed (no eclipse, idea etc). don't know how start. know directory layout of code i've checked out. simple dropping somewhere tomcat directory structure? . ├── pom.xml ├── readme.html ├── readme.md └── src ├── main │   ├── java │   │   ├── meta-inf │   │   ├── ncbi │   │   │   └── blast │   │   └── uk │   │   └── ac │   ├── resources │   │   ├── bioactivitiessql.sql │   │   ├── chemblwsclient.properties │   │   ├── chemblws.properties │   │   ├── log4j.properties │   │   ├── schemafolder │   │   │   ├── ncbi_blastoutput.dtd │   │   │   ├── ncbi_blastoutput.mod.dtd │   │   │   └── ncbi_entity.mod.dtd │   │   └── uk │   │   └── ac │   └── webapp │   └── web-inf │   ├── blast-context.xml │   ├── chemblws-client-context.xml │   ├── chemblws-servlet.xml │   ├── j...

sql - Tournaments, Players and Match Relations -

i have multiple players in multiple tournaments in multiple seasons (tables: player, tournament, season). match between 2 players has reference specific tournament , specific season. table match id season_id tournament_id player_home player_away let's natural assign players tournaments obvious benefits. one-to-many table between seasons , tournaments (call table competition) , many-to-many table competitions , players? table competition id season_id tournament_id table competition_player id competition_id player_id table match id competition_id player_home player_away or there more simple/better way achieve this? thanks advice. sqlfiddle very basic still can see relationship. here . structure tables players -------------------------- |id | name | otherinfo | -------------------------- | 1 | john | player info | -------------------------- | 2 | tom | player info | ---------------------...

How can I set a different class to past dates on the jQuery UI Datepicker? -

is there way set previous selected dates of jquery ui datepicker different class? the scenario dealing there calendar upcoming events , previous events. upcoming events right class applied them , styled accordingly. need same previous dates had event. so instance: may 10th colored gold ( highlight class) because it's upcoming event. may 8th colored light gray ( passed-event class) because it's previous event. here have far (working beforeshowday ): beforeshowday: function(date) { var result = [true, '', null], afterortoday = $.grep(events, function(event) { var eventdate = new date(event.date), todaysdate = new date(); return date.valueof() === eventdate.valueof(); }), beforetoday = $.grep(events, function(event) { var eventdate = new date(ev...

wpf - SlowCheetah placing settings in app.config.deploy and not .exe.config -

i'm using latest version of slowcheetah on existing wpf project have using clickonce. i'm trying provide different application settings (the applicationsettings node in app.config; ones form settings.settings file) each environment. when publish i'm getting app.config.deploy (with correctly transformed settings inside) , projectname.exe.config file doesn't have transformed settings. when installs application , runs it, it's using settings inside projectname.exe.config (which correct) , transformed settings in app.config ignored. there step slowcheetah put transformed settings exe.config instead?

Trying to understand optional, list and named arguments in Python -

i'm beginner @ python, trying understand function arguments , types , orders. i tried experiment little different kinds of argument , here's experiment def main(): test_a(2, 33, 44) test_b(2, 33) test_c(2) ## test_d(2,,44) **produces invalid syntax** test_e(2,33,44,55,66) test_f(2, 44,55,66, y = 44) test_g(2, 33, 44,55,66, rofa = 777, nard = 888) ##test_h(2, 33, foo = 777, boo = 888, 44,55,66) **invalid syntax in function definition ##test_l(2, 44,55,66 , foo= 777, boo = 888, y = 900) **invalid syntax in function definition test_m(2, 44,55,66 , y = 900, foo=77777 , boo = 88888) ############################################################# ## no optional arguments def test_a(x,y,z): print("test_a : x = {}, y = {}, z = {} ".format(x ,y ,z)) ## 1 optional argument @ end def test_b(x, y, z = 22): print("test_b : x = {}, y = {}, z = {} ".format(x ,y ,z)) ## 2 optional arguments @ end def test_c(x, y ...

Hibernate without Primary Key -

i making sample application hibernate. requirement there no primary key on table. had select query application. know there should primary key, table referring has been made without it. it has 50k records. so, modifying table add id column not see viable option. can possible? hibernate requires entity tables have primary keys. end of story. 50k records not many when you're talking database. my advice: add autoincrement integer pk column table. you'll surprised @ how fast is.

c# - DataGridView: Add Data Programatically on Specific Cells -

i'm trying add data programatically onto datagridview, doesn't seem working. have array, fill text file: public static string pathlist = @"c:\users\gbbb\desktop\pfade.txt"; _pathrows = system.io.file.readalllines(@pathlist); and have datagridview 4 columns on add many rows have paths, so: public void initpathstable() { tabellebib.rows.add(_pathrows.length); //and here want add paths on column nr.4 } next need way add paths (24) column nr.4, 1 path per row. seems impossible beginner me, asking you. this method you. read comments (especially make sure have added 4 columns datagridview ): public void initpathstable() { int rowindex; datagridviewrow row; foreach (var line in _pathrows) { rowindex = tabellebib.rows.add(); //retrieve row index of newly added row row = tabellebib.rows[rowindex]; //reference new row row.cells[3].value = line; //set value of 4th column line. war...

c++ - libc++ std::istringstream doesn't thrown exceptions. Bug? -

after configuring std::istringstream throw exceptions when failbit set no exceptions happening libc++ (this under linux libc++ compiled support libcxxrt). suppose bug in libc++ or libcxxrt: #include <iostream> #include <sstream> template<typename t> std::istream &getvalue(std::istream &is, t &value, const t &default_value = t()) { std::stringstream ss; std::string s; std::getline(is, s, ','); ss << s; if((ss >> value).fail()) value = default_value; return is; } int main() { std::string s = "123,456,789"; std::istringstream is(s); unsigned n; try { is.exceptions(std::ios::failbit | std::ios::eofbit); getvalue(is, n); std::cout << n << std::endl; getvalue(is, n); std::cout << n << std::endl; // disable eof exception on last bit is.exceptions(std::ios::failbit); getvalue(is...

python - Looping with a while statement while reading a string for an integer -

i need encasing the: if any(c.isdigit() c in name): print("not valid name!") inside of while statement. pretty reads input "name" variable , sees if there's integer in it. how use in while statement? want if user inputs variable input, print out string above , loop , ask user name again until enter in string no integer, want break. help? print("hello there!") yn = none while yn != "y": print("what name?") name = raw_input() if any(c.isdigit() c in name): print("not valid name!") print("oh, name {0}? cool!".format(name)) print("now how old you?") age = raw_input() print("so name {0} , you're {1} years old?".format(name, age)) print("y/n?") yn = raw_input() if yn == "y": break if yn == "n": print("then here, try again!") print("cool!") use while true , bre...

bind data to date using Highcharts -

im using highcharts on client side application (i'm using on js back-end calls getting data). anyway, issue is: first data series july 2012 - may 2013 second data series may 2012 - may 2013 the issue after loading second data series, using chart.addseries({ name : color: stack: data: }) it move backed first data series may though starting on july. i trying using date , convert them timestamp not help. thanks in advance! the solution came load data first series, second data series. , after having data create highchart. if have solution can bind date column data, please let me know. by way, when using data following format works. this.chart.addseries({ name: 'first data' color: '#' + arr[i].cms.global.graphcolor, stack: 'first stack', data: [[1,10][2,20][3,10]] }); this.chart.addseries({ name: 'second data' color: '#' + arr[i].cms.gl...

Alter color during OpenGL rendering without lighting or shaders -

i need render object using existing texture, , need alter color during rendering. (such multiplying red channel 0.5.) existing texture not monochromatic. need without enabling lighting , without shaders don't disturb application i'm working within. cannot work enough in rendering read/write buffer directly. in effect, i'd sort of color-transformation matrix or filter works during normal rendering. base in limited information i'll assume things. i'll assume working fixed pipeline. i'll assume not using low level pixel function glbitmap or gldrawpixels. if you should not. to solve problem try following: draw textured quad, using glbegin,glend,glvertex2f,gltexcoord2f alter color use glcolor after glbegin , before other draw instruction. should color-transformation matrix in cpu , use result glcolor. image blended accordingly. white doesn't change image color. make sure gl_lighting not enabled.

c++ - Detour on winsock recv doesn't return anything -

i injected dll server because needed block bad packets server isn't discarding. snippet code: #pragma comment(lib, "detours.lib") #pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "mswsock.lib") (...) int (winapi *precv)(socket s, char* buf, int len, int flags) = recv; int winapi myrecv(socket s, char* buf, int len, int flags); (...) allocconsole(); freopen("conout$", "w", stdout); detourtransactionbegin(); detourupdatethread(getcurrentthread()); detourattach(&(pvoid&)precv, myrecv); if(detourtransactioncommit() == no_error) cout << "[" << myrecv << "] detoured." << endl; and testing purposes i'm printing data out. int winapi myrecv(socket s, char* buf, int len, int flags) { cout << "[ recv " << len << " ] "; ( int = 0; < len; i++ ) { printf( "%02x ", unsigned char (buf[i]) ); ...