Posts

Showing posts from January, 2012

javascript - Jquery radio button doesnt register click -

i have following 2 div block: <div class="span9" id="lejer"> <div class="span9" id="udejer"> note in html have alot of things within them sake of keeping short not post of it. at top of document have following radio buttons: <div class="controls"> <label class="radio inline"> <input id="optionsradios1" type="radio" name="optionsradios" value="option1" checked="" id="select_lejer"> jeg er lejer </label> <label class="radio inline"> <input id="optionsradios1" type="radio" name="optionsradios" value="option1" checked="" id="select_udlejer"> <p style="padding-left:1em"> jeg er udlejer</p> </label> </div> now toggle between visibilty of 2 div tags have created following

How to print something to command window in Visual FoxPro 9? -

i trying write simple program in visual foxpro, using built in help, cannot find answer there. there dozens of samples work forms, , need console.out() or printf(). while looking samples on internet, found this: ? 2 + 2 this line supposed print 4, nothing happens when program run menu or tool bar. type command text box , press enter. close opened tables (if any) in order see 4.

C# Getting return value from Elapsed Time Event -

hi have similar problem old thread still can't work around ( pass return value through eventhandler ) . trying implement timer calculate velocity @ intervals require elapsed time event return kind of value. i've tried using global variables event doesn't seem change variable. advice? in advance! namespace timer_label { public static class globalvariables { public static int _stringholder; public static int stringholder { { return _stringholder; } set { _stringholder = value; } } } public partial class form1 : form { public form1() { initializecomponent(); system.timers.timer mytimer = new system.timers.timer(); mytimer.elapsed += new elapsedeventhandler(displaytimeevent); mytimer.interval = 500; mytimer.start(); messagebox.show(convert.tostring(globalvariables.stringholder)); } public static void displaytimeevent(object sender, elapsedeventargs e) {

php - replace all matches in string after given position without regular expressions -

i have string abcxdefxghix . wish remove "x"s except first one. can find position of first "x" using strpos() , wish remove "x"s after position. str_replace() performs replacement of given string another, doesn't allow start position. substr_replace() gives start position, doesn't have search parameter. realize can done using preg_replace() seems should possible without regular expressions (or without crazy split/replace/assemble strategy). i 'd old-fashioned way: $index = strpos($input, $needle); if ($index !== false) { $input = substr($input, 0, $index + 1). str_replace($needle, $replacement, substr($input, $index + 1)); }

set hour in DateTimePicker more than 23 -

in project , need using timepicker format hh:mm , use duration , not time , possible increase hh upto 99 , not stop in 23 ! i using datetime picker page : http://tarruda.github.io/bootstrap-datetimepicker/ after several time edit js file , found must change js code in "getutchours()" method http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js file goal ! but cannot find define of method :( can me ? in advances ! valentino ! yes possible, code has condition whenever detects hour equal or greater 23 reset 23. in code there no limit. in bootstrap.timepicker.js search "23" or "24" in code you find following `this.hour>=24?this.hour = 23` i changed this.hour>=24?this.hour = this.hour without limit. to make 99 changue to. `this.hour>99?this.hour = 99` **up 99** be sure use `showmeridian = false`, to make work. im using "time" variable type in mys

Sort an Array in PHP by a specific value -

how can sort this array $data['response']['games'][x]['name'] alphabetical a-z? i have tried array_multisort() didn't understand function @ all. hope can me - googled , searched didn't found solution problem. edit: link updated. code: https://github.com/gabrielwanzek/gwsteamlib/ you can achieve usort() , allows define custom comparison function: usort($data['response']['games'], function($a, $b) { return strcmp($a['name'], $b['name']); }); note $data object of type stdclass ; not array.

java - JavaFX stylesheet not applied when fxml loaded node is added as a child -

i have fxml file references css file. when load fxml , set root of scene, css applied nicely. however when create custom region (with getchildren made public), , add loaded fxml node it, no css applied anymore. the css uses style classes. what missing here? /edit i worked around using approach described here: http://www.guigarage.com/2012/11/custom-ui-controls-with-javafx-part-1 it doesn't answer initial problem guess it's better way of working anyway. if can still explain behavior of original question, i'd happy hear it. the problem used static load(...) method instead of instance load method created fxmlloader object.

ruby on rails - Converting a month and year to a date -

