Posts

Showing posts from March, 2012

git - Check out latest master branch after current branch is merged into it by another user -

let's have single master branch , push new code feature-a branch, sub-branch master : feature-a master now have feature-a branch checked out. later different person merges feature-a master , closes feature-a branch: master (merged feature-a) feature-a master but sourcetree stuck old feature-a branch , have resort using reset --hard move latest master commit , rid of feature-a references. is there way make process more streamlined? ideally script/simple button sequence automatically move latest master commit, the key thing remember here feature-a has been merged master , feature-a has not been updated. therefore feature-a still - middle commit in second diagram. if reset --hard , you're forcing feature-a branch point master , isn't has happened in remote repository. instead want checkout master , continue working; or perhaps create new feature branch starting @ master .

java - Android native library linking against another native library from aar -

i have curious question. have aar library, contains , uses native .so library. now, want write lib, depends on library , has native part depending on native lib first lib. dependent library uses both native code , java wrappers first lib. i wonder, there way, how standard gradle dependency(with copied headers files first lib)? or have build second lib directly sources? why need this: have multiplatform lib basic functionality, android aar. lib can used in standard android app , use in multiple projects, have no native code. but in 1 app want write multiplatform shared app code, depending on lib , want have these libs separated. thanks! here workable example basic on opencv , can same first lib . prepare first lib following package jar , *.so , , exported headers (see file opencv4android/opencv/build.gradle in linked project how append headers aar). you first.aar example building of first lib . using first lib in other projects add first.aar in other

editor - How to open 32 Gigabytes .log file -

here @ work 1 of our server have created log file of 32 gigabytes. need open in order know happened, text editor tried have said file large , doesn't open. we have found alternative text editor notepad or notepad++, have limit of 5gb. we have tried software split file in small files. log splitter it's called, issue have 4gb left of space on hard drive , reason log splitter not able process split. any suggestion on how open file? thank in advance give baretail try. cite 1 of features "view files of size (> 2gb)", should handle conundrum perfectly. http://www.baremetalsoft.com/baretail/ the basic version free , can scan file @ point, create filters highlight events... in nice gui. pro version ($25) offers better search features , additional display filters. or go windows port of tail itself... http://tailforwin32.sourceforge.net/ either perfect getting last 100 lines, or so, of logfile need see issues happened.

ios - Bridging header error -- "xxx-Bridging-Header.h"file does not exit in SWIFT -

how resolve bridging header error -- "xxx-bridging-header.h"file not exit in swift check bridging header file name in following location in xcode. go project traget -> build settings -> objective-c bridging header set projectfolder/projectname-bridging-header.h

c# - Using Include() in IQueryable times out even with LazyLoading disabled -

i have 'parent' entity links other entities , when loading list, timed out because of connections, disabled lazyloading. it has been working fine, need retrieve field child entity. included entity in query .include() , takes long load. these entities. coded summary of tree relationship created other classes. public partial class coded { public int codeid { get; set; } public int maters_materid { get; set; } public int levels_levelid { get; set; } public virtual mater mater { get; set; } public virtual level level { get; set; } public virtual sublevel sublevel { get; set; } ... } public partial class mater { public int materid { get; set; } public string name { get; set; } } public partial class level { public int levelid { get; set; } public string name { get; set; } public virtual mater mater { get; set; } } when following query, lazyloading disabled, works , works fast. mygrid mg = new mygrid(); mg.codes = db.co

Why is cohere function in matplotlib (python) give answer different from mscohere function in MATLAB? -

in maltlab , pythonmatplotlib.mlab contains numerical python functions written compatability matlab commands same names. but me different results in matlab , python. has idea, why so? matlab mscohere function has parameter window set size of window, not find cohere function in matplotlib.mlab (python) cxy = mscohere(y1,y2,16,0,16) cxy = matplotlib.pyplot.cohere(y1, y2,nfft=16,noverlap=0) where y1 , y2 same in matlab , python , of length 1024 any help? here code: matlab: fs=8000; y1=zeros(1,1024); y2=zeros(1,1024); f =0:100:1900 n=0:1023 y1(n+1)=y1(n+1)+sin(2*pi*f*n/fs); if mod(f,200)==0 y2(n+1)=y2(n+1)+sin(2*pi*f*n/fs); end end end cxy = mscohere(y1,y2,16,0,16); display(cxy); cxy = 0.8300 0.0504 0.0006 0.0082 0.1828 0.2562 0.7984 0.9788 0.9884 python: fs=8000 sample=1024 frequencys=100 * np.arange(20) #print(frequencys) y1=np.zeros(sample) y2=np.zeros(sample) f in range(frequencys.siz

