Posts

Showing posts from March, 2014

php - How do I centre post navigation links with images in WordPress? -

Image
i'm building own wordpress theme , struggling post navigation looking right. i have 2 images (a 'left/older' arrow , 'right/newer' arrow) want represent links show older or newer posts respectively. links displayed beneath last post shown. if there no newer posts (i.e. we're on front page) want show 'older' arrow link should centred , if both newer , older posts available want show both arrows, again centred @ bottom of page . finally, if there no older (i.e. newer posts) available want show 'newer' posts arrow centred . here's image illustrate: i've read docs on posts_nav_links() can't seem right. can me out? try this... <?php global $wp_query; if ( $wp_query->max_num_pages > 1 ) : ?> <div align="center"> <div class="previous"> <?php next_posts_link( '<img src="older post arrow" />' ); ?> </div> <div class="nex...

What is happening behind bash forward process substitution? -

according wikipedia, "process substitution can used capture output go file, , redirect input of process."( http://en.wikipedia.org/wiki/process_substitution ). so, in own words, means process substitution, can take output of command , use input of command b. in other words, it's pipe(is correct?). so if true, , if this: echo "test" >(wc) then should expect following: 1 1 5 because understanding of above command similar following: $echo "test" > tmp $wc tmp 1 1 5 tmp except don't make tmp file process substitution. but instead following output: test /dev/fd/63 this indicates somehow mental model incorrect. wrong? i understand <(command). example $diff <(head file1) <(head file2) perfectly makes sense. not >(command). from process substitution the process list run its input or output connected to fifo or file in /dev/fd . the name of file passed argument current command result of ex...

Haskell- Type matching -

i having trouble getting output helper function match output of function using code below: getsemidiag :: [[maybe player]] -> int -> int -> [maybe player] getsemidiag [] _ _ = [] getsemidiag (x:xs) start size = if start > (size -1) [] else (x !! start) : (getsemidiag xs (start+1) size) semiright :: [[maybe player]] -> int -> int -> [[maybe player]] semiright [] _ _ = [] semiright (x:xs) start size = if start > (size -1) [] else (getsemidiag x start size) : (semiright xs (start+1) size) the function semiright won't match despite best efforts. thoughts? judging type, x matched element has type of [maybe player] , you should pass [x] not x getsemidiag. moreover, brackets redundant. semiright :: [[maybe player]] -> int -> int -> [[maybe player]] semiright [] _ _ = [] semiright (x:xs) start size = if start > (size -1) ...

JSP form submission URL with parameters -

i working plain jsp (jsf not option) on web application. in jsp file, have table, , in each row display each student. also, in each row want have "edit" button, redirect page can edit student, , delete it. so far, think best think put submittable form button inside in each row. <table border="1"> <tr> <th>name</th> <th>lastname</th> <th>send message</th> <th>erase</th> </tr> <c:foreach items="${students}" var="bean"> <tr> <td>${bean.name }</td> <td>${bean.lastname }</td> <td><input type="button" name="edit" value="do!" onclick="foo();" /></td> <td><form action="<%="editstudent?studentid=6" %>"><input type="submit" val...

about measuring bandwidth with javascript -

i trying inject java script snippet webpage. in java script, try measure total amount of data downloaded webpage, data size divided page load time calculate bandwidth. does know how measure how data downloaded in complete event in java script? the suggested way measure bandwidth download file purposely measure don't want use. thanks lot the suggested way bandwidth (both upload , download) download/upload file of known size, take difference of start time , end time, divide size time took download/upload it. the suggested way easiest way since: you know size of file you can time takes download and have control of time when starts , finishes normally can. problem gauging speed using resources loaded on current page need hook every resource, includes (but not limited to): images scripts stylesheets frames xhr (ajax) sockets the page itself and other stuff missed. pages load resources in combination of sequential , parallel requests start , ...

How to include sitemap.xml from Wordpress in TYPO3 -

i have installation of typo3 , installation of wordpress , want have sitemap.xml search engines includes sites both systems. currently sitemap of typo3 installation generated typoscript (i use this generator ). in wordpress there no extension installed generate sitemap yet. edit: typo3 installed in domain.tld/ , wordpress in subdirectory domain.tld/blog. i open use way merge sites both systems in 1 sitemap. either extensions 1 or both cms or script running separately. or maybe there way parse sitemap.xml wordpress in typoscript. does know way merge sitemaps? there not direct way handle this. typoscript can not parse external files. way merge creating new simple extension gives output of both sitemaps merges.

sql - How can I order a Rails collection by the attributes of associated records? -

i have 3 models: teachers, students, , assignments class teacher < activerecord::base has_many :assignments has_many :students, through: assignments, uniq: true end for given teacher, retrieve list of unique students - simple enough, call: teacher.students however, order list of students based on has submitted assignments recently. specifically, student updated assignment appear first, , on. i stuck on following code, not working: teacher.students.group("assignments.student_id").order("max(assignments.updated_at) desc") any suggestions? it appears original query correct: teacher.students.group("assignments.student_id").order("max(assignments.updated_at) desc") i had thought wasn't working because had written bad rspec test failing because wasn't handling timestamps well. once used timecop handle timestamps properly, test passed. sorry that.

ruby on rails - Capybara not finding meta tags -

capybara 2.1.0 doesn't seem find meta tags: (rdb:1) p page.find 'meta' *** capybara::elementnotfound exception: unable find css "meta" even when appear in page.source : (rdb:1) p page.source "<!doctype html>\n<html>\n<head>\n<title>mytitle</title>\n<meta charset='utf-8'>\n<meta content='ie=edge,chrome=1' http-equiv='x-ua-compatible'>\n<meta content='width=device-width, initial-scale=1' name='viewport'>\n<meta name='description'>\n\n..." the solution use :visible => false either in find or in have_selector : page.should have_css 'meta[name="description"]', :visible => false or: page.find 'meta[name="description"]', :visible => false

Why can I assign a longer string to a pointer in C? -

#include <stdio.h> #include <stdlib.h> int main() { char *ptr = malloc(sizeof(char) * 1); ptr = "hello world"; puts(ptr); getchar(); } im not malloc() expert isn't code supposed give error since allocated 1 byte assigned value contains 11 bytes *ptr pointer ? or h stored in place assigned , rest of string goes in places after ? you reassigning pointer 'ptr' block of memory, won't see error. however, block of memory (size 1) allocated "lost" , leads memory leak.

ant - Extract a reference graph while compiling Java codebase? -

background: i'm working (for me) reasonably large codebase (eg: i've got few of related projects checked out @ moment, , > 11000 classes). build ant, tests junit, ci jenkins. running tests before checkin not option, takes jenkins hours. of individual apps can 45 minutes. there tests don't reference individual methods based on reflection, , in cases don't directly reference class of tested methods, interrogate aggregator class, , aware of patterns of pass-through methods in use here. it's big codebase, > 10 developers, , i'm not in charge, this can not change now. what want, ability before check-in print out list of test classes 2 degrees away (kevin-bacon-wise) class in git diff list. way can run them , cut down on angry emails jenkins when missed gets run , has error. the easiest way can think of achieve code myself ruby script or similar, allows me account of patterns we're using, need able query "which classes reference class x?...