in rails 4 app receive month , year user make date. new date should 1st of following month i'm not sure on best way tackle this. at moment have expiry = date.new(params[:expyear],params[:expmonth].to_i + 1,1) but isn't ideal because if entered 12 month approach make month 13 of course doesn't exist (and year wouldn't updated either). are there useful functions here? you can this: year,month = params[:expyear].to_i,params[:expmonth].to_i date.new(year,month) + 1.month or use end_of_month @dax wrote: date.new(year,month).end_of_month + 1.day that resolve problem

eclipse - How to run the example of ViewPager on Android developer site? -

Image
when try run example https://developer.android.com/reference/android/support/v4/view/viewpager.html on eclipse,the emulator display error dialog . here logcat: i don't know why can't run.i build project , copy example code in eclipse,i set android api level 11.and seem ok. when double click last 1 line of logcat: at com.lanz.xbp2v4.actionbartabspage.oncreate.java:37 it redirect code included in oncreate method : bar.setnavigationmode(actionbar.navigation_mode_tabs); so think may wrong in part of code,hope can me!xd the code in oncreate method: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mviewpager = new viewpager(this); mviewpager.setid(r.id.pager); requestwindowfeature(window.feature_no_title); setcontentview(mviewpager); // full screen getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullsc

python - Unicode escape error -

experts! i'm trying make twitter client, twython. now, retrieve command interactive interpreter. in test upload picture, passed string: "tweet photo: 'tweeted python test' + path: 'c:\users\akhya_000\pictures\my pictures\bing.png" but found invalid , resulted in error: syntaxerror: (unicode error) 'unicodeescape' codec can't decode bytes in position 51-52: truncated \uxxxxxxxx escape can me, what's wrong string? should fix it? you want escape backslashes or use raw string, since python seeing \u , interpreting unicode escape sequence . escaping looks this: "tweet photo: 'tweeted python test' + path: 'c:\\users\\akhya_000\\pictures\\my pictures\\bing.png" a raw string , python ignore escape sequences, looks this: r"tweet photo: 'tweeted python test' + path: 'c:\users\akhya_000\pictures\my pictures\bing.png"

c# - Transcribing a polygon on a circle -

Image
i try inscribe diagonals of decagon inside circle like in c# approach creating circle e.graphics.drawellipse(mypen, 0, 0, 100, 100); and draw lines inside using e.graphics.drawline(mypen, 20, 5, 50, 50); after draw decagon polygon. currently im stuck @ how divide circle 10 parts/ finding correct coordiantes of points on circumference of circles because im not in math, want know how know next point in circumference of circle size of circle indicated above. , want ask better approach problem. thank :) just grits , shins, here's generic implementation inscribe x-sided polygon rectangle pass it. note in approach i'm not calculating absolute points. instead, translating origin, rotating surface, , drawing lines respect origin using fixed length , angle. repeated in loop achieve end result below, , similar commanding turtle in logo : public partial class form1 : form { picturebox pb = new picturebox(); numericupdown nud = new numericupdo

android - My webview doesn't work on my app, It worked when the files were locally stored -

my problem used have super.loadurl code cordova leading file:///android_asset/ directory, , worked fine.. 100% , took bit load working fine. made files hosted on website take off whopping 197mb off app make lighter , uploadable, gave me "application error- connection server unsuccessful" tried using "webview" code , used example "www.google.com" , worked fine. tried using site, , change color of screen bg in site, nothing else show up. tried making simple html file small text , changed index.html it, , loaded text fine.. i'm lost, have no idea try or do. please lead me in right direction. `110-06 12:15:26.355: d/dalvikvm(1102): gc_for_alloc freed 46k, 5% free 2933k/3084k, paused 61ms, total 63ms 10-06 12:15:26.565: d/dalvikvm(1102): gc_for_alloc freed 291k, 12% free 3156k/3548k, paused 18ms, total 20ms 10-06 12:15:26.604: d/dalvikvm(1102): gc_for_alloc freed 2k, 9% free 3258k/3548k, paused 25ms, total 26ms 10-06 12:15:26.604: i/dalvikvm-heap(1102

regex - Match for words that have same letters -

i trying match words have same letter repeated second letter, ending character , in middle 1 times, , need capture second letter , match whole line. words examples syzygy error banana i tried doing ^[a-z]([a-z])[a-z]+[a-z]+\1$ and matches lines , captures second letter, need make sure second letter repeated s(y)z y <-same second character g y <- ends in same character so need sure in string y @ second position, 1 time in middle, , ending of string one way this, if understand correctly using negative ahead . ^.(.)(?:(?!\1).)*\1(?:(?!\1).)*\1$ the dot . matches single character, except line break characters. using \1 , reference match saved in first capture group. see regular expression explanation see live demo of capturing second character , matching whole string. see live demo of how \1 matching repeated characters.

