Posts

Showing posts from August, 2012

regex - .htaccess rewrite product URL to root category -

having problems writing rewrite rule, regex skills bit lacking i'm reading tutorials , working off examples... can't seem it... # /boys/footwear/socks/surfs_up_kids_three-pack_socks/product.aspx?productid=4407&deptid=365 # /boys/footwear.html rewriterule ^.*boys/footwear/socks/([^/]+)/product\.aspx([^/]+)$ /boys/footwear.html [r=301,l,nc] the idea match products have boys/footwear/socks , product.aspx assigned in url. though want able tweak depending on scenario... may not product.aspx what doing wrong 1st off... cause thats annoying part. i've followed dozens of tutorial , examples no luck... , know smallest thing... thanks everyones input! update this suppose work according to: http://htaccess.madewithlove.be/ (but not work on website?) rewriterule ^(.*)boys/footwear/socks/(.*)/product.aspx(.*)$ $1boys/footwear/socks.html [r=301,l,nc] don't know rewrite regex usage, since nobody answered yet, thought might steer in right direction.

delphi - .NET Interop 'Method not found: 'Void System.Threading.Monitor.Enter.. -

a partner created com lib x.dll , x.tlb in c#, .net framework 4. had "com interop" checkbox checked in vs. he referred register c#/vb.net com dll programmatically create tool registers .dll. worked. (our delphi app can access .com object) code used register (from above link) is: assembly asm = assembly.loadfile (@"c:\temp\x.dll"); registrationservices regasm = new registrationservices(); bool bresult = regasm.registerassembly(asm, assemblyregistrationflags.setcodebase); we imported x.tlb delphi 7, creating .pas file through making calls com library. in delphi, when call function in com library, we're getting error: ...exception class eoleexception message 'method not found: 'void system.threading.monitor.enter(system.object, boolean byref)''. process stopped. we have no idea means or how resolve it. any suggestions? when compiling c# dll, targeting .net version prior framework 4. make sure setting in compiler targe

python - Using soundex feature w/django search engine -

i'm building search engine django/python site. 1 requirement soundex feature, if searches "smith" or "johnson" search return homonyms "smyth" or "jonsen". database mysql, fwiw. what's recommended approach? right i'm leaning towards haystack + whoosh, capture soundex feature. thanks in advance help. mysql has soundex() function. docs here . soundex algorithm developed aid in searching anglo-saxon names in english. it's not best choice these days. you're better off either metaphone or double metaphone . in case, people store result. makes easy index, , searching pretty fast. data integrity problem, though. ideally, i'd want this. create table persons ( ... last_name varchar(25) not null, last_name_phonetic varchar(6) not null, -- not sure length check (last_name_phonetic = double_metaphone(last_name)) ... ); but requires dbms have either intrinsic double_metaphone() function, or supp

random - Generating pseudorandom nonrepeating integers from a 32-bit finite set -

i want take set of 4 billion positive integers , output them in pseudorandom sequence, such no number repeated until 4 billion have been outputted. want sequence repeatable , predictable given seed. there algorithm producing such sequence, without resorting putting ordered sequence in memory running pseudorandom sorting operation on entire thing? randomness can weak if makes things easier. thanks you can use simple linear congruential generator appropriate values a (= 214013) , c (= 2531011) , m (= 2^32) make full period. x(n+1) = (a*x(n) + c) mod m this produce all 2^32 values without replacement , repeat same sequence after that.

html - Fantasy Font Loading differently in ie -

i using default font-family "fantasy"(default font), want showing in chrome, ie rendering differently here on js fiddle loading differently in ie , chrome p{font-family: fantasy;} js fidldle created thanks i used font-family:impact, charcoal, sans-serif; to fantasy font in chrome in browsers..

insert - MySQL - Creating records in table 2 on creation in table 1 -

say have 2 tables, ballplayers , stats in database. when add ballplayers record (add new team) there way create new entry player in stats table well? ballplayers stats id, playername, number id, totalpts, totalrebounds (they referenced using id column in each table.) so this... add ballplayers ballplayers id, playername, number 1 nick 22 how can mysql create new entry in stats triggered on entry creation in ballplayers given id , having defaults of totalpts , totalrebounds set 0? stats id, totalpts, totalrebounds 1 0 0 is bad db design? possible without having write 2 queries? ( insert ballplayers; & insert stats; )any appreciated. if chose go route of trigger, automatically add row second table, using following code: create trigger trig_ballplayers_after_insert after insert on ballplayers each row insert ignore stats values(new.id, 0, 0);

MvvmCross Android - Alternative to RelativeSource binding for button command -

