Posts

Showing posts from September, 2011

android - SimpleCursorAdapter - set 2 columns to 1 view -

i have sqlite datebase displaying data in listview simplecursoradapter . have 2 columns want displey them in 1 textview . how can that? thanks try code , may you method calling listview oncreate private void populatelistviewfromdb1() { cursor cursor = helper1.getalldata(sharedemail); startmanagingcursor(cursor); string[] productname = new string[] { databasehelper.key_namevalue, databasehelper.key_type, }; int[] viewproduct = new int[] { r.id.textview1, }; // create adapter mysimplecursoradapter mycursoradapter = new mysimplecursoradapte

android - Delete checkbox and button from the LinearLayout -

i creating checkbox list button programmatically. updating purpose need delete old checkbox list , button before creating new 1 in delete_element method. how can delete checkbox , button linearlayout? i appreciate help. private void createcheckboxlist(final arraylist<integer> items) { final arraylist<integer> selected = new arraylist<integer>(); final linearlayout ll = (linearlayout) findviewbyid(r.id.lila); (int = 0; < items.size(); i++) { checkbox cb = new checkbox(this); cb.settext(string.valueof(items.get(i))); cb.setid(items.get(i)); ll.addview(cb); } button btn = new button(this); btn.setlayoutparams(new linearlayout.layoutparams(500, 150)); btn.settext("submit"); ll.addview(btn); btn.setonclicklistener(new view.onclicklistener() {} } i think need rethink design, need go adapter approach. listview created

iphone - How can I access my own 2 iOS app database from each other -

i developing 2 ios app , want access database each other. eg. app1 , app2 both developed me, app1 can access app2 database , vice-versa i read somewhere same ios app developer can have sandbox access authorities access own developed ios app. yes, can this. create app group, put both apps in same app group. files created in shared file area available both apps. works same way extension shares files host app. i'm using share sql db between 2 different apps. the shared file can accessed via file manager: nsfilemanager* filemgr = [nsfilemanager defaultmanager]; nsurl* shareddirectory = [filemgr containerurlforsecurityapplicationgroupidentifier:appgroupid];

sqlite - developement database is not configured -

how can solve problem facing problem on server in development mode? developement database not configured. available: ["default", "development", "test", "production"] (activerecord::adapternotspecified) database.yml default: &default adapter: sqlite3 pool: 5 timeout: 5000 development: <<: *default database: db/development.sqlite3 test: <<: *default database: db/test.sqlite3 production: <<: *default database: db/production.sqlite3 try database.yml : # sqlite version 3.x # gem install sqlite3 # # ensure sqlite 3 gem defined in gemfile # gem 'sqlite3' development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 # warning: database defined "test" erased , # re-generated development database when run "rake". # not set db same development or production. test: adapter: sqlite3 database: db/test.

drools - How to assign an incrementing values to a variable in optplanner? -

i planning use optplanner optimize server usage , if required add additional hardware on demand. my questions is: how auto increment 1 variable if system not able find optimal solution after fixed time? i don't know if work specific use case define custom phase modify problem entity. if need modify problem fact set time on thread separate 1 called solve(). once timer hits 0 can introduce problemfactchange solver.

calling a php script using $.POST in javascript -

i have html form textarea , button calls function below when part of text selected. de id of clicked button , selected text want call php script post method. $(document).ready(function() { $(".postbit_buttons").on("click", ".quoted_clicked", function() { var post = this.id; var selected = getselectedtext(); alert(" post = " + post + " seleted text = " + selected); $.post("test_quoted.php", { pid: post, selection: selected }) .done(function() { alert("done") }); }); }); function getselectedtext() selection found here. first alert shown correct information. however, after clicking ok following error message on browser console: typeerror: 'collapse' called on object not implement interface selection. i have used similar construct in part of forum software of part, , wo

How to use AngularJs with Servlet and Jsp -

i developing dynamic web project using jsp , servlet. want use angularjs in project. need know can use angularjs , how? jsp : server side templating. suffice requirement of providing dynamic html page. although served html page remain static on front end side, unless make ajax calls server, fetch data , repaint page on fly. angular : front end javascript framework. helps templating webpages way more that. while can serve dynamic html pages using angular, can leverage long list of other benefits adding data binding, utilizing mvc pattern, having services, control routing , on... so can use angular on front end side , leverage benefit without changing code @ backend. one piece of advice : there hardly use of jsp if using angular on front end side. can keep using jsp server side templating prefer velocity oracle.

c++ - Complex python packaging with extension -

i'm symplifying packaging process. i have large open source library in c++ designed installed in system, want installed locally in python virtualenv this cd /path/to/mycpplibrary sh ./autogen.sh ./configure –prefix=/home/user/virtualenvs/myvirtualenv (absolute path needed here) make make install theses commands compile , send .so file folder /home/user/virtualenvs/myvirtualenv now have swig package uses library. these commands generate wrapped.cpp file cd /path/to/swig-package workon myvirtualenv python setup.py wrap and it's time compile links .so file created previously ld_run_path=/home/user/virtualenvs/myvirtualenv/lib/ python setup.py build python setup.py install i need specify ld_run_path=/home/user/virtualenvs/myvirtualenv/lib/ build process find .so file. this installation process seems complex. don't think putting command line .sh file solution. how can package swig-package contains library.so file , wrapped.so file in 1 egg or wheel ? th

command line - c# - Reading commandline args with their associated values -

was wondering whether there way read in commandlines in console app values. can read in commandlines enough can't seem find info obtaining values commandline. for example(args): atest = 5; btest = 13; would there way read in arg atest associate int 5...? thanks :) i have written helper method me along time ago, extracts value of swtich or returns if present or not - maybe. /// <summary> /// if arguments in format /member=value /// function returns value given membername (!casesensitive) (pass membername without '/') /// if member switch without value , switch preset given argname returned, if switch presetargname means true.. /// </summary> /// <param name="args">console-arg-array</param> /// <param name="argname">case insensitive argname without /</param> /// <returns></returns> private static string getargvalue(string[] args, string argname) { var singlefound = args.where(w =&g

Stop Timer At Any Time and Start Timer Again in C++ -

i doing in c++. example, want calculate time taken process a, reset timer , start timer again calculate time process b. how reset timer , start again second process? use ctime library. code: #include <iostream> #include <ctime> using namespace std; int main() { time_t time_1; time_t time_2; time ( &time_1 ); processa(); time ( &time_2 ); cout<<time taken a: << time_2 - time_1<< seconds<<endl; time ( &time_1 ); processb(); time ( &time_2 ); cout<<time taken b: << time_2 - time_1<< seconds<<endl; } similar question here:- trying calculate difference between 2 times, won't subtract . edit: there clock() function approximate measure taken process in execution. whereas time() function gives system time. depends on need, might use 1 of them. these 2 functions return different values. use time() when need exact time taken, including time when proce

python - SQLite execute statement for variable-length rows -

i've read advice here using parametrized execute call sql escaping you, seems work when know number of columns in advance. i'm looping on csv files, 1 each table, , populating local db testing purposes. each table has different numbers of columns, can't use: sql = "insert table_a values (%s, %s)" cursor.execute(sql, (val1, val2)) i can build sql statement string quite flexibly, doesn't give me use of cursor.execute's sql-escaping facilities, if input contains apostrophes or similar, fails. it seems there should simple way this. there? if know number of parameters, can create list of them: count = ... sql = "insert ... values(" + ",".join(count * ["?"]) + ")" params = [] in ...: params += ['whatever'] cursor.execute(sql, params)

navbar - Unable to Highlight/activate menu bar items for static page urls in yii2 -

i using basic yii2 app. using nav bar widget , having problem in highlighting current menu item. problem nav bar items not getting activated when have static pages in url value. e.g when domain_name/site/contact clicked highlights nav bar item "contact us" it's calling controller action whereas when rendering static pages , using url domain_name/site/page?view=about/about_us , parent item "about" , child item "about us" not getting highlighted/activated. can't find possible solution it. the code used given below [ 'label' => 'about', 'items' => [ ['label' => 'about college', 'url' => ['/site/page?view=about/about_us']], ], ], and contact us ['label' => 'contact us', 'url' => ['/site/contact']], i have used following workaround , in nav widget have used

javascript - Displaying existing content in editable textarea -

hi trying make editable page javascript , php , want display whats stored in area not work. meant blog page meaning there multiple posts. , unsure whether problem within js or php. this javascript using. console.log() writes post_id unassigned. $(document).on('click', '.editbutton', function () { var post_id = $(this).parent().data('id'); var self = this; $.getjson(settings.server, {post_id: post_id}, function(data){ var editabletext = '<textarea class="editpostbody">' + data.body + '</textarea>'; console.log(post_id); $(".post").parent().replacewith(editabletext); }); }); var formatpost = function(d) { var s = ''; s = '<div class="post" data-id="' + d.post_id + '"><h2 class="postheading">' + d.title +'</h2>'; s += d.bod

java - Add constructor to AspectJ aspect with parameters -

i have @aspect public class myaspect { int x,y,z; public myaspect(int _x,int _y,int _z){ x=_x; y=_y; z=_z; } @after("execution(public * save(..))") public void methodafter(joinpoint joinpoint) { //code } after calling save method,it doesn't execute methodafter. however,without constructor,it works.how can use aspectj constructors? i assume working in spring environment, suggest you'll is: add @component annotation aspect. use @inject , @value annotations inject required values x,y,z.

solver - Output of solve in maxima and sage have x on both side -

i trying solve equation sqrt(x)==sqrt(20*(1500-x)) in sage , getting output given bellow, sqrt(x) == sqrt(-20*x + 30000) problem in above solution there x in both side. how can solve kind of question sot proper solution. have tried same problem in maxima , getting same answer. there few options in sage solve , , 1 seems (i assume answer okay). sage: solve(sqrt(x)==sqrt(20*(1500-x)),x,to_poly_solve=true) [x == (10000/7)]

if statement - php if, and, or : multiple variables to check. Working, but getting variable not defined errors -

basically i'm trying check if variable exists, if so, run snippet regardless if others exist or not. i'm using: if ($a1 || $a2 || $a3 || $a4): $a = "success"; endif; if $a4 exists, works , set's $a variable fine. however, i'm getting variable not defined error's before $a4 . a different variable set if $a0 variable doesn't exist (null): if (!empty($a0) && $a1 || $a2 || $a3 || $a4) : $a-alt = "no0success"; endif; this code working fine. however, it's giving me variable not defined error. make use of isset function, try this if( isset($variable) ){ // , so.... }else { // define variable $variable = 'foo'; }

c# - WPF ignores d:IsHidden="True" in run mode (OK in design mode) -

Image
why left image hidden in design mode , not hidden in runtime? looks wpf ignores attribute "ishidden". new empty solution, no single line of code - blend. here code <window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" x:class="wpfapplication222.mainwindow" title="mainwindow" height="350" width="525"> <grid> <image horizontalalignment="left" height="157.093" margin="98.316,88.148,0,0" verticalalignment="top" width="95" source="pack://siteoforigin:,,,/img0.jpg" rendertransformorigin="0.5,0.5" d:ishidden="true"> <image.rendertransform

How can I remove scrollbar of an Internet Explorer ActiveX -

i'm embedding ie com program. qaxwidget. want hide scrollbars no matter how large content is. have no idea of how it. if you're in control of content of html pages visiting, can use <body scroll="no"> or overflow: hidden; in css of element scrolling.

javascript - remove localstorage array object base on value -

says have saved key in localstorage, how remove player_id has value of 2 , shoe size_of 1? [{"player_id":1,"shoe_size":3},{"player_id":2,"shoe_size":1},{"player_id":2,"shoe_size":2}, what next after saved value? if(localstorage["player"]){ player = json.parse(localstorage["player"]); } you can use .filter() the filter() method creates new array elements pass test implemented provided function. player = player .filter(function( obj ) { return !(obj.player_id == 2 && obj.shoe_size == 1); }); if want set it: localstorage["player"] = json.stringify(player) var player = [{"player_id":1,"shoe_size":3},{"player_id":2,"shoe_size":1},{"player_id":2,"shoe_size":2}]; player = player.filter(function(obj) { return !(obj.player_id == 2 && obj.shoe_size == 1); }); document.write(

javamail - java mail api (1.5.3) not working in recent jre1.8.25 -

im using javamail send mail in application. every thing works fine. when change runtime jre1.8.25, got exception as nested exception is: javax.net.ssl.sslkeyexception: rsa premaster secret error @ com.sun.mail.smtp.smtptransport.openserver(smtptransport.java:2056) @ com.sun.mail.smtp.smtptransport.protocolconnect(smtptransport.java:697) @ javax.mail.service.connect(service.java:364) @ mainclass.main(mainclass.java:44) caused by: javax.net.ssl.sslkeyexception: rsa premaster secret error @ sun.security.ssl.rsaclientkeyexchange.<init>(rsaclientkeyexchange.java:86) @ sun.security.ssl.clienthandshaker.serverhellodone(clienthandshaker.java:880) @ sun.security.ssl.clienthandshaker.processmessage(clienthandshaker.java:344) @ sun.security.ssl.handshaker.processloop(handshaker.java:936) @ sun.security.ssl.handshaker.process_record(handshaker.java:871) @ sun.security.ssl.sslsocketimpl.readrecord(sslsocketimpl.java:1043) @ sun.security.ss

windows phone 8 - How to Delete Item from Observable collection in C# -

i working on windows phone app , want delete item listbox. i using following code list numbers=new list(); observablecollection<string> mycollection = new observablecollection<string>(numbers); int indexperson = listbox1.selectedindex; mycollection.removeat(indexperson); var = (observablecollection<string>)listbox1.itemssource; listbox1.itemssource=my; and when click on delete button 1 item deleted based on index , when delete item deleted item show , current deleted item deleted. how can delete items? if want clear items can use mycollection.clearitems() if want remove selected item use mycollection.remove(listbox1.selecteditem)

java - Retrieving details from a YouTube video given the URL -

for example, given link https://www.youtube.com/watch?v=hl-zzrqqose video installing java jdk. using java , youtube-api, how can information such length, title, , views? i looked , found https://developers.google.com/youtube/2.0/developers_guide_protocol_video_entries it's outdated , i'm not sure how use it. forgive ignorance i'm new java. thanks. you can use videos:list , specify video id retrieve video information specific video. example: youtube youtube = new youtube.builder(new nethttptransport(), new jacksonfactory(), new httprequestinitializer() { public void initialize(httprequest request) throws ioexception { } }).setapplicationname("video-test").build(); final string videoid = "hl-zzrqqose"; youtube.videos.list videorequest = youtube.videos().list("snippet,statistics,contentdetails"); videorequest.setid(videoid); videorequest.setkey("{your-api-key}"); videolistr

c# - When should I use Async Controllers in ASP.NET MVC? -

i have concerns using async actions in asp.net mvc. when improve performance of apps, , when not ? is use async action everywhere in asp.net mvc? regarding awaitable methods: shall use async/await keywords when want query database (via ef/nhibernate/other orm)? how many times can use await keywords query database asynchronously in one single action method? asynchronous action methods useful when action must perform several independent long running operations. a typical use asynccontroller class long-running web service calls. should database calls asynchronous ? the iis thread pool can handle many more simultaneous blocking requests database server. if database bottleneck, asynchronous calls not speed database response. without throttling mechanism, efficiently dispatching more work overwhelmed database server using asynchronous calls merely shifts more of burden database. if db bottleneck, asynchronous calls won’t magic bullet. you should have @ 1

How do you conditionally combine filters using the MongoDB C# driver? -

consider following filter: var builder = builders<product>.filter; var filter = builder.gte(i => i.price, criteria.minprice) & builder.lte(i => i.price, criteria.maxprice); if (0 != criteria.categoryid) //combine following filter previous filter. how?? var criteriafilter = builder.eq(i => i.categoryid, criteria.categoryid); how combine criteriafilter , filter ? if (criteria.categoryid != 0) { var criteriafilter = builder.eq(i => i.categoryid, criteria.categoryid); filter = filter & criteriafilter; }

java - Android TabHost not working. I haven't done any mistake -

i have created app show tabhost . when launch application on emulator closes saying app unfortunately closed . searched internet can't find solution. code activity_main.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity"> <tabhost android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/tabhost" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layou

javascript - AngularJs - facing an issue when using ng-init -

i facing issue using ng-init , assign model inside html. the following code works fine. following code add/edit functionality. example, when row is opened in edit mode persist existing value , shows in textbox . <div> <div ng-if="title == 'add student'"> <input type="text" name="name"placeholder="student name" data-ng-model="registration.student.firstname" maxlength="50"> </div> <div ng-if="title == 'edit student'"> <input type="text" name="name"placeholder="student name" data-ng-model="student.student.firstname" maxlength="50"> </div> </div> however, following code short version of above code not work. mean when row opened in edit mode shows text field not show existing value (first name) in it. why? <div ng-init="model = (title == 'add student' ? r

gruntjs - How to use grunt sass to compile and compress scss to css? -

i trying use grunt-contrib-sass in order compile ... basically want achieve following sass --compass --force --update --style compressed --sourcemap /scss:/css i tried following sass: { dist: { options: { style: 'compact' }, files: { '/css/screen.css': '/screen.scss' } } } however, grunt complainaing " errno::eisdir: directory @ rb_sysopen " any idea how fix this? uses compass way.. need defined in grunt? i use grunt-sass , usual sass config looks this: client: { options: { loadpath: ['<%= config.tmp %>/styles'], compass: false }, files: { '<%= config.tmp %>/styles/main.css': '<%= config.tmp %>/styles/main.scss' } }

javascript - Keyboard Controls With DeviceOrientationControls -

i creating vr web app using three.js . camera controls using device orientation controls used here in google cardboard three.js demo. what need add keyboard controls this(e.g arrow go forward etc). i've fiddled around moving camera on 2 axis (x , z) here: if (e.keycode == '38') { camera.position.set(0, 10, camera.position.z+4); controls.target.set( camera.position.x +4, camera.position.y, camera.position.z ); effect.render(scene, camera); ... however want make character move relative looking (e.g 1 way , press arrow , character moves way looking). first person view. does have ideas on how done? ive tried using first person controls three.js eliminates head tracking essential vr game. any answers appreciated. (my source code practically google cardboard three.js demo code function added in detect key presses) i solved different approach. created object3d moving in scene. model , camera child of object. i'

android - How to tap / click at x,y position automatically? -

i have created 1 alertdialog ok , cancel button's in application, when ever alert dialog opened. have tap/click on ok button automatically without user interaction, have x,y position of ok button. how implement please share me, main requirement how tap @ particular position (x, y) automatically out user interaction . just call performclick() method. see view docs reference. button button = (button) findviewbyid(r.id.mybutton); button.performclick(); or, if developing ice cream sandwich (api level 15), callonclick() method added. performclick() more suitable needs, though. for alert dialog interface positive button, can use: suggested @mike dialogtoclick.getbutton(alertdialog.button_positive).performclick();.

python - query by ListField(ReferenceField) and parants id -

i have models: class group(basedocument): movies = listfield(referencefield('movie'), required=false) season = intfield() class movie(moviebase): season = intfield() episode = intfield() i whant movie thats season 5 , movie parent id (group) parent_id, how can this?

c - Inlining a script using macro -

i working script engine, , i'd able or similar: const char* script = some_macro( function foo() { print "bar"; } foo(); ) os* engine = os::create(); engine->eval(script); what way achieve this? i know multiline macros, i'd need \ @ end of line, , if possible, i'd avoid using bunch of quoted strings, since script might quoted strings too, , id preserve line numbers. is there way so? you don't need macros. can use raw string literals. const char* script = r"script_delimiter( function foo() { print "bar"; } foo(); )script_delimiter"; you can replace script_delimiter delimiter want, 16 characters, no parentheses, backslashes or spaces, , sequence )your_delimiter" can not appear in string (because used terminate it).

asp.net mvc - IF ELSE html helper in razor view? -

i use if else statement in razor view. possible use if( html.helper ) something? or suggestion? @using (html.beginform()) { <table> @for (int = 0; < model.count; i++) { <tr> <td> @html.hiddenfor(m => m[i].question_id) @html.hiddenfor(m => m[i].type) @html.displayfor(m => m[i].question) </td> </tr> <tr> @if(@html.displayfor(m=> m[i].type =="info_text") ** { <td> //do nothing </td> } else { <td> @html.editorfor(m => m[i].answer) </td> }

swift - Road Type in Google Maps API -

i new google maps api. in swift ios app, have current location coordinates. while reverse geocoding, how road type (highway, primary, secondary etc.)? you want use road api that. roads api identifies roads vehicle traveling along , provides additional metadata roads, such speed limits.

html - Custom Font Won't Work -

i want have custom font (hp simplified light) webpage. have font file uploaded dropbox, , have link here . nothing happens. times new roman font. i've tried testing locally, both hosting font locally, , html document, same effect. <html> <head> <style> @font-face { font-family: hp simplified; src: url('http://dl.dropboxusercontent.com/s/dau4s6y033jkg4y/hpsimplified_lt.ttf'); } h1 { font-family: hp simplified } </style> hello world! </html> your css styling h1 elements font hp simplified . text "hello world!" not h1 . either can make so: <h1>hello world!</h1> or can have css style font: * { font-family: hp simplified }

c - Netbeans debugger not stopping at breakpoints -

i on ubuntu 12.04 vm running netbeans 8.0.2 i trying debug c project in netbeans , deubgger not stop @ breakpoints. stop on breakpoints other c projects not one. multi-threaded project maybe has it, although seems netbeans can debug multi-threaded projects. one thing might have issue have run netbeans sudo in order compile project. if don't error: flowop.c:1374:1: fatal error: opening dependency file .deps/flowop.tpo: permission denied any advice on how proceed appreciated.

Python Pandas - n X m DataFrame multiplied by 1 X m Dataframe -

i trying multiply 10x7 pandas dataframe 1x7 dataframe in python. here have: df = pd.dataframe(np.random.rand(10,7),columns=list('abcdefg')) df_1 = pd.dataframe(np.random.rand(1,7),columns=list('abcdefg')) i tried this: df_prod = pd.dataframe(columns=df) in range(0, df.shape[0]): df_prod.iloc[i,:] = df[i,:].tolist()*df_1.iloc[0,:].tolist() but error message: traceback (most recent call last): file "c:\python27\test.py", line 29, in <module> df_elem.iloc[i,:] = df_val[i,:].tolist()*df_cf.iloc[0,:].tolist() file "c:\python27\lib\site-packages\pandas\core\frame.py", line 1678, in __getitem__ return self._getitem_column(key) file "c:\python27\lib\site-packages\pandas\core\frame.py", line 1685, in _getitem_column return self._get_item_cache(key) file "c:\python27\lib\site-packages\pandas\core\generic.py", line 1050, in _get_item_cache res = cache.get(item) typeerror: unhashable type i

qt - Drop-down button in QToolBar with changing fields -

i'm bit stucked creating drop-down button based on qaction placed in qtoolbar have xml file following data: <cfg> <fields> <group name="first fields"> <field>filed1</field> <field>filed2</field> <field>filed3</field> </group> <group name="second fields"> <field>filed4</field> <field>filed5</field> <field>filed6</field> ... etc ... </group> </fields> <button name="mybutton1" /> <button name="mybutton2 /> ... etc ... </cfg> nb: don't know how field groups be, don't know how button be. so, first of all, parse following xml-file , extract needed data. for each button create own qaction , add existing toolbar. later, create qmenu each button , fill qaction s each group , field. have qaction first fields , field1 , field2 , etc... then, each butto

Debugging Time in PHP -

ok have been through several other q&a sections of site looking information pertaining php validation problem having. trying validate user input time a) in valid given time format, , b) valid time begin with. here code using (including html section of form) if ($_server["request_method"] == "post") { if (empty($_post["time"])) { $timeerror = "current time required"; } else { $time = test_input($_post["time"]); if (!preg_match("/(([0-1][0-9])|([2][0-3])):([0-5][0-9])/i", $time)) { $timeerror = "time must in hh:mm format"; } } } <input type="text" size="6" name="time" id="time" title="enter current time" required><?php echo $timeerror; ?><br> when input time such 06:30 or 6:30 returns error "time must in hh:mm format". frustrating form supposed being published in 2 weeks , t

configuration files - How to Configure a SPARQL Endpoint in dotNetRDF? -

i trying specify configuration file sets sparql endpoint in dotnetrdf . before integrating in application, testing configuration file loading run local server in rdfserver gui tool , trying access server store manager tool, both dotnetrdf tools (though shouldn't relevant issue). i following manual using minimal configuration code setting sparql handler: @prefix dnr: <http://www.dotnetrdf.org/configuration#> . <dotnetrdf:/sparql> dnr:httphandler ; dnr:type "vds.rdf.web.queryhandler" ; dnr:queryprocessor _:proc . _:proc dnr:sparqlqueryprocessor ; dnr:type "vds.rdf.query.leviathanqueryprocessor" ; dnr:usingstore _:store . _:store dnr:triplestore ; dnr:type "vds.rdf.triplestore" . the documentation says: this specifies configuration handler responds requests on uri /sparql providing sparql query endpoint. i load configuration , run on localhost:1987 . however, when trying access described, sending simple que

python - Apply a single decorator to multiple functions -

i've searched this, results i've seen involve opposite: applying multiple decorators single function. i'd simplify pattern. there way apply single decorator multiple functions? if not, how can rewrite above less repetitious? from mock import patch @patch('somelongmodulename.somelongmodulefunction') def test_a(patched): pass # test 1 behavior using above function @patch('somelongmodulename.somelongmodulefunction') def test_b(patched): pass # test behavior @patch('somelongmodulename.somelongmodulefunction') def test_c(patched): pass # test third behavior from mock import patch patched_name = 'somelongmodulename.somelongmodulefunction' @patch(patched_name) def test_a(patched): pass # test 1 behavior using above function @patch(patched_name) def test_b(patched): pass # test behavior @patch(patched_name) def test_c(patched): pass # test third behavior if want make "long" functio

angularjs - directive not working in its own module -

if declare module in way, receive error : "uncaught error: [$injector:modulerr]" angular.module('myapp.resumedirectives',[]) .directive('nameresume',[ function(){ return { restrict: 'ae', template: '<h1 id="user-name">{{resume.name}} resume </h1>' }; } ]); this code in directive file , code in main file var myapp=angular.module('myapp', [ // ... 'myapp.resumedirectives' ]); if, instead, declare directive way, directive works properly. myapp.directive('nameresume',[ function(){ return { restrict: 'ae', template: '<h1 id="user-name">{{resume.name}} resume </h1>' }; } ]); any ideas? you'll need create file declaring module such index.js or whatever name want , declare module angular.module('myapp.resumedirectives',[]); then, inject new file script files

mysql - What are potential negative side effects of running a cronjob every few minutes to start mysqld? -

i have issue mysql server on 1 of physical webservers. crashes periodically ( every few tens of days or ). have been unable trace issue. site not need every second, being down few minutes once week not issue. in lieu of continuing chase issue, can run cronjob attempts start mysql every minute. when goes down, it'll come 60 seconds later. */1 * * * * /sbin/service mysqld start what potential negative side effects of solution ( besides being super lame i'm not chasing root cause ... i've got more important things ). i had problem demon ( vpnc )that keep falling on did start in non-demon mode in loop: while true demon-process-foreground sleep 1 done the sleep 1 optional. running mysql in foreground have @ running mysql in foreground in centos

python - web2py GAE connection issue with google cloud SQL -

trying use web2py application on google gae. database google cloud sql. in local test environment, application works fine when trying deploy on gae + google cloud sql, data connection fails. error in gae log: 'not authorized access instance: myapp.appspot.com:instance1' the gae app granted access sql instance. questions: i not sure "instance name" correct. found "instance 1" in examples, find name of actual db instance? is specification of user name required? (saw "root" being specified in connection strings), not on web2py user manual: specifies google:sql://project:instance/database

Standalone letters treated as words - regex, javascript -

i have regex: /^[a-za-z'.,-]{5,500}$/ but doesn't treat standalone letters such a or i whole word. wondering how change letters treated words , numbers ignored. thank you. change following: var pattern = /^[a-za-z'.,-]{1,500}$/; ↑

regex - grep and return line continuations? -

i want grep return results through line continuations, ie input file like: $ cat input.txt abba \ jjjj \ nnnn $ grep "abba ?" input.txt abba jjjj nnnn i can't seem working. maybe looking search in file after replacing slashes newlines... tr '\\' '\n' < input.txt | grep

c# - quickbooks sdk add payment -

hi i've been trying add payments using quickbooks sdk, far i'm able when send request quickbooks got message transaction empty here sample code: code using 1 of sample company quickbooks if past on c# project run right away private static void createpayment() { //var customers = getcustomers(); bool sessionbegun = false; bool connectionopen = false; qbsessionmanager sessionmanager = null; try { //create session manager object sessionmanager = new qbsessionmanager(); //create message set request object hold our request imsgsetrequest requestmsgset = sessionmanager.createmsgsetrequest("us", 8, 0); requestmsgset.attributes.onerror = enrqonerror.roecontinue; //connect quickbooks , begin session sessionmanager.openconnection(@"qid", "quickbooks integration

c# - Generate model description in AspNet WebApi help pages -

Image
how generate description model in asp.net web api pages? example: as can see example, can generate name , type , additional information . how generate description ? i've tried nothing , i'm out of ideas. no, that's not true. i've tried adding comments transactiondto class, not work. /// <summary> /// dto (data transfer object) transaction objects. /// </summary> public class transactiondto { /// <summary> /// manager registered transaction. /// </summary> public string fromid { get; set; } /// <summary> /// receiving manager. /// </summary> [required] public string toid { get; set; } /// <summary> /// optional expiration date. /// </summary> public datetime? expires { get; set; } /// <summary> /// date transaction created. /// </summary> public datetime created { get; set; } } i have configured helppageconfig.cs use xml

R strucchange RSS and BIC for one breakpoint -

the reference manual r strucchange package states: as maximum of sequence of f statistics equivalent minimum ols estimator of breakpoint in 2-segment partition can extracted breakpoints object of class "fstats" computed fstats. is breakpoint extracted above approach same breakpoint extracted applying coeftest object of class "breakpointsfull" when "breaks" option 1? in other words, breakpoint extracted calling breakpoints on fstats object (minimum rss) equal breakpoint extracted calling coeftest on breakpointsfull object (minimum bic) when breaks = 1? library(lmtest) library(strucchange) data("nile") fs.nile <- fstats(nile ~ 1) breakpoints(fs.nile) bp.nile <- breakpoints(nile ~ 1) coeftest(bp.nile, breaks = 1) essentially yes. breakpoint associated supf statistic (supwald or suplr) , minimum rss breakpoint in linear regression model identical. of course, trimming/minimal segment size needs same. default 15

queue - MQJCA4004: Message delivery to an MDB 'null' failed with exception: 'deactivate of endpoint is in progress.' -

i have ear deployed on 7.0.0.3 server , web service deployed. mq listener , running in server , corresponding mq host, channel name , mq queue name configured correctly. response queue. whenever i'm getting data mq, i'm getting below error in systemout.log error "mqjca4004: message delivery mdb 'null' failed exception: 'deactivate of endpoint in progress.' " please me on this. i've managed further analyze similar mqjca4004 error using this, kinda hackish, technique. you need java decompiler preserves line numbers. jadclipse plugin eclipse can that. make sure have enabled: debug settings [x] align code debugging in window > preferences > java > decompiler . the standard intellij idea community decompiler has feature enabled. the ibm class responsible producing mqjca4004 error com.ibm.mq.connector.inbound.abstractworkimpl when open (with decompilation enabled) you'll able find string mqjca400

java - How does the syntax look like to create and test a vector? [level: newbie] -

i'm studying java bit , want create vector class understand exceptions , arrays. in case go double arrays first. i implemented 2 constructors class. 1 length , 1 array. the variable length contains length of vector. get() , set() implemented read or change values. minimum(), maximum() , average() implemented wanted values of array. tostring() should print vector string. my code far public class myvector { //lenght of vector public final int l; //array representing vector private double[] arr; // constructs vector. public myvector(int l) { this.l = l; arr = new double[l]; } // constructs vector existing array public myvector(double[] array) { l = array.length; // copy] arr = new double[l]; (int = 0; < l; i++) arr[i] = array[i]; } //gets value @ given index. public double get(int index) { return arr[index]; } // sets value @ gi

Image not displaying in Django 1.8 template -

i want display images static folder inside django app called index . shows icon in browser means cannot find image in path specified in <img src=""/> . here's directory structure: |-- db.sqlite3 |-- images | |-- __init__.py | |-- __init__.pyc | |-- settings.py | |-- settings.pyc | |-- urls.py | |-- urls.pyc | |-- wsgi.py | `-- wsgi.pyc |-- index | |-- admin.py | |-- admin.pyc | |-- __init__.py | |-- __init__.pyc | |-- migrations | | |-- __init__.py | | `-- __init__.pyc | |-- models.py | |-- models.pyc | |-- static | | `-- index | | `-- file2 | |-- templates | | `-- show.html | |-- tests.py | |-- urls.py | |-- urls.pyc | |-- views.py | `-- views.pyc `-- manage.py views.py def show(request): return render(request, 'show.html', {}) urls.py from django.conf.urls import url django.conf import settings django.conf.urls.static import static index import views urlpatterns = [

swing - Java GUI not appearing after implementing socket methods -

i no errors in code. code works fine long code within start method, created, commented out. unsure why happening. have tried moving code around not solve issue. why code within start method preventing gui showing on screen? package my.ipmessenger; import java.io.bufferedreader; import java.io.dataoutputstream; import java.io.ioexception; import java.io.inputstreamreader; import java.math.biginteger; import java.net.inetaddress; import java.net.serversocket; import java.net.socket; import java.net.unknownhostexception; import java.util.logging.level; import java.util.logging.logger; import javax.swing.joptionpane; /** * * */ public class ipmessengergui extends javax.swing.jframe { static serversocket sc; static socket socket; static bufferedreader in; static dataoutputstream out; static char[] c; static string text; static string ip; static socket sock2; static bufferedreader in2; static dataoutputstream out2; static inetaddress addr