networking - Benefit of small TCP receive window? -

i trying learn how tcp flow control works when came across concept of receive window. my question is, why tcp receive window scale-able? there advantages implementing small receive window size? because understand it, larger receive window size, higher throughput. while smaller receive window, lower throughput, since tcp wait until allocated buffer not full before sending more data. doesn't make sense have receive window @ maximum @ times have maximum transfer rate? my question is, why tcp receive window scale-able? there 2 questions there. window scaling ability multiply scale power of 2 can have window sizes > 64k. rest of question indicates asking why resizeable, answer 'so application can choose own receive window size'. are there advantages implementing small receive window size? not really. because understand it, larger receive window size, higher throughput. correct, bandwidth-delay product. beyond that, increasing has no eff...

iphone - How to access UITableView from delegate? -

when dismiss modal, i'm overriding viewwillappear in order make table view in view reload. problem don't have pointer table view call refresh. i've considered awkward solution such storing in pointer when tableview first loads , calls uiviewcontroller (the delegate) each row, seems there hast pointer somewhere. know how it? it's common viewcontroller uitableview in it's view hierarchy (even root, in case of uitableviewcontroller ) keep weak pointer uitableview kind of thing. if uitableview built in storyboard/xib , set iboutlet , otherwise, build uitableview in code, add subview , assign pointer self.tableview . viewwillappear sensible place [self.tableview reloaddata]

html - Horizontal rule/line beneath each <h1> heading in CSS -