android - How set ad-hoc mode on nexus 4 with cynogenmod -

i'm tryng set ad-hoc mode on galaxy nexus 4 rom cyanogenmod i've problems. have executable file load kernel modules called "wifiloader" activate ad-hoc mode, made reading code: https://android.googlesource.com/platform/hardware/libhardware_legacy/+/745e7fd4e09db2b47371338ee54c54255e286473/wifi/wifi.c besides found (searching on internet) executable of iwconfig android(with samsung s2 gingerbread works) nexus 4 have error: ./wifiloader start starting wifi... ok. ./iwconfig wlan0 mode ad-hoc essid my_network channel 9 error wireless request "set mode" (8b06) : set failed on device wlan0 ; invalid argument. any suggestion? can find executable of iwconfig version of android? there way activate ad-hoc mode? i'm getting crazy :(

python - Get last exception in pdb -

is there way examine last exception when in pdb/before entering pdb? (using python 2.7.5). immediately (yes, enter no other commands @ all) after exception being raised in code, sys.exc_info() ; results in (none, none, none) . @ point, can pdb.pm() , , pdb starts @ point exception raised. i'd able examine exception object (it not stored in variable before being raised). there nothing helpful in http://docs.python.org/2/library/pdb.html or http://docs.python.org/2/library/sys.html edit: know set_trace . i'd examine exception before modify code. you can use sys.last_value : >>> no_such_var traceback (most recent call last): file "<stdin>", line 1, in <module> nameerror: name 'no_such_var' not defined >>> import sys >>> sys.last_value nameerror("name 'no_such_var' not defined",) >>> sys.last_value.args ("name 'no_such_var' not defined",) >>>

android - imageButton onClick is not activating specified method -

i have 2 imagebuttons refer same openthebag method onclick. weird thing can't head around right when click @id/purse imagebutton activates openbug, @id/red_paint doesn't can seen debugger. on earth happening here, please help. here piece of xml. <framelayout android:id="@+id/frame" android:layout_weight="1.0" android:layout_width="match_parent" android:layout_height="0dip" android:background="@drawable/shelf_wall"> <imagebutton android:id="@+id/purse" android:layout_width="67dp" android:layout_height="82dp" android:layout_gravity="right" android:contentdescription="@string/bag" android:onclick="openthebag" android:scaletype="fitcenter" android:src="@drawable/purse" android:background="@null" /> <imagebu

html - How can I display vertical text in a table with fixed height? -