Image
i have list of items bound mvxbindablelistview mvxitemtemplate. have 4 items in list bound view. data gets updated , view displays new data fine . now, want add 2 buttons item template. however, relative source binding not available mvvmcross. (see image) but i'm having difficulties working out solution this. i have tried itemclick binding of list item, gives me 1 possibility of click , need 2. can help? see second option in answer in mvvmcross changing viewmodel within mvxbindablelistview - covers 1 way this. using approach you'd expose list of objects like: public class wrapped { public icommand gothrucommand { get; set; } public icommand opencommand { get; set; } public string name { get; set; } } and you'd use axml list template bound controls like: <textview ... local:mvxbind="{'text':{'path':'name'}}" /> <button ... local:mvxbind="{'click':{'path'

emacs - How to make *Buffer List* appear below the other windows? -

so, instead of creating split window under (or right of) active window, appear below existed ones half of frame height? and, after closing, frame layout restored before calling c-x c-b? i’d see full paths opened files. see previous answer related issue: https://stackoverflow.com/a/21544307/2112489 see related answer @phils, includes nice halve-other-window-height function: https://stackoverflow.com/a/4988206/2112489 see built-in stock functions display-buffer-below-selected or display-buffer-at-bottom , available in recent version of emacs trunk -- i'm not sure when each function first introduced. in window.el . the doc-string of function split-window states in relevant part:   size defaults half of window's size . second optional argument -- i.e., split-window (&optional window size side pixelwise) don't shy modifying these things -- can make whatever want. if want select window automatically after displayed, can add bottom of lawlist-dis

jquery - trouble setting checkboxes based on array -

i'm trying check boxes on form based on what's in array. var day = ["1", "2", "3", "4"] here's html: <div id="daysoftheweek" class="control-group uncheckit"> <label class="control-label" for="thedaysoftheweek">which days:</label> <div class="controls" name="thedaysoftheweek"> <label class="checkbox inline"> <input type="checkbox" name="days" value="1"> mon </label> <label class="checkbox inline"> <input type="checkbox" name="days" value="2"> tue </label> <label class="checkbox inline"> <input type="checkbox" name="days" value="3"> wed </

asp.net mvc 4 - mvc4 bind @Html.DropDownListFor in controller -

how bind @html.dropdownlistfor value comes model? model: public updatepersonalmodel() { titles = new list<selectlistitem>(); titles.add(new selectlistitem{text = "mr",value = "mr"}); titles.add(new selectlistitem{text = "mrs",value = "mrs"}); titles.add(new selectlistitem{text = "miss",value = "miss"}); titles.add(new selectlistitem{text = "ms",value = "ms"}); titles.add(new selectlistitem{text = "dr",value = "dr"}); titles.add(new selectlistitem{text = "hon",value = "hon"}); titles.add(new selectlistitem{text = "prof",value = "prof"}); } public list<selectlistitem> titles { get; set; } public string title { get; set; } ... ... controller: public actionresult updatepersonal() { //... var model = new updatepersonalmodel(); model.title = webcontext.currentuser.title; model.firstname = webcontext.

java - retrieve results from a table evaluating if the variable is within the interval of a row -

it's first time asking here , couldn't find me issue in related questions tables , rows intervals. i'm working on simple aplication electrical purposes in java 7 using netbeans. thing there 3 tables this isc/il----------tdd 10-20 -------5.0 21-50 -------8.0 51-100 -----12.0 101-1000 --15.0 1000+ -------20 each of tables has different values , 2 of them have same amount of rows. need evaluate x , check row belongs to tdd value. all values double or float beacuse it's related physics , can't use int values. the way can imagine if...else clause there many intervals , there 3 tables think impractical way because generate many lines of code single value. if guys know other way done appreciate if share it. can make use of example can give me or library should through. if there's no other way i'll cup of coffee , start typing clauses lol. also i'm not using database table, i'd use if necessary. thanks in a

Trying to display data from mongodb database in node.js app -

server.get('/', function(req, res) { counter.find({}, function(err, result) { if (!(err)) { res.render('index', {'lol' : result}); } }); }); i'm trying app display contents of whole database , came with. counter mongoose model. database contains items inserted prior execution of program , 1 item inserted in app itself. something iffy conceptually me (i'm new node), think render() being executed before find() why i'm not getting result, can't think of solution. or push in right direction appreciated. :) what view code? your implementation correct, should try debug. server.get('/', function(req, res) { counter.find({}, function(err, result) { if (!(err)) { console.log('debug: ' + json.stringify(result) ); res.render('index', {lol : result}); } }); });

ios - Date Formatting is Weird -

i have date string looks this: 1391640679661 when use code: nsstring *seconds = @"1391640679661"; nsdate *date = [nsdate datewithtimeintervalsince1970:[seconds doublevalue]]; i end this: 46069-05-03 07:27:41 +0000 so what's happening here? particular date format i'm not accounting for? or doing else wrong? to convert timestamp string nsdate, need divid timestamp double value 1000, , call datewithtimeintervalsince1970: nsstring *timestamp = @"1391640679661"; double seconds = [timestamp doublevalue]/1000.0; nsdate *date = [nsdate datewithtimeintervalsince1970:seconds]; the result is: 2014-02-05 22:51:19 +0000

