Posts

Showing posts from 2010

asp.net - In WebForms, why does my anonymous event handler not get called when added after OnLoad? -

i have asp.net webforms page several buttons added programmatically this: private void addexportbutton(control control, action clickaction) { linkbutton exportbutton = new linkbutton { text = "export", enableviewstate = false /*buttons recreated on each postback anyway.*/ }; exportbutton.click += (sender, e) => clickaction(); control.controls.add(exportbutton); } now works, long addexportbutton() method called along path onload() or onpreload() method. not fire handler action however, when addexportbutton() called onloadcomplete() method. i add/create buttons when event handler (coming dropdown) gets called. happens after onload(), break code. why this, , how can use anonymous methods event handlers in case? see nice cheat sheet asp.net page lifecycle léon andrianarivony more info order of page/control creation. in page life cycle, internal raisepostbackevent method (which raises ...

Python: split and select the best one for undefined number of entries -

sorry if question silly... looking trick in python allow splitting line , selecting best value , corresponding source, actual number of entries unknown, can 1 100. x = "32.1 (pdbbind), 50.1 (bdb), 83.0 (bmoad_4832)" in x.split(","): b = [] if float(i.split()[0]) < float(b[0]): b = i.split()[0] i error "list index out of range". the problem here: b = [] if float(i.split()[0]) < float(b[0]): #^ b empty list, b[0] raise error if understand problem right, concise solution be: >>> max(x.split(","), key=lambda x: float(x.split()[0])) ' 83.0 (bmoad_4832)'

ios - How to highlight searched text in UITableView rows? -

i have uitableview , uisearchbar associated it. want highlight searched string if substring in row. if understand question, you're done searching within uitableview if highlight result you've 2 options, if you're targeting ios 6.0 , higher there's 1 nsattributedstring see doc here , can bold , colored or apply different fonts substring within string like, this example of highlighted text check this, how use nsattributedstring? or if want support ios 6 previous versions have use attributed labels highlight search, implemented labels are, 1) tttattributedlabel 2) ohattributedlabel if you've not implemented searching in uitableview yet here's example .

Jquery on submit not responding -