i want display vertical text on header of table; header has fixed height. , want hidden overflow too. my html is: <table border='1px solid black'> <thead> <tr style='font-weight:bold; color:blue'> <td width="60"> data </td> <td width="35"> voto </td> <td width="50"> tipo </td> <td width="10"> </td> <th style="color:red; height:200px; vertical-align:bottom" width="20"> <span> <div style="width:100%;height:100%;overflow:hidden;"> hi </div> </span> </th> <td> annotazioni </td> </tr> </thead> </table> and css: table { border-collapse:collapse; table-layout: fixed; width: 400px; } th span { writing-mode: tb-rl; filter: flipv fliph; -webkit-transform:rotate(-90deg);

linux - virtualhost without real domain name -

i've configuration virtual host , runs real domains. testing purpose need create same virtual host non real domain (i.e. domain10). considerated browser check name of domain of virtual host, think using 127.0.0.1. i've no idea realize this. <virtualhost *:80> serveradmin info@domain10.org servername domain10.org serveralias domain10.org directoryindex index.html index.htm index.php documentroot /home/domain10.org/ <directory /home/domain10.org/> options -includes -indexes -followsymlinks -execcgi +multiviews allowoverride none order allow,deny allow </directory> </virtualhost> you can use /etc/hosts file purpose. there should line in beginning 127.0.0.1 . add domain10.org list of hosts resolves address. for example, if existing line is: 127.0.0.1 localhost localhost.localdomain just extend to: 127.0.0.1 localhost localhost.localdomain domain10.org then (on machine only) domain10.org resolve 127.0.0.1 . if testing on same

Send mail with Python App Engine turns norwegian characters into <?> -

i using from google.appengine.api import mail to send email on app engine running python. when checked sent mail not handle norwegian characters åæø. åæø characters turned when reading mail in gmail. below mail sending method called (removed content). mail.send_mail(sender="exphilapp <xxxxx@gmail.com>", to=email, subject="velkommen til exphil-appen", body=""" hei {0}! takk @ du registerte deg til exphil-appen. ditt brukernavn er {1}. mer info, se www.exphilapp.no hilsen håkon """.format(name,username)) file encoding is: # -*- coding: latin-1 -*- the special case here use triple """ quote mark construct string .format insert users name , username. how can make string work norwegian characters åæø? try enabling unicode literals representing norwegian characters with: from __future__ import unicode_literals btw, seems h

c# - Add comma between values by using Linq -

my values come combobox: 2|722|742|762|77 i delete unnecessary characters follows: foreach (var item in checklistbox) { string[] list = item.split( new string[] { "2|" }, stringsplitoptions.removeemptyentries); } my list values result: "72" "74" "76" "77" my question is: how can of above values in 1 row (next each other) separated comma this: 72,74,76,77 ? how about var result = string.join(",", item.split(new string[] { "2|" }, stringsplitoptions.removeemptyentries));

javascript - Table using a tag and spans -

Image
i building table using css , combination of <a> tags <span> s : <a class='header'> <span>user id</span> <span>name</span> <span></span> </a> <a href='somesite.php'> <span>7</span> <span>ofek</span> <span><button type="button" onclick="somefunc()">add favourites</button></span> </a> the results looks : now problem when click button still redirected somesite.php, , function somefunc() never gets called, seen somewhere button cant nested inside span, whats alternative make work? want whenever user click on line redirected him somesite.php, not when presses button, want func somefunc() called. nesting button element in a element creates problems in handling events, , forbidden in html5 cr. the simple way avoid creating problem separate interactive elements: <a href='somesite.php'>

ffmpeg command line for capturing (and recording) audio and video in 720p from decklink card using Windows 7 -

i trying capture audio , video blackmagic decklink capture card using windows 7 @ 720p, cant seem ffmpeg command line settings right. ffmpeg -list_devices true -f dshow -i dummy [dshow @ 02457a60] directshow video devices [dshow @ 02457a60] "blackmagic wdm capture" [dshow @ 02457a60] "decklink video capture" [dshow @ 02457a60] directshow audio devices [dshow @ 02457a60] "decklink audio capture" ffmpeg -list_options true -f dshow -i video="decklink video capture" [dshow @ 03c2ea20] directshow video device options [dshow @ 03c2ea20] pin "capture" [dshow @ 03c2ea20] pixel_format=uyvy422 min s=720x486 fps=29.97 max s=720x486 fps=29.97 [dshow @ 03c2ea20] pixel_format=uyvy422 min s=720x486 fps=23.976 max s=720x486 fps=23.976 [dshow @ 03c2ea20] pixel_format=uyvy422 min s=720x576 fps=25 max s=720x576 fps=25 [dshow @ 03c2ea20] pixel_format=uyvy422 min s=720x486 fps=59.9402 max s=720x486 fps=59.9402 [dshow @ 03c2ea20]

whitespace - Avoid line break between html elements -

Image
i have <td> element: <td><i class="flag-bfh-es"></i>&nbsp;+34&nbsp;666&nbsp;66&nbsp;66&nbsp;66</td> i hoping keep single line, get: as can see, flag , telephone number in separate lines. &nbsp; working in between numbers of telephone number, not between flag , telephone number. how can make sure no line-break @ introduced renderer? there several ways prevent line breaks in content. using &nbsp; 1 way, , works fine between words, using between empty element , text not have well-defined effect. same apply more logical , more accessible approach use image icon. the robust alternative use nobr markup, nonstandard universally supported , works when css disabled: <td><nobr><i class="flag-bfh-es"></i> +34 666 66 66 66</nobr></td> (you can, need not, use &nbsp; instead of spaces in case.) another way nowrap attribute (deprecated/obsolete, st

Error with G++ while compiling -

i got error when trying compile cpp code c:\mingw\bin>g++ hello.cpp g++: fatal error: -fuse-linker-plugin, liblto_plugin-0.dll not found compilation terminated what going wrong? you have (or build-system has) specified flag -fuse-linker-plugin requires dynamic library file liblto_plugin-0.dll in library search path, linker cannot find it. btw, have discovered reading error message got.

php - Postgresql usage of aggregates and non-aggregate columns, grouping by -

some things in lecture , in lab assignment not explained well. having trouble displaying correct information. here database info, reference me. the database tables info query trying execute the postgresql php select statement this results in sql error being throwned connected database! query failed: error: column "city.name" must appear in group clause or used in aggregate function line 3: city.name ^ now if add city.name group clause, returns 4096 rows! dont want happen, results have group country name 232 rows. want display country name, city name, , city highest population in country. city name throwing me off, im guessing there more complicated more syntax heavy solution. can provide. -tom reese you need this: select country.name, city.name, mp.maxpop lab6.country, lab6.city, (select country_code, max(population) maxpop lab6.city group

sqlite - Running Total example -

i have following data: id customer date value1 value2 istrue 10 13 2013-08-20 00:00:00.0000 170 180680 0 11 13 2013-09-02 00:00:00.0000 190 181830 0 12 13 2013-09-07 00:00:00.0000 150 183000 1 13 13 2013-09-14 00:00:00.0000 150 183930 0 14 13 2013-09-16 00:00:00.0000 150 184830 0 15 13 2013-09-19 00:00:00.0000 150 185765 1 16 13 2013-09-30 00:00:00.0000 800 187080 0 17 13 2013-10-02 00:00:00.0000 100 188210 0 28 13 2013-10-04 00:00:00.0000 380 188250 1 how can have following results,where sumvalue1 summury of value1 until field istrue gets true , resets after , difference value2 difference of field value2 everytime istrue field gets true? id customer date value1 value2 istrue sumvalue1 differencevalue2 10 13 2013-08-20 00:00:00.0000 170 180680 0 11 13 2013-09-02 00:00:00.0000 190 181830 0 12 13 2013-09-07 00:00:00.0000 150 183000 1 510

Windows Impersonation Apache Module in Lazarus -

i in process of porting several windows desktop applications single web site. the current setup includes several sql server backend databases, configured windows authentication (sspi) only, , every user/group/role has specific rights on specific objects. convenient, because application layer doesn't have implement access control. i'd keep same way web server, apache on windows machine. every connection databases being made using apache's account. that's understandable , expected, in fact apache deliberately given access public data, able deliver public content. but in case domain user logs in (the login process implemented) i'd apache process handles request impersonate user, , act them during whole request. at first, tried php's fastcgi.impersonate trick, using iis web server. gave on that, because (1) had port apache anyway , (2) php-specific, , turned out should targeting web server whole... so redirected search apache modules. months of resea

incompatible pointer type conversion warning in C socket programming -

list *attachnode(list *tmp,list *hd)//function ip address { if(hd==null) { hd=tmp; } else { tmp->next=hd; hd=tmp; } return(hd); } tmp->next=hd giving warning of incompatible type pointer conversion default "next" list type. you say, "next" "list type" believe should "list *" type but without typedef cannot sure okay, comment, edith: it should typedef struct list {...; struct list *next;} list; the reason is, c need forward declaration, else not determine "type" of next. visualication: typedef struct {xxx *next;} yyy;

html - fixed bottom bar with css gradient background -

i trying put bottom bar bottom of screen. have piece of css code creates bar me. haven't able fix bar bottom. css .top_bar { display:block; height:18px; margin-bottom:10px; margin-top:10px; background-image: linear-gradient(left bottom, rgb(135,30,51) 15%, rgb(90,115,183) 58%, rgb(90,116,183) 79%); background-image: -o-linear-gradient(left bottom, rgb(135,30,51) 15%, rgb(90,115,183) 58%, rgb(90,116,183) 79%); background-image: -moz-linear-gradient(left bottom, rgb(135,30,51) 15%, rgb(90,115,183) 58%, rgb(90,116,183) 79%); background-image: -webkit-linear-gradient(left bottom, rgb(135,30,51) 15%, rgb(90,115,183) 58%, rgb(90,116,183) 79%); background-image: -ms-linear-gradient(left bottom, rgb(135,30,51) 15%, rgb(90,115,183) 58%, rgb(90,116,183) 79%); background-image: -webkit-gradient( linear, left bottom, right 0, color-stop(0.15, rgb(135,30,51)), color-stop(0.58, rgb(90,115,183)), col

asp.net mvc - How to change View & partial view default location -

i new in mvc , curious know how change view & partial view location. we know view & partial view store in view folder. if controller name home view must store in home folder inside view folder , parial view store in shared folder. know how can change view & partial view default location ? 1) suppose controller name product want store corresponding view in myproduct folder.......guide me need make works fine. 2) want store partial view in partial folder inside view folder , want load partial view there. guide me need make works fine. basicall how instruct controller load view & partial view folder without mentioning path. looking discussion. thanks you can modify razorviewengine 's viewlocationformats , partialviewlocationformats properties in global.asax startup code. around lines below should work: protected void application_start(object obj, eventargs e) { var engine = viewengines.engines.oftype<razorviewengine>().single(); var

sql server - C# Hash SHA256Managed is not equal to TSQL SHA2_256 -

i using hashed passwords salt (the username). problem hashed values of c# not equal initial values add database tsql script. tsql: update [users] set password = hashbytes('sha2_256', 'test123'+upper([username])) go; c#: var passbytes = new unicodeencoding().getbytes(pass); var saltbytes = new unicodeencoding().getbytes(username.toupper()); var datatohash = new byte[passbytes.length + saltbytes.length]; array.copy(passbytes, datatohash, passbytes.length); array.copy(saltbytes, datatohash, saltbytes.length); var sha = new sha256managed(); return sha.computehash(datatohash); i guess has encoding. have no idea how fix this. username varchar(50) the db existing 1 changing varchar not easy. i tried: update [users] set password = hashbytes('sha2_256', n'test123'+upper([username])) go; if sql server database configured use default collation of sql_latin1_general_cp1_ci_as, in c# code, use code page 1252 convert characters bytes

sql - Select all tables in schema based on their parent-child hierarchy -

my requirement delete data couple of table selected dynamically based on search condition. so cursor should fetch tables in parent-child hierarchy not give exception 'child record found' while deleting records. lets take exable table child of table b table b child of table c table d child of table g so should delete in sequence. a then b or d d or g if use cascading foreign keys, don't have worry table order. delete top of hierarchy (table g in in example) , dependent rows in descendent tables deleted atomically. read more cascading referential integrity constraints . re comment: also should generic enough handle delete if delete cascade not there , not have knowledge of dependencies. see these questions tips on discovering constraints in oracle: list of foreign keys , tables reference oracle - recursive query (for table dependencies) not recursing (not as i'd like) thanks question regarding "all parent - child tabl