javascript - How to pass a global array to web worker and return it? -

last 30-40 minutes i'm trying understand how works passing array web worker , returning it. moment following: var myglobalarray = [1, 2, 3, 4, 5]; var code = 'self.addeventlistener("message", function(e) {' + ' var receivedarray = e.data.buffer;' + ' var receivedarraysize = receivedarray.length;' + ' //dosomethinwithreceivedarray here...' + ' self.postmessage(receivedarray, [receivedarray]);' + '}, false);'; var blob = new blob([code], {type: 'text/javascript'}); var bloburl = window.url.createobjecturl(blob); var worker = new worker(bloburl); worker.addeventlistener('message', function(e) { var returnedarray = e.data; myglobalarray.length = 0; myglobalarray = e.data.slice(); }, false); var passedarray = new arraybuffer(myglobalarray); worker.postmessage(passedarray, [passedarray]); but still getting receivedarray undefined , receivedarray.length undefined . ideas problem? a

eclipse - How do I revert all files to a previous commit using EGit? -

i using egit 2.2.0.20-1212191850-r github. of local files committed , pushed. there master branch. permanently revert of files previous commit (not head~1). how do it? here's have tried: i opened history pane, see past commits. i right-clicked on earlier commit , selected reset > hard. i see old version. try committing old version none of changed files show in commit changes window, if explicitly add them index. i tried checkout in step 2, same result. eclipse git checkout (aka, revert) not relevant, since reverting head, not earlier commit. what i'd create new branch earlier commit, i'll settle reverting. if pushed commits, recommended revert commits. reason revert add new commits history instead of replacing history, makes possible other people pull instead of having rebase on replaced history. so in history view, select newest commit want undo, open context menu , select "revert". repeat parent commits. when you're done

c# - Using HTML.ActionLink with a <li> -

i doing front-end dev work , being exposed c# first time. trying change menu navigation each list item clickable, rather inside each list item. example (if static html): <li><a href="#">link</a></li> change to <a href="#"><li>link</li></a> this menu using html.actionlink however, looks this: <li>@html.actionlink("blah", "index", "blahblah", new { area = "shared" }, null)</li> how change link applied whole list item? thanks! you may use url.action method along typical html markup. <a href="@url.action("index","home")" title="go home"><li>link</li></a> this generate markup this <a href="home/index" title="go home"><li>link</li></a> change parameters(action method/controller names) values of url.action method needed. url.action

How do I start over in Git? -

i did number on git installation. accidentally added origin incorrect upperlowercase, , cant figure out how remove "wrongly named" version git's procedures. along way, tried modify core.ignorecase in git/config , git won't (it gives me: fatal: bad config value 'core.ignorecase' in .git/config) anyways, want start f over. located git being here: /usr/bin/git , rm command doesnt seem have effect. way uninstall git? way reinstall? thank you simply rm ~/.gitconfig file , should fine. how reinstall git depends on how installed it. in case of debian based system should work: apt-get install --reinstall git

Type of Template Parameters (For function Templates) : C++ -

i reading tutorial: http://www.learncpp.com/cpp-tutorial/144-expression-parameters-and-template-specialization/ and mentioned however, template type parameters not type of template parameters available. template classes **(not template functions)** can make use of kind of template parameter known expression parameter. so wrote program: #include <iostream> using namespace std; template<typename t,int n> bool compare(t t,const char* c) { if (n != 1) { cout << "exit failure" << endl; exit(exit_failure); } bool result=false; cout << c << endl; cout << t << endl; cout << t.compare(c) << endl; if(t.compare(c) == 0) result = true; return result; } int main() { string name="michael"; if (compare<string,1>(name,"sam")) cout << "it sam" << endl; else cout << "thi

Correct sequence and activity diagrams (UML) -

Image
im working through practice problems in textbook , hoping guys "grade" answers these 2 questions. have attached picture questions , diagrams , i'll retype questions below: 1) draw sequence diagram application user uses withdraw money. application sends web service 2 things in process. one, users credit card information , two, requests money/new balance. 2)draw activity diagram of registering website. must first request username, , if username not rejected must next submit email. if email not rejected, sent confirmation email. after rejection or sent confirmation email, application closes. it first work! only changes in notification: quit shown filled black circle of size of large letter. should write quit or end or of sort near it. initial node same point @ start. word start or of sort near it. submit name action (ok show in circle, tools show them rounded blocks), , should go after initial node. you don't need show time direction - dow

mysqldump: Error: 'Lost connection to MySQL server during query' when trying to dump tablespaces -

i trying dump of database on 1 of our (small) servers. running command: sudo mysqldump --opt -u [name] -p [password] smx > smxfeb52014.sql and i'm getting error back: mysqldump: error: 'lost connection mysql server during query' when trying dump tablespaces mysqldump: got error: 2006: mysql server has gone away when selecting database i've set me max_allowed_packet 500 , restarted mysql no dice. any tips?

reflection - Python: access nested functions by name -

inside function, can use dir() list of nested functions: >>> def outer(): ... def inner(): pass ... print dir() ... >>> outer() ['inner'] ...but what? how can access these functions name? see no __dict__ attribute. first: sure want this? it's not idea. said, def outer(): def inner(): pass locals()['inner']() you can use locals dictionary of local variable values, value of 'inner' function. don't try edit local variable dict, though; won't work right. if want access inner function outside outer function, you'll need store somehow. local variables don't become function attributes or that; they're discarded when function exits. can return function: def outer(): def inner(): pass return inner nested_func = outer() nested_func()

Creating OSGi for utility jar and using it with Websphere EAR -

i have unsuccessfully tried find kind of documentation using osgi bundles utility jars in websphere application. i writing common classes used across organisation depend on third party libraries log4j, commons-lang etc. create osgi bundle utility can used different websphere applications utility jars other dependent jars, 1 wouldn't need add dependent jars every application uses utility creating. i have found osgi tutorials, nothing using them in simple websphere app. how can achieve this? there tutorials or documentation guide me in how this? likely need maven , build jars dependencies: how can create executable jar dependencies using maven?

javascript - jquery not working in .appended content -

i have div, has content populated on load (a bunch of 'span' tags delete link in each. clicking delete button remove span. can add new 'span' tags using separate button (each own delete button). loaded span delete buttons work fine, newly added ones not delete. <div class="instances"> <span class="item">instance 1 <a href="#" class="del">delete</a></span> <span class="item">instance 2 <a href="#" class="del">delete</a></span> </div> <span class="addinstance">add instance</span> $('.addinstance').click(function () { $('.instances').append('<span class="item">more <a href="#" class="del">delete</a></span> '); }); $('.instances .del').click(function (event) { event.preventdefault(); $(this).parent('.item').hide(); }); c

security - Howto for simple pipe without shell escape in perl? -

my perl cgi program needs pass arbitrary latex math expression, provided anonymous untrusted malicious web user, (trusted) phantomjs script runs mathjax obtain svg. think want do use perl6::slurp; $svg= slurp( $fname, "mathjax-script.js '$not_trusted_expr' |"); in many scripts had written in past, sanitize $not_trusted_expr containing characters approved list, latex expressive make feasible approach. user can provide $not_trusted_expr can contain literally anything---incl \' itself---and reasons. so, need absolutely there no ways shell escape characters interpreted along way in travel of characters mathjax-script.js . do read slurp doc correctly in believing that my $svg=slurp( "-|", "mathjax-script.js", $not_trusted_expr ); is complete solution problem, because means shell never invoked? /iaw yes, perl6::slurp::slurp wraps builtin open function, , ... -|, $cmd, @args syntax pass arguments directly system execvp

java - Encrypting plain text using own RSA implementation -

im trying encrypt , decrypt string, , file containing plaintext, using own rsa implementation in java. ive tried following countless examples here on , web, people using either built in java rsa function or own implementation of algorithm, cant of them work, in decrypted text never matches original string. i dont know if doing wrong encoding/decoding of text, have tried using default utf-8 , base64 encoders in java.xml.* no luck there either. im not using padding, dont know if thats necessary work @ all, , im using arbitrary key length, ive tried changing size of, , doesnt make things work either. exercise myself, no ones information going protected or anything. im not sure issue is, here code, tries encrypt/decrypt simple string: biginteger 1 = new biginteger("1"); securerandom rand = new securerandom(); biginteger d; biginteger e; biginteger n; biginteger p = biginteger.probableprime(10, rand); // 10 arbitrary, have tried different numbers big

linux - BASH shell script works properly at command prompt but doesn't work with crontab -

here script want execute crontab. #!/bin/bash # file of path /home/ksl7922/memory_test/run_process.sh # 'mlp' name of process, , 'ksl7922' user account. prgep mlp > /home/ksl7922/proc.txt # line give number of process of 'mlp' result=`sed -n '$=' /home/ksl7922/proc.txt` echo "result = ${result}" # if 'mlp' processes run less six, read text file 1 line , delete # it, , execute line. if ((result < 6)); filename="/home/ksl7922/memory_test/task_reserved.txt" cat $filename | while read line # delete line first. sed -i "$line/d" $filename # execute line eval $line break; done else echo "you're doing great." fi after that, editted crontab , checked crontab -l */20 * * * * sh /home/ksl7922/memory_test/run_process.sh this scripts works command line, however, doesn't work crontab. it seems shell script works crontab anyway

html - Height of image is not getting through jquery height() in chrome and opera -

i having slider, in there image container li displaying li depends on slide timing. issue if finding image height or li height @ first not displaying in chrome , opera (only time). how fix issue . html <!doctype html> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="content-type"> <title>demo slider</title> <link href="sample.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="js/jquery.min.js"></script> </head> <body> <div class="slidestoryhome"> <div class="slider"> <ul class="sliderwrapper"> <li> <div class="slidepart1"> <a href="#"> <img src="img/slideshow_1.jpg" alt="one" /> </a>

ios - restkit 0.20: can not pass in an NSManagedObject to the getObject: method -

i trying retrieve 1 item restful service (confirmed working) http://www.example.com/person/25 i need somehow pass in '25' part of url. figure i'm supposed use rkroute. way execute in restkit use getobject: method of rkobjectmanager. using restkit 0.22 , not know how call getobject: method because expects full person object, no? though need pass in string '25'. the method in question is: [self getobject:personnsmanagedobject path:nil parameters:nil success:^(rkobjectrequestoperation *operation, rkmappingresult *mappingresult) ..... i can't "person *person = [[person alloc] init] because person nsmanagedobject. but when this: nsmanagedobjectcontext *moc = self.managedobjectstore.mainqueuemanagedobjectcontext; nsentitydescription *person = [nsentitydescription entityforname:@"person" inmanagedobjectcontext:moc]; person *personnsmanobj = [[person alloc] initwithentity:person insertintomanagedobjectcontext:nil]; personnsmanobj.

php - how to disable validation rule of yii framework -

i created registration form using gii code generator in yii framework. gii code generator created validation rules in fields fname,lname,email,etc. trying put custom validation rule in fields. need disable other validation rule in field en-billet yii framework. how suppose that. assume have in model : public function rules(){ return array( array('firstname', 'length', 'max'=>20), array('lastname', 'length', 'max'=>40), ); } this means validation method checks length of firstname , lastname , , checks length should not greater 20 , 40. if want remove rule validating, can remove line, , put custom validation rules in it. list of validation rules in yii framework create own validation rule

java - creating enum constants with all class types? -

i have create emum wih class types. enum should contain: employee.class boarding.class address.class salary.class how can create enum above constants? thanks! enums own type, can't other class types. want enum holds reference other classes. maybe this. public enum thing { employee(employee.class), boarding(boarding.class), address(address.class), salary(salary.class); private final class clazz; thing(class clazz) { this.clazz = clazz; } public class getclassofthing() { return clazz; } } you might come better names though.

java web application mysql connection error -

i new in java. java environment 1. windows 8. 2. mysql - 5.5.27. 3. eclipse ide java ee devoper v-2. 5. apache tomcat v-7. 6. mysql-connector-java-5.1.28 bin rar 7. jdk 1.7. want connect mysql jsp file. add mysql-connector library resource. can not connect. code , error given in following. code: home.jsp <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@ page language="java" import="java.sql.connection"%> <%@ page language="java" import="java.sql.preparedstatement"%> <%@ page language="java" import="java.sql.resultset"%> <%@ page language="java" import="java.sql.sqlexception"%> <%@ page language="java" import="java.sql.drivermanager"%> <%@ page language="java" import="java.util.*"%> <!doctype html public "-//w3c//dtd html 4.01 transit

How to use dialog-form jquery for list of buttons in javascript -

i have list in javascript, i'm displaying in table format using loop along edit button each row. when click on edit button need open dialog pop-up using jquery dialog. in code, when click on edit button i'm neither getting error nor pop displaying. might issue. below code. $.ajax({ url : '/edsweb/getedslogdata', type : 'get', datatype : 'json', data : {dc: dc, mdc:mdc, group:group}, success : function(map) { console.log(map); var htmlstr = "<table border='1'>"; htmlstr += "<tr> <td>user name </td> <td> user group </td> <td> remarks </td>"; htmlstr += " <td> edit user remarks</td></tr>"; (var = 0; < map.length; i++) { htmlstr += "<tr><td>"; html

objective c - Addressbook Modified Date in Xcode -

i creating application in used update contacts sqlite database on rewrite actions. used fetch contacts addressbook of iphone on user's permission everytime user logged in , insert database on main thread. i don't want insert iphone contacts everytime database when user login exceeding logged in time , not approach, if addressbook of iphone not modified database insertion happening on each loggin. this how fetching contacts nsarray *thepeople = (__bridge nsarray *)abaddressbookcopyarrayofallpeople(_addressbook); nsmutablearray * _allpeoplesdictarr = [nsmutablearray array]; (id person in thepeople) { abmultivalueref phones =(__bridge abmultivalueref)((__bridge nsstring*)abrecordcopyvalue((__bridge abrecordref)(person), kabpersonphoneproperty)); nsstring* name = (__bridge nsstring *)abrecordcopycompositename((__bridge abrecordref)(person)); abrecordref record = (__bridge abrecordref)[thepeople objectatindex:loop]; if(abre

Retrieve all users and their roles from LDAP using Java -

Image
i have web application. ldap using apache directive studio. want users , roles in application. i able particular information using following code. import java.util.properties; import javax.naming.context; import javax.naming.namingexception; import javax.naming.directory.attributes; import javax.naming.directory.dircontext; import javax.naming.directory.initialdircontext; public class directorysample { public directorysample() { } public void dolookup() { properties properties = new properties(); properties.put(context.initial_context_factory, "com.sun.jndi.ldap.ldapctxfactory"); properties.put(context.provider_url, "ldap://localhost:10389"); try { dircontext context = new initialdircontext(properties); attributes attrs = context.getattributes("dc=example,dc=com"); system.out.pri

javascript - I need to hide/remove path from the url -

i'm opening html file javascript index.html .the index.html in folder (index) under root folder. when index.html opens, url becomes www.abc.com/index/ i want remove or hide folder name index url. url should display www.abc.com wherever redirect page. i'm opening index.html using window.open window.open("/index/","_self"); for achieving can use .htaccess file uses index directory root directory. in root directory on www.abc.com create file named .htaccess , paste following code: rewriteengine on rewritecond %{request_uri} !^/index/ rewriterule ^(.*)$ /index/$1 [l,r=301] now if correctly set up, url should open in popup should www.abc.com or /

serialization - jackson-module-scala (play): registerModule(DefaultScalaModule): found DefaultScalaModule.type; required: databind.Module -

i trying un/marshall json in play app, using jackson-module-scala , example: val mapper = new objectmapper() mapper.registermodule(defaultscalamodule) i included these libraries in build.scala "com.fasterxml" % "jackson-module-scala" % "1.9.3", "com.fasterxml.jackson.core" % "jackson-databind" % "2.3.0", and imported: import com.fasterxml.jackson.databind.objectmapper import com.fasterxml.jackson.module.scala.defaultscalamodule however, when run play app, following error: [error] found : com.fasterxml.jackson.module.scala.defaultscalamodule.type [error] required: com.fasterxml.jackson.databind.module [error] mapper.registermodule(defaultscalamodule) play.playexceptions$compilationexception: compilation error[type mismatch; found : com.fasterxml.jackson.module.scala.defaultscalamodule.type required: com.fasterxml.jackson.databind.module] @ play.playreloader$$anon$1$$anonfun$reload$2$$anonfun

gwt platform - gwtp dispatchAsync not injected in onBind() method -

i tried inject dispatchasync in presenter class's onbind() method. @inject dispatchasync dispatchasync; but, null while try invoke execute inside dispatchasync.onbind() method. i need details server while loading. what can or can use statement in onbind() method or other place in presenter. thanks in advance, bennet. you should inject this private final dispatchasync dispatchasync; @inject presenter(...., dispatchasync dispatchasync) { super(...); this.dispatchasync = dispatchasync; } this way dispatchasync injected in presenter.

How do I support generic expression in C# 2.0 -

i have code written c# 4.0+, need compile c# 2.0 compiler. the following snippets don't how write, in order support same functionality: public sealed class myclass { private static readonly genericstaticmethod _deserializehelper = new genericstaticmethod(() => deserializehelper<object>(null, null, null)); //... } public sealed class genericstaticmethod { private readonly methodinfo methodtocall; public genericstaticmethod(expression<action> methodcall) { var callexpression = (methodcallexpression)methodcall.body; methodtocall = callexpression.method.getgenericmethoddefinition(); } public object invoke(type[] genericarguments, params object[] arguments) { try { return methodtocall .makegenericmethod(genericarguments) .invoke(null, arguments); } catch (targetinvocationexception ex) { throw ex.unwrap(); }

wso2esb - WSO2 : Implementing Routing Slip Pattern using ESB -

i used of 3 header mediators implementing routing slip pattern. used of sequence structure process unit of pattern. need detect first slip (header) in each process (sequence) after performing related process , rout message next process unit based on first slip , delete header soap. please guide me scenario. thanks in advance. you can refer documentation @ http://docs.wso2.org/display/integrationpatterns/routing+slip can use iterate , switch mediators routing mentioned in doc. get value of soap header e.g. - <property name="headervalue" expression="get-property('transport','accept')"/> remove soap header e.g. - <header name="replyto" action="remove"/>

nginx - PHP doesn't load mcrypt extension -

i can't see mcrypt in phpinfo() in section "additional .ini files parsed". 'php_mcrypt' have been installed. use centos nginx php 5.3.3. in /etc/php.d/mcrypt.ini wrote extension=mcrypt.so . i tried change extension path in php.ini (ex extension=/usr/lib64/php/modules/mcrypt.so ), still doesn't work. you using nginx, assume using php-fpm? if need restart php-fpm service in order reload plugins. restarting nginx wont reload php.ini

osx - HTML button becomes square after background color is set on Chrome for Mac -

Image
on chrome mac, why buttons become square after background color set (normally rounded)? <html> <body> <input type="button" id="bt1" value="click me!" onmouseover="this.style.backgroundcolor='red;'" onmouseout="this.style.backgroundcolor='transparent';"> </body> </html> the web page when mouse has not been on button: the web page when mouse on button: the web page after mouse on button: how set background without making button square? thanks. webkit/blink draws buttons "-webkit-appearance:push-button", draws buttons native api (cocoa in case). native api doesn't support arbitrary background colors. webkit/blink automatically removes "-webkit-appearance:push-button" internally , falls poor css drawing if web author specifies css properties such background-color. you can't change background color native button appearance.

What are best practices organizing css for the Asset Pipeline in Rails 4 -

what best practices organizing css asset pipeline in rails 4? want able share color variables among files, , want control in order scss files fired. better not use manifest syntax, rename application.css application.css.scss , use imports instead? this how i've structure folder assets/stylesheet: --application.css --colors.css.scss --fonts.css.scss --frameworks.css.scss --layout.css.scss --nav.css.scss and application.css file looks this: *= require_self *= require frameworks *= require fonts *= require colors *= require layout *= require_tree . and example fonts.css.scss looks this: @import url(//fonts.googleapis.com/css?family=raleway:400,700,800,900); @import url(//fonts.googleapis.com/css?family=merriweather:400,900,700); to use custom variables, @import solution. i don't use assets pipeline default require in sass project. instead use @import . //application.css.scss @import "my_variables"; @import "bootstrap"; @import &qu

sql - Setting Datediff as a variable in a stored procedure -

i trying insert new holiday holidays table, have duration column want calculated inside stored procedure. have used date diff work out days want declare date diff variable , print variable values of insert statement. statement below getting error: column name 'startdate' specified more once in set clause or column list of insert. column cannot assigned more 1 value in same clause. modify clause make sure column updated once. if statement updates or inserts columns view, column aliasing can conceal duplication in code. create procedure sprequestholiday @employeeid int, @startdate date, @enddate date, @duration int /* name: sprequestholiday description: inserts requested holiday holidays table */ as select datediff(day,@startdate,@enddate) diffdate begin insert holidays(employeeid, startd

c# - Selenium WebDriver enters wrong digit information to input -

for tests of web site use c# , selenium web driver. , have problems fill input values. code this: // create random digit value int value = (new random()).next(1, 999); // enter value input driver.findelement(by.id("someid")).clear(); driver.findelement(by.id("someid")).sendkeys(value.tostring()); it works unfortunately not always. if want example enter '100' input enters 1à0 or 10à . i have french keyboard , enter digits need shift pressed. if press '0' shift have '0', without shift 'à', etc problem not 0 9, changed 'ç' , digits. does knows problem? edit 07/02 problem appears @ ie9 only

c# - Protect UserInterfaceOnly and EnableOutlining -

i creating addin excel. protecting sheets in workbook: public static void protectsheetui(_worksheet sheet, string password) { sheet.enableoutlining = true; sheet.protect(password, contents: true, userinterfaceonly: true, allowformattingcells: true, allowformattingcolumns: true, allowformattingrows: true); } but problem when close , reopen workbook, grouping/ungrouping doesn't work. because userinterfaceonly not persistent. in workbook level, unprotect , protect sheets again when being opened. how can achieve add-in? the userinterfaceonly setting not saved when close workbook. have reset when workbook opened. best place in workbook_open event procedure. need handle in add-in. example ( doing memory please ignore typos/syntax errors ) private void thisaddin_startup(object sender, system.eventargs e) { this.application.workbookopen += new excel.appevents_workbookopeneventhandler(application_workbookopen); } void application_workbookopen(e

c++ - Get rid of security message Outlook -

i'm writing application needs access outlook address book, however, every time launch warning message shown saying application trying access adress book. i've noticed behaviour machines no antivirus installed. how rid of message? here part of code use retreive emails related informations capplication l_application; l_application.createdispatch("outlook.application"); cnamespace l_namespace = l_application.getnamespace(_t("mapi")); cmapifolder l_mapifolder = l_namespace.getdefaultfolder(olfolderinbox); citems l_items = l_mapifolder.getitems(); m_mailitem = l_items.getlast(); m_mailitem.save(); //get infos (mail's size, from, to, conversation topic...) capplication, cnamespace, citems generated automatically, , m_mailitem cmailitem object. see http://www.outlookcode.com/article.aspx?id=52 list of options. can either make sure up-to-date antivirus app installed or use redemption .

linux - Is netstat -an same as netstat -na? -

i working on linux, , came across instances netstat -an , netstat -na. are both same.what significance both having same effect. most of programs found on gnu/linux system, netstat , using glibc function getopt parsing command line arguments. that's why have @ documentation of gnu getopt , it's argument syntax follows posix standard. here is: http://www.gnu.org/software/libc/manual/html_node/argument-syntax.html however, not programs using syntax. shell scripts or programs written in language has no bindings gnu getopt . means question can't answered in general, need check man page if want know exact argument syntax program. netstat uses getopt .

java - Find an object within an geographical area -

Image
i want java function if pass lat,long of object, whether object lies inside area. again area defined lat,long for example define area 3 lat/long positions.( rectangle ) , if pass lat/long position should return me whether within rectangle. if area rectangle, easiest way compare coordinates. let's assume rectangle defined upper left (r1x: lon , r1y: lat) , lower right (r2x , r2y) corners. object (a point) defined px: lon , py: lat. so, object inside area if px > r1x , px < r2x and py < r1y , py > r2y programatically like: boolean ispinr(double px, double py, double r1x, double r1y, double r2x, double r2y){ if(px > r1x && px < r2x && py < r1y && py > r2y){ //it inside return true; } return false; } edit in case polygon not rectangle, can use java.awt.polygon class. in class find method contains(x,y) return true if point x , y coordinates inside polygon. method uses ray-casting algorith

c# - ExecuteSqlCommand parallel execution -

sql server 11.0.3, c# .net 4.5, wcf, ef v4.0.30319 i have following table store queries : object_type object_name object_type_name object_query 1 hub_person hub merge ... 1 hub_gps hub merge ... 2 lnk_person_gps lnk merge ... 2 sat_curr_person sat merge ... 2 sat_gps sat merge ... 2 sat_hist_person sat merge ... i have execute queries service in order specified object_type column. queries have same object_type can executed in order, why want parallelize execution of these queries if possible. here function using, without parallelism : public int executeloadsources() { int nb = 0; using (pocdventities pocdb = new pocdventities()) { using (transactionscope transaction = new tr

javascript - Ext JS 4 - Unchangeable cookies -

i need prevent hijack attacks through html cookies. i'm using ext.state.cookieprovider manage sessions; want unchangeable end users (actually hijackers). it'll changeable through application functions. there solutions situation? i believe solved ecmascript 6's const functionality, supported in newer versions of firefox , chrome (if enable experimental javascript): const cookie = "username=david;"; cookie = "username=lincoln;"; console.log(cookie); // returns "username=david;" but other waiting that, if cookie object, can use object.freeze , pretty nifty: var cookie = {cookie: 'username=david;'}; object.freeze(cookie); cookie.cookie = 'username=lincoln;'; // returns "username=lincoln;" console.log(cookie.cookie); // returns "username=david;" unfortunately, cookie object can overwritten, @ least protects against simple attacks.

ios - Navigation Bar custom button -

backbutton = [uibutton buttonwithtype:uibuttontypecustom]; [backbutton addtarget:self action:@selector(gotoamphorasviewcontroller) forcontrolevents:uicontroleventtouchupinside]; [backbutton setframe:cgrectmake(0.0f,0.0f, 44,44)]; the problem facing though button dimensions are 44*44 , wherever tap anywhere around it, the button action fired. please try bellow code : working properly - (void)viewdidload { [super viewdidload]; uiimage *buttonimage = [uiimage imagenamed:@"back.png"]; uibutton *button = [uibutton buttonwithtype:uibuttontypecustom]; [button setimage:buttonimage forstate:uicontrolstatenormal]; button.frame = cgrectmake(0, 0, buttonimage.size.width, buttonimage.size.height); [button addtarget:self action:@selector(back) forcontrolevents:uicontroleventtouchupinside]; uibarbuttonitem *custombaritem = [[uibarbuttonitem alloc] initwithcustomview:button]; self.navigationitem.leftbarbuttonitem = custombaritem; [c

php - How could I perform two action on a button click -

i have page input fields , table , 3 button play , pause , stop respectively.i want refresh table part when ii press play button. want play button perform 2 action 1 run update query , reload page only. when click on pause button want stop reloading of table .and when press stop button want run udate query . using codeigniter, mvc architecture. tried , view page. <meta http-equiv="refresh" content="300"> <input type="text" size="7" id="ic" name="ic" value="<?php echo set_value('ic',$ic); ?>" /> <input type="text" size="7" id="id" name="id" value="<?php echo set_value('id',$id); ?>" /> <button type="button" style="width:100px;">play</button> <button type="button" style="width:100px;">pause</button> <button type="button" style="width:

python - Not able to go on with the Request object and callback mechanism of scrapy spider-crawler -

i new scrapy , python.this spider-crawler from scrapy.spider import spider scrapy.selector import selector scrapy.http import request tutorial.settings import * tutorial.items import * class dmozspider(spider): name = "dmoz" allowed_domains = ["m.timesofindia.com"] start_urls = ["http://mobiletoi.timesofindia.com/htmldbtoi/toipu/20140206/toipu_articles__20140206.html"] def parse(self, response): sel = selector(response) torrent = dmozitem() items=[] links = sel.xpath('//div[@class="gapleftm"]/ul[@class="content"]/li') ti in sel.xpath("//a[@class='pda']/text()").extract(): yield dmozitem(title=ti) url in sel.xpath("//a[@class='pda']/@href").extract(): yield dmozitem(link=url) yield request(url, callback=self.my_parse) def my_parse(self, response): sel = selector(response)