so have form wuth button. on click need use run google analytics code (_gap.push). wasnt working have decided alert test. alert showing word "outside" works alert showing word "inside" not working. means not going function js code applyregisternewuserlistener: function() { alert ("outside") // form attempts register users $(document).on('submit', 'form#signup-form', function() { alert ("inside" _gaq.push(['_trackevent', 'register', 'account', 'form',, false]); }) }, html <form method="post" id="#signup-form"> <input type="submit" value="submit"> </form> i cannot understand problem. function being called too. the # sign should not in id form markup. <form method="post" id="signup-form"> there syntax error in section of code. ...

list - Two floated spans inside li a -

trying style few li's in calendar having bit of bother creating 2 columns inside li. notice orange not fill area , 2 spans not align... http://jsfiddle.net/qn4tp/3/ <ol> <li> <a href="#"> <span class="event-time">12:00pm</span> <span class="event-name">retail sales grew @ fastest pace in 7 years during july, according latest data british retail consortium , kpmg. sales 2.2% year-on-year, driven by… </span> </a> </li> </ol> this css might you. add attribute li. add overflow:hidden . , reduce width of event_name class. thats :) ol { width: 83%; margin:0; } li { line-height: 1.2; margin: 0; padding: 5px; list-style-type: none; background: #d4481b; border:1px solid ; color: #ccc; overflow:hidden} { text-decoration: none; line-height:1.2} .event-time { width: 20%; float: left; display:inline} .event-name { width: 70%; float: le...

javascript - Angular Get Selected CheckBoxes -

i have list of dynamically filled checkboxes using angular. <div ng-repeat="x in xlist"> <label>{{x.header}}</label> <input type="checkbox" name="x" value="{{x.item.id}}" /> <p>{{x.header}}</p> </div> i want method retrieve list of selected checkboxes. i'd use $('input[name=checkboxlist]:checked').each(function() { } but not acceptable angular .... there appropriate method so? here implemented plunker <input type="checkbox" ng-model="selected[record.id]"> {{record.id}} $scope.showselected = function() { console.log($scope.selected); alert(json.stringify($scope.selected)); };

spring - In Thymeleaf with multiple actions and multiple forms are possible? -

hi new in thymeleaf + spring , start learn it. , wanted integrate these 2 form in one page . that means now 2 forms in 2 different pages , th:action different .. here want these 2 forms work in 1 page i tried page 2 forms , 2 actions caught error.. create standard code <form action="#" th:action="@{/savestandard.html}" th:object="${standard}"> <table> <h1>create standard</h1> <tr> <td>standard name:</td> <td><input type="text" placeholder="enter standard name" required="required" th:field="*{standardname}"/></td> </tr> <tr> <td><input type="submit" value="create" name="save" /></td> </tr> </table> </form> create division code <form action="#" th...

css - Sass store selector in variable -

i trying save selector in sass easier referencing later, syntax error. here's i'm trying do: $icon: [class*="icon"]; you need convert string if want use variable: $icon: '[class*="icon"]'; #{$icon} { // stuff }

asp.net mvc 4 - DisplayForModel is not working mvc4 -

my controller: public viewresult index() { return view("normal", postaladdressrepo.all() ienumerable<postaladdress>); } normal.cshtml @model ienumerable<object> @html.displayformodel() it not displaying records, instead displaying below: system.data.entity.dynamicproxies.contactmechanism_4e4bc83827d1fe8c7cd34454310ef12db90e894128f3024aeb8c7e9bf8843d2asystem.data.entity.dynamicproxies.contactmechanism_4e4bc83827d1fe8c7cd34454310ef12db90e894128f3024aeb8c7e9bf8843d2a if use below, working fine: @model ienumerable<object> @foreach (object obj in model) { @html.displayfor(m => obj) } not sure doing wrong displayformodel(). can advise? try eagerly loading model before passing view: public viewresult index() { var model = postaladdressrepo.all() ienumerable<postaladdress>; return view("normal", model.tolist()); } also make view typed same type model: @model ienumerable<postaladdress...

Access GreenDAO generator project dynamically from Android project -

is possible, android project using greendao, dynamically (at run-time) access database model structural information (entities, properties, schema, ...) defined in generator project? my first impression it's not possible. if is, how can that? thanks answer. you can via reflection. daomaster 's parent, abstractdaomaster has private field daoconfigmap includes configuration tables. not proper way possible if trying hack sth. another approach, if want access properties on know dao's etc, each generated dao class have public static properties class defines properties.

android - Dagger cannot create object graph although it can produce dot file -

i'm struggling setup of dagger (1.0.1), in existing application. configured use proguard disabled test -dontobfuscate . when enable dagger-compiler it's able generate dot file dependencies graph, when remove compiler , build app in release mode crashes during startup, complaining it's unable create object graph. java.lang.runtimeexception: unable start activity componentinfo{com.corp.myapp/com.corp.myapp.ui.activity.mainactivity}: java.lang.illegalstateexception: errors creating object graph: no injectable members on com.corp.myapp.core.services.connectionmonitor. want add injectable constructor? required com.corp.myapp.core.services.connectionmonitor com.corp.myapp.ui.activity.myappbaseactivity.connectionmanager no injectable members on com.corp.myapp.ui.crouton.croutonmanager. want add injectable constructor? required com.corp.myapp.ui.crouton.croutonmanager com.corp.myapp.ui.activity.myappbaseactivity.croutonmanager no injectable member...

java - When will we use applicationContext.xml in Spring? -

this question has answer here: difference between applicationcontext.xml , spring-servlet.xml in spring framework 5 answers why need applicationcontext.xml in spring? in situation use it? have example? what difference between applicationcontext.xml , spring-servlet.xml ? how can compare applicationcontext.xml in spring struts.xml in struts easy understanding? why need applicationcontext.xml in spring? in days of spring framework, application context i.e various weave , settings necessary bootstrap, coordinate , control objects, done using xml file. although 1 can break various settings , dependency injection several context files, process has been made easier in spring 2.5 , later annotation-driven settings. what difference between applicationcontext.xml , spring-servlet.xml? in mvc based project, again if you're not using annotation-dri...

Mixing wide and narrow string literals in C -

just found out of following work: printf( "%ls\n", "123" l"456" ); printf( "%ls\n", l"123" "456" ); printf( "%ls\n", l"123" l"456" ); the output is 123456 123456 123456 why can freely mix , match wide , narrow string literals wide string literal result? documented behavior? is documented behavior? yes, behavior supported standard, section 6.4.5 string literals paragrph 4 of c99 draft standard says ( emphasis mine ): in translation phase 6, multibyte character sequences specified sequence of adjacent character , wide string literal tokens concatenated single multibyte character sequence. if of tokens wide string literal tokens, resulting multibyte character sequence treated wide string literal ; otherwise, treated character string literal.

datasource - how to used data source declared in tomee.xml in java class -

hi configure data source in tomee.xml file , web.xml file.this work fine when executing project implmented test case need used when used there giving exception javax.naming.noinitialcontextexception: need specify class name in environment or system property, or applet parameter, or in application resource file: java.naming.factory.initial this tomee.xml file <?xml version="1.0" encoding="utf-8"?> <tomee> <resource id="jdbc/mydb" type="datasource"> jdbcdriver com.mysql.jdbc.driver jdbcurl jdbc:mysql://localhost:3306/test username root password root jtamanaged false initialsize 50 maxactive 100 maxidle 3 </resource> </tomee> this code working fine in servlet when writing in java class giving exception java class accessing context initcontext = new initia...

QuickBooks Webconnector Error - Django Soap Web Service - Actual error received from web service for serverVersion call -

i have written soap web service in django , have installed following components soaplib-0.8.1 in system quickbooks pro qbwc version 2.1.0.30 - intuit when try add application(.qwc file) qbwc(quick books web connector), calling web service. giving me below error error: 20130807.09:03:28 utc : qbwebconnector.webservicemanager.doupdateselected() : updatews() application = 'quick books integration' has started 20130807.09:03:28 utc : qbwebconnector.registrymanager.getupdatelock() : hkey_current_user\software\intuit\qbwebconnector\updatelock = false 20130807.09:03:28 utc : qbwebconnector.registrymanager.setupdatelock() : hkey_current_user\software\intuit\qbwebconnector\updatelock has been set true 20130807.09:03:28 utc : qbwebconnector.registrymanager.setupdatelock() : * ** * ** * *** update session locked ** * ** * ** * * 20130807.09:03:28 utc : qbwebconnector.soapwebservice.instantiatewebservice() : initiated connection following application. 20130807.09...

Audio download link works in Firefox but streams in Chrome -

i've setup download link on site i'm building when users sign musicians mailing list can download track free. current code: <a href="http://samsouth.com/audio/mind.mp3">click here download</a> it works in firefox when click link opens window asking if you'd download in chrome streams track. if change file .ogg reverse happens - can download in chrome streams in firefox. guess happening because i'm providing format browser capable of streaming. how stop streaming? can provide 2 href's? having looked similar questions here came across html5 attribute can added links download="filename.mp3" i've tried this: <a href="http://samsouth.com/audio/mind.mp3" download="mind.mp3">click here download</a> but still keeps streaming in chrome, ideas? please? can zip file? that'll avoid streaming. other option other option little of php : <?php $file = $_get['file']; h...

html - Div position with inline-block -

i'm trying make navigation area, div , 4 divs inside it. i created list, , set inline-block divs class. but cant set them horizontal position. i want have hidden scroll, , make moves jquery, clicking on directional buttons bellow div. you can see problem divs position here: http://jsfiddle.net/brtcg/1/ .divsroll { display: inline-block; margin:0; padding: 0; vertical-align: middle; } #main { width: 500px; height: 500px; border: 1px solid #000; overflow: scroll; margin: auto; } thanks since now. i believe you're trying achieve. in css, you'll need set ul li inline-block , make width of ul account needed space (the 15px accounts space around elements): #main ul { list-style-type: none; margin: 0; padding: 0; width: 2015px; } #main ul li { display: inline-block; } i restructured jquery code, , scrolling functional (tested in firefox). html changes: <input type='button' v...

c# - Response returning html code instead of XML -

i sending xml data using http post specified url.expected response in xml format. receiving html code instead of xml.i sending sample post code. string postdata = null; postdata = "netconnect_transaction=" + system.web.httputility.urlencode(xdoc.tostring()); httpwebrequest experianrequest = (httpwebrequest)webrequest.create("some url"); experianrequest.method = "post"; experianrequest.contenttype = "application/x-www-form-urlencoded"; string useridformated = "username:password"; experianrequest.headers.add("authorization: basic" + converttobase64string(useridformated)); experianrequest.timeout = 100000; experianrequest.keepalive = false; experianrequest.credentials = system.net.credentialcache.defaultcredentials; system.text.asciiencoding encoding = new asciiencoding(); byte[] bytedata; bytedata = encoding.getbytes(postdata); experianrequest.allowautoredirect = true; experianrequest.contentlength = bytedata.length; str...

javascript - Twitter Bootstrap alert (notification) dynamically change text -

simple question, didn't succeed finding satisfactory answer on so. when have bootstrap alert: <div id='alert' class='alert alert-error hide'>alert.</div> i want text controlled using either javascript of jquery, looked @ solution this problem , have complicated? really? as simple as: $("#alert").text("my new text");

command line interface - MySQL Query with LARGE number of records gets Killed -

i run following query shell : mysql -h my-host.net -u myuser -p -e "select component_id, parent_component_id myschema.components comp inner join my_second_schema.component_parents related_comp on comp.id = related_comp.component_id order component_id;" > /tmp/it_component_parents.txt the query runs long time , gets killed. however if add limit 1000 , query runs till end , output written in file. i further investigated , found (using count(*)) total number of records returned 239553163. some information server here: mysql 5.5.27 +----------------------------+----------+ | variable_name | value | +----------------------------+----------+ | connect_timeout | 10 | | delayed_insert_timeout | 300 | | innodb_lock_wait_timeout | 50 | | innodb_rollback_on_timeout | off | | interactive_timeout | 28800 | | lock_wait_timeout | 31536000 | | net_read_ti...

c# - calling procedure from sql -

i coding winform application call procedure in datagrid. have method define parameters of procedure public int add_nastavenie(out int typnastav, int nastavid, string hod) { resetparameters(); cmd.commandtext = "add_nastav"; cmd.commandtype = commandtype.storedprocedure; sqlparameter sqlparameter; var sqlparameterout = new sqlparameter("@typnastav", sqldbtype.int); sqlparameterout.direction = parameterdirection.output; sqlparameter = new sqlparameter("@nastavenieid", sqldbtype.int); sqlparameter.direction = parameterdirection.input; sqlparameter.value = nastavid; cmd.parameters.add(sqlparameter); sqlparameter = new sqlparameter("@hodnota", sqldbtype.nvarchar, 100); sqlparameter.direction = parameterdirection.input; sqlparameter.value = hod; cmd.parameters.add(sqlparameter); var sqlparameterret = new sqlparameter(...

android - \n appears in string is not funcional -

when getstring of database: inf = c.getstring(5); //inf equals "hello how you?\nfine , you\ni fine, thanks."; when print appears in same way , not execute parameters "\ n": tv1.settext(inf); //the text "is hello how you?\nfine , you\ni fine, thanks." but want: "hello how you? fine , fine, thanks." what problem? the solution me: string finalinf = inf.replace("\\n", system.getproperty("line.separator")); tv1.settext(finalinf); thanks : skaard-solo , rest. i think can try string finalinf = inf.replace("\\n", system.getproperty("line.separator")); tv1.settext(finalinf); system.getproperty("line.separator")) is system replacement new line

javascript - Position of a vertical div on an horizontal div with database dates in Rails (timeline) -

i create kind of timeline (horizontal line: div) data coming database creation date. place kind of marker (vertical line) automatically on timeline date. the issue timeline div fix size (responsive size in %) when there new data on timeline, others has resize. , example, if have 3 dates: 2009 -2010 -2045 of course there more space between 2010 , 2045 2009 , 2010 ... do have advises / algorithm please? thanks advance if want place them scale, can like: totaltime = maxdate - mindate each date ypercentage = (maxdate - date) / totaltime this put first date @ start, last date @ end, , others in between, proportionally.

Php file image upload security -

$filename=$_files['file']['name']; $type=$_files['file']['type']; $extension=strtolower(substr($filename, strpos($filename, '.')+1)); $size=$_files['file']['size']; if(($extension=='jpg' || $extension=='jpeg') && ($type!='image/jpg' || $type!='image/jpeg')){... i have input file, can let user upload jpg/jpeg image only, have check type, extension, size. however i'm not sure how check if user change extension.(ex. abc.php -> abc.jpg) any thing else need check before save user's image server? you can check image exif_imagetype() http://www.php.net/manual/en/function.exif-imagetype.php exif_imagetype() reads first bytes of image , checks signature.

python - tk: do I need to mention the widget master? -

i want rearrange frames in panedwindows @ runtime based upon user request. specified master each frame (here pw1). ex: import tkinter tk root = tk.tk() pw1 = tk.panedwindow(orient=tk.horizontal, sashpad=2, sashwidth=4, sashrelief=tk.raised) pw1.pack(fill=tk.both, expand=1) frame1 = tk.frame(pw1, bg='red',width=100, height=100) frame2 = tk.frame(pw1, bg ='yellow',width=100,height=100) # seems same thing: # frame1 = tk.frame(bg='red',width=100, height=100) # vs. tk.frame() # frame2 = tk.frame(bg ='yellow',width=100,height=100) pw1.add(frame1, sticky=tk.nsew) pw1.add(frame2, sticky=tk.nsew) root.mainloop() what advantage of specifying master? the master paremeter can interpreted parent . passing add new key in parent.children attribute. if print pw1.children when not pass master and not execute pw1.add() see returns empty dictionary. print pw1.children #{} the pw1.add() method includes added widget in pw1.children ...

c# - Security script based on Global Group? -

i'm not sure if possible, i'd limit users specific areas of intranet site based on membership in specific global groups created in sql server. for example, i've got following menu in asp: <div class="clear hideskiplink" id="mainmenu"> <asp:menu id="navigationmenu" runat="server" cssclass="menu" includestyleblock="false" orientation="horizontal" backcolor="#cc3300"> <items> <asp:menuitem navigateurl="~/default.aspx" text="home" selectable="true" /> <asp:menuitem navigateurl="~/forms/frmcensuslist.aspx" text="census editing"/> <asp:menuitem navigateurl="~/forms/frmroster.aspx" text="roster editing"/> <asp:menuitem navigateurl="~/forms/frmreportmenu.a...

parse.com - Page won't ccroll after dynamically creating HTML with Javascript -

i have created javascript function dynamically creates html string, reason once html loads page no longer scroll. if open chrome developer console of sudden allows page scroll. have checked , think have of required open , close div tags. has seen before. does have javascript not being able finish before page loads? any appreciated! html: //here call function dynamically create html <div id="memberlist"> <script> $(document).ready(function() { generatemembers(); }); </script> </div> javascript: function generatemembers(){ var donetask = false; var trebuser = parse.object.extend("trebuser"); var querytrebuser = new parse.query(trebuser); querytrebuser.find({ success: function(results) { //create member profiles var t ="<div class=\"row-fluid\"><div class=\"span12\">"; (i = 0; < results.length; i++) { ...

installation - Does android:installLocation in manifest affect updates as well as fresh installs -

i have 2 questions: 1 . " android:installlocation " tag in android manifest affect updates fresh installs? i have published app on market no "android:installlocation" @ all, thinking of adding 1 of following manifest: android:installlocation="auto" or android:installlocation="preferexternal" could affect users update app? app transferred external storage? my second question follows on assuming answer "yes". 2 . if app moved during update, data associated app affected? e.g. databases or shared preference files. the documentation says "the .apk file saved on external storage, private user data, databases, optimized .dex files, , extracted native code saved on internal device memory." but worried instead of normal update, system may perform full uninstall/install cycle wipe data. unacceptable in situation. i'm sorry cannot answer question myself through experimentation don't have access devices have...

delphi - Can anything bad happen, if I clear my array by assigning a non-initialized array to it in pascal? -

in pascal, way dared cleaning array iterate through , clear it, extremely inefficient. can't reinitialize assigning empty array it? program arrays; var working, empty : array [1..10] of integer; begin working[3] := 5; working:= empty; end. is ok this, can backfire? this absolutely fine. semantics of code need. delphi compiler emit code perform simple , efficient memory copy. compiler able because have fixed length array elements simple value types. i'd surprised if fpc did not produce similar code. even if array contained managed types (it doesn't), assignment operator result in code respected managed types. as final comment, array full of zeros should constant.

r - Create and Call Linear Models from List -

so i'm trying compare different linear models in order determine if 1 better another. have several models, want create list of models , call on them. possible? models <- list(lm(y~a),lm(y~b),lm(y~c) models2 <- list(lm(y~a+b),lm(y~a+c),lm(y~b+c)) anova(models2[1],models[1]) thank help! if have 2 lists of models, , want compare each pair of models, want map : models1 <- list(lm(y ~ a), lm(y ~ b), lm(y ~ c) models2 <- list(lm(y ~ + b), lm(y ~ + c), lm(y ~ b + c)) map(anova, models1, models2) this equivalent following loop: out <- vector("list", length(models1)) (i in seq_along(out) { out[[i]] <- anova(models1[[i]], models2[[i]]) } map example of functional, , can find out more them @ https://github.com/hadley/devtools/wiki/functionals

maven - Errors in pom.xml with dependencies (Missing artifact...) -

Image
a friend has passed me maven project i'm trying run locally in computer. have done in eclipse, selected: file -> import -> existing maven projects after that, project showed me 4 errors in pom.xml (missing artifact..): i tried removing content of .m2 folder , in eclipse clicked on project , chose "run as" -> "maven clean" , "run as" -> "maven install". still have same errors. i'm new spring dont know else do. edit: when try do: run as/ maven install, console says: slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. [info] scanning projects... [info] [info] ------------------------------------------------------------------------ [info] building datalayer 0.0.1-snapshot [info] -...

silverlight - listbox not updating content when data source changes -

i'm working on large wp7 project, , current task implement offline functionality. i've got listbox should display items when device connected internet, , display empty view otherwise. i've got event handler wired fires when connectivity changes, retrieve neccesary data listbox if i've got connection. the problem when run app in offline mode, , turn wi-fi on, data listbox updates not ui itself here xaml: <listbox name="lstitemcategories" itemssource="{binding itemcategories, mode=twoway}" selecteditem="{binding selecteditemcategory, mode=twoway}" margin="0,-15,0,60" tap="lstitemcategories_tap"> <listbox.itemtemplate> <datatemplate> <stackpanel orientation="horizontal" margin="0,0,0,0" height="78" width="432"> <image height="70" w...

javascript - Selecting button with specific text only to activate on click event -

i have row of buttons difference between them inner text: <a href="#contact" class="btn btn-large btn-info" data-toggle="tab">text1</a> <a href="#contact" class="btn btn-large btn-info" data-toggle="tab">text2</a> <a href="#contact" class="btn btn-large btn-info" data-toggle="tab">text3</a> i want activate script when button 'text3' pushed . tried following works buttons not 'text3'. $(function(){ $('a.btn[text()="text3"]').click(function(){ console.log(id); // action here }); }); how can fix this? you can use :contains selector bind event handler specific anchor contains text $('a.btn:contains(text3)').click(function(){ ...

php-mysql database apostrophe and comma insertion -

i insert 10 field's value in mysql php code is. problem whenever user inserts apostrophe , comma(',) query code disturbed. functions there. necessary parse field's value these functions?? not time consuming :p here php code $rs = mysql_query(" insert _{$pid}_item values ( '$pid', '$item_brand', '$item_code', '$item_name', '$item_quantity', '$item_mrp', '$i‌tem_discount', '$item_vat', '$item_sat', '$item_selling_price', '$item_rating', '$item‌​_image' ) "); i passing values these variables.. try mysql_real_escape_string , or if using pdo , use pdo::quote . and please please please read on sql injection attacks. not matter of getting failed queries, matter of having attacker access entire database, other user's information. eve...

PHP : array in Format part to sprintf or vprintf -

student of php ! searched haven't got answer posting q i know sprintf ( string format [, mixed args]) sprintf description :returns string produced according formatting string format. and vsprintf ( string format, array args) though these pretty enough ran through problem is there simple way (i mean pretty iteration , sprintf each) "returns array produced according formatting array format. " ( desc:copied sprintf ) i have general $product array $product = array( "p_id" => '%s', "u_price" => '%s', "qty" => '%d' ); $newproductarray1= sprintf_special($product,"tomato","30","12"); $newproductarray2= sprintf_special($product,"carrot","20","10"); so that $newproductarray1= ( "p_id" => 'tomato', "u_price" =...

apache - .htaccess rewrite to add .php to no extension requests, BUT to not accept .php requests by users -

i want rewrite rules (mod_rewrite) block users accessing pages directly, using .php extension @ end of urls, want keep php files extension in website folders. problem , want server accept no extension url requests, , take user respective .php page. have following rewrite code: rewriteengine on rewriterule \.php$ - [r=404] rewriterule ^(.*)$ $1.php the first rule giving 404 error, wanted. second rule works when it's alone, no other rules. above block, when type no extension url think server "redirecting" request , adding .php extension, first rule act user request , give me 404 error, making 2nd not work want. i think need rewrite condition tell server apply first rule if request comes website user, , ignore if comes rewrite engine. possible? i not htaccess guru yet, hope helps: rewritecond %{the_request} \.php rewriterule \.php$ - [r=404] rewritecond %{request_uri} !(\.php) rewritecond %{request_uri} !(^\/error\/.*$) rewriterule ^(.*)$ $1.php [l] ...

javascript - Moving on deep function -

i have short question: how can move a b in code: for(var i=0;i<length;i++) { b <--------------- far if (/*condition*/) { if(/*condition*/) { ..... } else { <------------ here }; } else if(/*condition*/) { ... } } i know break , continue , doesn't work here thanks all! you use goto.js ( http://summerofgoto.com/ ) handle exact loop you're trying use, should consider finding different way factor code.

linux kernel - How to implement timer expire function in sysfs of driver.? -

scenario: suppose if doing echo 1 > sysfs_entry - start doing i/o operation until echo 0 > sysfs_entry . here, wanted implement timer in sysfs_entry should stop i/o operation after t seconds , if not give echo 0 > sysfs_entry . ps: not want use busy wait methods. preferred: deferred/delayed work please me resolve scenario. you can use add_timer() , del_timer() api this. event queue might work (depends on context). more details, please read chapter 7 «time, delays, , deferred work» of linux device drivers (aka ldd) book available free of charge right here . timer api described on page 198.

Update a field for a specific # of records in SQL Server 2005 -

say want 3 records flagged each product in table. if products 1 or 2 records flagged or no records flagged, how can make randomly flag remaining records total of 3 per product. ex: 1 record gets flagged product_a, 2 records flagged product_b , 3 records flagged product_c. once script complete, need 2 more records flagged product_a , 1 more product_b. this can loop or cte or whatever efficient way in sql. thanks! here's 1 way it: ;with selectedids as( select id, row_number() on ( partition productcode -- distinct numbering each product code order newid() -- random ) rowno productlines ) update p set isflagged = 1 productlines p join selectedids s on p.id = s.id , s.rowno <= 3 -- limit 3 records / product code ; here's full sample, including test data: http://www.sqlfiddle.com/#!3/3bee1/6

c - Pointer array and pointers in parantheses -

could tell me difference between int *p[n]; and int (*p)[n]; where n number? i know first case implies array of pointers, know second declaration implies. int * p[10] defines p array of ten int -pointers. int (*p)[10] defines p pointer array of ten ints. say: int a[10]; int (*p)[10] = &a;

xcode - Renaming Duplicated Target: Where do I fix the reference to the default plist name? -

environment: xcode 4.6.3 i wish duplicate target , rename default ' copy' ' (simulator)'. steps i've done: 1) select target & contextually click 'duplicate' option. 2) click/select copied target name , modify chose name: ' (simulator)'. 3) manage schemes: delete generated (copy) , auto-generate new scheme. ...the newly-generated scheme should correctly labeled '...(simulator)'. problems... either compiler error of conflicting piece of code, or following: error: not read data '/users/ric/desktop/iphone5_support/cg-mobile copy-info.plist': file “cg-mobile copy-info.plist” couldn’t opened because there no such file. question: what's simplest way a) duplicate , b) rename duplicate don't screw-up build? in these situations manually fix things in project.pbxproj text editor. close xcode open project.pbxproj in text editor (emacs, vim, sublimetext, etc) search/replace cg-mobile cop...

data annotations - Using dataannotations displayFormat to change to title case in ASP.Net MVC -

is possible use dataannotations specify fields display title case rather upper? if want change display name of particualr field, add [displayname("displayedname")] data annotation property in model. for example, if model has property "firstname", may want display space , colon in "first name:" seen here: public string firstname { get; set; } [displayname("first name:")]

android - Duplicate string names in strings.xml -

we have shared intellij project use build our android app. 1 person (out of 10) ran build error: android-apt-compiler: [ui] <path>\strings.xml:454: error: resource entry <name> defined. looking it, sure enough there duplicate definitions of string resource, both in same strings.xml file. these should fixed, because makes no sense @ all. but here's don't understand: else can build fine, despite duplicate entries in strings.xml. assume there difference between our global or project settings (despite project being shared) can't see. any ideas of look? thank you. i able fix problem downgrading intellij 13.0.3 , reimporting project maven. ymmv

Stopping debugging in Visual Studio fails to close browser -

i have opposite problem thread: visual studio - prevent stopping debugging closing internet explorer in both visual studio 2008 , 2010 whenever debug web projects, hitting [stop debugging] (or [shift-f5]) still stops debugging, no longer closes browser (ie10). if don't stay on toes, leads many many browser windows being open, , machine starts grinding stop. it's not show-stopper, it's bothersome nonetheless. john when stop debug, stop vs debugger, iis running yet , can continue browse site.

Python Error when imported from different directory -

in mydir/test/testing/pqtest.py import os,sys lib_path = os.path.abspath('../../lib/mine') sys.path.append(lib_path) import util <---- traceback import string import random # code traceback (most recent call last): file "pqtest.py", line 5 in ? import util file "mydir/lib/mine/util.py", line 89 yield v if l > 0 else '' error point @ if syntaxerror: invalid syntax however, there other files import util.py inside mydir/lib/mine not have problems file. so why giving me traceback when importing somewhere else, in case mydir/test/testing ? syntax error on yield v if l > 0 else '' def expand(): l,v in zip(field,val): yield l yield v if l > 0 else '' this python 2.5 not python 2.4 i assuming need tell pqtest.py use python 2.5 not sure how if you're willing change util.py, obvious thing rewrite co...

html - Same font files, same PC, same OS, same browser, same code--two different rendering results on two different sites. What gives? -

i'm running incredibly frustrating issue webfonts on employer's website. (screenshot here: http://imgur.com/pvb5lrl ) i've added font files and, best can tell, written code correctly. however, text rendering incredibly jagged , ugly in chrome , firefox. what's bizarre simple test set using same font files, same @font-face code, , same css text rendering fine in same browsers on same machine. idea might causing crappy rendering on full website? urls both below reference. company website: http://staging.lmsonline.com/services/email-marketing/ simple test: http://datafulfill.com/fonttest/demo.html screenshot (windows 7, chrome): http://imgur.com/pvb5lrl not sure, font supposed like. @ end arrives sort of arial, pretty same generic sans-serif anyway. playing around fonts in past taught me address issue in order: @font-face { font-family:"delitsch antiqua"; src:url("/path/to/fonts/delitschantiqua.eot"); } @font-face { font-family:...

ruby on rails - Parent-Child form -

how show parent-child relationship on single page in rails? don't need form want show information (no edits or updates required). parent customer , child orders. want able select customer, display customer information such address, , list orders placed in row format. thanks. assuming have model associations set properly.. in controller, @customer = customer.find(params[:id]) @orders = @customer.orders.all then in view, use orders variable.