Posts

Showing posts from May, 2011

jquery - Bootstrap CSS strange conflict with qtip2 -

i have strange bug when using bootstrap css qtip2: i have button, on bind qtip popup: <button type="button" class="btn btn-default" id="deletebutton"> delete </button> i bind qtip (is working fine) var $button = $("#deletebutton"); $button.qtip({ show: { event: 'mouseenter', solo: true, effect: false, delay: 100 }, content: function (event, api) { return "tooltip message"; } }); as button gets css class disabled (only class, not attribute), qtip stops working. here jsfiddle important: if button doesn't have class btn , having disabled class, qtip still works. issue has bootstrap btn class? in bootstrap.min.css find .btn.disabled, .btn[disabled], fieldset[disabled] .btn { cursor: not-allowed; pointer-events: none; opacity: .65; filter: alpha(opacity=65); -webkit-box-shadow: none; box-shadow: no

image - RGB histogram using bitshift in matlab -

i'm trying create mozaic image in matlab. database consists of rgb images gray scale images. i need calculate histograms - in example of wikipedia article color histograms - rgb images , thought using bitshift operator in matlab combine r,g , b channels. nbins = 4; nbits = 8; index = bitshift(bitshift(image(:,:,1), log2(nbins)-nbits), 2*log2(nbins)) + ... + bitshift(bitshift(image(:,:,2), log2(nbins)-nbits), log2(nbins)) + ... + bitshift(image(:,:,3), log2(nbins)-nbits) + 1; index matrix of same size image index corresponding bin pixel value. how can sum occurences of unique values in matrix histogram of rgb image? is there better approach bitshift calculate histogram of rgb image? calculating indices the bitshift operator seems ok do. me create lookup relationship relates rgb value bin value. first have figure out how many bins in each dimension want. example, let's wanted 8 bins in each channel. means have total of 512

java - app crashes when launching emulator -

my logcat: 01-01 05:13:28.690: d/androidruntime(696): shutting down vm 01-01 05:13:28.690: w/dalvikvm(696): threadid=1: thread exiting uncaught exception (group=0x40a13300) 01-01 05:13:28.741: e/androidruntime(696): fatal exception: main 01-01 05:13:28.741: e/androidruntime(696): java.lang.runtimeexception: unable start activity componentinfo{com.example.myfunapp/com.example.myfunapp.mainactivity}: java.lang.runtimeexception: content must have listview id attribute 'android.r.id.list' 01-01 05:13:28.741: e/androidruntime(696): @ android.app.activitythread.performlaunchactivity(activitythread.java:2059) 01-01 05:13:28.741: e/androidruntime(696): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2084) 01-01 05:13:28.741: e/androidruntime(696): @ android.app.activitythread.access$600(activitythread.java:130) 01-01 05:13:28.741: e/androidruntime(696): @ android.app.activitythread$h.handlemessage(activitythread.java:1195) 01-01 05:13:28.741: e/androidru

node.js - Modify Express sessions on set and get -

i'm wondering if there's way (globally via express middleware) intercept , set of session objects. so, instance if somewhere in 1 of controllers set req.session.foo = 'bar' can change bar baz , when req.session.foo accessed can send bar . i'm not sure trying accomplish should take @ connect-flash middleware store messages in requests. from docs: app.get('/flash', function(req, res){ // set flash message passing key, followed value, req.flash(). req.flash('info', 'flash back!') res.redirect('/'); }); app.get('/', function(req, res){ // array of flash messages passing key req.flash() res.render('index', { messages: req.flash('info') }); });

unit testing - How to run tests in Nemerle project -

how run tests test nemerle code. example, i've calculator class , calculatortests class in nemerle project. have added reference nunit using package manager ("install-package nunit"). nunit available in nemerle project. after writing following code [testfixture] class calculatortests { [test] mytest() : void { def result = calculator().add( 1 ); assert.areequal( 2, result ); } } i tried use testdriven.net visual studio add-in run test couldn't able to. can tell me how run tests in nemerle or have write code run tests when executing console app? maybe caused nunit runs under .net 2.0 runtime. try set runtime version in nunit command line.

Python saving unicode to XML -

i'm writing short python script walk through directories on server, find i'm looking , save data xml file. the problem of data written in other languages such "ハローワールド" or of similar format. when trying save in entry in xml following traceback: unicodedecodeerror: 'ascii' codec can't decode byte 0xec in position 18: ordinal not in range(128) this function saves data looks like: def addhistoryentry(self, title, url): self.log.info('adding history entry {"title":"%s", "url":"%s"}' % (title, url)) root = self.getroot() history = root.find('.//history') entry = etree.subelement(history, 'entry') entry.set('title', title) entry.set('time', str(unixtime())) entry.text = url history.set('results', str(int(history.attrib['results']) + 1)) self.write(root) self.getroot() following: def getroot(self): return etree.e