jQuery Uniform iPad – doesn't click -

i'm having trouble uniform plugin jquery on ipads. on ipad if go http://shop.area51store.co.nz , go "mens" , click on product notice once gets product detail view able select size. doesn't seem work when ipad in horizontal orientation work when in portrait. tap , nothing happens. any ideas? update: turns out can't edit quantity when it's horizontal updated link: http://www.shop.area51store.co.nz/estore/style/n5500565033.aspx the problem :hover state , touch states. installing modernizr fixed me

Why do we need interfaces to achieve event listeners in java? -

i have doubt in java: when people writing event listener implement interface , define particular function in interface achieve particular task. doubt instead of implementing interface can define function appropriate name. also, how interfaces in achieving event listeners? because many different classes want listen same event , java not allow multiple inheritance.

java - Restlet - Using URI Template Variables in Authenticator -

i attempting perform authentication in restlet looking credentials based on portion of uri, i.e. multitenant authentication. i have not been able chain router authenticator router resource access. possible? let's have authenticator needs tenantid variable user. i've been trying setup following work no success. thoughts? public class myapplication extends application { public authenticator authenticator; @override public restlet createinboundroot() { router router = new router(getcontext()); router.attach("/", traceresource.class); router.attach("/{apiversion}/{tenantid}/pathone/{someid}", resourceone.class); router.attach("/{apiversion}/{tenantid}/pathtwo/{someid}", resourcetwo.class); authenticator.setnext(router); router authenticationrouter = new router(getcontext()); authenticationrouter.attach("/{apiversion}/{tenantid}/{remaining}&qu

Access Denied mysql after creating user, granting, and flushing -

i making https://stackoverflow.com/a/18756674/1197775 . but getting this: mysql -uspot -pfakepasswd error 1045 (28000): access denied user 'spot'@'localhost' (using password: yes) how can debug problem? update i tried mysql error 1045 (28000): access denied user 'bill'@'localhost' (using password: yes) . no anonymous users anymore, no luck yet. update 2 select user,host mysql.user; +------------------+-------------------+ | user | host | +------------------+-------------------+ | root | 127.0.0.1 | | root | ::1 | | spot | % | | root | localhost | +------------------+-------------------+ try 'mysql -u spot -p' , enter password.

inner classes - Access the methods of an InnerClassNode using java and ASM -

i trying access methods, fields, etc of inner class using asm. treating parent class classnode , storing list<innerclassnode> list = myclassnode.innerclasses i iterating through list , trying information want each innerclassnode. here's thing though. looking @ official asm api documentation, innerclassnode class not extend classnode class. in fact there appears no way useful inner class. since way that's apparent me information class "inside" classnode, impossible information inner class? the innerclassnode , corresponding classvisitor.visitinnerclass method reflect information stored in class bytecode's innerclasses_attribute , describes relationship between inner class , current class (e.g. class name, outer class name , access flags). information inner class need load separately, same way you've loaded outer class.

Linking Visual Studio 2012 C++ Unit Testing project against an exe causes access violations -

i'm starting existing, monolithic, .exe native visual studio 2012 project. want add native unit test project alongside, according http://msdn.microsoft.com/en-us/library/hh419385.aspx#objectref , suggests supported: the code under test built .exe file: add separate test project. link output object file. i dllexport 'ed methods needed test, linked test project exe project's .lib library , things seemed work simple test functions. however, tried more interesting started getting access violations one: first-chance exception @ 0x04fa4aac (testapplication.exe) in vstest.executionengine.x86.exe: 0xc0000005: access violation reading location 0x011bf0e0. so created new solution simplest .exe , unity test project pair muster , able reproduce exceptions caller (unit test project) , callee (.exe project): callee (.exe project) header.h : #include <string> __declspec( dllexport ) std::string __cdecl strtest( std::string j ); callee (.exe project) he

oop - C++ Singleton/Active Object Paradigm -

i wondering how make class create several instances i.e session o1 = new session(); session o2 = new session(); you make these sessions active session so. o1.makeactivesession(); session::setactivesession(o2); then @ point in code go: session::getactivesession(); and return active session object or create new 1 if 1 doesn't exist. 1 session can active session @ 1 time, if session told become active session old 1 deactivated. so question is, how make ? this lazy-loading based singleton: class session { public: static session& getinstance() { static session s; // <-- instantiated upon first call return s; } private: session() { } // <-- private constructor ~session() { } session(const session&); // <-- private copy constructor session& operator=(const session&); // <-- private assignment operator }; used as: session&

Create a weekCount column in SQL Server 2012 -

i have data: id worked_date ----------------- 1 2013-09-25 2 2013-09-26 3 2013-10-01 4 2013-10-04 5 2013-10-07 i want add column called weekcount . based date 2013-09-25 . data worked_date 2013-09-25 2013-10-01 have weekcount 1 , 2013-10-02 2013-10-8 have weekcount 2 , on. how can done? thanks. perhaps approach solve problem. i compute in-memory table contains week's boundaries along monotonically increasing number (buildweeks). compare worked_date values date boundaries. based on comment @sgeddes, need reverse week number use dense_rank function calculate reverseweeknumber . with bot(startdate) ( select cast('2013-09-25' date) ) , buildweeks (weeknumber, startofweek, endofweek) ( select n.number weeknumber , dateadd(week, n.number -1, b.startdate) startofweek , dateadd(d, -1, dateadd(week, n.number, b.startdate)) endofweek dbo.numbers n cross apply bot b ) sel

r - How to Remove any row with "." in it? -

in following example, want remove row "." in row names data<-matrix(nrow=10,ncol=3,1) rownames(data)<-c("a.1","b.2",letters[3:10]) i have tried grep that: data[( grepl(".", rownames(data))), ] but, think there missing here. appreciate thanks '.' matches character needs escaping. data <- matrix(nrow=10, ncol=3,1) rownames(data) <- c("a.1", "b.2", letters[3:10]) data[!grepl('\\.', rownames(data)), ] [,1] [,2] [,3] c 1 1 1 d 1 1 1 e 1 1 1 f 1 1 1 g 1 1 1 h 1 1 1 1 1 1 j 1 1 1

github - Git add does not add the folder and files that are copied in Windows -

i unzipped , copied folder (with files in them) directory project directory git did: git add . but not seem add folder @ all. i tried git status nothing seems showing there either. is there need fix this?

Have connection strings as well as common config source in asp.net or wcf websites -

hi looking solution have common connection strings have common connections strings file need specific add , remove connection strings in sites...but not see way it... <configuration> <connectionstrings configsource="connections.config"> <remove name="appconnectionstring" /> <add name="appconnectionstring" connectionstring="data source=(local);initial catalog=xyz;integrated security=true;multipleactiveresultsets=true;" /> <connectionstrings/> </configuration> with file connections.config containing <connectionstrings> <add name="name" connectionstring="conn_string" providername="system.data.sqlclient" /> <add name="name2" connectionstring="conn_string2" providername="system.data.sqlclient" /> </connectionstrings> thanks, bala if not work have expressed above (which shame in opinon), have

cuda - Using GPU Shared Memory : A check on my understanding -

i have gtx titan has 49152 bytes/block of shared memory. i'm trying solve ~9000 coupled ode's , store these ~9000 concentrations, doubles, in shared memory in order calculate rate of change of each concentration. so i'd affirm not possible since double 8 bytes , 49152/8 = 6144. right? your understanding correct. cannot simultaneously store 9000 double quantities in shared memory accessible single threadblock (i.e. in single sm).

javascript - File-Upload Server Side Script Cross Domain Execution? -

this scenario: have 2 domains, d1.com , d2.com, , have complete ftp access d1.com , store file-upload script there, , have second domain d2.com not own, can edit general html/javascript. is there way possible can access server-side script on d1.com , execute on d2.com , have upload @ same time d2.com. thank answer.

javascript - communication between ear modules -

hi working on project there rest service deployed part of ear , our application deployed different ear . (let me call restapi.ear , myapplication.ear) . we have gui deployed in myapplication.ear , want access rest services through our gui. js file within myapplication.ear using rest apis exposed restapi.ear . i read cross domain js problems suggestions how allow communication . best practices have follow allow integration. you can configure server support cors can take tomcat 1 example tomcat 7 cors_filter

css - Are div's even necessary around most elements since there is absolute positioning -

so in past few months i've taught myself web design. of course there's ton more learn, feel have firm grasp on know far. 1 thing i've wondered how necessary div is, when end using absolute positioning. instance wrote following code: <section id="header-section"> <header class="main-header"> <h1>the voice of jeremy donahue</h1> <nav class="main-navigation"> <ul> <li><a href="http://www.thevoiceofjeremydonahue.com/about">about</a></li> <li><a href="http://www.thevoiceofjeremydonahue.com/contact">contact</a></li> </ul> </nav> </header> </section> when read source code on lot of pages seems me things grouped or similar. of course assumption is, designer have artist

.htaccess - Will Google be able to access my website after blocking all US IPs? -

i'm going block ips using .htaccess way : <limit head post> order deny,allow deny 3.0.0.0/8 deny 4.0.0.0/25 deny 4.0.0.128/26 deny 4.0.0.192/28 deny 4.0.0.208/29 .... allow </limit> will google able access , index website after blocking ips? edit : sorry ambiguity, i want google index website. although google has servers spread across whole world, quite hard search engine's bots originate from. suggest block ip ranges add exclusion clause matches against user-agent search bots like: setenvifnocase user-agent (googlebot|bingbot|yahoo!\sslurp) is_search_bot <directory /docroot> order deny,allow deny 3.0.0.0/8 deny 4.0.0.0/25 deny 4.0.0.128/26 deny 4.0.0.192/28 deny 4.0.0.208/29 allow env=is_search_bot </directory>

ajax - hiding the parameters value in web browser MVC C# -

is there possible way hide form data or controllers value in web bowser need hide username , password when logging in im working on security site. unfortunately after checking in google chrome developer's tool every time im requesting ajax call shows password , user name if go network , browse ajax call. there s code hide sensitive data me? there no effective way hide username , password browser, if attacker has access browser war lost. should protect during transit user's browser server. can accomplish using ssl. ssl encrypt form data in transmission intercepting traffic cannot view form data. setting ssl beyond scope of so here's link started. http://www.iis.net/learn/manage/configuring-security/how-to-set-up-ssl-on-iis you can ask more questions on how setup ssl in superusers stackexchange site.

cocos2d iphone - several layers using the same sprite sheet -

pardon me if sounds bit trivial. in game several of layer classes use same sprite sheet. want avoid declaring same batch nodes in every layer class. how can achieve this? you can't. node can have 1 parent. if create batch node , add 1 layer, can't add another. if pass reference batch node around work makes having layers pretty pointless because sprites children of layer batch node added to. you instead use single batch node , group sprites adding "layer sprites" empty texture rect batch node, , adding actual sprites layer sprites. to create sprite empty texture use initwithtexture:rect: method , use cgrectzero. alternatively in case no longer works can use small rect , set sprite's opacity 0. setting visible no may work, depending on whether visibility propagated in sprite batched sprites or not.

c# - Using async/await to improve performance -

i have service method runs set of "rules" on incoming data. of these rules perform simple checks validating id number, , go out databases lookup information. looks pretty this: public void runrules(validationrequest request) { // each rule returns bool example var rules = getrules(); var results = list<bool>(); parallel.foreach(rules, rule => { var result = rule(); lock(results) results.add(result); }); foreach(var result in results) { recordresultindatabase(result); } callnextservice(somenewrequest); } i think (but not sure) improve things using async/await . idea is, when 1 rule finishes call recordresultindatabase while other rules still running. as requirement though, wouldn't want call callnextservice happen until rules have ran , results recorded in database. problem i'm absolute noob async/await , think (but not sure) task.waitall might i'm looking for.