android - Google Map on click of back button going to blank screen -

i have implemented google map in app. problem whenever click on button going blank page. referred few links find needful . have implemented following code in java file dint find useful. public void ondestroy() { // gmap = null; super.ondestroy(); } try putting following in activity. @override public void onbackpressed() { finish(); }

python - Testing page content after redirect not working -

i writing simple unit test method tests view redirecting after receiving post. can test expected url matches response object not content. current shoddy code: def test_example_view_redirects_to_home_after_post(self): client = client() response = client.post('/example/') # test location self.assertequal(response.get('location'), "http://testserver/") # test page content expected_template = render_to_string('home.html') self.assertequal(response.content, expected_template) the test failing: assertionerror: b'' != '<html> etc etc... the view code can ultra simple @ stage: def example(request): if request.method == "post": return httpresponseredirect('/') else: return render(request, 'example.html') i new tdd , wondering why isn't working might expect to. thanks. you can use follow=true in client.post emulate browser follo

c# - Default document ASP.NET -

my login.aspx default document, when user goes on website they'll on login.aspx url won't show that, instead show: http://localhost:52294/ rather than: http://localhost:52294/login.aspx now when user logs out redirected login.aspx, when they're redirected url this http://localhost:52294/login.aspx how make when they're redirected shows http://localhost:52294/ rather additional "login.aspx" ? would possible redirect user site root rather specifying page? redirect "/". answers both questions.

ios - Draw border "within" UIViewController -

Image
i need draw visible border goes around edge of screen within view controller. tried setting view's borderwidth , bordercolor, nothing appeared on screen. how accomplish this? i tried following code , worked. self.view.layer.bordercolor = uicolor.orangecolor().cgcolor self.view.layer.borderwidth = 3

php - Many to many relation with ON DELETE CASCADE with Symfony and Doctrine -

i want simple many many relation symfony , doctrine. unidirectional one-to-many association can mapped through join table the docs indicate using yaml file configure following code: in file content.orm.yml: manytomany: comments: cascade: ["persist","remove"] ondelete: cascade options: cascade: remove: true persist: true #refresh: true #merge: true #detach: true orphanremoval: false orderby: null targetentity: comment jointable: name: content_comments joincolumns: content_id: referencedcolumnname: id inversejoincolumns: comment_id: referencedcolumnname: id unique: true this produce following sql commands: $ php app/console doctrine:schema:update --dump-sql | grep -i "comment\|content" create table comment (id int auto_increment not null, text longtext not null, content_id int not null, creation_date datetim

android - Audio in webview continues to play in background -

i have webview audio player. if start audio , press return previous activity, audio still keeps playing in background. problem occurs when api lower 11. my code: @override public void finish() { if (android.os.build.version.sdk_int >= build.version_codes.honeycomb) { webview.onpause(); } else { webview.loadurl("about:blank"); } } i tried webview.loaddata("", "text/html", "utf-8"); and webview.clearcache(true); webview.clearhistory(); webview.destroy(); but didn't work. does know how solve that? this solves problem fro api > 11 @override public void onpause() { super.onpause(); if(webview != null) { webview.onpause(); } } @override public void onresume() { super.onresume(); if (webview != null) { webview.onresume(); } } but lower versions (in case) need call onpause , onresume follows @override public void

c++ - Using virtual destructors gives error -

this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers i'm making little program school. want add virtual destructor class 'iobject', 'square' , 'rotatedsquare'. when do, gives error. not possible in case or how here? here's code: interface iobject : #ifndef iobject_h_ #define iobject_h_ #include "point.h" class iobject { public: virtual const point& getposition()const = 0; virtual double getsize()const = 0; //virtual ~iobject(); }; #endif class square #ifndef square_h_ #define square_h_ #include "iobject.h" #include "point.h" #include <iostream> class square : public iobject{ private: point position; double size; public: square(const point& position, const double size):position(position),size(size){

python - How to organise columnar data into a network table -

i have tab delimited file text file 2 columns. need find way prints values “hit” each other 1 line. for example, input looks this: a b c d b c b d c d b e d e b f c f f g f h h k l my desired output should this: a b c d b d e b c f f g h h k l my actual data file larger if makes difference. prefer in unix or python possible. can help? thanks in advance! there's no way put input file .csv ? easier parse delimiters. if wouldn't posible, try next example: from itertools import groupby operator import itemgetter open('example.txt','rb') txtfile: cleaned = [] #store file information in list of lists line in txtfile.readlines(): cleaned.append(line.split()) #group py first element of nested list elt, items in groupby(cleaned, itemgetter(0)): row = [elt] item in items: row.append(item[1]) print row hope helps you. solution

Mysql subquery for sum all columns in inner Join -

i attempting sum of 12 columns (in same table) in subquery in inner join. here link schema : sqlfiddle the query attempting use this: select `inventory`.`part_number`, `inventory`.`qty`, `inventory`.`description`, `reorder`.`reorder_point` * '1' `point`, `inventory`.`cost`, `vendor`.`name` `vendor_name`, select (sum(`saleshistory`.`sales_1_month_prior`)+sum(`saleshistory`.`sales_2_month_prior`)+sum(`saleshistory`.`sales_3_month_prior`)+sum(`saleshistory`.`sales_4_month_prior`)+sum(`saleshistory`.`sales_5_month_prior`)+sum(`saleshistory`.`sales_6_month_prior`)+sum(`saleshistory`.`sales_7_month_prior`)+sum(`saleshistory`.`sales_8_month_prior`)+sum(`saleshistory`.`sales_9_month_prior`)+sum(`saleshistory`.`sales_10_month_prior`)+sum(`saleshistory`.`sales_11_month_prior`)+sum(`saleshistory`.`sales_12_month_prior`) ttl `inventory` left join `reorder` on `inventory`.`part_number` = `reorder`.`part_number` left join `vendor` on `inventory`.`vendor` = `vendor`.`vendor_id`

c# - An unhandled exception of type 'System.InvalidCastException' -

my c# vs2015 application throws exception: system.invalidcastexception unhandled message=unable cast object of type 'system.data.entity.infrastructure.dbquery`1[adonet4linqtoentities.customer]' type 'system.data.objects.objectquery'. source=adonet4linqtoentities the error occurs in line defines query variable: var customers = c in de.customers c.orders.any(o => o.orderamount > 150) select c; string query = ((objectquery)customers).totracestring(); my assumption objectquery prompting exception. i tried string query = ((dbquery)customers).tostring() instead, works in vs2013, resulted in same exception. why vs2015 throw exceptions these query approaches? because customers not objectquery want objectquery<customer> remove projection (the select ). change to var customersquery= c in de.customers c.orders.any(o => o.orderamount > 150); string query =

Redis how to reduce lua copy-paste -

i'm writing logic redis inside lua , each of scripts have common, handy move out shared function but redis can't use lua's require statement officially can't call other redis function(see: https://stackoverflow.com/a/22599862/1812225 ) for example have snippet literally everywhere local prefix = "/" .. type if typeid prefix = prefix .. "(" .. typeid .. ")" end i'm thinking post-processing before feeding scripts redis seems over-kill... what best practice solve/reduce problem? updated: local registrykey = "/counters/set-" .. type local updatedkey = "/counters/updated/set-" .. type if typeid redis.call("sadd", updatedkey, name .. ":" .. typeid) redis.call("sadd", registrykey, name .. ":" .. typeid) else redis.call("sadd", updatedkey, name) redis.call("sadd", registrykey, name) end is code sample , can't trivially

C++ Linux Google Protobuf + boost::asio Cannot Parse -

i trying send google protobuf message on boost::asio socket via tcp. recognize tcp streaming protocol , performing length-prefixing on messages before go through socket. have code working, appears work of time, though i'm repeating same calls , not changing environment. on occasion receive following error: [libprotobuf error google/protobuf/message_lite.cc:123] can't parse message of type "xxx" because missing required fields: name, applicationtype, messagetype the reason easy understand, cannot single out why occurs , parses fine majority of time. easy duplicate error having single client talking server , restarting processes. below socket code snippets. const int tcp_header_size = 8; sender: bool write(const google::protobuf::messagelite& proto) { char header[tcp_header_size]; int size = proto.bytesize(); char data[tcp_header_size + size]; sprintf(data, "%i", size); proto.serializetoarray(data+tcp_header_size, si

c# - AllowsTransparency and TabbedThumbnail issue in Windows 10 -

Image
i created application uses image preview in taskbar. done using glasswindow extended version of windowsapicodepack. window styled using allowstransparency, windowsstyle , using windowchrome. now noticed after updating windows 10 behavior of these components changed. border shown in preview in taskbar. when allowstransparency , windowchrome removed, behavior correct again, window ugly. it looks window generated in window, wich shown in taskbar. does have idea how style window without adding border in preview taskbar?

amazon web services - Dynamodb query error - Query key condition not supported -

i trying query dynamodb table feed_guid , status_id = 1. returns query key condition not supported error. please find table schema , query. $result =$dynamodbclient->createtable(array( 'tablename' => 'feed', 'attributedefinitions' => array( array('attributename' => 'user_id', 'attributetype' => 's'), array('attributename' => 'feed_guid', 'attributetype' => 's'), array('attributename' => 'status_id', 'attributetype' => 'n'), ), 'keyschema' => array( array('attributename' => 'feed_guid', 'keytype' => 'hash'), ), 'globalsecondaryindexes' => array( array( 'indexname' => 'statusindex',

SQL Server : counter for insert,update,delete & select queries -

i newbie sql server. in mysql find count of insert, update, delete, select queries have below queries: select mysql> show global status '%com_select%'; +-------------+-----+ | variable_name | value | +-------------+-----+ | com_select | 1 | +-------------+-----+ 1 row in set (0.00 sec) insert mysql> show global status '%com_insert%'; +-----------------+-----+ | variable_name | value | +-----------------+-----+ | com_insert | 0 | | com_insert_select | 0 | +-----------------+-----+ 2 rows in set (0.00 sec) update mysql> show global status '%com_update%'; +----------------+-----+ | variable_name | value | +----------------+-----+ | com_update | 0 | | com_update_multi | 0 | +----------------+-----+ 2 rows in set (0.00 sec) delete mysql> show global status '%com_delete%'; +----------------+-----+ | variable_name | value | +----------------+-----+ | com_delete | 0 | | com_d

jsf - @FacesConverter(forClass = Clazz.class) and p:calendar -

basic joda time converter (the code absolutely superfluous context of thread) : @named @applicationscoped @facesconverter(forclass = datetime.class) public class datetimeconverter implements converter { @override public object getasobject(facescontext context, uicomponent component, string value) { if (value == null || value.isempty()) { return null; } try { return datetimeformat.forpattern("dd-mmm-yyyy hh:mm:ss aa z").parsedatetime(value).withzone(datetimezone.utc); } catch (illegalargumentexception | unsupportedoperationexception e) { throw new converterexception(new facesmessage(facesmessage.severity_error, null, "message"), e); } } @override public string getasstring(facescontext context, uicomponent component, object value) { if (value == null) { return ""; } if (!(value instanceof datetime)) { throw

C# -> If ... Throw Warning ... Else if... Throw Error.. Else.. Return -

iv'e looked in few sites , seems have not found answer let's iv'e got struct "mystruct" public struct mystruct { private int value; private mystruct(int i) { value = i; } public static implicit operator mystruct(int i) { return new mystruct(i); } public static implicit operator int (mystruct ms) { return ms.value; } public static explicit operator uint (mystruct i) { return convert.touint32(i); } } and want on explicit operator that if (i< 40) throw compiler warning else if (i > 50) throw compiler error else -> return value i know can use throw exception, want warning/error part this: public class program { static void main() { mystruct ms1 = 30; mystruct ms2 = 60; console.writeline((uint)ms1);//so throw warning console.writeline((uint)ms2);//so throw error console.readkey(); } } if i'm trying that:

python 2.7 - Why is day of pandas date_range not what I specified? -

why first date not 4/19/1965? why day 30 instead of 19? dates = pd.date_range('1965-04-19', freq='6m', periods=3) dates[0] timestamp('1965-04-30 00:00:00', offset='6m') it looks default behavior freq='m' monthend() , so dates = pd.date_range('1965-04-19', periods=3, freq='6m') dates datetimeindex(['1965-04-30', '1965-10-31', '1966-04-30'], dtype='datetime64[ns]', freq='6m', tz=none) this can changed setting freq = pd.tseries.offsets.dateoffset(months=6) . dates = pd.date_range('1965-04-19', periods=3, freq=pd.tseries.offsets.dateoffset(months=6)) dates datetimeindex(['1965-04-19', '1965-10-19', '1966-04-19'], dtype='datetime64[ns]', freq='<dateoffset: kwds={'months': 6}>', tz=none)

javascript - Angular JS dynamically populate options for Select fields -

i have problem can't figure out in angular (i new angular not js). essentially have html template gets repeated loops through array of results returned post request. works fine, except have select field repeated each time loop goes round. the template shows adverts, , each advert has date created. trying achieve , have done js , ejs before below: var today = moment(); var ad_date = moment(ad.ad_date); var diff = today.diff(ad_date,'days'); var lowend = 1; var highend = 14 - diff; var arr = []; while (lowend <= highend) { arr.push(lowend++); } and in ejs had <select class="form-control" name="offer_time"> <% (var d in arr) { %> <option value="<%= arr[d] %>"><%= arr[d] %></option> <% } %> </select>

amazon web services - Connection to AWS timed out using Python boto -

i ran python program in cygwin connect aws, failed consistently being timed out. connection aws using aws cli in cygwin works. if run same python code in windows, works. have checked connection credentials same all. here error msg: traceback (most recent call last): file "<stdin>", line 1, in <module> file "/usr/lib/python2.7/site-packages/boto-2.38.0-py2.7.egg/boto/ec2/connection.py", line 585, in get_all_instances max_results=max_results) file "/usr/lib/python2.7/site-packages/boto-2.38.0-py2.7.egg/boto/ec2/connection.py", line 681, in get_all_reservations [('item', reservation)], verb='post') file "/usr/lib/python2.7/site-packages/boto-2.38.0-py2.7.egg/boto/connection.py", line 1170, in get_list response = self.make_request(action, params, path, verb) file "/usr/lib/python2.7/site-packages/boto-2.38.0-py2.7.egg/boto/connection.py", line 1116, in make_request

html - Double Entry on Select? -

i have 2 select tags form someone's birthday, dob month , dob day. problem (yes sometimes) duplicated dob in database. these selects should give me "july 23" dob in instances "july 23 july 23". idea how happening? <select name="dobmonth" class="form-control"> <option value="">june 23</option> <option value="january">january</option> <option value="february">february</option> <option value="march">march</option> <option value="april">april</option> <option value="may">may</option> <option value="june">june</option> <option value="july">july</option> <option value="august">august</option> <option value="september">september</option> <option value="october"&g

asp.net mvc 4 - Parameter is null in controller when using $routeProvider in angularjs -

routing .when('/student/:id', { templateurl: 'student/index', controller: 'studenteditctrl' }) my link contains <a class="btn btn-primary" ng-href="#/student/@v.id">edit</a> my angular controller angular.module('newapp') .controller('studenteditctrl', ['$scope', function ($scope, $stateparams) { $scope.istabactive = true; $scope.id = $stateparams.id; alert("studenteditctrl"); }]); i have used $routeparams instead $stateparams. my mvc controller public actionresult index(int? id) { student st = new student(); if (id != null) st = srepository.students.firstordefault(c => c.id == id); return view(st); } in asp.net mvc controller id null, i think should change link to: <a class="btn btn-primary" ng-href="#/student/{{id}}"&

ZipArchive::addEmptyDir is not creating empty dir in ubuntu 3.15 & PHP 5.3.10 -

i'm trying add empty director archive, using following code in ubuntu3.15 running php 5.3.10. creating zip without empty directory in it. idea what's wrong in code? $zip = new ziparchive(); $filename = "/var/www/enteliweb/website/public/test.zip"; if ($zip->open($filename, ziparchive::create)!==true) { exit("cannot open <$filename>\n"); } if($zip->addemptydir('newdirectory')) { echo 'created new root directory'; } else { echo 'could not create directory'; } $zip->close();

Running Tomcat causes java.rmi.ServerException in the unrelated project -

i have java non-web application programmatically starts jetty server give api access it. communication between them done via rmi. works fine until start tomcat has no relation project. if tomcat running, getting following exception while trying start application: java.rmi.serverexception: remoteexception occurred in server thread; nested exception is: java.rmi.unmarshalexception: error unmarshalling arguments; nested exception is: java.lang.classnotfoundexception: ua.cn.stu.datalink.rmi.acmremoteservice (no security manager: rmi class loader disabled) @ sun.rmi.server.unicastserverref.olddispatch(unicastserverref.java:420) @ sun.rmi.server.unicastserverref.dispatch(unicastserverref.java:268) @ sun.rmi.transport.transport$1.run(transport.java:200) @ sun.rmi.transport.transport$1.run(transport.java:197) @ java.security.accesscontroller.doprivileged(native method) @ sun.rmi.transport.transport.servicecall(transport.java:196) @ sun.rmi.transport.tc

css3 - Responsive design for elements -

how can make element class properties display inline-block laptops , desktops , list tablets , mobiles? whenever shrink width of browser, ipad design elements not fit properly. .properties { display: inline-block; } @media screen , (min-device-width: 1200px) , (max-device-width: 1600px) , (-webkit-min-device-pixel-ratio: 1) { .properties { display: inline-block; } .propertybutton { display: inline-block; } } @media (max-width: 900px) { .properties { display: list-item; list-style-type: none; } .propertybutton { margin-top: -2%; margin-left: 30%; } } <div class="propertywrapper" style="width:100%;"> <div style="float:right"> <span ng-click="addproperty()" class="button buttonprimary pull-right">add property</span> </div> <div class="properties"> <label>name</label> <input type=&

angularjs - dynamically name an angular controller -

i trying name angular controller dynamically, so: app.controller(dynamic_name_constructed_here, ...); right now, when run program, error: error: [ng:areq] argument dynamic_name_constructed_here not function, got undefined is constructing name way constructing allowed? if not, explanation why doesn't work awesome! if so, how can eliminate error? thanks in advance!

ios - Xcode UI tests - adding tests to test classes -

is there way add tests existing ui test classes in xcode? have looked @ quick , there ways add new tests classes , targets not tests pre-existing test classes. creating new methods of class did not either. thanks if test class extends xctestcase , in testing target, method starts test , takes no arguments executed test.

c++ - ifstream::read keeps returning incorrect value -

i working way through teaching myself how work files in c++, , having bit of difficulty extracting binary information files. my code: std::string targetfile = "simplehashingfile.txt"; const char* filename = targetfile.c_str(); std::ifstream file; file.open( filename, std::ios::binary | std::ios::in ); file.seekg(0, std::ios::end); // go end of file std::streamsize size = file.tellg(); // size of file std::vector<char> buffer(size); // create vector of file size bytes file.read(buffer.data(), size); // read file buffer vector int totalread = file.gcount(); // check data read std::cout<<"total read: " << totalread << std::endl; // check buffer: std::cout<<"from buffer vector: "<<std::endl; (int i=0; i<size; i++){ std::cout << buffer[i] << std::endl; } std::cout<<"\n\n"; the "simplehashingfile.txt" file contains 50 bytes of normal text. size correctly

ruby on rails - Using namespaced models in association in fixtures -

in rails 4.1 app have model called teacher , model called student . each student belongs_to single teacher . let's few days later have 100 more models, decide cleaning via namespaces. put teacher , student models inside folder named human . put classes inside modules, it's human::teacher , human::student . great! can open rails console , play around models before. (no changes in db.) but sure, run tests... i have following fixture files haven't touched yet: # teachers.yml english_teacher: name: john doe spanish_teacher: name: juan pueblo # students.yml only_student: name: annie teacher: english_teacher i run tests: table students has no column named teacher but of course not, it's teacher_id , fixtures supposed know that. right? i guess if put fixture files under test/fixtures/human folder, should work?

Stuck trying to parse XML using AJAX and Javascript with XMLHttpRequest -

re-edit of innerhtml show how many div's included in finished code. re-edit of start function not work , i'm not sure @ point broke it. var fname = name; function load() { var x = new xmlhttprequest(); x.open ("get", "file1.xml",true); x.onreadystatechange = handleserverinput; x.send(); xml =x.responsexml; fname = xml.getelementsbytagname("name")[0]; name = fname.childnodes[0].data; function handleserverinput() { if (x.readystate == 4 && x.status == 200) { function displaydiv() { var html = ""; html+= " <div id = \"displayouter\">"; html+= " <div id = \"displayinner\">"; html+= " <p id = \"fname\">"; html+= " </p>"; html+= " </div>"; html+= " <div id = \"displayinner2\">"; ht

mysql - Selecting Max from a nullable int field with LINQ -

i trying find biggest ordernumber(int?) in mysql database linq: int maxordernumber = context.datacontext.purchaseorders.where(r=> (r.ordernumber.hasvalue)).max(r=>r.ordernumber); but says: cannot implicitly convert type 'int?' 'int'. missing cast? in understanding, first part of expression filters field those, has value. you pretty close, should it: int maxordernumber = context.datacontext.purchaseorders.where(r=> (r.ordernumber.hasvalue)).max(r=>r.ordernumber.value);

asp.net mvc - mvc-pdf not opening in mobile browsers -

i using object render pdf works fine on desktop browsers on mobile browsers not opening pdf file,it says pdf reader not supported on device.i have tried using embed didn't worked out. view <object type="application/pdf" data="@url.content(model.reporturl)" width="100%" height="100%">pdf reader not supported device. </object> //tried these @*<object type="application/pdf" data="@url.content(model.reporturl)" width="100%" height="100%">pdf reader not supported device. <a href="@url.content(model.reporturl)"></a></object>*@ @*<object type="application/pdf" data="@url.content(model.reporturl)" width="100%" height="100%">pdf reader not supported device.

javascript - AJAX query with php and mysql -

$(document).ready(function(){ $('input.phonebook_user').phonebook_user({ name: 'phonebook_user', remote:'search.php?type=phonebook&key=%query%', limit : 10 }); }); and <form method="post"> <table border="0"> <tr> <td><input type="text" name="phonebook_name" placeholder="phonebook name" required /></td> </tr> <tr> <td><input type="text" name="phonebook_user" class="typeahead tt-query" autocomplete="off" spellcheck="false" placeholder="type username manage phonebook"></td> </tr> <tr> <td><button type="submit" name="com_btn-phbook-create">create phonebook</button></td> </tr> </table> </form> and $type=$_get['type']; // user or company if($type=="user") {

c++ - Elegant way for "if(T t = ...) { } else return t;"? -

is there better way "idiom"? if(state s = loadsomething()) { } else return s; in other words, want something, may return error (with message) or success state, , if there error want return it. can become repetitive, want shorten it. example if(state s = loadfoobar(&loadpointer, &results)) { } else return s; if(state s = loadbaz(&loadpointer, &results)) { } else return s; if(state s = loadbuz(&loadpointer, &results)) { } else return s; this must not use exceptions favor otherwise (unsuitable build). write little class booleannegator<state> stores value, , negates boolean evaluation. want avoid doing ad-hoc, , prefer boost/standard solution. you do: for (state s = loadsomething(); !s; ) return s; but not sure if more elegant, , less readable...

How to remove file path viewer from eclipse editor view -

Image
i looked online, unable find answer. wondering how remove bar below list of files tells current position of file in project. first picture shows location of bar , second shows close of bar. in advance. see image this known breadcumbs in eclipse. couple of ways disable them. right click on breadcrumb-> hide breadcrumb option ->click on hide. on the action bar. there button called "toggle breadcrumbs" disable if enabled. click on disable it. hope helps. best regards, saurav

javascript - JSON information is looped once -

so problem i'm loading json files url html , it's working besides fact shows information twice.. know why case? here's jquery/javascript code use load json html. $.ajax({ url: 'http://datatank4.gent.be//bevolking/totaalaantalinwoners.json', datatype: 'json', type: 'get', cache: false, success: function(data) { = 0; var access; var url; $(data).each(function(index, value) { wijkname = value.wijk; year = value.year_2010; i++; $('#pagewrap2').append( '<div class="dataond col col-xxs-12 col-md-3"> <h2> ' + wijkname + '</h2><p>' + year + '<div id="maps">' + "<iframe width='100%' height='100%' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='https://maps.google.com/maps?&a

sql server - best practice for large remote tsql query -

i have rather large query builds 3 tables , union all's them together. of tables used remote, output used locally. would see performance gain creating view on remote server union query, selecting that, rather have lot of remote calls local query?

Angularjs - Calling only one of many subcontrollers/ multiple controllers -

i have index page wherein define 2 controllers. want call 1 main controller (should rendered always) , other called specific sub url calls. should make 1 nested within another, or can keep them independent of each other? don't have access change routes or anything, controller. right when use template (html) mentioned, calls/renders both controllers, though url /index only /index/subpage, want both controllers rendering. /index /index/subpage html: <div ng-controller="mainctl" ng-init=initmain()> <p> within ctller2 {{results}} </p> </div> <div ng-controller="ctller2"> <!-- should not displayed unless /subpage/mainurl rendering --> <p> within ctller2 {{results}} </p> </div> js: app.controller('mainctl', ['$scope', '$http', '$location', function ($scope, $http, $location) { $http.get('xx/mainurl').then(function(data) {

jsf 2 - Interceptors don't work with JSF managed beans? -

i decide try interceptors first interceptor binding annotation is @inherited @interceptorbinding @target({type}) @retention(runtime) public @interface withlog { // no parameters required } and interceptor class is @interceptor @withlog public class loginterceptor { @aroundinvoke private object logmethod(invocationcontext context) throws exception { system.out.println("method " + context.getmethod().getname() + " of class " + context.gettarget().getclass().getname() + " called."); return context.proceed(); } @postconstruct private void construct(invocationcontext context) { system.out.println("@postconstruct of " + context.getmethod().getdeclaringclass().getname() + " started."); } } so, want add simple logging jsf managed bean: @managedbean(name = "departmentrootmb") @viewscoped @withlog public class departmentrootmb implements serializable { long serialversionu

javascript - Locating content on page with nested(?) anchor tags? -

asume website domain.com, store page, domain.com/store adding id = "itemid" every item can let users visit item directly by: domain.com/store#itemid usual anchor behavior. however, need little more complex. assume item hierarchy follows: <div id="item1> <div class="images"></div> </div> i want user directly reach "images" box of given item using anchor-like addressing. such as domain.com/store#itemid.images what's best approach this? something should work, split hash 2 parts: id , class use using javascript or jquery find element , scroll view. hash = window.location.hash.split('.') document.getelementbyid(hash[0]).getelementsbyclassname(hash[1])[0].scrollintoview(true);

json - Node.js, Express, Mongodb using monk database empty -

i having problem while following tutorial in node.js using mongodb database monk. when run database command in mongo console can see database nodetest1 has 3 entries, when doing returns nothing. router.get('/', function(req, res, next) { var db = req.db; var collection = db.get('usercollection'); collection.find({},{},function(e,docs){ res.send(docs); }); }); and here print mongo console when use find method. > db.usercollection.find().pretty() { "_id" : objectid("55b17a551efb190c06c38d31"), "username" : "testuser1", "email" : "testuser1@testdomain.com" } { "_id" : objectid("55b17a5f1efb190c06c38d32"), "username" : "testuser2", "email" : "testuser2@testdomain.com" } { "_id" : objectid("55b17a5f1efb190c06c38d33"), "username"

javascript - How can I set a variable inside a loop without messing up the loop? -

i'm quite new this, sorry if daft question. have searched answer can't find close enough solution adapt. part of code: for (var k = 0; k < (pointstoshow.length-1); k++){ // k looping nicely @ point u = pointstoshow[k] //k not looping @ point, uses last number allpoints[u].setmap(map); } i trying access numbers inside array (pointstoshow) use number stored reference search array (allpoints), can't work. if set alert show pointstoshow[k] works fine, it's once try , attach them variable doesn't work. i've been working on of today no joy, suggestions appreciated. thanks you missed semi-colon , need declare u. not entirely sure needs happen here shot in dark. var u; for(var k = 0; k < (pointstoshow.length-1); k++){ u = pointstoshow[k]; allpoints[u].setmap(map); }

validation - In CakePHP3 how do I create a custom model rule which validates that a time is after another time in the same table? -

columns (both datatype time): start end end cannot before start. $validator ->requirepresence('end', 'create') ->notempty('end') ->add('end', [ 'time' => [ 'rule' => 'time', 'message' => 'end can accept times.' ], 'dependency' => [ 'rule' => [$this, 'endbeforestart'], 'message' => 'end can not before start.' ], ]); if put request contains end, model need query existing record compare against start. if put contains both need validate against intended new parameter. how cakephp3 this? private function endbeforestart($fieldvaluetobevalidated, $datarelatedtothevalidationprocess) { //what

node.js - Trouble uploading a file (Express/Node, Multer) -

hi using jade generate html , have form on page: p upload new schedule #uploadnew form(id = "form1", action="/upload", method="post", enctype="multipart/form-data") input(type="file", id="control") br input(type="submit" value="upload" name="submit") when select file , try upload, connection times out. doing wrong? using multer middleware upload well: back in app.js: var multer = require('multer'); var upload = multer({dest: './uploads'}); ... app.post('/upload', upload.single('submit'), function(req, res) { if (done == true) { console.log(req.files); res.end("file uploaded"); } }); add name field input box of "file" type: p upload new schedule #uploadnew form(id = "form1", action="/upload", method="post", enctyp