clojure - How to prevent overlapping animations using core.async? -

i have loop handling animations character -- set-image! takes key , displays appropriate image. (defn main-animation-loop [] (go (while true (set-image! :normal) (<! (timeout 8000)) (set-image! :blink) (<! (timeout 150))))) every once in while character needs special actions. should able interrupt main animation: (defn dance! [] (go (set-image! :look-left) (<! (timeout 1000)) (set-image! :look-right) (<! (timeout 1000)) (set-image! :wave) (<! (timeout 2000)))) what's way pause main animation while dance routine happening? it's common in csp style programming pass control channel event loops can, @ least tell them when stop. in case if there control channel went main-animation-loop , gave copy of dance! , dance tell main-animation-loop pause , unpause appropriatly. or stop start again (passing same control channel in case others using it). i use pattern check messages eac

osx - Why do git commits exist on my local clone/directory but not on GitHub? -

i have committed , pushed several changes project using git on command line, when log in github, branches , commits made not shown on account. why? i can review commit history have made using git on command line. results of git remote -v command origin https://github.com/felixtan/guessing-game.git (fetch) origin https://github.com/felixtan/guessing-game.git (push) once committed locally, still need push commits github: git push (since remote named origin, don't need specify name: pushes default 'origin') this assumes owner or one of collaborators of repo felixtan/guessing-game . if first time push current branch: git push -u origin yourcurrentbranch that establish tracking relationship between branch , ' origin/yourbranch ', detailed in " why need explicitly push new branch? ". once first push done, subsequent pushes simple ' git push '. if not owner/collaborator, won't have right push repo. you need m

ios - Disclosure Indicator doesn't call seque while Detail Disclosure does -

i have interesting problem. i'd have detail screen pop when people click on arrow in table view. cells dynamic. when select disclosure indicator - not segue called , and don't accessorybuttontappedforrowwithindexpath called either. when change detail disclosure works fine. any guesses can make disclosure indicator act detail disclosure? thanks! disclosure indicators not buttons , therefore not cause tableview:accessorybuttontappedforrowwithindexpath: delegate method fire, while detail disclosure is button , therefore fire method. the best can hope do, imagine, add uibutton table view cell , give image closely resembles default table view disclosure indicator. kind of hacky solution though, discourage doing this.

c# - What happens when you claim a PosPrinter using Microsoft Point of Serivce & Epson OPOS for.net then computer unexpectedly shutdown? -

what happens when claim posprinter using microsoft point of serivce & epson opos for.net computer unexpectedly shutdown? posprinter broken? or library manage already? since lock in software drivers, , in memory, once pc shutdown lock gone.

.net - Limiting WCF service to a specific client app -

i have created .net wcf services hosted under iis. services using ssl. the customer has security demand. services should allowed consumed specific client application. the services using windows authentication , limited specific users. identifying consumer's ip or using certificate not enough because theoretically approved user approved client machine able consume services not intended client application. is there secured way achieve this? if use message security can specify x509 certificate should used signing messages. locks down usage specific machines (group policy can used control installation of certificates). if need limit specific users rather specific machines or devices, federated security way go. additionally client , server message headers may helpful, although encourage use regular security mechanisms as possible rather rolling own.

math - how SVG curveTo ( C ) works? -

Image
i need , confused little. my question how svg curveto works, can't understand. look example <svg height="400" width="400"> <path d="m 200 90 c 200 90 0 0 90 300 " stroke="black" fill="none" stroke-width="3"/> </svg> this code draws shape but can't understand how done , can't understand how curve identified , control points , 0 0 coordinate represents in example. you drawing cubic bezier curve (with two control points). 1 of control points has same coordinates starting point. move ( m ) (200,90). draw cubic ( c ) bezier curve a. starting @ current position (200,90) b. first control point @ (200,90) - same starting point c. second control point @ (0,0) d. ending @ (90,300)

javascript - Coding browser extensions, Addons, Firefox, Safari, Chrome etc… Is this possible? -

