Posts

Showing posts from March, 2010

css - A circle with inside and out side box-shadow have 1px border -

i have circle have both inside , outside box-shadow,but there 1px unwanted border.anyone can me remove border , tell me why happening circle. here code html <div class="wrapper"> <div class="circle"></div> </div> css .wrapper{padding:30px;} .circle{ width:120px; height:120px; border-radius: 50%; box-shadow:inset 0 0 0 16px #f9f9f9, 0 0 0 16px #f1f1f1; background:#32a500;} you can find on fiddle. http://jsfiddle.net/efrke/2/ i think box-shadow: inset messing border-radius . while waiting other solutions, can avoid using inset , apply instead border , removing manually 32px (16px + 16px) height , width of div; demo: http://jsfiddle.net/efrke/3/ code: .wrapper{padding:30px;} .circle{ border-radius: 50%; background:#32a500; box-shadow: 0px 0px 0px 16px #f1f1f1; border: 16px solid #f9f9f9; width:88px; height:88px; }

c# - How to integrate with Google Plus -

how configure google application inside https://code.google.com/apis/console/ integrate google plus. need common networks functionallity getting friends, writing on wall etc. fortunately google provides c# sample doesn't works, because of incorrect configuration. i using c# .net. the google+ api different api other social networks. in particular, cannot write directly user's wall without them taking explicit "share" action. for details using google+ api, including step-by-step examples of how configure project in developer's console, see http://developers.google.com/+/

javascript - Different font sizes on website -

my website has menu named font size. option user change font size of website like: smaller small medium large default font size "small". when user selects font size "medium", font size should remain medium throughout user's visit pages of website(in 1 browser session). how achieve through javascript or jquery or else. i tried changing font size on selection when go page font size changes default font size. my website using html5, css3, javascript, jquery. on spring mvc/java. in ideal world, have on elements on page based on percentage of body font size, e.g. body{ font-size: 12px; } h1{ font-size: 120%; } or h1{ font-size: 1.5em; } if had set up, can change font-size of body element, , automagically update fonts on page. as baadshah has suggested, can use jquery cookie plugin persist users selection across pages. i have put simple demo here @ jsfiddle you can change body font-size based on selection, set cookie, , check see i

jsf - primefaces panelgrid update from datatable -

Image
i getting "cannot find component identifier "contentform:tabview:form:addressdialogpanel" referenced "contentform:tabview:form:addressbooktable" " error. how can update panelgrid inside widget? <h:form id="form"> <p:datatable id="addressbooktable"> <p:ajax event="rowselect" listener="#{addressbookcontroller.onrowselect}" update="contentform:tabview:form:addressdialogpanel" oncomplete="addressdialog.show()" /> </p:datatable> <p:dialog id="addressdialogid" widgetvar="addressdialog"> <h:panelgrid id="addressdialogpanel" columns="2" cellpadding="4"> </h:panelgrid> </p:dialog> </h:form> the main problem giving wrong client id of component's. p:tabview component not form. when define h:form , generates standart html form element. , when submit page jsf us

jquery mobile - #&ui-state=dialog appear automatically when call popup and make error when refresh -

i strat 192.168.1.102:8080 call server url change into... http://192.168.1.102:8080/#&ui-state=dialog instead of http://192.168.1.102:8080 which make error if refresh browser. don't know why happen that??? here code call popup start first username window.onload = function(){ $('#popuplogin').popup("open","slidedown"); } here popup call <!--popup in start || note** data-dismissible='false' = prevent popup close when click outside --> <div data-role="popup" data-dismissible='false' id="popuplogin" data-theme="a" data-overlay-theme="a" class="ui-corner-all ui-popup ui-body-a ui-overlay-shadow" aria-disabled="false" data-disabled="false" data-shadow="true" data-corners="true" data-transition="slidedown" data-position-to="origin"> <form id="startdialog" onsubmit=&quo

masking multiple dynamic images in kineticjs using setClipFunc -

i'm trying add simple rectangular mask cover multiple images, container method 'setclipfunc' looks winner http://kineticjs.com/docs/symbols/kinetic.container.php#setclipfunc confused how works , why being passed number 'deg' (presumably degrees?). if has working example of 'setclipfunc' in action i'd grateful! layer.setclipfunc(function (deg) { var context = deg.context; context.beginpath(); context.moveto(5, 5); context.lineto(34, 202); context.lineto(2, 405); context.lineto(212, 385); context.lineto(425, 405); context.lineto(400, 202); context.lineto(415, 10); context.lineto(212, 25); context.closepath(); }); layer.draw();

Invalid Login logic in Flask Python -

i'm using flask sqlalchemy , flask-login. i can login , logout registered user. what find confusing when enter incorrect password on login page, i'm returned login page flash message of "welcome user@email.com", have thought, based on code, appear if logged in. @app.route('/login', methods=['get', 'post']) def login(): form = loginform() user = user.query.filter_by(email=form.email.data).first() if form.validate_on_submit(): if user , check_password_hash(user.password, form.password.data): session['user_id'] = user.id flash('welcome %s' % user.email) return redirect(url_for('dashboard')) else: flash('wrong email or password') return render_template("login.html", form=form) flash('the email or password wrong.') return render_template("login.html&q

php - Translate empty value in Symfony form -

i have form select box, , field has empty value property. want have translated adding translation_domain doesn't change anything. <?php namespace devell\howfolderbundle\form; use symfony\component\form\abstracttype; use symfony\component\form\formbuilderinterface; class notetype extends abstracttype { public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('name', 'text') ->add('body', 'textarea'); $categorychoices = array(); $builder->add('category', 'entity', array( 'class' => 'howfolderbundle:category', 'empty_value' => 'note.form.category.choose', 'translation_domain' => 'howfolderbundle' )); } public function getname() { return "note"; } } this should perfectely work it's natively supported since > [form] made pos

xna 4.0 - XNA 4.0 contentloadexception was unhandled -

Image
this first time doing xna project. i've been following tutorial ( http://rbwhitaker.wikidot.com/using-3d-models ), , i'm having trouble running game, returning error in question. i've read similar questions here, on net, , have content project, root, custom content manager, etc. now, i'm not familiar of those, modified nothing of xna's template code, added (from tutorial). and here's code: public class mainclass : microsoft.xna.framework.game { graphicsdevicemanager graphics; spritebatch spritebatch; // below: added of 5/2/13 - referenced tutorial private model testmodel; private matrix testworld = matrix.createtranslation(new vector3(0, 0, 0)); private matrix testview = matrix.createlookat(new vector3(0, 0, 10), new vector3(0, 0, 0), vector3.unity); private matrix testprojection = matrix.createperspectivefieldofview(mathhelper.toradians(45), 800f / 480f, 0.1f, 100f); // code e

vba - Using the Offset Function with dynamic Row number -

looking way make code work: the idea paste block of data dynamically underneath last used cell of sheet specifically lookimng way dynamically using offset function dim sit long set sit = cells(row.count, 1).end(xlup).row data_sheet1.range(data_sheet1.cells(1, icol), data_sheet1.cells(irow, icol)).copy destination:=target_sheet.cells(1, targetcol).offset(sit, 0) many thanks sub test() dim sit long sit = cells(row.count, 1).end(xlup).row msgbox (sit) end sub this error lies; have isolated bit of code from msdn set keyword: in vba, set keyword necessary distinguish between assignment of object , assignment of default property of object. since default properties not supported in visual basic .net, set keyword not needed , no longer supported. see example dim sit long target_sheet sit = .range("a" & .rows.count).end(xlup).row + 1 end data_sheet1 .range(.cells(1, icol), .cells(irow, icol)).copy _ target_shee

overloading - Undefined number of arguments in C++ -

this question has answer here: variable number of arguments in c++? 12 answers can overload function lot of arguments in javascript . example: function f() { alert(arguments[0]); } f(4); // alert 4 can same thing in c++ ? you can use variadic template arguments , tuples: #include <tuple> #include <iostream> template <class... args> void f(args&&... args) { auto arguments = std::make_tuple(std::forward<args>(args)...); std::cout << std::get<0>(arguments); } void f() {} // 0 arguments int main() { f(2, 4, 6, 8); } live demo for bounds checking, try following: #include <tuple> #include <iostream> template <class... t> struct input { std::tuple<t...> var; input(t&&... t) : var(std::forward<t>(t)...) {} template <std::size_t n, bool i

android - Read Text file and fill the data in Array. -

im pretty sure im asking silly question but, jut in have txt file has data on it unipub;112 binara st;act mooseheads;54 cohen st;act cube;24 mawson st;act ill read in application using code: package au.edu.canberra.g30813706; import java.io.bufferedreader; import java.io.file; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.ioexception; import java.io.inputstreamreader; import java.util.arraylist; import java.util.arrays; import android.app.activity; import android.os.environment; public class filereader extends activity{{ arraylist<string> sinfo = new arraylist<string>(); string txtname = "accomodationtxt.txt"; file root = environment.getexternalstoragedirectory(); file path = new file(root, "canberratourism/" + txtname); try { bufferedreader br = new bufferedreader ( new inputstreamreader( new fileinputstream(pat

java - Unable to create folder "classes" in WEB_INF folder in eclipse while building using ANT -

i using ant build simple web application project named "hellowebapp" in eclipse. while using ant build build.xml file getting following error. buildfile: c:\users\bimal\workspace\hellowebapp\build.xml clean: [echo] cleaning build init: [echo] creating build directory build failed c:\users\bimal\workspace\hellowebapp\build.xml:18: directory c:\users\bimal\workspace\hellowebapp\build \web-inf\classes creation not successful unknown reason total time: 849 milliseconds the section in build.xml file causes error given below. <target name="init" depends="clean">` <echo>creating build directory</echo> <mkdir dir="${build.dir}/web-inf/classes"/> <mkdir dir="${build.dir}/web-inf/lib"/> <mkdir dir="${dist.dir}"/> </target> please provide me solution problem. in advance. make sure has read/write permissions on folder, use windows permission tab on prefer

ssis - Updating column name with source system where data comes from -

am new ssis , started learning sample projects. am trying below task , not sure how start , didn't in google well. example scenario: i have created "student" table in db. student columns : id,name,class,section,source and trying pull data table different data sources a,b,c am trying insert data school table a,b,c sources 1 row : how updating **a** insert in id **a** insert in name **b** insert in class **c** insert section and in source column of table need have format mentioning data-source each column comes id:a,name:a,class:b,section:c sample o/p id|name | class| section | source 1 | test | test | test | id:a,name:a,class:b,class:c 2 | test2| test | test | id:a,name:a,class:b,class:c what did ? i tried pulling data sources didn't find way update source section. how implement scenario.. ? thanks i add columns each data flow source values e.g data source = 'id:a,name:a' data source b = 'class:b' d

how to find sinh value in degree in javascript -

for sinh(30) did var rad=(math.exp(30) - math.exp(-30)) / 2; above 1 giving value in radian correctly. degree if do var deg=rad * (180/math.pi);// giving 306144945697592.7 but in scientific calculator sinh(30) sinh(30)=0.547853473888 what logic find sinh value in javascript 30 should in radians, not degrees in first one. function deg2rad (radangle) { return radangle * .017453292519943295; } function sinh (arg) { return (math.exp(arg) - math.exp(-arg)) / 2; } var x = deg2rad(30); var ans = sinh(x); alert(ans);

java - ClassNotFoundException problems with manifest in created JAR -

i'm trying create jar file sources, when run class not found exception - can't find main class, though defined in manifest.mf file. can spot errors please? my jar structure: meta-inf/ meta-inf/manifest.mf main/ main/java/ main/java/threadwatcher.java main/java/watcherobject.java main/resources/ main/resources/watcherobjecttype.java main/resources/tlogger.java main/resources/dataprovider.java main/resources/watcherobjectstatus.java main/resources/settingsprovider.java main/java/watcherobject.java contains main method. my manifest.mf: manifest-version: 1.0 created-by: 1.6.0_27 (sun microsystems inc.) main-class: main.java.threadwatcher when run get: exception in thread "main" java.lang.noclassdeffounderror: main/java/threadwatcher caused by: java.lang.classnotfoundexception: main.java.threadwatcher @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass

c# - WebBrowser font size in pixels -

i trying set font size in c# webbrowswer in pixels. i tried: webbrowser1.document.write(@"<span style=""font-size:10px"">text </span>"); but number before "px" doesn't seem have affect. what doing wrong? edit: whole function: private void form1_load(object sender, eventargs e) { webbrowser1.navigate("about:blank"); webbrowser1.document.write("<span style=\"font-size: 50px; color: #f00; \">big red writing!</span>"); } update: tested exe file on pc , worked properly. here, <font size="7">...</font> doesn't work. give same size. ideas? you can try : webbrowser1.navigate("about:blank"); htmldocument objhtmldoc = this.webbrowser1.document; objhtmldoc.write("<span style=\"font-size:10px\">text </span>");

size - integrity of list in elasticsearch messed up while paging -

i using version 0.90.0 of elastic-search , stumbled upon strange problem: after filled index documents, using sort , from/size works properly. when overwrite document updating it, messed up. { "size": 2, "from": 0, "sort": { "arbitraryfield": { "order": "asc" } }, "query": { "match_all": {} } } when increase 0 2 , 4, same documents show multiple times. neither sorting on boolean fields nor strings (multi field sortable member) work properly. same results java-api , elasticsearch-head. has encountered before and/or solution approaches? many in advance! edit: @javanna: tried different mappings. boolean fields, used no explicit mapping strings follows: "document" : { "properties" : { "arbitrarystring" : {"type" : "string", "index" : "not_analyzed"} } } @imotov: yes, _id same. if try

cakePHP get a variable from each Model and Controller -

i got question. have db table settings (id, name). if read them db $settings = $this->setting->find('list'); how can in appcontroller or access each controller , model? hope can me. thanks explanation: i assume you're looking below (obviously you'll want tweak per own application, - it's idea). in app controller, it finds settings table repeats through each , puts each 1 "configure" variable code: /** * read settings db , populate them in constants */ function fetchsettings(){ $this->loadmodel('setting'); $settings = $this->setting->findall(); foreach($settings $settingsdata) { $value = $settingsdata['setting']['default_value']; //note: can't check !empty because values 0 (zero) if(isset($settingsdata['setting']['value']) && $settingsdata['setting']['value'] !== null &&

python - Preventing minidom from escaping already escaped text -

import xml.dom.minidom text='2 &gt; 1' impl = xml.dom.minidom.getdomimplementation() doc = impl.createdocument(none, "foobar", none) docelem = doc.documentelement text = doc.createtextnode(text) docelem.appendchild(text) f=open('foo.xml', 'w') doc.writexml(f) f.close() i expected foo.xml read follows: <?xml version="1.0" ?><foobar>2 &gt; 1</foobar> but in fact reads: <?xml version="1.0" ?><foobar>2 &amp;gt; 1</foobar> how can stop minidom escaping escaped sequence? in application text being read (non-xml) document, cannot write text = '2 > 1' . unescape before inserting: from xml.sax.saxutils import unescape text = doc.createtextnode(unescape(text)) the escaping takes place when writing , cannot disabled, nor should be. want include literal &gt; text in xml, , should escaped if do. if input xml escaped, unescape before inserting.

Best way to obtain user input from GUI and pass to function (C++/CLI)? -

i've been working on console application on 2 years, , although code being improved/extended, thought helpful add gui it. after initial stumbling blocks, have basic gui (windows forms using cli). initially, tried input gui within "main" function (it main function console app). read not idea, , realised don't want input function potentially change after click "run" button. so basically, i'm wondering best programming practice this. way know how open "main" function within button_click event, , pass values obtained textboxes , checkboxes it. i'm not aware of way, seems way sloppy. there potentially on 100 values passed main function, , i've never seen function many arguments. in past, hardcoded them function, or used cin alter them @ runtime. any advice on appreciated. don't want continue doing i'm doing if it's poor programming practice. should mention programming style procedural, don't have knowledge of oop.

objective c - Linker error when trying to link log4cxx into an Xcode ObjC/C++ program -

i have been trying link log4cxx objc/objc++/c++ project. compiles fails @ link stage due undefined symbols. turning on xcode build option "display mangled names" able see why case. mangled names linker looking different mangled names in log4cxx.dylib file. for example "log4cxx::logger::forcedlog(log4cxx::helpers::objectptrt<log4cxx::level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::locationinfo const&) const" becomes "__znk7log4cxx6logger9forcedlogerkns_7helpers10objectptrtins_5leveleeerknst3__112basic_stringicns7_11char_traitsiceens7_9allocatoriceeeerkns_3spi12locationinfoe" from linker's point of view. closest symbol nm reports in log4cxx.dylib is __znk7log4cxx6logger9forcedlogerkns_7helpers10objectptrtins_5leveleeerksbiwst11char_traitsiwesaiweerkns_3spi12locationinfoe i created library created using xcode project provided ap

python - How to Customize the time format using logging.config.fileConfig() -

i using python logging module write log files: logging.config.fileconfig(log_conf_file) the formatter section in log_conf_file "logging.conf" looks like: [formatter_mylog] format: %(asctime)s %(message)s this makes log looks like: 2013-05-02 13:39:55,325 mesagebody blablablabla how can customize asctime format output like: may 02 13:39:55 mesage_body blablablabla i know if it's in python code, can like: # create formatter formatter = logging.formatter("%(asctime)s;%(message)s", "%y-%m-%d %h:%m:%s") but how do via logging configuration file ? try this: [formatter_mylog] format: %(asctime)s %(message)s datefmt=%m-%d %h:%m:%s not sure if change month verbal style. update: to implement verbal style of month try use %b ( source )

asp.net mvc - How to keep the old asp path in MVC web deployment -

i have old web page extension of .asp files web links. deploying mvc4 project, old path lost. because people used web more 10 years, want them able access old link " http://www.mysite.com/about.asp " did before, won't work in mvc web site. mvc has use controller/action/id path not want old links, direct in home directory. i want new mvc page have links old asp pages, try few methods found in google, none of them works. i tried described here : routes.maproute( "dosomething", "{action}.asp", new { controller = "asp" } ); public actionresult projectinfo_networksecurity() { return view(); } when put http://localhost:9014/projectinfo_networksecurity.asp to access, reported error "this type of page not served.". then removed ".asp", `http://localhost:9014/projectinfo_networksecurity and changed method follows: public actionresult projectinfo_networksecurity() {

C++ SDL Reaction Time Game -

me , friend needs create reaction time game. like this . right managed show image of red button, need how make hitbox, if click red button, becomes green. would show how? we using sdl, guess that's important mention. here our code far: #include <sdl/sdl.h> void plot(sdl_surface *sur, int x, int y, sdl_surface *dest) { sdl_rect rect = {x, y}; sdl_blitsurface(sur, null, dest, &rect); } sdl_surface *loadimage(const char *filename) { sdl_surface *sur = null; sur = sdl_loadbmp(filename); if(sur == null) { printf("img not found"); } sdl_surface *opsur = null; if(sur != null) { opsur = sdl_displayformat(sur); sdl_setcolorkey(opsur, sdl_srccolorkey, 0xffffff); if(opsur != null) sdl_freesurface(sur); } return opsur; } int main(int argc, char **argv) { sdl_init(sdl_init_everything); sdl_surface *screen = sdl_setvideomode(640, 480, 32, sdl_swsurface);

osx - How to store a hash in extended file attributes on OS X with Java? -

preface working on platform in-depended media database written in java media files identified file hash. user shall able move files around, not want rely on file path. once imported, store path , hash in database. developed fast file-hash-id algorithm based on tradeoff between accuracy , performance, fast not fast enough. :) in order update , import mediafiles, need (re)create file hashes of files in library. idea calculate hash once , store in files metadata (extended attributes) boost performance on filesystems support extended file attributes. (ntfs, hfs+, ext3...) implemented it, , can find current source here: archimedesj.io.metadata attempts @ first glance, java 1.7 offers userdefinedfileattributeview nice way handle metadata. platforms works. sadly, userdefinedfileattributeview not work on hfs+. albeit, not understand why hfs+ filesystem not supported - 1 of leading formats metadata? (see related question - which not provide solution ) how store extended file att

How can I get Tomcat's logging.properties to recognize my Catalina variables? -

we have several tomcat 7 instances installed on different servers. deploy same app different tomcats (for different customers) differences being configs. in effort standardize logging locations, etc., trying make apps "universal" deploying war file tomcat instance wire automatically don't have remember change app customer 1 , again customer 2, etc. anyway, in each tomcat/conf folder, have added properties end of catalina.properties file. example: # custom logging log.base=c:/logs/tomcat/myapp log.file=myapp.log now, in application's log4j.cfg file, have: log4j.appender.r.file=${log.base}/${log.file} and in application's myapp.cfg have: logfile=${log.file} works great when deploy. tomcat puts should except what's in logging.properties file. that file contains: 1catalina.org.apache.juli.filehandler.directory = ${catalina.base}/logs 2localhost.org.apache.juli.filehandler.directory = ${catalina.base}/logs 3manager.org.apache.juli

Eclipse: how to install Subclipse on Eclipse (Indigo) [on Linux] -

i trying install subclipse on linux. eclipse (indigo) version 3.7.2. went this site , copied link says: links 1.8.x release: zipped downloads: http://subclipse.tigris.org/servlets/projectdocumentlist?folderid=2240 but not working... in eclipse, go --> install new software... put url in box (this url site link to). http://subclipse.tigris.org/update_1.8.x the plugins appear select. or can click on --> eclipse marketplace... , search subclipse if have marketplace installed.

internet explorer 8 - Highcharts - IE8 not rendering chart correctly -

Image
we have chart rendering incorrectly in ie8. updated highcharts.js file yesterday latest version receiving script error on "d.join". don't script error , our page continues load properly, step in right direction, chart missing axis , plot lines , coloring. here chart looks in chrome/ie10/ie9: and in ie 8: please me figure out. thanks! it looks problem due upgrading jquery 2.x. jquery has intentionally dropped support internet explorer 8 , below. see http://blog.jquery.com/2013/04/18/jquery-2-0-released/ your solution either downgrade jquery 1.x drop support internet explorer 8

javascript - DataTables in VisualForce Page, Setting swfPath as Static Resource -

i have been working datatables library in visualforce , have working except export features. followed sample initialization on datatables website, getting error zeroclipboard.js undefined in tabletools.js file. however, have checked , re-checked multiple times , zeroclipboard.js listed resource in chrome. the thing doing differently, , not able determine in adapting function visualforce how call swf file. hosting file on local server , referencing explicitly in function. issue? error above not seem related, thing left think after extensive troubleshooting. does know how can make swf file static resource in salesforce , call way function file on same server else? below current function setting datatables (question in reference swfpath: call, how do static resource?) var otabletools = new tabletools( otable, { "sswfpath" : "www.mywebsite.com/resources/copy_csv_xls_pdf.swf", "buttons": [ "copy", &q

struct - Creating own float structure in C++ -

yet lectures in c++ @ university began yet got first problems. our task implement self made structure in c++ floating points via ieee 754 standard: create data structure allows store float, read raw byte representation , internal representation s, e , m. use combination of union , bit-field-struct. write program float number assigned float part of structure , raw , s/e/m representation printed. use hexadecimal output raw , m. what had far following: #include <stdio.h> #include <math.h> union { struct kfloat { //using bit fields our self made float. s sign, e exponent, m mantissa //it should unsigned because use 0 , 1 unsigned int s : 1, e : 8, m : 23; }; //one bit wasted our '.' char internal[33]; }; float calculaterealfloat(kfloat kfloat) { if(kfloat.s == 0) { return (1.0+kfloat.m)*pow(2.0, (kfloat.e-127.0)); } else if (kfloat.s == 1) { return (-1.0)*((1.0+kfloat.m)*pow(2.0, (kfloat.e

java - how to save web-harvest data to database -

i scrapping data using web-harvest tool , getting required data i.e. name , price of product. here config file. <include path="functions.xml"/> <!-- collects tables individual products --> <var-def name="products"> <call name="download-multipage-list"> <call-param name="pageurl">http://www.amazon.de/s/ref=nb_sb_noss?__mk_de_de=amazon&amp;url=search-alias%3daps&amp;field-keywords=at300-103%20tegra%203%201gb</call-param> <call-param name="nextxpath">//a[@class="pagnnext"]/@href</call-param> <call-param name="itemxpath">//div[@class="fstrow prod"]</call-param> <call-param name="maxloops">10</call-param> </call> </var-def> <!-- iterates on collected products , extract desired data --> <file action="write" path="reports

asp.net mvc - Parse all values from a textbox in a method using javascript before sending to the controller -

i have static method here: public static string parsestringforspecialchars(string stringtoparse) { const string regexitem = "[^a-za-z0-9 ]"; string stringtoreturn = regex.replace(stringtoparse, regexitem, @"\$%&'"); return stringtoreturn; } this method works fine stops many strings being harmful application. suppose there's better way things, that's not point of post. right want values any textboxes in javascript call method , send data controller. say have view: @using myapp.utilities @model list<myapp.models.customerobj> @{ viewbag.title = "customer index"; } <h2>customer index</h2> <p> @html.actionlink("create new", "create") @using (html.beginform()) { <p> name: @html.textbox("customername") <br/> address: @html.textbox("customeraddress") city: @html.textbox("customercity")

firebase - Possibility for only currently connected (not authenticated) and admin user to read and write on certain location -

is there way write security rule or there other approach make possible connected (not authenticated) user write/read location - admin should able write/read? can rule written disallows users read of complete list of entries , let them read entry matches identifier passed client? i'm trying exchange data between user , node.js application through firebase , data shouldn't able read or write else other user and/or admin. i know 1 solution user requests auth token on server , uses authenticate on firebase , make possible write rule prevents reads , writes. however, i'm trying avoid user connecting server solution not first option. this in way session based scenario not available in firebase have ideas solve kind of problem - if implemented before session management: maybe letting admin write /.info/ location observed client every change , can read active connection - if understood correctly how .info works maybe creating .temp location purpose maybe letting adm

javascript - Prevent form submission when validation fails on submit button click -

on submit button click need check validation if returns true . need submit form. when returns false form gets submitted , event saveprojects() gets called. how can prevent form submission when checkvalidation() returns false ? <script type="text/javascript> function checkvalidation() { alert(); return false; } </script> @using (@ajax.beginform("saveprojects", "projects", null, new ajaxoptions { onsuccess = "onsuccessproject", httpmethod = "post" }, new { id = "projectsform" })) { <div class="outerbox" id="divprojectcreate"> @html.partial("../projects/_createoredit", model) <div class="row centeralign"> <input type="submit" value="save" id="btnsaveprojects" onclick="checkvalidation()"/> <input type="button" value="

Obtain facebook token access from authorization -

i have facebook account (lets call him admin), page, , application... have problems obtain extended token server script post in page's wall. in lot of tutorials, recommends call url: https://graph.facebook.com/oauth/authorize?client_id=[app_id]&scope=manage_pages,publish_stream&redirect_uri=http://www.facebook.com/connect/login_success.html i login facebook account, apply permissions, instead of give me code/token, got page this: success advertencia de seguridad: trata la dirección url como si fuera tu contraseña y no la compartas con nadie. with font red... i've tried 3 browsers, same results. i'm doing wrong? know (and updated) tutorial? you using wrong flow and/or not handling current authentication flow. that flow desktop applications , must parse access token returned in url message, security warning: please treat url above password , not share anyone. because access token given in open. see page mor information https://develope

Unable to get automake to build .proto files into .pb.cc files with google protocol buffers -

i've been trying automake automagically determine how build .pb.cc , .pb.hh files google protocol buffers .proto description, have had no luck. i've tried using this post on so, still doesn't work. here's excerpt makefile.am: protoc=@ac_protoc_cmd@ %.pb.h %.pb.cc: %.proto $(protoc) --proto_dir=$(srcdir)/proto --cpp_out=$(srcdir) $(srcdir)/proto/$< libtass_a_sources = \ $(srcdir)/tass.pb.cc nobase_include_headers = \ $(srcdir)/tass.pb.h upon attempting run make, get: > making in src > make[1]: entering directory `/project/tass/src' > make[1]: *** no rule make target `tass.pb.cc', needed `tass.pb.o'. stop. > make[1]: leaving directory `/project/tass/src' > make: *** [all-recursive] error 1 ac_proto_cmd filled in path protoc binary configure.ac when check gpb dependency. i've verified it's of form "/opt/common/protobuf/-version-/bin/protoc" keep gpb library. i'm trying keep .proto f

css - how to locate cursors randomly in map -

a lot of cursors in map every time refresh map different cursors different ids can't use ids test random cursors i want click @ cursor, tooltip should appear when click of them tried lots of things can't :( please help all cursor details map id="gmimap208" name="gmimap208"> <area log="miw" coords="11,0,12,1,13,2,14,3,14,4,14,5,14,6,14,7,14,8,14,9,14,10,13,11,12,12,12,13,11,14,10,15,10,16,9,17,9,18,8,19,7,20,7,20,7,19,6,18,6,17,5,16,4,15,4,14,3,13,2,12,2,11,1,10,1,9,0,8,0,7,0,6,0,5,1,4,1,3,2,2,2,1,4,0,11,0" shape="poly" title="" style="cursor: pointer;"> </map> <div class="gmnoprint" style="width: 15px; height: 21px; overflow: hidden; position: absolute; opacity: 0.01; left: 373px; top: 370px; z-index: 2000;"> <img style="position: absolute; left: 0px; top: 0px; width: 15px; height: 21px; -moz-user-select: none; border: 0px none; padding: 0px; marg

python - Getting started with the Django Zinnia Platform -

here's easy karma somebody. completed django introductory tutorial intent of applying zinnia blogging platform. have serving fine, customize zinnia , not sure how it. that's lie, i sort of know , have no idea link doing. since completing tutorial accustomed nice folder in djo project housing poll apps, customizable url/models/settings/templates in poll directory, , forth. zinnia has none of this, or storing of these things in obscure directory: /usr/local/lib/python2.7/dist-packages/django_blog_zinnia-0.12.3-py2.7.egg/zinnia can explain me going on, , how can learn customize zinnia platform? say wanted change background, title, static content, models, or url file zinnia. how!?! 1 change of these files directly, or copy lot (there's way more /templates/ in here) django project folder (i.e., maybe /djo/zinnia/template work?)? happen if copied other template directory djo/zinnia/ folder; override /usr files (contents below)? admin/ fixtures/

php - Call to a member function prepare() What's wrong with this? OOP -

okay have class (will include header, , first function). require_once("./inc/db.inc.php"); class users { /** * properties **/ private $insert; protected $user; protected $email; protected $get; protected $check; protected $generate; protected $drop; /** * public function register * * registers user system, checking errors. * if error found, throw new exception. * * @parm username username user posted. * @parm password password user posted. * @parm repassword validated password user posted. * @parm email email user posted. * @parm reemail validated email user posted. * @parm day day user posted (for date of birth). * @parm month month user posted (for date of birth). * @parm year year user posted (for date of birth). * * @return return true means correct, register successfully. **/ public function register($username, $password, $repassword, $em

php - Laravel Session Array Values -

i've started test out laravel. i'm using form fields , trying validate inputs using laravel's built-in validator class. $input = input::all(); $rules = array( 'fname' => 'required|max:100', 'lname' => 'required|max:100', 'email' => 'required|email', ); $validation = validator::make($input, $rules); if ($validation->fails()){ return redirect::to('inputform') ->with('input_errors', $validation->errors); } everything goes well, , validation check works. when validation fails, put errors in session variable called input_errors , pass view. problem can't seem display errors. tried foreach loop using blade templating engine given below: @foreach (session::get('input_errors') $message) {{ should put here? }} @endforeach how can display errors being returned array. tried referencing

java - How to import/add libraries into Spring STS? -

Image
i having issue spring sts. i'm receiving following messages: this 1 when trying download template projects: "error while downloading or parsing descriptors file ' https://raw.github.com/springsource/spring-integration-templates/master/si-sts-templates/builds/descriptor.xml ': org.eclipse.core.runtime.coreexception: error while retrieving https://raw.github.com/springsource/spring-integration-templates/master/si-sts-templates/builds/descriptor.xml " ...and 1 when check updates: "some sites not found. see error log more detail. no repository found @ http://download.eclipse.org/tools/gef/updates/releases/site.xml . no repository found @ http://geronimo.apache.org/devtools/ . unable read repository @ https://dl-ssl.google.com/android/eclipse/content.xml . java.util.nosuchelementexception" also, see attachment screen shoot of how tool suite not import java.whatever and/or org.springframework.whatever i believe 3

php - htaccess redirection is not working -

i don't know more how write htaccess code redirection. now url : http://mydomain.com/beta/?selector=login . above link open login page, login page available here : page/login.php and have write following code in index.php <?php include ("page/header.php"); if(isset($_get['selector'])){ if($_get['selector']=="feed") { include ("feeds/index.php"); } else { include ("page/".$_get['selector'].".php"); } } else{ include ("page/home.php"); } include ("page/header.php"); ?> now want instead of above link http://mydomain.com/beta/login i have write following code in htaccess file : rewriteengine on rewritebase /beta/ rewriterule ^index.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /beta/index.php [l] it's not working.. please me , in advance. please don't down vote , sorry language , poor

javascript - How to detect if the image path is valid? -

i have found question regarding images how detect if image path broken? i have tried following codes var image = new image; image.src = "http://project" + path + '.png'; image.onload = function(){ var imagewidth = this.width + this.height; if(imagewidth==0){ image.src = "http://project2" + path + '.png'; //the project2 path broken , //i want use project3 or project4 //path , keep testing it, there no way here. } } would possible recursive test here? lot! you try setup: var paths = ["/img1", "/img2", "/img3"]; var beginning = "http://project"; var ending = ".png"; function getimage(images, prefix, suffix, callback) { var iterator = function (i) { if (i < images.length) { var image = new image(); image.onload = function () { var im

asp.net - WebAPI returning UnAuthorized if missing Header Value -

using aps.net mvc 4 webapi each request must have header called "version" if doesn't or version low, need return unauthorized value client. i'm not sure how send response . in baseapicontroller have this: public abstract class baseapicontroller : apicontroller { public override system.threading.tasks.task<system.net.http.httpresponsemessage> executeasync(system.web.http.controllers.httpcontrollercontext controllercontext, system.threading.cancellationtoken cancellationtoken) { var versiontext = controllercontext.request.headers.getvalues("version").firstordefault(); if(!string.isnullorempty(versiontext)) int.tryparse(versiontext, out _version); ***here*** if _version <1 return unauthorized ???? **** return base.executeasync(controllercontext, cancellationtoken); } } i'm not sure if that's acceptable way of doing can try out returning task give response want:

objective c - get socket from Stream -

i using following code open stream sends files ftp. need socket out of can implement second code posted here. self.networkstream = cfbridgingrelease( cfwritestreamcreatewithftpurl(null, (__bridge cfurlref) url) ); assert(self.networkstream != nil); if ([usernametext length] != 0) { success = [self.networkstream setproperty:usernametext forkey:(id)kcfstreampropertyftpusername]; assert(success); success = [self.networkstream setproperty:passwordtext forkey:(id)kcfstreampropertyftppassword]; assert(success); } self.networkstream.delegate = self; [self.networkstream setproperty:(id)kcfbooleanfalse forkey:(id)kcfstreampropertyftpattemptpersistentconnection]; [self.networkstream setproperty:(id)kcfbooleantrue forkey:(id)kcfstreampropertyshouldclosenativesocket]; [self.networkstream scheduleinrunloop:[nsrunloop currentrunloop] formode:n

get user info from popup windows phone 8 -

i have question how user info popup control ? got code msdn cant figer out how user input text box , checkbox ... found windows phone 7 , not same ... popup p = new popup(); private void showpopup_click(object sender, routedeventargs e) { // create content show in popup. typically // create user control. stackpanel panel1 = new stackpanel(); button button1 = new button(); border border = new border(); border.borderbrush = new solidcolorbrush(colors.black); border.borderthickness = new thickness(5.0); panel1.background = new solidcolorbrush(colors.blue); button1.content = "close"; button1.margin = new thickness(5.0); button1.click += new routedeventhandler(button1_click); textblock textblock1 = new textblock(); textblock1.fontsize = 30; textblock1.text = "the popup control"; textblock1.margin = new thickness(5.0);

Issues creating a model instance - TypeMismatch error in Ruby on Rails -

i'm getting error , don't understand why. have form passes control input create model instance with. here form: =form_for :message, :url => {:action => 'create', :controller => 'messages'} |f| =f.text_area :body, :placeholder => 'enter message.', :size => '40x5' =f.hidden_field :subject, value: "re:#{@message.subject}" =f.hidden_field :parent, value: @message.id =f.hidden_field :receiver, value: @message.sender =f.submit 'reply' here controller: def create user = user.find_by_username(params[:message][:receiver])#remove receiver , give varibale -rg 4/29 if user ||= user.find_by_id(params[:message][:receiver]).username#valid entry -rg 4/29 params[:message].delete('receiver') params[:message][:status] = 'unread'#set status -rg 4/29 params[:message][:sender] = @current_user#set sender -rg 4/29 # raise params.inspect 13 => @m

web cam image from url using objective-c -

i writing os x app, cocoa, , trying figure out how web-cam still image axiscam @ url: http://bigwatersedge.axiscam.net/view/snapshot.shtml?picturepath=/jpg/image.jpg&timestamp= using dispatch/queue/block suggested here: getting image url objective c it return html code of page. what suggested way image data web-cam , not page? since there isn't direct link jpg image, bit confusing. i able make work in c# - save webcam image website answer/question @ bottom - looks forgot old accnt , started new one. looks figured out. headers need set follows: self.bweheader = @"http://bigwatersedge.axiscam.net/view/snapshot.shtml?picturepath=/jpg/image.jpg?timestamp="; self.bweimage = @"http://bigwatersedge.axiscam.net/jpg/image.jpg?timestamp="; self.bwehost = @"bigwatersedge.axiscam.net"; nsmutableurlrequest *therequest = [nsmutableurlrequest requestwithurl:[nsurl urlwithstring:[self.bweimage stringbyaddingpercentescapesusing

Eclipse Juno Mark as Merged tool throwing NullPointerException -

i consistently receiving nullpointerexception eclipse juno when try "mark merged" file have resolved of merge issue in while in "team synchronizing" perspective. shows in synchronize package view conflicted file update (blue arrow left) , updated file new (grey arrow plus sign pointing right) .tmp appended. i have used merge tool in older versions of eclipse years fine , continue using tool in eclipse

linux - How to use sed to replace 3 letter words? -

i need use sed replace 3 letter words end og, word frog. thought work: sed 's/?og/frog/' filename but not? this work you. sed 's/\<.og\>/frog/g' filename . matches 1 character \< beginning of word anchor \> end of word anchor

Written forms to sql including multiple yes, no other -

i designing database written forms filled out each time person visits office. have: patient: patient_id , fname, lname, gender etc adult *patient_id*, occupation etc child *patient_id*, school etc i'm supposed store form data written each time person visits approximately 20 questions. e.g: written form has questions like: yes / no - indication of hearing difficulty? if yes, ear involved? r___ l___ both___ yes / no - head injury? _ __ _ __ _ __ _ __ _ __ _ yes / no - scheduled surgery? if yes type , when? what best way implement it's normalized , structured? suggestions column names lot of data? i'm figuring far may need 2 tables child_info , adult_info foreign key person, store data first, have 'questions' table; question_id question_text answer_type (this may foreign key question_types table) this makes easy add or update questions in future. to hold answers given patient, have 'answers' table;