Posts

Showing posts from July, 2015

ios - How do I add an image to the UITableViewHeaderFooterView? -

can me figure out how add , image header view? code tried using doesn't work. below have far. - (void)tableview:(uitableview *)tableview willdisplayheaderview:(uiview *)view forsection:(nsinteger)section { uitableviewheaderfooterview *headerview = (uitableviewheaderfooterview*)view; if (headerview != nil) { headerview.contentview.backgroundcolor = [uicolor greencolor]; uiimageview *imageview = [[uiimageview alloc] initwithframe:cgrectmake(200.0f, 0.0f, 100.0f, 25.0f)]; *imageview.image = [uiimageview = image.png];* //this line doesn't work. [headerview.contentview addsubview:imageview]; uilabel *mainlabel = [[uilabel alloc] initwithframe:cgrectmake(0.0f, 0.0f, 100.0f, 25.0f)]; mainlabel.text = [sectiontitles objectatindex:section]; mainlabel.backgroundcolor = [uicolor redcolor]; [headerview.contentview addsubview:mainlabel]; uilabel *secondlabel = [[uilabel alloc] initwithframe:cgre

java - Error installing pyjnius, "jni.h" not found. (OS X 10.10.1) -

i have been trying install pyjnius on os x 10.10.1. other dependencies taken care of, haven't been able solve issue of header file "jni.h" not being found. here's happens: $ sudo python setup.py install /system/library/frameworks/python.framework/versions/2.7/lib/python2.7/distutils/dist.py:267: userwarning: unknown distribution option: 'install_requires' warnings.warn(msg) running install running build running build_py running build_ext skipping 'jnius/jnius.c' cython extension (up-to-date) building 'jnius' extension cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -os -pipe -fno-common -fno-strict-aliasing -fwrapv -denable_dtrace -dmacosx -dndebug -wall -wstrict-prototypes -wshorten-64-to-32 -dndebug -g -fwrapv -os -wall -wstrict-prototypes -denable_dtrace -arch x86_64 -arch i386 -pipe -i/system/library/frameworks/javavm.framework/versions/a/headers -i/system/library/frameworks/python.framework/versions/2.7/incl

php - Limiting the number of radio buttons checked by a user after submit in Symfony2 form -

i new symfony2. have created form has 3 sets of radio buttons , submit button. display form, have used formtype. now, have apply condition user can select maximum of 2 sets of radio buttons(and minimum of 0 sets of radio buttons) , not 3 sets of radio buttons. if user selects 3 sets of radio buttons , clicks on submit want throw error message user saying "you can select 2". this formtype "subscriptionstype.php" <?php namespace instituteevents\studentbundle\form\type; use symfony\component\form\abstracttype; use symfony\component\form\formbuilderinterface; class subscriptionstype extends abstracttype { public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('event1', 'choice', array('choices' => array('1' => 'tourism', '2' => 'food party', '3' => 'south korean food', '4' => 'cooking', '5' =>

sql - Join two select queries horizontally in Postgresql -

i have following 2 queries: query #1: (select pl.c_project_id, pl.c_projectphase_id, pl.c_projecttask_id, pl.m_product_id, pj.name projectname, ph.name phasename, pt.name taskname, pd.name prodname, round(pl.plannedqty, 2) planqty, round(pl.plannedprice, 2) planrate, round(pl.plannedamt, 2) planamt adempiere.c_projectline pl left join adempiere.c_project pj on pl.c_project_id = pj.c_project_id left join adempiere.c_projectphase ph on pl.c_projectphase_id = ph.c_projectphase_id left join adempiere.c_projecttask pt on pl.c_projecttask_id = pt.c_projecttask_id left join adempiere.m_product pd on pl.m_product_id = pd.m_product_id pl.c_project_id = 1000001 , pl.ad_client_id = 1000000 order ph.c_projectphase_id, pt.c_projecttask_id) output is: 11 columns , 16 rows query #2: (select fa.c_project_id, fa.c_projectphase_id, fa.c_projecttask_id, fa.m_product_id, pj.name costprojectname, ph.name costphasename, pt.name costtaskname, pd.name costprodname,

javascript - append values to radio button instead of dropdown box after previous dropdown selection -

i have piece of program fetches values database , displays in dropdown box depending on previous dropdown selection. but instead of displaying/appending fetched value on dropdown, want in radio button format. i'm doing it javacsript. have tried couple of codes , searched on net still dont want , still struggling. can please me find out how displayed on radio buttons instead of drop down? many in advance help. below have. on html: <div class="modal-body"> <div id="secondmodelalert"></div> <div id="defaultsmodelcontainer"> <form onsubmit="return false;" class="form-horizontal"> <fieldset> <div id="currentprojectidinputcontainer" class="control-group"> <label class="control-label" for="currentprojectid">project</label> <div id="

c - FTP Active mode client error in Ubuntu: I won't open a connection to 127.0.1.1 -

i have created ftp active mode client. on os x operating system works great. when have migrated ubuntu, has started fail. problem on os x, when enabling data connection, listening socket listens on wifi router ip. don't know why, on ubuntu listens on 127.0.1.1. because of this, response port commnd: i won't open connection 127.0.1.1 how prioritize hosts had in os x? data connection: else if (strcmp(command, "ls") == 0) { // listening data socket initialization data_socket = listen_to_server(&ip_address); if (data_socket == socket_error) { goto exit; } // ftp commad port request if(request_port(&command_socket, ip_address) == socket_error) { goto exit; } // server response receiving if(receive_packet(&command_socket, packet) == socket_error) { goto exit; } // server response printing

asp.net mvc 4 - Why httpGet action method not display the data into view in mvc 4? -

my problem view model,when pass values http action to http post action through view, view method not display values directly showing http post action without display view method why not displaying view? [httpget] public actionresult index() { return view(); } view model public class sample { [key] public int id { get; set; } public string name{ get; set; } } view @using (html.beginform()) { @html.textboxfor(m=>m.name); <input type="submit" value="index"/> } post method [httppost] public actionresult index(string name) { return view(); } i think not using httppost method correctly. should doing way: [httppost] public actionresult index(sample model) { return view(model); }

java - Which format of "en_US" and "en-US" should be used in Http header request as Accept-Language? -

i tested these 2 formats , server okay both. since http header fields saying "en-us" format , local java class returning "en_us", i'm little bit confused of them use! my partial code this: // set accepted language list<string> acceptedlanguages = null; final locale defaultlocale = locale.getdefault(); // en if (defaultlocale != null) { final string defaultlang = defaultlocale.tostring(); // en_us if (!textutils.isempty(defaultlang)) { acceptedlanguages = new arraylist<string>(); acceptedlanguages.add(defaultlang); // add en fallback if applicable if (!httpclient.default_accepted_language_country.equals(defaultlang)) { acceptedlanguages.add(httpclient.default_accepted_language_country); } }

php - Error on getting data from JSON API -

i new php. currently i'd data json api url: https://kickass.so/json.php?q=test+category:tv&field=seeders&order=desc&page=2 i have tried following: <?php $query = file_get_contents('https://kickass.so/json.php?q=test+category:tv&field=seeders&order=desc&page=2'); $parsed_json = json_decode($query, true); foreach ($parsed_json $key => $value) { echo $value['title']; } ?> here i'd want value as: title, category, link, hash ect. but i'm getting error: warning: illegal string offset 'title' in c:\xampp\htdocs\xxxxx\test.php on line 6 k warning: illegal string offset 'title' in c:\xampp\htdocs\xxxxx\test.php on line 6 h warning: illegal string offset 'title' in c:\xampp\htdocs\xxxxx\test.php on line 6 b warning: illegal string offset 'title' in c:\xampp\htdocs\xxxxx\test.php on line 6 e warning: illegal string offset 'title' in c:\xampp\htdocs\xxxxx\test.php on

swift - NSArray with contents of file not work in ios -

i trying json array json file in ios. problem code not working content in json file is: [{a:"m",data:"1597,144",tick:1},{a:"m",data:"1595,144",tick:1}, ...] this swift code: if let filepath = nsbundle.mainbundle().pathforresource("data", oftype: "json") { let array = nsmutablearray(contentsoffile: filepath) println("\(array)") } the file exists @ path reason not working. null when try print array. nsmutablearray(contentsoffile: filepath) work property lists: https://developer.apple.com/library/ios/documentation/general/reference/infoplistkeyreference/articles/aboutinformationpropertylistfiles.html what have json string. if want load array json file check out this: how parse json file in ios?

c# - All listbox items colored instead of one by one -

when listbox's drawitem event fired. iterate through items , if each item's text meets condition, background color green , if not, yellow. with following code, items same color. not @ programming graphics in c sharp guess. private void listboxyourselection_drawitem(object sender, drawitemeventargs e) { listbox lst = (listbox)sender; foreach(string item in lst.items) { color col = new color(); e.drawbackground(); e.drawfocusrectangle(); if (conditionistrue) col = color.green; else col = color.yellow; e.graphics.drawrectangle(new pen(col), e.bounds); e.graphics.fillrectangle(new solidbrush(col), e.bounds); if (e.index >= 0) { e.graphics.drawstring(lst.items[e.index].tostring(), e.font, new solidbrush(color.black), e.bounds, stringformat.genericdefault); } } } the mistake indeed iterate on items in listbox . yo

php - Symfony 2. Controller's createForm does not bind Model to submodels -

i have 2 models, , 2 types. formtype "eventschedule" subform of "event". when tried use $this->createform(new eventtype(), $event); in controller, got form eventschedules(that part of event) have no links related events. /** * event * * @orm\table() * @orm\entity(repositoryclass="voulidance\sharedbundle\repository\eventrepository") */ class event extends baseentity { /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** * * @var string * * @orm\column(name="name", type="string", length=255) * @assert\length(max = "50", maxmessage="the value long. should have maximum {{ limit }} characters") * @assert\notblank() */ private $name; /** * * @var \datetime * * @orm\column(name="start_d

c++ - ISCSI Target Windows API -

i'm newbie boss asked me make iscsi target server c++ using windows api (run on windows server 2012) project requirements - create iscsi target - connect target vhd find alot, fond iscsi discovery library functions volume shadow copy api interfaces i created file .vhd anh truy winapi addiscsistatictarget windows api cannot add "file , storage service" thank , best regards sr because english the first link in question api configuring iscsi client component, not iscsi server component. the second link volume shadow copy api, don't think relevant either. that's used intelligent snapshotting of volumes, in order run backup. to manipulate iscsi target server component, use iscsi target server provider api . since you're dealing vhd file, might need virtual hard disk api .

oracle - Sql in java throws that java.sql.SQLException: ORA-00904: "Row Number": invalid identifier, but run in PLSQL success -

this problem occurs in windows 8.1 oracle 11.0.1.0, in ubuntu , oracle 11.0.2.0 dose not happened. running select * t_5188881_8 order "row_number" in plsql success. in java code: rs = stmt.executequery(string.format( "select * %s order \"row_number\"", tablenames.get(i))); the tablenames.get(i) equals t_5188881_8, ... the error info: java.sql.sqlexception: ora-00904: "row_number": invalid identifier @ oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:112) @ oracle.jdbc.driver.t4cttioer.processerror(t4cttioer.java:331) @ oracle.jdbc.driver.t4cttioer.processerror(t4cttioer.java:288) @ oracle.jdbc.driver.t4c8oall.receive(t4c8oall.java:743) @ oracle.jdbc.driver.t4cstatement.dooall8(t4cstatement.java:207) @ oracle.jdbc.driver.t4cstatement.executefordescribe(t4cstatement.java:790) @ oracle.jdbc.driver.oraclestatement.executemaybedescribe(oraclestatement.java:1039) @ oracle.jdbc.driver.t4cstatement.executemaybedes

gridsplitter - WPF GridSpliter Movment to both sides for sub-grids -

im creating grid hold 4 displayes. i started grid divided 2 grids (top/bottom) gridsplitter. part worked fine - can change height of noth top , buttom grids. splited each of them 2 more grids - left , right, again seperated grid spliter. these gridspliters can change size right left widht kept constant(the initial width) how fix it? heres xaml code: <grid background="#ddddff"> <grid.rowdefinitions> <rowdefinition height="*"/> <rowdefinition height="5"/> <rowdefinition height="*"/> </grid.rowdefinitions> <gridsplitter grid.row="1" height="5" horizontalalignment="stretch"></gridsplitter> <grid x:name="topdisplaysgrid" grid.row="0"> <grid.columndefinitions> <columndefinition width="*"/> <columndefinition width="5"/>

java - Change how the compiler parses the string -

this question has answer here: java equivalent of c#'s verbatim strings @ 3 answers in c#, @ sign used before string literals change how compiler parses string. there counterpart of in java? using concatenation confuses me sometimes. strings cannot on multiple lines in java. editor may automatically wrap them, string cannot on multiple lines - is, don't hit enter in middle of string literal. if want string contain new line, use \n ex system.out.println("line 1\nline 2"); results in line 1 line 2

plugins - MvvmCross/MvvmCross-SQLite support for profile 259 on Xamarin (.Net 4.5) -

i'm working xamarin , mvvmcross. i'm using "community mvvmcross sqlite-net" plugin. need change pcl profile 259. plugin not support profile 259 on xamarin (.net4.5). does know workaround? right nuget has not been released updated source code of community sqlite plugin profile 259. you'll have download , compile until package released.

jwplayer6 - jwplayer - hide part of the movie with black div -

i have movie built in subtitles. want option hide captions created black div absolute position hide captions. problem i'm having when movie shown on full screen can't see black div. added z-index of 10000000 div , works covers jwplayer controls. any idea how can achieve that? <div id="movie_container" class="movie_container"> <div class="videoplayer" id="videoplayer"></div> <div id="hide_captions_box" class="hide_captions_box"> </div> </div>

c# - Redirect stdout, but stdout still appears -

i'm spawning child processes process.start. both process , child process console apps. stdout child process shows in parent console window. avoid this, redirected stdout, output still appearing. setup looks this: var proc = process.start(new processstartinfo { redirectstandardinput = true, redirectstandardoutput = true, redirectstandarderror = true, useshellexecute = false, filename = filename, arguments = args, createnowindow = false }); var stderr = proc.standarderror.readtoendasync(); var stdout = proc.standardoutput.readtoendasync(); var stdin = proc.standardinput.writeasync(stdintext).continuewith(something => proc.standardinput.close()); proc.waitforexit(); task.waitall(stderr, stdout, stdin); // process output i don't write stdout own stdout, it's still appearing in parent console. seems occur child pro

javascript - Retrieving a display results from a search -

i'm relatively new meteor.js , i'm trying search form work. far i'm not trying params work, come later. i'm trying bunch of lifts display. lib/router.js router.configure({ layouttemplate: 'layout', loadingtemplate: 'loading', notfoundtemplate: 'notfound', waiton: function() { return meteor.subscribe('lifts'); } }); router.route('/', { name: 'liftslist' }); router.route('/lifts/search/:from-:to-:when', { name: 'liftssearch', waiton: function() { return meteor.subscribe('liftssearch'); } }); server/publications.js meteor.publish('liftssearch', function() { var query = { fromloc: { $near : { $geometry: { type : "point" , coordinates: [ 6.11667, 45.9 ] } }, $maxdistance : 50 }}; return lifts.find(query); }); if try display results lifts.find(query).fetch(), returns actual results. client/lifts_search.html &l

javascript - angularjs - loading images issues -

i have small issue how handle loading images browser not try load images cant find because angularjs havent kicked in yet. how can that?, ng-if? or ng-hide/show?, still find images tag before angularjs kicked in. if can me how handle issue too: need have standard image time, if there campaign on site, need "overwrite" image data got http call standard image <img class="img-responsive hidden-sm hidden-xs" src="/images/header.jpg"> <img class="img-responsive hidden-lg hidden-md" src="/images/header-mobile.jpg"> campaign image <img class="img-responsive hidden-sm hidden-xs" src="/images/{{campaign}}.jpg"> <img class="img-responsive hidden-lg hidden-md" src="/images/{{campaign}}-mobile.jpg"> you can use ng-src . within attribute, can use {{campaign}} markup. in case should work with: <img class="img-responsive hidden-lg hid

java - Select column in a selected row using selenium web driver -

i have select row in table there multiple rows , in have click on column link . column link has same xpath in rows. example: row1 name1 updatelink row2 name2 updatelink row3 name3 updatelink where name unique. after selecting particular row have click update link. update link has same xpath rows try following: //td[contains(.,'name1')]/following-sibling::td/a

excel - I am trying to find a formula where the outcome can add or subtract a value from a row number. -

i trying find formula outcome can add or subtract value row number. e.g. the formula looking should (imaginary) =cel(d(5+1), refers cel c6 instead of c5, +1 or -1 should outcome of formula or in separate cel, can refer or in formula itself. does have solution? rene one way using index function, formula give nth cell in column c =index(c:c,n) so can derive n formula or include row number, e.g. =index(c:c,row()+1)

css - Center aligning image in div -

Image
html <div class="image-container"> <img class="image" src="image.png"> </div> css .image-container { width: 95px; height: 95px; background: #000000; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center; } .image { max-width: 95px; max-height: 95px; } this works fine on chrome , safari not in firefox. it's filling whole div , aspect ratio not maintained. how make work on firefox? chrome / safari firefox because of .image height stretch image. change css this. .image { width:100%; }

python - Row count in a csv file -

i making stupid mistake, can't find is. want count number of lines in csv file. wrote this, , isn't working: have row_count = 0 while should 400. cheers. f = open(adresse,"r") reader = csv.reader(f,delimiter = ",") data = [l l in reader] row_count = sum(1 row in reader) print row_count with open(adresse,"r") f: reader = csv.reader(f,delimiter = ",") data = list(reader) row_count = len(data) you trying read file twice, when file pointer has reached end of file after saving data list.

javascript - Modal only triggered after ajax request -

i have 2 questions code. first why modal not shown before alert? second how can delay modal, because popup fast can't see nothing in modal. $('#mymodal').modal('hide'); $(document).ajaxstart(function() { $('#mymodal').modal('show'); }).ajaxstop(function() { $('#mymodal').modal('hide'); //$('#mymodal').delay(5000).modal('hide'); not work }); $(".generate_report").click(function(event) { event.preventdefault(); $.post("xls.php", $(".form_report").serialize(), function() { }).done(function(data) { alert("should executed after modal"); }); }); demo you can achieve same code: $(".generate_report").click(function (event) { event.preventdefault(); $('#mymodal').modal('show'); settimeout(function(){ $.post("xls.php&

php - Edit a record without code -

i'm looking sort of (free) framework / script generates code (or reads mysql metadata @ runtime) edit mysql record can insert existing website. something like: give credentials, tell table , how id (in case $_get['id'] ) , spits out html form , php code select/update/insert it. i'm sure exists can't find google search terms. a key word searching be: scaffolding http://www.phpscaffold.com/ http://www.amplescaffolder.com/2009/12/18/ample-scaffolder-everything-youve-ever-wanted-in-a-php-scaffolding-package/

android - Building webrtc library -

Image
i trying build webrtc android demo application. following readme applied project. first thing mentioned gclient when tried run "no external or internal command". got link according link cloned depot_tool repository when @ step when try run gclient got so after hours of trying not able run it. if 1 has experience webrtc library please provide help. guidance? hlep appreciated i heard few things changed svn git. tried building webrtc windows7 using visual studio. see if can use parts on this. get depot_tools software , extract location (set path in environment variable). cd depot_tools directory , hit 'gclient' (this should take sometime) install python 2.7 , put path. create folder of choice webrtc , open command prompt there. now hit, gclient config http://webrtc.googlecode.com/svn/trunk then, gclient sync. then set gyp_generators=msvs environment variable (use ninja if want that). also set msvs_version=2012 (depending on visual studio vers

memory - Stackalloc Pointer to Pointer in C# -

i have structue in c#: [structlayout(layoutkind.sequential)] public unsafe struct svm_node { internal int index; internal double value; } and wrote below code allocate unmanaged memory variable p svm_node** p = stackalloc svm_node*[100]; but after executing code variable p null, if use code: svm_node* p = stackalloc svm_node[100]; p real pointer. problem?

concatenate arrays of data in MATLAB -

i have set of features in cycle in matlab: = step:indexmax posture(i) = 0; motionlevel(i) = randi(10)/100 ; positionx(i) = 50; positiony(i) = 50; positionz(i) = 50; features(i) = [posture(i) motionlevel(i) positionx(i) positiony(i) positionz(i)]; end when arrive @ row definition of array features have error: "in assignment a(i) = b, number of elements in b , must same." i need concatenate features in 1 vector ( output can matrix rows , 5 colums...) in code, try assign row vector single element of features . index whole row of features features(i,:) = [posture(i) motionlevel(i) ...

git - eclipse intellij can use Github for same project -

is possible create 1 project in github, , 2 teams using different ide eclipse , intellij can configure project github , can work simultaneously on same project? have searched not able find proper solution it. yes, can version: your .project , .classpath (eclipse) and your .idea folder (intellij) and both set of ide-specific files ignore each others: 1 use eclipse settings without realizing there intellij idea project, , vice-versa.

Changing time from epoch time to iso format in Python -

this question has answer here: initialize datetime object seconds since epoch 4 answers i change time epoch time format readable kml extensions (such iso format of time). there plenty of change epoch formats yyyymmddhhmmss , other structs using tuples , mktime, .iso formation , haven't been able find it. utcfromtimestamp converts seconds since epoch corresponding utc datetime.datetime . datetime.datetime objects have isoformat method returns date string in iso 8601 format. in [6]: import datetime dt in [7]: seconds_since_epoch = 0 in [8]: dt.datetime.utcfromtimestamp(seconds_since_epoch) out[8]: datetime.datetime(1970, 1, 1, 0, 0) in [9]: dt.datetime.utcfromtimestamp(seconds_since_epoch).isoformat() out[9]: '1970-01-01t00:00:00'

c# - HtmlAgilityPack SelectNodes Syntax -

i have following html: <tbody> <tr> <td class="metadata_name">headquarters</td> <td class="metadata_content">princeton new jersey, united states</td> </tr> <tr> <td class="metadata_name">industry</td> <td class="metadata_content"><ul><li><a href="/q-engineering-software-jobs.html" rel="nofollow">engineering software</a></li><li><a href="/q-software-development-&amp;-design-jobs.html" rel="nofollow">software development &amp; design</a></li><li><a href="/q-software-jobs.html" rel="nofollow">software</a></li><li><a href="/q-custom-software-&amp;-technical-consulting-jobs.html" rel="nofollow">custom software &amp; technical consulting</a></li&g

java - Inject PersistenceContext with CDI -

currently, i'm using persistencecontext inject entitymanager. em injected perfectly. @stateless public statelesssessionbean implements statelesssessionbeanlocal { @persistencecontext(unitname = "mypersistenceunit") private entitymanager em; @override public collection<myobject> getallobjects(){ criteriabuilder cb = em.getcriteriabuilder(); criteriqquery<myobject> query = cb.createquery(myobject.class); query.from(myobject); return em.createquery(query).getresultlist(); } } now try decorate bean, , em doesn't injected. nullpointerexception. @decorator public statelesssessionbeandecorator implements statelesssessionbeanlocal { @inject @delegate @any statelesssessionbeanlocal sb @override public collection<myobject> getallobjects(){ system.out.println("decorated method!"); return sb.getallobjects(); } } i know ejb , cdi 2 different m

doctrine2 - Symfony, ManyToMany refers to the owning side field which does not exist -

i have @manytomany relation 2 entities. i have (short code) class photo { /** * @orm\manytomany(targetentity="application\sonata\userbundle\entity\user", mappedby="photos") */ protected $users; } class user { /** * @orm\manytomany(targetentity="mybundle\photobundle\entity\photo", inversedby="users", cascade={"persist"}) * @orm\jointable(name="user_photos") */ protected $photos; } php app/console doctrine:schema:validate -> [mapping] fail - entity-class 'mybundle\photobundle\entity\photo' mapping invalid: * association mybundle\photobundle\entity\photo#users refers owning side field application\sonata\userbundle\entity\user#photos not exist. i looked in stack , try somethings still have problem. sonatauserbundle using xml entities. can't use annotations relation.

.htaccess - Rewriting url rule applied on a folder -

i have url looks : www.mysite.com/directory1/directory2/directory3 . using htaccess want define rewrite rule able redirect last piece of url in example (directory3) directory3.html has idea ? you can use code in document_root/.htaccess file: rewriteengine on rewritebase /restapi/ rewritecond %{document_root}/restapi/$1\.html -f [nc] rewriterule ^(.+?)/?$ $1.html [l] this rule captures whole uri except last optional slash in back-reference $1 . it constructs full filesystem path using %{document_root}/restapi/$1.html %{document_root} internal mod_rewrite variable representing value of actual document_root path in system. using -f checks whether .html fils exists. if condition true routes .html file.

java - How do I Gson-serialize an object extending a Collection? -

i have class want serialize: class enrichedlist extends arraylist<string> { long timestamp = system.currenttimemillis(); } the out-of-the-box gson serializer ignores timestamp field because it's in collection class. know can write typeadapter , manually handle class, , might solution go for, want explore options. there better option scales , maintains better? think of scenario when new developer enters team , adds field/property enrichedclass without knowing has update typeadapter simultaneously. evidence issue: class enrichedlist extends arraylist<string> { long timestamp = system.currenttimemillis(); } class simpleobject { long timestamp = system.currenttimemillis(); } @test public void serializeit() { enrichedlist list = new enrichedlist(); list.add("fred"); list.add("flintstone"); system.out.println("enriched list: " + new gson().tojson(list)); system.out.println("simple object: &q

HTML, CSS, Sticky Header and Footer, Minimum Height Content DIV -

i have reviewed number of posts , have not found looking for. perhaps might have missed something. if so, apologies. have sticky header , footer , content div observe minimum height of 100%. in case div requiring minimum height has id of "minheightcontainer". have commented out number of paragraphs within div when un-commented illustrate desired vertical scroll behavior. however, when commented out div observe minimum height of 100% due different background colors on various elements. html , css shown below. assistance appreciated. <!doctype html> <html> <head> <title>sticky header , footer</title> <style type="text/css"> @font-face { font-family:segoe ui; } @font-face { font-family:segoe ui semibold; } @font-face { font-family:segoe ui light; } body { background:#fff; border:0px; color:#323232; font-family:"segoe ui"; font-size:12px;

javascript - Angular save vars to laravel session with ajax call dont work -

i want save var session, , when make request ajax dont work. service: function huntservice( $http ) { this.hunts= { draws : null, hunters: null }; this.savetosession = function( hunts) { var hunts = this.hunts; return $http.post('savetosession', { hunts: hunts }); }; } huntservice.$inject = ['$http']; module.exports = huntservice; and controller: class huntcontroller extends \basecontroller { public function saveitems() { session::put('hunts', input::get('hunts')); return response::json(array('saved' => true), 200); } public function destroy($id) { session::forget('hunts'); } public function gethunts() { return session::get('hunts') // dont exits } } and when im trying test regular request , no ajax working. the problem here: var hunts = this.hunts; here, this.hunts not exist. note: use inspect element

Find available graphics card memory using Fortran -

i using globalmemorystatusex in order find out amount of memory in system. there similar way find amount of memory on graphics card? here piece of code : use kernel32 use ifwinty implicit none type(t_memorystatusex) :: status integer(8) :: retval status%dwlength = sizeof(status) retval = globalmemorystatusex(status) write(*,*) 'memory available =',status%ullavailphys i using intel visual fortran 2010 on windows 7 x64. thank you! since tagged question cuda tag, i'll offer cuda answer. not sure if makes sense given environment. i haven't tested on ivf, works on gfortran , pgi fortran (linux). can use fortran iso_c_binding module available in many implementations directly call routines cuda runtime api library in fortran code. 1 of routines cudamemgetinfo . here's worked example of calling gfortran (on linux): $ cat cuda_mem.f90 !================================================================================================================

linux - What does the parameter protocol stand for in socket() system call? -

http://linux.die.net/man/2/socket the protocol specifies particular protocol used socket. single protocol exists support particular socket type within given protocol family, in case protocol can specified 0. however, possible many protocols may exist, in case particular protocol must specified in manner. protocol number use specific 'communication domain' in communication take place; http://linux.die.net/man/5/protocols the field descriptions are: protocol native name protocol. example ip, tcp, or udp. when specifying second parameter either sock dgram or sock stream why again need protocol parameter? there or can many different datagram or stream protocols. typical default af_inet , af_inet6 domain(when pass 0) streaming protocol tcp, , datagram protocol udp. another interesting protocol sctp , can operate in both datagram , stream mode, can create sctp socket in either of these ways: socket(af_inet, sock_stream, ipproto_sc

performance - ksar show only one day from monthly sar report in OpenSuse -

i try graph performance ksar. in centos machines following: for in /var/log/sa/sa??; sar --legacy -a -f $i >>monthly; done ksar -input 'file:////root/monthly' that show me 30 days -- but, in opensuse ksar show me 1 day. here experiences try no success: for in /var/log/sa/sa??; sar -a -f $i >>monthly; done or cat /var/log/sa/sar?? >> monthly or scp root@acentosmachine:monthly . any idea? bug? unfortunately answer bad. from wikipadia https://en.wikipedia.org/wiki/ksar_%28unix_sar_grapher%29 known issues sometime due unknown reason multiple day graphs not being generated. so bug , luck can multiple day on centos

redirect - Struts 2 'redirectAction' changes protocol from HTTPS to HTTP -

i have java ee web application running in http mode time except authentication in https. need have https time. while testing, saw problem struts 2 : "redirectaction" (which generates 302 status return code on client side) changes protocol https http. example : <struts> <package name="suiviaffaire" namespace="/suiviaffaire" extends="webapp"> <action name="*" method="{1}" class="com.myaction"> <result name="consultredirection" type="redirectaction"> <param name="actionname">consult?idaffaire=${idaffaire}</param> <param name="parse">true</param> <param name="encode">true</param> </result> <result name="consult">/jsp/suiviaffaire/consult.jsp</result> network capture : 1) status 302

r - Accessing children elements of XML -

i have xml document require(xml) url <- "http://stats.oecd.org/restsdmx/sdmx.ashx/getdata/sna_table1/nor+can+fra+deu+gbr+usa+ita+jap.b1_ga+b1g_p119+b1g+b1gva+b1gvb_e+b1gvc+b1gvf+b1gvg_i+b1gvj+b1gvk+b1gvl+b1gvm_n+b1gvo_q+b1gvr_u+d21_d31+d21s1+d31s1+db1_ga.cxc/all?starttime=1950&endtime=2013" xml <- xmlparse(url) which trying access. i can access root element getnodeset(xml, "//message:messagegroup") but can't descend 3 parse elements dataset/series . getnodeset(xml, "//message:messagegroup/dataset/series") returns empty list. problem namespace of document? yes. problem default namespace. need give name in order able select nodes it. can this xml <- xmlparse(url) ns<-xmlnamespacedefinitions(xml, simplify=t) names(ns)[1] <- "def" #assign name "def" then can do getnodeset(xml, "//message:messagegroup/def:dataset/def:series", namespaces=ns)

datetime - MySQL query to generate a punch card dataviz -

i have database chat history has datime field, author of messsage , message. i wan´t make query returns table that, correlates weekday hours of day, counting how many messages sent, using same format github uses generate punch card graph: [day, hour, number of messages] [ [0,0,23], [0,1,20], [0,2,56], []...] i tried sql instruction, don't think working. select dayofweek(date_time) day, hour(date_time) `hour`, sum(dayofweek(date_time)) msgs chat group day(date_time) order `day` the return is: [[1,1,4734] [1,20,4503] [1,11,6510] [1,0,7058] [2,0,6518] [2,8,3913] [2,9,3885] [2,0,2305] [2,9,4471] [2,0,3703] [3,0,3315] [3,0,9600] [3,0,3910] [3,9,4956] [3,0,2692] [4,0,5225] [4,10,4815] [4,0,7667] [4,11,5249] [4,0,5121] [5,8,3148] [5,10,4947] [5,0,4109] [5,0,4775] [6,0,4970] [6,0,4342] [6,12,4488] [6,0,7191] [7,0,3790] [7,9,9294] [7,9,4749]] i don't know happening, return should have 168 lines, 7 * 24, i'm missing here? thanks! the prob