i trying place 100% horizontal line (rule) automatically beneath every instance of an <h1> header tag using css. example of i'd see: --- snip 8< --- introduction --- snip 8< --- i have in css: .mypage .headline { font-family: calibri, "helvetica", san-serif; line-height: 1.5em; color: black; font-size: 20px; } and have in main html page: <body class="mypage"> <h1><span class="headline">introduction</span></h1> i cannot figure out how have horizontal line appear beneath every use of headline class. you can try using pseudoclass :after. . have used kind of styling in 1 of applications. http://jsfiddle.net/ffmfq/ h1:after { content:' '; display:block; border:2px solid black; } you can tidy little more style this:- http://jsfiddle.net/5hq7p/ h1:after { content:' '; display:block; border:2px solid #d0d0d0; bord...

ios - UIDatePicker and date not storing properly -

i have ibaction method tied uitoolbarbutton runs following code. the uidatepicker setup show time user. therefore, picker randomly chooses date: date today, date tomorrow. want picker choose time selected (but in future). e.g. if user picks 6:00am @ 10:00pm on jan 1st, want date store 6:00 on jan 2nd. the following if should that, 50% of time nslog returns 1 answer , 50% of time returns other. if (self.picker.date >= [nsdate datewithtimeintervalsincenow:0]) { nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; nsdate *pickerdate = self.picker.date; [defaults setobject:pickerdate forkey:@"pickerdate"]; [defaults synchronize]; nslog(@"the date more now. pickerdate %@",pickerdate); } else { nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; nscalendar* calendar = [[nscalendar alloc] initwithcalendaridentifier: nsgregoriancalendar]; nsdatecomponents* components = [[nsdatecomponents alloc] i...

join - Crystal Reports & Raiser's Edge: Selecting Data from 2 Joined Tables -

i have strange issue. have data stored in 2 tables. table 1: contains data individual individualid birthdate email table 2: contains individual names split 3 fields each having key. individualid nametype name this means nametype = 1, surname, nametype = 2, middle name, , nametype = 3 firstname. i need create crystal report list individual's name in 1 line, such as surname + firstname + middlename the problem experience related how pull data out , joins. if create join between these 2 tables left outer join, cannot select nametype select. means tht surname, other times middlename, etc.. seems tho join not consistent. furthermore, cannot iterate on expected 3 values seems can pull same 1 every time. i have tried fix adding command in turn select each of names second table. however, report meant integrated called raiser's edge not support command objects. in other words, command objects not option me. so options here? prefer not using subreport k...

android - jsonException:End of input at character 1 of -

Image
im making listview , using jsonobject array purposes im getting error dont know how fix dont know exception takes place when run program end , doesnt not show result java file hope can find exception @override protected arraylist<todaydetails> doinbackground(void... params) { try { // create new http client defaulthttpclient defaultclient = new defaulthttpclient(); // setup request httpget httpgetrequest = new httpget("http://api.androidhive.info/contacts"); // execute request in client httpresponse httpresponse = defaultclient .execute(httpgetrequest); // grab response bufferedreader reader = new bufferedreader( new inputs...

Convert BMP image to PNG with C#. Alpha channel changing? -

i have bitmap image alpha channel transparency. converting bmp image png format. here code: string tmp = @"c:\mypath\imagename"; using (bitmap changeformat = new bitmap(tmp+".bmp")) { changeformat.save(tmp + ".png", imageformat.png) } everything okay. have png image alpha channel white instead of transparent (which in bmp image). ps:test window xp, png imgae when open in window 7 ok . , open gimp soft.

xml - API request and respond in HTML? -

currently want api in website. lets apikey, write link in process.php file <a href="http://api.aaa.com/rest/?&apikey=75be12309809zzsd0zsdsdd&imagesid=19232"> image-search </a> so when click link access api.aaa.com.. then respond xml data on http://api.aaa.com/rest/?&apikey=75be12309809zzsd0zsdsdd&imagesid=19232 <rsp stat="ok"> <br> <image> <br> <size label="blog" width="315" height="400" format="jpg" price="1"/><br> <size label="web" width="615" height="779" format="jpg" price="2"/><br> </image> <br> </rsp> <br> well.. xml response api. how render html under own website?

java - Why is it a good idea to use Math.min() for x, y coordinates and math.abs() -

why idea use math.min() x-y coordinates , width , height using math.abs() method (for rectangle)? thought x-y coordinates positive, i'm confused why matters. the x,y coordinates represent position of rectangle on plane; can negative since rectangle can place anywhere relative origin (ie. 0,0 position). the height , width of rectangle must positive negative lenghts not defined. considering then, makes sense use math.min position , math.abs dimension.

java - Can I pass a parameter to an Android Apk from a properties file? -

i need pass string android apk externally. app in development, haven't deployed on google market. there way pass parameter apk external file properties file? if yes, please explain procedure. if need development only, place file on sd card. final file tmpfile = new file("/sdcard/myparam.txt"); try { fileinputstream s = new fileinputstream(tmpfile); ... use adb push myparam.txt /sdcard/ , adb pull /sdcard/myparam.txt transfer between desktop , device. it of course incorrect assume sd card mounted, use hard-coded file name, development only. if need pass parameter application, store in intent (assuming author of both applications).

string - Parse a file in c++ and ignore some characters -

i'm trying parse file has following information test_wall ; comments!! je,5 forward goto,1 test_random; je,9 i'm supposed ignore comments after ";" , move on next line. when there comma i'm trying ignore comma , store second value. string c; int a; c=getchar(); ifstream myfile (filename); if (myfile.is_open()) { while ( c != ';' && c != eof) { c = getchar(); if( c == ',') { a= getchar(); } } } myfile.close(); } here's code. i'm not entirely sure i've understood problem correctly, if not set on right direction. ifstream myfile (filename); if (myfile.is_open()) { // read 1 line @ time until eof string line; while (getline(myfile, line)) { // line have semi-colon? size_t pos = line.find(';'); if (pos != string::npos) { // remove semi-colon , afterwards line = line.substr(0, pos); } ...

how to check if connection is established when use libev with non-block socket -

i have code use libev on how deal connection timeout below (please refer http://lists.schmorp.de/pipermail/libev/2011q2/001365.html ): sd = create_socket() set_socket_nonblock(sd) connect("127.0.0.1", port) // connect invalid port ev_io_init(&w_io, connect_cb, sd, ev_write) ev_io_start(...) ev_timer_init(&w_timer, timeout_cb, 5.0, 0) ev_timer_start(...) and in someplace perform ev_run. connect_cb called , in callback function checked revents ev_error, result no error. strange because provide invalid port number not listening in local machine. anyway, try send message in connect_cb function, got error 111, means connection refused. i'm confused! how check if connection established correctly when use non-block socket? getsockopt possible way if connection has error happen: int err; socklen_t len = sizeof(err); getsockopt(sd, sol_socket, so_error, &err, &len); if (err) { // error happen } else { connection ok }

visual c++ - Reading a key and getting the section from .ini file in c++/MFC -

i have .ini file sections like: [hai1] value1 = 1 value2 = 2 [hai2] value1 = 3 value2 = 4 now, need search particular key "value1 = 3" , have corresponding section belongs, in case "hai2".to use getprivateprofilestring need section first. in case need particular section based on key value.any thoughts on how this? browse sections. section names via getprivateprofilesectionnames. char lpszreturnbuffer[4096]; dword nsize; nsize = sizeof(lpszreturnbuffer); dword dwret = getprivateprofilesectionnames(lpszreturnbuffer, nsize, lpszfilename); while (strlen(lpszreturnbuffer)>0) { trace(lpszreturnbuffer); searchformykeyvalueinsection(lpszreturnbuffer); lpszreturnbuffer+= strlen(lpszreturnbuffer)+1; }

c++ - Operator(s) too many parameters for this function? -

made own string class (i.e. homework obviously) , getting odd syntax errors on 2 of operators. equality , add operators claim have many parameters (i.e. in .h file), claim method not belong class in .cpp file! i made equality operator friend, intellisense still gives me same error messages. does know doing wrong?? friend bool operator==(string const & left, string const & right); string.h bool operator==(string const & left, string const & right); string const operator+(string const & lhs, string const & rhs); string.cpp bool string::operator==(string const & left, string const &right) { return !strcmp(left.mstr, right.mstr); } string const string::operator+(string const & lhs, string const & rhs) { //find length of left , right hand sides of add operator int lengthlhs = strlen(lhs.mstr); int lengthrhs = strlen(rhs.mstr); //allocate space left , right hand sides (i.e. plus null) char * buffer = new cha...

Primefaces "<p:ajax" listener javascript method -

i want listen picklist transfer event via javascript method, listener works java bean : <p:picklist value="#{picklistbean.cities}" var="city" itemlabel="#{city}" itemvalue="#{city}"> <p:ajax event="transfer" listener="#{picklistbean.handletransfer}" /> </p:picklist> but doesn't work : listener="myjavascriptmethod(event)" are there way listening events above? listener serverside, in client can use oncomplete, onsuccess,..(your option): <p:ajax event="transfer" oncomplete="js_function()" /> <p:ajax event="transfer" onstart="js_function()" /> ...

java - File upload using AJAX instead of form submission -

i trying upload file, using rich:fileupload control, able too. problem facing here, when click on upload button in file upload control, page gets submitted, trying avoid. what trying do, upload button clicked, listener called necessary backend operations. , section refreshed picture displayed. running fine want file uploading via ajax. i using richfaces 4.1 <rich:fileupload addlabel="add photo" clearalllabel="clear all" clearlabel="clear" deletelabel="remove" donelabel="upload successful!" uploadlabel="upload profile pic" fileuploadlistener="#{studentprofile.fileuploadlistener}" acceptedtypes="jpg, gif, png, bmp" noduplicate="true" immediateupload="false"> <!-- <a4j:ajax event="uploadcomplete" render="validationbutton"/> --> <!-- <a4j:ajax event="clear" listener="#{uploadbean.doclearfileslist}...

android - Can anyone suggest me what this below logcat is saying? -

04-18 10:43:01.765: i/system.out(23278): manual hours === 9:8 04-18 10:43:01.820: i/system.out(23278): ---gpsonoff.detectgps() 04-18 10:43:01.835: d/androidruntime(23278): shutting down vm 04-18 10:43:01.835: w/dalvikvm(23278): threadid=1: thread exiting uncaught exception (group=0x40018578) 04-18 10:43:01.851: e/androidruntime(23278): fatal exception: main 04-18 10:43:01.851: e/androidruntime(23278): java.lang.runtimeexception: unable start activity componentinfo{com.example.security/com.example.security.colect_data_from_usr_activity}: android.view.windowmanager$badtokenexception: unable add window -- token android.app.localactivitymanager$localactivityrecord@40538820 not valid; activity running? 04-18 10:43:01.851: e/androidruntime(23278): @ android.app.activitythread.performlaunchactivity(activitythread.java:1651) 04-18 10:43:01.851: e/androidruntime(23278): @ android.app.activitythread.startactivitynow(activitythread.java:1491) 04-18 10:43:01.851: e/androidruntime(23278):...

security - Symfony2 access controll and path names -

i not find in symfony2 docs i'm asking here. possible set path names instead of patterns inside security.yml access_controll ? instead of: access_control: - { path: /admin/logowanie, roles: is_authenticated_anonymously } set this: access_control: - { path: pkr_blog_user_login, roles: is_authenticated_anonymously } path name correct @ moment second form not work . how can make work? i don't think can this. what can secure controller pretty you're trying here, controller (action) invoked particular route , if change route name, supposed have pass through same controller action. in way can have flexibility you're searching for.

java - Apache Camel: Query Params vs Header Params -

i'm trying out apache camel (as routing engine). understand camel supports multiple dsls , configured using java (java dsl) or spring (spring dsl). question: have following spring dsl configuration. idea if incoming request has header-param called "name", hit when clause or else route request google: <camel:route> <camel:from uri="servlet:///test" /> <camel:choice> <camel:when> <camel:header>name</camel:header> <camel:transform> <camel:simple>hello ${header.name} how you?</camel:simple> </camel:transform> </camel:when> <camel:otherwise> <camel:to uri="http://www.google.com?bridgeendpoint=true" /> </camel:otherwise> </camel:choice> </camel:route> i expected above config work header param. however, noticed configuration working query para...

Django Redirect the Logout Process to a View -

i new django, have following template: {% if settings.login_system %} <a href="{{ settings.logout_url }}?target={{ settings.logout_redirect_url}}">{% trans %}sign out{% endtrans %}</a> {% endif %} i have view clears out session: class logoutview(templateview): redirect_field_name = "target" def get(self, *args, **kwargs): i want make sure login signal goes through logoutview method. can call view method template? if example great. example logout @require_post def logout(request): auth.logout(request) return redirect('/')

dictionary - confuse with saving between previous value and current in python -

i new in python, try make simple python script save fluctuative value between previous value , current value. confuse that.. let that, fluctuative value position previous_value = position current_value = position how make previous value saved before next position value ?? previous_value,current_value = none,none #initialize values outside loop loop ... : previous_value = current_value #storing last current value previous value current_value = position #storing current position current value.

Most feasible way to display images in android and ios app -

i want display around 1000+ images application. effective way store images, on device or in database ? i using sqlite database in app. store image on server download in device, save image sdcard cache or simple image. @ download on single success of image store path table , used in application. use lazy loading concept load image in application. better store image in sdcard rather in database.

css - What would be the correct way to insert a form in HTML, in such a way that it's field labels are equally distanced from the input field? -

previously have been using <table> tag in order structure form in such way nice formatted form each label , field on line eachother following: email: [############] password: [############] however there's semantic problem here, form not table data. table graphically suiting, not on semantic level. what proper way structure form it's graphically pleasing semantically correct in terms of data type? this a list apart article that. it uses semantically correct tags, , css styling build table-less form stable margins. in nutshell, uses label tags display text, , gives them fixed widths make form fields start @ same horizontal position. for solution flexible dimensions, see fluid input elements .

java - Multiple constructors with same arguments -

i need create multiple constructors same arguments can call these dao class populating different drop down values public static employee emptype(string empcode, string emptype) { employee emp = new employee(); emp .empcode= empcode; emp .emptype= emptype; return emp ; } public static employee empdept(string deptcode, string deptname) { employee emp = new employee(); emp .deptcode= deptcode; emp .deptname= deptname; return emp ; } when referencing dao class, how can refer these constructors? e.g. private static employee mylist(resultset resultset) throws sqlexception { return new <what should here>((resultset.getstring("db_name1")), (resultset.getstring("db_name2"))); } you cant. also, these functions aren't constructors. , how want decide "constructor" call??? you can merge both functions: public static employee createemp(string empcode, string emptype, string...

android - alloc native buffer and use in JAVA? -

i have bitmap should manipulate both in c++ , java sides. therefore, according this post allocated buffer in c++ , passed reference java. in java filled buffer bitmap using copypixelstobuffer method. when tried create bitmap buffer(without manipulations) decodebytearray returned null. , don't understand mistak. below code used. bitmapfactory.options options = new bitmapfactory.options(); options.inpreferredconfig = bitmap.config.argb_8888; mcurrentbitmap = bitmapfactory.decodefile(hardcodedpath, options); // 4- bytes count per pixel bytescount = mcurrentbitmap.getwidth() * mcurrentbitmap.getheight() * 4; pixels = (bytebuffer) allocnativebuffer(bytescount); pixels.order(byteorder.nativeorder()); mcurrentbitmap.copypixelstobuffer(pixels); pixels.flip(); pixels.order(byteorder.big_endian); byte[] bitmapdata = new byte[pixels.remaining()]; pixels.get(bitmapdata); bitmapfactory.options opt = new bitmapfactory.options(); ...

java - use google drive api get children without trash -

how can folder's children files without deleted files in trash, code follow: children children = service.children(); drive.children.list request = children.list("root"); { try { childlist clist = request.execute(); (childreference cr : clist.getitems()) { file file = service.files().get(cr.getid()) .execute(); system.out.println(file.gettitle() + "--"+ file.getmimetype()); } request.setpagetoken(clist.getnextpagetoken()); } catch (ioexception e) { system.out.println("an error occurred: " + e); request.setpagetoken(null); } } while (request.getpagetoken() != null && request.getpagetoken().length() > 0); use trashed = false query when listing: drive.files().list().setq("trashed = false").execute(); more querying options on https://developers.google.com/drive/search-parameters ...

html - jQuery: mouseover function not triggering for unordered list descendant -

i have unordered list below: <ul id="daslist"> <li id="daslistitem1"> <span> <div style="height:10px"> <label id="daslabel1">lalala</label> </div> <a id="dasanchor1"></a> </span> </li> <li id="daslistitem2"> <span> <div style="height:10px"> <label id="daslabel2">lalala</label> </div> <a id="dasanchor2"></a> </span> </li> </ul> now here want do. want trigger mouseover function on anchor tag contained in list item. currently, i'm using this: $("#daslist a").mouseover(function(){ alert('i find lack of faith disturbing'); }); but ungodly reason, isn't triggering. have placed break-points well, no avail :( is there better way of doing this? i figured out! problem browser :)...

c# - Is it possible to make 1 generic method out of these 2 linq statements? -

i have 2 linq statements - in middle of switch block. statements below. pwstarttime = lender.applicationwindows .where(w => w.name == pwperiod && w.endtime.timeofday > datetocheck.timeofday) .select(w => w.starttime) .firstordefault(); pwstarttime = lender.transferwindows .where(w => w.name == pwperiod && w.endtime.timeofday > datetocheck.timeofday) .select(w => w.starttime) .firstordefault(); as can see difference refer 2 different properties of "lender", however, elements used in linq query identical in "applicationwindows" , "transferwindows", although not same objects , each contain other unique properties. so, it possible return w.startdate via 1 generic method? thanks in advance. // here's 2 classes public class applicationwindow { public string name { get; set; } public datetime starttime { get; set; } public datetime endtime { get; set; } } public class transferwindow { public...

javascript - Getting value from a JSON -

i have json -- .... "location" : { "lat" : 37.42140090, "lng" : -122.08537010 }, .... i trying access lat , lng values. how can it? my code results[0].geometry.location.lat or results[0].geometry.location.lng does not work. output when use results[0].geometry.location . the json using -- http://maps.googleapis.com/maps/api/geocode/json?address=1600+amphitheatre+parkway,+mountain+view,+ca&sensor=true update -- this how making request api geocoder.geocode( { 'address': search_addr}, function(results, status) { if (status == google.maps.geocoderstatus.ok) { var t = results[0].geometry.location.lat; } else { alert('geocode not successful following reason: ' + status); } thanks when using google's javascript apis, you're not typically interacting parsed json directly, rather wr...

ios - iPAD calendar Control with month, day and week -

i've checked google enough time ipad calendar control (ui) same native calendar app ipad. i've got few options example. tapku calendar http://developinginthedark.com/posts/iphone-tapku-calendar-markers iphone , not show week, month, day view. i've used kal in 1 of app. again iphone , no month, week, day view. muhku , close want.but not show month view. https://github.com/muhku/calendar-ui ? i know eventkit not give control show actual calendar (as far know) can please suggest me if there control or library exist . should show month, week, day view , ipad. or if not suggestion highly appreciated. many thanks you can see answer lists out calendar controls available open source. upto knowledge dont think there component handles day,week , month in single control, gotta merge two.

url rewriting - php url friendly withhtaccess and get variables -

can me user friendly url , variables. my file called test.php , i'm using htaccess remove .php part of url. in theory want following url construction in following format: www.example.com/test/1234 where 1234 id= part whats best way , how can this? here's htaccess far: options -indexes rewriteengine on rewritecond %{request_filename}.php -f rewriterule !.*\.php$ %{request_filename}.php [l, qsa] rewriterule ^(.*)$ test.php?/$1 [l] i'm trying get variable by: $var = $_get['id']; echo $var; any appreciated. in future using pass products name , using them variables increase seo , user experience. if need more information or questions im happy respond can see if works? rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{request_filename} !-l rewriterule ^test/(.+)$ test.php?id=$1 [qsa,l] ^ above works

PHP looping trough XML error -

function loadfilestoarrays(){ $notpromo1array = simplexml_load_file('pages/hegnar/source/1/notpromo-1_08_04_2013_1.xml'); foreach($notpromo1array $xml){ echo $xml -> getname(); echo "<br>"; echo $xml -> ordrehode -> sluttkundenr; echo "<br>"; } } my xml this <?xml version="1.0" encoding="utf-8"?> <is_data> <ordrer class="linked-list"> <ordrehode> <ordrekundenr>10541</ordrekundenr> <sluttkundenr>1240</sluttkundenr> <and other properties></and other properties>.......... </ordrehode> <ordrehode> <ordrekundenr>10541</ordrekundenr> <sluttkundenr>1344</sluttkundenr> <and other properties></and other properties>.......... </ordrehode> ...

specs2 - A simple Scala Given/When/Then style specification failed -

i new spec2, , trying learn it. come following codes, @runwith(classof[junitrunner]) class gwtstylespec extends specification { "a given-when-then example addition" ^ "given following number: ${1}" ^ number1 ^ "and second number: ${2}" ^ number2 ^ "then should get: ${3}" ^ result ^ end val number1: given[int] = (_: string).toint val number2: when[int, (int, int)] = (n1: int) => (s: string) => (n1, s.toint) val result: then[(int, int)] = (n: (int, int)) => (s: string) => ((n._1 + n._2) must_== s.toint) } after run it, got java.lang.exception: not instantiate class com.me.scala.start.gwtstylespec: null , lots of exception stack trace below it. what did wrong this? if importing org.specs2.specification there should def = ... method defined: @runwith(classof[junitrunner]) class gwtstylespec extends specification { def = "a given-when-then example addition" ^ ...

domParser.Process throws Dom parser operation failed in lotus script -

i need read xml file local disk using lotus script. added code in script library , called notes view. origxml = "d:\dxl\xmldom.xml" outputfile = "d:\dxl\domtree.txt" on error goto errh set session = new notessession set db = session.currentdatabase 'create output file set outputstream =session.createstream outputstream.open (outputfile) outputstream.truncate set inputstream = session.createstream inputstream.open (origxml) 'create dom parser , process set domparser=session.createdomparser(inputstream, outputstream) domparser.process output , input stream , getting. throws following error in domparser.process dom parser operation failed please me solve this. appreciated. i have same error. see detail in domparser.log . maybe incorrect encoding type or not found xsd|xslt stylesheet url.

compilation - mpif90 -v does not create object file with flag openmp -

i compiling third-part software, mpif90, in case mpi version of gcc. package comes makefile. after compiling object files, makefile creates archive ar, fails because there not input object files. in effect tried compile hand object files (.o) with mpif90 -lmkl_gf -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -openmp -o3 -dmpi -c a.f90 and a.o not created, .mod file created instead. don't have experience fortran, , bit puzzled, because -c flag should create object, shouldn' it? i have verified gfortran create object file if remove flag openmp notes: mpif90 -v gcc version 4.4.3 os : ubuntu 10.04.4 lts i changed flag openmp fopenmp http://gcc.gnu.org/onlinedocs/gfortran/openmp.html

c# - Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) -

i try flowing code create wmplib.iwmpfoldermonitorservices in c# manage folders contain music. public partial class mainwindow : window { private wmplib.iwmpplayer player; private wmplib.iwmpfoldermonitorservices managefolder; [dllimport("ole32.dll", exactspelling = true, preservesig = false)] [return: marshalas(unmanagedtype.interface)] static extern void cocreateinstance([in, marshalas(unmanagedtype.lpstruct)] guid rclsid, [marshalas(unmanagedtype.iunknown)] object punkouter, clsctx dwclscontext, [in, marshalas(unmanagedtype.lpstruct)] guid riid, [marshalas(unmanagedtype.iunknown)] out object rreturnedcomobject); public mainwindow() { initializecomponent(); object instanceplayer = null; guid gui...

javascript - JQM: popup not closing on timeout? -

i have managed popup open on page load, first time page opened. once opens, want close on own after several seconds, not able that. this code using: <script type="text/javascript" language="javascript"> $(document).on('pageshow', function (event) { if (sessionstorage.popupshown != 'true') { $('#strelica').popup('open', {positionto: '#hitnizbor'}); sessionstorage.popupshown = 'true'; settimeout(function () { $("#strelica").popup("close"); }, 3000); } else{ alert('already shown popup'); } }); </script> your example should work, made safer version: http://jsfiddle.net/gajotres/uauar/ $(document).on('pageshow', '#index', function(){ var start = settimeout(function () { $('#strelica').popup('open', {positionto: '#hitnizbor'}); clearinterval(start); }, 0); ...

c# - SQL check if value exists and return primary key -

i have 2 tables, customer , application, both have primary keys (customerid , applicationid), application has foreign key of customerid. when user starts application adds customerid application table other information. what want write sql query/stored procedure first checks if customerid in application table , if don't add again, update information , return applicationid me use. then if not in table, add customer id , information , return me applicationid. my code add database is. insert application (customerid, q5, q11a) values (@customerid,@q5, @q11a);" + "select scope_identity()"; int applicationid = convert.toint32(command.executescalar()); how go turning want do? you can use merge statement in order perform insert or update operation. after can use select statement in order applicationid . query this: merge application target using (select @customerid,@q5, @q11a) source (customerid, q5, q11a) on (target.customerid = source...

c++ - CreateProcess() in a client server application in windows -

i working on udp client-server application 1 server supposed handle 40 clients logged on @ once. now in unix, such issues resolved using fork function creates child process deal client , leaves server accept new connections. i searched on internet , found out fork not available in windows, createprocess used. my previous research introduced me thread pools. i've 2 questions: could acheive functionality of fork() using createprocess() in windows? if possible, should go for: thread pools or creating multiple processes? in linux fork function used create new process. each process, there different virtual memory space. threads, 1 common virtual memory there. the fork api can simulate in windows (upto extent) using native api rtlcloneuserprocess.

javascript - Detach then append AngularJS form change validity status -

you can test in jsfiddle: here (better see on new jsfiddle, see edit part of post) i think there bug in angularjs or @ least not expected result. if detach form re-append it, it's class ng-invalid switch ng-valid on re-append dom. has consequence enable submit button of form data aren't valid. of course, expecting validity status didn't switch. i think it's angular bug, maybe jquery one. use jquery check on append if form valid or not , forcing form class it's seems not working valid form status of invalid. it's quite weird don't know other workaround without using kind of data saved status form before detaching it. so has encountered problem? there method (if possible using angularjs directive) rid of bug? ps: need detach form (and other elements) in single page web application keep dom clean possible. edit i've done new jsfiddle illustrating more problem, detaching content on internal site navigation: http://jsfiddle.net/ewvwa/ u...