i'm not familiar browser extensions , before begin explore them have few questions. let's extension injects javascript in current website user visiting (if that's possible). injected javascript code get, let's current url example purposes, , send , store on database. next time user visits same website, user extension notification informing second or third or x time or has visited same website. now have gave scenario, following possible? injecting javascript browser extension current visiting website. if so, can make ajax communication javascript , php server? yes, can inject stuff. see e.g. insert code page context using content script , how inject javascript page, firefox add-on, , run it? or 1 of many dupes there are. you can use whatever communication available between site , server, e.g. xhr , websockets , jsonp . please check policies of chrome web store , mozilla add-ons site regarding content/code injection , privacy rules. e.g. mozilla add

Upload Data from Local System Ms Access to Web Sql Server? -

i have windows forms application maintains billing details of company's employees. application stores , manipulates data in ms access database. have send data every sql server web database employees can see monthly reports on website. code : private sub uploaddata() dim conn new oledb.oledbconnection("connection string ms access db") dim scon = new sqlconnection(" web sql sever connection") try scon.open() catch ex exception msgbox(ex.message) exit sub end try dim qcmd new sqlcommand("select query", scon) dim cmd new oledbcommand("select id,acc,newacc,city,name,billduedateamt,oldbalance records city = 'delhi'", conn) dim mrdr oledbdatareader = cmd.executereader try while mrdr.read qcmd.commandtext = "insert billing (acc,newacc,city,name,billduedateamt,oldbalance) values (" + _ mrdr.ite

c - How the Average Cache Miss Ratio (ACMR) is calculated? -

i'm studying tom forsyth's linear-speed vertex cache optimization , don't understand how calculates acmr. have read know acmr = number of cache misses / number of triangles, don't understand kind of cache being used (i.e. fifo or lru?). i have written test program calculates , prints acmr of given 3d model using fifo cache, can please tell me if code ok? or should use lru cache instead? /* number of entries in fifo cache */ #define fifo_cache_size 32 struct fifo_cache { long entries[fifo_cache_size]; }; /** * init_cache - initializes fifo cache * @cache: pointer fifo cache structure initialized. * * before fifo cache can used, must initialized calling * function. */ static void init_cache(struct fifo_cache *cache) { int = 0; /* initialize cache entries invalid value */ (i = 0;i < fifo_cache_size;i++) cache->entries[i] = -1; } /** * check_entry - checks if same entry added cache * @cache: pointer fifo cache structure

dart - Dart2js brackets Symbol in metadata annotation -

i can run code on dart vm: @mirrorsused(metatargets: tag) import 'dart:mirrors'; class tag { final symbol name; const tag(this.name); } @proxy @tag(#[]) class tagged { nosuchmethod(invocation invocation) { instancemirror instancemirror = reflect(this); classmirror classmirror = instancemirror.type; classmirror.metadata.foreach((em) { if (em.reflectee tag && em.reflectee.name == invocation.membername) print(invocation.positionalarguments); }); } } void main() { var tagged = new tagged(); tagged[42]; tagged.foo(); tagged["dart"]; } output: [42] [dart] but when try compile dart2js fails error: [error dart2js]: bin\dart2jswithbracketanotation.dart:9:7: expected identifier, got '['. @tag(#[]) so 1 has bug?: (dart vm) because can run @ all. (dart2js) because doesn't compile js. update: i reported bug i think it's bug in dart2js because operator sho

Can I simulate traits/mixins in Swift? -

does swift have way of mixing in traits, la scala? section of swift book on using extensions add protocols existing classes comes tantalizingly close. however, since protocols can't contain implementation, can't used mix code class. there way? as of swift 2.0, yes! providing default implementations you can use protocol extensions provide default implementation method or property requirement of protocol. if conforming type provides own implementation of required method or property, implementation used instead of 1 provided extension.

gruntjs - Absolute path using grunt-wiredep for Grunt + Bower -

the grunt-wiedep task outputs relative paths assets. instead need absolute paths. so, reconfigured replace block suggested here: https://github.com/stephenplusplus/grunt-wiredep/issues/46 but, after specifying replace block suggested, following added script reference. can see, wrong. <script src="/../../../public/vendors/jquery/dist/jquery.js"></script> <script src="/../../../public/vendors/angular/angular.js"></script> <script src="/../../../public/vendors/angular-resource/angular-resource.js"></script> <script src="/../../../public/vendors/angular-route/angular-route.js"></script> what want instead: <script src="/vendors/jquery/dist/jquery.js"></script> <script src="/vendors/angular/angular.js"></script> <script src="/vendors/angular-resource/angular-resource.js"></script> <script src="/vendors/angular-route/a

javascript - Mongoose doesn't seem to support the $max field update operator, any advice? -

i'm trying make use of the $max update operator in node.js project using mongoose, think a) i'm either doing horribly wrong or b) mongoose doesn't support functionality. (using example): var updategamescores = function(game, newscore, callback) { models.scores.update({ gamename: game }, { $set: { $max: { highestscore: newscore } } }, { upsert: true }, function(err) { callback(err); }); }; gives me following error: mongoerror: dollar ($) prefixed field '$max' in '$max' not valid storage. i couldn't find (or similar functionality) in mongoose docs, suggests mongoose doesn't support this. if indeed case, there alternative ways can achieve this** while minimizing number of database operations? **: "update value of field specified value if specified value greater current value of field" thanks in advance. consider writing update expression { $max: { highestscore: newsc

java - Binary Search - Trouble getting information -

i have issue. learning bout binary arrays , trying figure out. trying make user enter book number , search through array reflist , print through booklist. problem when enter number greater 1 compare value never reaches 0. public boolean binarysearch(string [] a, int left, int right, string v){ int middle; numofsearches ++; if (left > right) { return false; } middle = (left + right)/2; int compare = v.compareto(a[middle]); system.out.println("middle value: "+middle); if (compare == 0) { binaryoutput.settext("the book is: "+booklist[middle]); } if (compare < 0) { return binarysearch(a, left, (middle-1), v); } else { return binarysearch(a, middle + 1, right, v); } } just forgotten return true. if (left > right) { return false; } middle = (left + right)/2; int compare = v.compareto(a[middle]); system.out.println("middle value:

networking - Java Multicast send and receive -

working on little app in java. suppose have 3 nodes, a, b , c, each listening on multicast socket same group. suppose 1 of them needs send message group, can merely pop message out on same socket on it's listening or need create second socket connected group , transmit on that? have not yet googled me definitive answer on it can use same socket sending , receiving.

objective c - iOS Partial Keyboard Display -

is possible display part of keyboard in ios 7? example, display keyboard, not want space bar visible. how add keyboard display portion of keyboard above space bar? research has confirmed not possible adjust frame of keyboard.

how to Access Sharepoint Custom list from Xamarin -

i have custom list in sharepoint , need send data xamarin custom list, there possible way? sharepoint web services can manipulate lists

sql - How to populate data from a table, depending upon another table -

my question super straight, i have table naming faq_master having data of faqs i have table naming faq_override having data of overrided faqs foreign key company_id different table now want populate data faq_master, if faq_override not populating data depending upon company_id fetched session variable if faq_override populating data, populating data faq_master not required. i want run query in postresql what have tried : select * ( select distinct fm.faq_uid faquid, case when fm.qa_text not null fm.qa_text else fm.qa_text end qatext, case when fm.sort_order not null fm.sort_order else fm.sort_order end sortorder, fm.end_date enddate rnr.faq_master fm ) faq_qry left outer join rnr.company_faq_override fo on faq_qry.faquid = fo.faq_override_uid , fo.mp_compan

asp.net - can't trace e.NewValues at RowUpdating event of grid view -

i have problem grid view. have code grid view binding : public void fillgrid1(string startalpha1, string columnname1, string searchtext1) { using (dataclassesdatacontext db = new dataclassesdatacontext()) { var query = enumerable.repeat(new { id = default(int), reasontext = string.empty }, 0).tolist(); if (startalpha1 == "all") { query = db.reasons.select(r => new { id = r.id, r.reasontext }).filterforcolumn(columnname1, searchtext1).tolist(); } else { query = db.reasons.select(r => new { id = r.id, r.reasontext }).filterforcolumn(columnname1, searchtext1).where(x => x.reasontext.startswith(startalpha1)).tolist(); } dataset mydataset = new dataset(); datatable dt = new datatable(); dt.columns.add(new datacolumn("id&q

joomla2.5 - Joomla : How to filter results of nested/ajax Tag field? -

good day, using tag field of joomla. so far have 3 tag fields in 1 admin page , tag fields querying tags in #__tags table. is there way can filter tags returned? example filter parent_id or that?

android - Google Tracking Campaign returns just few infos -

i'm testing google tracking campaign before putting app on google play store. following instruction here , installed apk via adb, without starting it, , did instruction adb shell broadcast -a com.android.vending.install_referrer -n <package>/com.google.analytics.tracking.android.campaigntrackingreceiver --es "referrer" "utm_source=fb&utm_medium=500_600" i put source , medium since think need in app. (500_600 random string). launching isntruction (as expected link above) broadcasting: intent { act=com.android.vending.install_referrer cmp=<package>/com.google.analytics.tracking.android.campaigntrackingreceiver (has extras) } broadcast completed: result=0 when went seeing logcat found this: thread[gathread,5,main]: campaign found: utm_source=fb nothing else... medium part? cant understand. need info since need track db after app start. me pls! :d did things work after published play store? think might encoding or logging i

java - custom message properties in scala play framework for removing hard coded string -

this below code getting keyword value text file works in localhost . when put code in aws server , works only. returns value keyword returns null package models import java.io.fileinputstream import java.io.fileoutputstream import java.util.properties import scala.language.postfixops object msgmodel { def getkeyword(msgkeyword: string) = { var fileinput = new fileinputstream("./conf/keywords"); val properties = new properties properties.load(fileinput); var out = new fileoutputstream("./conf/keywords"); properties.store(out, null); val point = properties.getproperty(msgkeyword) val key = properties.keyset() val data = point fileinput.close(); out.close(); data } } some times msgmodel.getkeyword("jid")//some times returns jid, expected msgmodel.getkeyword("jid")//some times return null file: keywords.txt jid=jid why works only? i suspect issue of not having file present

android - Push notification turns off my app -

i´m doing game on android. i´m using gcm push notifications , i´m doing push check content in order know if push has winner or loser value , if has win value , user on screen "waiting result" app goes other activity screen (waiting or loser screen depending on push value). schema is: if user on waiting screen , push comes goes push screen value. all work on android 4.2.x on 4.1.x , earliest (the last version support 2.3.6) doesnt work when push comes , devices on sleep mode, on case ( api<16 , push comes , device in sleep mode) app turn off ,not errors turn off, , need start again. in order solve trouble have written following lines , force tha app working, , works ,but problem screen turn on always, never goes sleep mode , ,as can imagine, battery dead fast in case not playing in monent. schema problem new implementation is: when android version<4.1.x , screen on sleep mode. push comes , screen on (always) waiting user screen unlock. my questions is: hav

delphi - Why does the Alt key not trigger my low-level keyboard hook? -

i experimenting keyboard hooks, , seems if alt key (amongst other command keys) not being hooked, , can't figure out why? below keyboard hook debug code in prints out vkcode, scancode , lpchar readings. it works keys basically, not alt , ctrl etc function lowlevelkeybdhookproc(ncode, wparam, lparam : integer) : integer; stdcall; // possible wparam values: wm_keydown, wm_keyup, wm_syskeydown, wm_syskeyup var info : ^keybdllhookstruct absolute lparam; lpchar : word; kstate : tkeyboardstate; begin result := callnexthookex(khook, ncode, wparam, lparam); info^ case wparam of wm_keydown : begin getkeyboardstate(kstate); form1.memo1.text:=form1.memo1.text+'vkcode: '+inttostr(vkcode)+ ' scancode: '+inttostr(scancode)+ ' lpchar: '+inttostr(lpchar)+; end; end; end; to detect alt key going down, need respond wm_syskeydown . note ignoring value of ncode . must read documentation , says.

.net - Convert string base64 to string in C# without Encoding.UTF8.GetString -

i'm trying convert string base64 string in c# under unity3d. when try build on windows phone 8, error occurs because system.text.encoding not supported yet. byte[] data = convert.frombase64string(encodeddata); string decodedstring = system.text.encoding.utf8.getstring(data); i'm getting following error: exception: error: method system.text.encoding system.text.encoding::get_ascii() doesn't exist in target framework update: i tried alternative of utf8.getstring: public static string bytearraytostring(byte[] bytearray) { char[] chars = new char[bytearray.length / sizeof(char)]; system.buffer.blockcopy(bytearray, 0, chars, 0, bytearray.length); return new string(chars); } it's supposed convert bytes string, utf8.getstring, got chinese characters! wonder if utf8.getstring other converting bytes string.

Android Up button with appcompat on Gingerbread, title not clickable -

we using appcompat library use actionbar down gingerbread , enabling home button on activities (also including both versions of parentactivityname setting in manifest). but 1 thing testers have reported different "size" of button. on newer devices can click on arrow, logo, or title of activity. on gingerbread smaller area of arrow , logo clickable. title not clickable. is there way behavior same , have title clickable on gingerbread? afaik, there no native way of doing it. making both title , logo clickable feature introduced in later versions. but yeah, can make custom view , set view of actionbar. actionbar actionbar = getactionbar(); actionbar.setdisplayshowcustomenabled(true); actionbar.setdisplayshowtitleenabled(false); actionbar.sethomebuttonenabled(false); actionbar.setdisplayhomeasupenabled(false); layoutinflater inflator = (layoutinflater) getsystemservice(context.layout_inflater_service); view v = inflator.inflate

sql server - Dropping an unindexed table with over 1.7 Billion rows on live database (SQL Admin Nightmare) -

a recent employee of our company had stored procedure has gone haywire, , caused mass inserts debug table of his. table unindexed, @ close 1.7 billion rows, , taking space backup no longer fits on backup drive (backups reach close 250gb). i haven't seen this, i'm seeking advice mssql gurus out here. i know nibble away @ table, being unindexed, delete [table] id in (select top 10000 [id] [table]) locks server searching them. i don't want log file massive, it's sitting @ 480gb on 1tb drive. if delete table, able shrink down? (my recovery mode simple) we index id field on table, though have around 9 hours downtime day, , during business hours can't locking database. just looking advice here, , point in right direction. thanks. you may want consider truncate msdn reference: http://technet.microsoft.com/en-us/library/aa260621(v=sql.80).aspx removes rows table without logging individual row deletes. syntax: truncate table [your_table]

c# - how to make DLL acess a class/object in the exe applicaiton in which it is loaded -

i have c# exe application loads dll runtime, know how can dll access public static class of application ?? this problem can sloved third dll containing contracts , commonly used stuff. declare interface in contracts assembly , inject object implementing dynamically loaded classes. you cannot use static class, cannot implement interfaces. if need static use singleton pattern. // in contracts assembly // defines same functionality in static class. public interface iservicecontract { void someservicemethod(); } // classes dynamically loaded dll public interface iaddin { void testmethod(); } // in dynamically loaded assembly public class addinclass : iaddin { private iservicecontract _service; public addinclass(iservicecontract service) { _service = service; } public void testmethod() { _service.someservicemethod(); } } // in main assembly (exe) public class implementsservicecontract : iservicecontract {

c# - Alert on gridview edit based on permission -

i have gridview edit option @ start of row. maintain seperate table called permission maintain user permissions. have 3 different types of permissions admin, leads, programmers. these 3 have access gridview. except admin if tries edit gridview on clicking edit option, need give alert this row has important validation , make sure make proper changes . when edit, action happen on table called application . table has column called comments . alert should happen when try edit rows comments column have these values in them. manlog datas funding approved exported applications my try far. public bool isapplicationuser(string username) { return checkuser(username); } public static bool checkuser(string username) { string cs = configurationmanager.connectionstrings["connectionstring"].tostring(); datatable dt = new datatable(); using (sqlconnection connection = new sqlconnection(cs)) { sqlcommand command = new sqlcommand(); command.co

Problems with my javascript program on the RPi -

i new javascript , made little program control rpi robot on wlan... got problem. every time when hold w, or d longer time, robot goes crazy , doesn't want stop , drives in 1 direction, until press 1 of other 2 keys. can control robot on webinterface. here code: <html> <head> <script language="javascript"> window.addeventlistener("keydown", onkeydown, false); window.addeventlistener("keyup", onkeyup, false); function set0() { document.location="cgi-bin/set0.cgi"; } function set1() { document.location="cgi-bin/set1.cgi"; } function set01() { document.location="cgi-bin/set01.cgi"; } function clear01(event) { document.location="cgi-bin/clear01.cgi"; } function onkeydown(event){ var keycode = event.keycode; switch(keycode){ case 87: //w set01(); break; case 68: //d set1(); break; case 65: //a set0(); break; } } function onkeyup(event){ var keycode = event.keycode; switch(keycod

c# - MVC Web API Binding Model to a Derived Class -

i looking @ how bind model derived class within mvc web api, issue have think have found 5 ways of doing it... what have is: models -> modelbase modela : modelbase modelb : modelbase controller containers method: post(modelbase model) {} the data posted modela or modelb, want add information http request metadata (think content-type: application/json; type=modela) , based on tell mvc bind posted content either or b. in code imagine like: bind(request, bindingcontext) { // check request headers , then... bindingcontext.modeltype=typeof(modela); // let framework continue doing thing deserializing content base.bind(request, bindingcontext); } how has else this? or how recommend doing this? i've seen parameterbinding, imodelbinder, mediatypeformatter, etc. mvc great, hard think hook should use... edit: to add more information, modelbase become interface, , there hundreds of concrete classes. it going cqrs: command , concretecommanda

java - AspectJ - Multiple @annotation Pointcut -

i can't make pointcut "||" operator , multiple annotations. i'm trying create pointcut jbehave annotations (@given, @then, @when). this works fine: @pointcut("@annotation(given)") public void jbehavegivenpointcut(given given) { } and if create , advice arount it, works. what syntax making pointcut 3 annotations? since had used logical or operator in other pointcuts assume like: @pointcut("@annotation(given) || @annotation(then) || @annotation(when) ") public void jbehavegivenpointcut(given given, then, when when) { } but doesn't work, inconsist binding exception. tried other combinations couldn't find 1 trick. what want cannot done way because, error message says, annotation binding inconsistent: cannot bind 3 annotations @ same time because in (possibly mutually exclusive) or parts of pointcut, i.e. of of them can bound (unless assign multiple annotations same method). expectation might aspectj can

python - How do you store the request.form to db through wtforms or error in sqlalchemy update? -

this following on question: sqlalchemy/wtforms update issue - 400 bad request have flask framework issue when submit form flash message comes saying prediction added although when query db nothing has changed?? can spot i'm going wrong? what trying achieve users able view predictions making changes current predictions. if there no new predictions can submit new predictions. views # predictor - user makes predictions , saves/ @app.route('/predictor/',methods=['get','post']) @login_required def predictions(): user_id = g.user.id # retrieve predictions prediction= db.session.query(fixture_prediction,\ fixture_prediction.fixture_id,fixture.stage,\ fixture.home_team,fixture_prediction.home_score,\ fixture_prediction.away_score,fixture.away_team)\ .outerjoin(fixture,fixture.id==fixture_prediction.fixture_id)\ .outerjoin(user,fixture_prediction.user_id == us

java - Taking user selection in a spinner, storing it in sharedPreferences, and using it in another activity -

i need user choose restaurant, got pretty large list different selections. need save choice, preferably in sharedpreferences. , use in activity display data excel document. currently code looks this: in oncreate: resturantspinner = (spinner) findviewbyid(r.id.resturantspinner); // create arrayadapter using string array , default spinner layout arrayadapter<charsequence> adapter = arrayadapter.createfromresource(this, r.array.resturant_arrays, android.r.layout.simple_spinner_item); // specify layout use when list of choices appears adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); // apply adapter spinner resturantspinner.setadapter(adapter); onitemselected: public void onitemselected(view view) { int userchoice = resturantspinner.getselecteditemposition(); sharedpreferences sharedpref = getsharedpreferences("resturantfile",0); sharedpreferences.editor prefeditor = sharedpre

Match regex with php -

i 2 results preg_match , don't understand why. code: $pattern = "\[precom\]([a-za-z]|\(|\)|[0-9]|\s|\*)*\[\/precom\]"; $data = "[precom](homme) cher monsieur $name[/precom] "; preg_match("/" . $pattern . "/", $data, $m); print_r($m); this result: array ( [0] => [precom](homme) cher monsieur *name[/precom] [1] => e ) could me find problem please? from http://www.php.net//manual/en/function.preg-match.php matches if matches provided, filled results of search. $matches[0] contain text matched full pattern, $matches[1] have text matched first captured parenthesized subpattern, , on.

android - Getting SSLHandshakeException when trying to acces https url -

i'm trying access https url through android app , getting javax.net.ssl.sslhandshakeexception: java.security.cert.certpathvalidatorexception: trust anchor certification path not found. exception is: 06-10 14:18:37.083: w/system.err(28459): javax.net.ssl.sslhandshakeexception: java.security.cert.certpathvalidatorexception: trust anchor certification path not found. 06-10 14:18:37.083: w/system.err(28459): @ org.apache.harmony.xnet.provider.jsse.opensslsocketimpl.starthandshake(opensslsocketimpl.java:399) 06-10 14:18:37.083: w/system.err(28459): @ libcore.net.http.httpconnection.setupsecuresocket(httpconnection.java:211) 06-10 14:18:37.083: w/system.err(28459): @ libcore.net.http.httpsurlconnectionimpl$httpsengine.makesslconnection(httpsurlconnectionimpl.java:478) 06-10 14:18:37.083: w/system.err(28459): @ libcore.net.http.httpsurlconnectionimpl$httpsengine.connect(httpsurlconnectionimpl.java:433) 06-10 14:18:37.083: w/system.err(28459): @ libcore.net.http.htt

html - CSS - Space between border and background color -

Image
i need create white space between border , background color. example okay so, | = border, # = background color above example drawn |#####| , need | ##### | how go doing that? code have example in picture (below) css .nav-justified > .active > a, .nav-justified > .active > a:hover, .nav-justified > active > a:focus { background-color: #f0f0f0; background-image: none; color: #8f1b1f; left: 0; width: 100%; margin-top: -17px; padding-bottom: 20px; padding-top: 20px; padding-right: 20px; padding-left: 20px; } .nav-justified > li > { border-left: 1px solid #d5d5d5; line-height: 2px; } html <ul class="nav nav-justified" id="tablebuttons"> <li class='active'><a href="#">text here</a></li> </ul> update: your scenario jsfiddle example . you use margin show white bac

Facebook Graph API to get shared links of public page -

we had investigated facebook api page uploaded photos (public page ), common request : https://graph.facebook.com/page id/photos/uploaded which gives last images page . but, found out not returns shared links of page , photos page had uploaded . we shared links, need token ? if need token ,how request token,to page last data? thanks. obviously endpoint using returns uploaded photos of page, why should return else? if want links shared page can use /page-id/links endpoint. documentation [1] has info need regarding tokens required read data. [1] https://developers.facebook.com/docs/graph-api/reference/v2.0/page/links#read

hibernate - Grails controller saves the domain item anyways -

using grails 2.3.9 in controller checks , when failing returning custom error response. here code snippet: def update() { def instance = group.get(params.groupid) instance.properies = params if (instance.haserrors()) { // going through here: instance not saved respond instance.errors, view:'edit' return } // custom checks if(checksfailed) { // instance saved anyways :( instance.discard() response.senderror(response.sc_conflict) return } instance.save flush:true // ... respond success } when check fails, error response returned want it. however, instance gets saved anyways (the instance.save not reached). how can make grails/hibernate know not save instance? another approach might disconnect instance hibernate session. how have in grails? update: in controller domain instance scaffolded, instance.discard() trick works: def update(group groupinstance) { if (groupin

apache - Redirect of domain to Amazon EC2 without Route53 -

i have website hosted in amazon ec2.i have set record point elastic ip. have set www point record. the problem both homepages exist (the 1 domain have in godaddy , 1 amazon url) i ec2-.....compute.com redirect homepage of domain. could me on how it? should use somehow httpd.conf? i not sure how httpd.conf. but alternative make redirection instance attach elastic ip instance, go domain management tools [ godaddy or network solutions ] , set in record. [ recommended ] take public dns of instance, go domain management tools [ godaddy or network solutions ] , set in c record www sub-domain

html - php to create table rows -

struggling bit (im learning php) create table rows when new user added. have tried re-arranging code still not working. so here code: <?php $args1 = array( 'role' => 'committee', 'orderby' => 'user_nicename', 'order' => 'asc' ); $committee = get_users($args1); foreach ($committee $user) { echo ' <table> <tr> <th style="padding: 10px;">job title</th> <th style="padding: 10px;">members name</th> <th style="padding: 10px;">email address</th> <th style="padding: 10px;">telephone number</th> </tr>'; echo ' <tr> <td style="padding: 10px;">' .$user->job_title .'</td> <td style="padding: 10px;">' . $user->display_name .'</td> <td style="padding: 10px;">'.$user->u

reporting services - To draw horizontal line in tablix region -

Image
i using ssrs 2005(ms-bids 2005) design reports.for designing 1 of table have requirement draw horizontal lines above , below group headers , footers shown in image below when try drag , drop line tool box, below error is there way using can draw lines shown in image. thanks in advance :) . you can use borders property. make top , bottom border style solid in border style , rest none . border color black want lines. , set border style none don't want it.

css - Apply styles to GWT widgets -

i have started explore gwt, , i'm bit confused different ways of applying styles gwt widgets.in gwt docs, there 4 ways can override default style of widget, 1) using tag in host html page.(deprecated) 2) using element in module xml file.(deprecated) 3) using cssresource contained within clientbundle. 4) using inline element in uibinder template. suppose have css file in package say, com.abc.xyz.styles.css .and file has following contents, /**the panel itself**/ .gwt-tablayoutpanel { border: none; margin: 0px; padding: 0px; } /**the tab bar element**/ .gwt-tablayoutpanel .gwt-tablayoutpaneltabs { background-color: #f4f4f4 !important; } /**an individual tab**/ .gwt-tablayoutpanel .gwt-tablayoutpaneltab { background-color: #6f6f6e !important; } .gwt-tablayoutpanel .gwt-tablayoutpaneltab-selected { background-color: white !important; } /**an element nested in each tab (useful styling)**/ .gwt-tablayoutpanel .gwt-tablayoutpaneltabinner { font-fa