Posts

Showing posts from June, 2012

c# - how can i populate the Text Items which is of date type to Textbox text of version asp.net 4.5 where the textmode is set to date type -

how can populate text items of date type textbox text of version asp.net 4.5 textmode set date type. here sample, txtenddate of date type (textmode=date) , taking column enddate database of datetime type sql server , trying populate textbox txtenddate of date type (textmode=date) txtenddate.text = dtfilter.rows[0]["enddate"].tostring();

security - How to make a password uncrackable for one username "System" -

i working on old website , trying make reach today's web standards. website contains many database tables on 1 million rows in of them. website not have user system: deleted user database table today. had 10k users, gone now. because of insecurity , way of information stored - yes ocd kicked in!), , making new table users , store passwords in right way! not using md5() ! data added website before.. create user account called "system". default user show old data added website. how can make account inaccessible!? should putting password in database no 1 can crack (cracking should hard anyways because of password_hash() function)! should put value shorter password_hash() function.. make account inaccessible on website? drawbacks of why should not this? or should make password complicated point won't remember it? one last thing, consider answering before click button. there few options: add active column database you check column on login. way ca

javascript - Iterate Constructor Chain Up -

assuming have this: function a() {} function b() {} b.prototype = object.create(a.prototype); function c() {} c.prototype = object.create(b.prototype); var inst = new c(); i can inst instanceof c == true, inst instanceof b == true, instanceof c == true. but how "iterate" constructor functions starting instance of c() it'd return function c(), function b(), function a() use instantiate instance. you can iterate prototypes doing for (var o=inst; o!=null; o=object.getprototypeof(o)) console.log(o); // {} // c.prototype // b.prototype // a.prototype // object.prototype however, iterate prototype chain. there no such thing "constructor chain". if want access constructors, need set .constructor property on prototypes appropriately when inheriting: function a() {} function b() {} b.prototype = object.create(a.prototype); b.prototype.constructor = b; function c() {} c.prototype = object.create(b.prototype); c.prototype.constructor = c

javascript - getting message condition is always true -

i'm getting message resharper condition true following code if (filters == "answers" || "solution") { } what's happening here in code? if (filters == "answers" || "solution") { } in above code "solution" true so, change if (filters == "answers" || filters =="solution") { } example if("i") { } above true always. so, in code second condition returns true as per boolean or , [anything true] true you have 2 predicates , truth table i/p o/p true false true false ture true false false false true true true in code, never condition #1 , #3 so, true so code true

entity framework - Creating Asp.net Identity user in Seed method of Db Initializer -

i have created data layer ef 6 code first , populating db through seed method of evinitializer class inheriting dropcreatedatabaseifmodelchanges . implementation of seed method protected override void seed(evcontext context) { //add other entities using context methods applicationusermanager manager = new applicationusermanager(new userstore<applicationuser>(context)); var user = new applicationuser { email = "admin@myemail.com" ,username = "admin@myemail.com"}; var result = await manager.createasync(user, "temp_123");//this line gives error. await cannot used in non- async method , cannot make seed async } my question how can add user in seed method using usermanager class. when change var result = awit manager.createasync(user, "temp_123"); to var result = manager.createasync(user, "temp_123").result; //or .wait application hangs indefinitely in asp.net-identity-2 usermanager has non async m

javascript - Meteor template doesn't re-render even though its helper is called? -

ive got template on front end: if tournament .tournament if round each round ul(class='round#{currentround} of#{rounds}') each match li each participant if winner .participant.winner a(href='#') span.participant-title #{displayname} span.participant-number #{rank} span.participant-id #{id} span.participant-status #{status} span.participant-round #{thisround} span.

ios - Capture the attribute strongly in the block, am converting the app non arc to arc -

this question has answer here: capturing self in block lead retain cycle 5 answers i have declared variables subclass of uiviewextention . converting project non-arc arc @interface sectioniconview : uiviewextention @property (nonatomic,weak) uiimageview *sectionportraitimageview; @property (nonatomic,weak) uiimageview *sectionlandscapeimageview; i have declared property weak, shows error in .m file i.e., assigning retained object weak variable;object released after assignment. i have changed attribute strong.. @property (nonatomic,strong) uiimageview *sectionportraitimageview; then shows error is: capture in block lead retain cycle. how avoid error? please see this apple documentation on how avoid capturing "self" in block. here's key part: xyzblockkeeper * __weak weakself = self; self.block = ^{ [weakself dos

java - Filter difference between 2 images? -

i trying filter out difference between 2 images (screenshots). unfortunately have absolutely no experience in java , images , have no real idea for. are there ready-to-use classes that? what expecting like: image imga = new (pathtoa); // image instance 500kb image imgb = new (pathtob); // image instance 500kb image imgc = imagefilter.filterdifference(imga, imgb); // difference between imga , imgb , therefore instance 20kb edit: example: anyway, mean difference visual difference between images (screenshots). if have 1 screenshot 5 icons in folder , screenshot 1 icon more, want imgc show new icon. edit 2: clarification: want difference between 2 screenshots in new image. edit 3: some kind of code 1 (code not work): private bufferedimage getimagedifference(bufferedimage img1, bufferedimage img2) { if (img1.getwidth() == img2.getwidth() && img1.getheight() == img2.getheight()) { bufferedimage img3 = new bufferedimage(img1.getheight(), img1.

c# - The remote server returned an error 405 method not allowed -

i trying move mails inbox deleted folder. when run program getting above error message. please solve this. here code string mailboxuri = "url//"; string username = "username"; string password = "password"; string domain = "domain name"; console.writeline("connecting exchange server...."); try { networkcredential credential = new networkcredential(username, password, domain); exchangeclient client = new exchangeclient(mailboxuri, credential); exchangemailboxinfo mailboxinfo = client.getmailboxinfo(); // list messages inbox folder console.writeline("listing messages inbox...."); exchangemessageinfocollection msginfocoll = client.listmessages(mailboxinfo.inboxuri); foreach (exchangemessageinfo msginfo in msginfocoll) { // move message "deleted" folder

ruby on rails - Multiple form for the same model -

i have 2 models named station , stream. station has_many streams. have form streams @ streams/new page , on submission sets station_id current_user.station_id (i have model user has_many stations). need allow user click button "add more streams" on form, duplicate existing streams form , show 1 submit button. when user submits form, creates multiple entries in streams table station_id set @ current_user.station_id. user never create station. created admin , allocated particular users. how achieve this? you need use accepts_nested_attributes_for method in model. can find great example of how here: http://railscasts.com/episodes/196-nested-model-form-revised?view=similar you can using cocoon gem: https://github.com/nathanvda/cocoon

android - How to pass HttpPost( URI ) with Volley Request ? -

how pass httppost( uri ) stringrequest using volley ? need pass uri, request, , httppost localhttppost = new httppost(" uri "); how using volley request ? well, first of need requestqueue. requestqueue = volley.newrequestqueue(context); then, having requestqueue defined in place on code (a global variable) work defining request. example stringrequest. notice method.post in code. stringrequest req = new stringrequest(method.post, getbaseurl() + post_opportunities_url, requestlistener, new response.errorlistener(){ @override public void onerrorresponse(volleyerror volleyerror) { //manage error } }); and add request de queue requestqueue.add(req);

html - Chrome login auto dropdown is too big -

Image
i have strange problem google chrome's autocomplete on login page on website. when there many logins, login/emails dropdown big, overlaps windows start menu. i don't want turn autocomplete off. if there way make smaller or scrollbar. possible? i searching web solution , strangely haven't found similar question. questions disabling autocompletes or autocompletion of search results. nothing start-menu-overlapping big logins autocomplete list. edit no custom javascript widget used here. default chrome's autocomplete mechanism. set scrol bar... .dropdown{ height: 60px; max-height: 60px; overflow-y: scroll; }

java - How exactly does the instanceof method work? and why is it not working in my code shown below? -

this question has answer here: instanceof - incompatible conditional operand types 3 answers so have defined main class shown below , have defined words class , sentence class. note program should return false when ran. however, getting "incompatible conditional operand types words , sentence" error when run it. isn't how instanceof operator used or confused? how can program modified run without crashing? public class main{ public static void main (string[] args){ words example = new words("heyo"); sentence ex = new sentence("wats dog"); system.out.println(example instanceof sentence); } } if variable running instanceof on can't of same type class supply operator, code won't compile. since example of type words , not sub-class or super-class of sentence , instanceof cannot applied on example , se

java - Best way to reduce risk of server-side report taking up too much memory -

we have service, tomcat-spring-jpa running on top of mysql. a part of our service reports function. have different clients of different sizes , therefor, different amounts of data. when run reports, select dates , various other parameters, send them server, , server creates pdf's, xls sheets etc. we concerned if select date periods might take memory, made estimations , came "max time period" reports. this not optimal number of reasons, have more time, we're looking @ alternatives. the best i've come far have "max number of rows" instead, i.e. count(*) of query params , if data, tell user have reduce date period. i have couple of concerns though, , hoping feedback: won't count(*) take quite memory? is there better way haven't thought about? (i don't want paging or similar, if they're running report they'd expect data) count(*) won't take significant amount of memory. i define time ranges reduce amoun

python - How to convert text like \u041b\u044e\u0431\u0438 to normal text while data download? -

when bulk download gae data written in russian, text u'\u041b\u044e\u0431\u0438\u043c\u0430\u044f \u0430\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0443\u043b\u0430\u0441\u044c! \u0412 \u0440\u0435\u0441\u0442\u043e\u0440\u0430\u043d\u0430\u0445 \u0415\u0432\u0440\u0430\u0437\u0438\u044f ""3 \u0440\u043e\u043b\u043b\u0430 \u043f\u043e \u0446\u0435\u043d\u0435 1""! \u0421 9 \u043f\u043e 12 \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f! \u0422\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438 4 \u0434\u043d\u044f! \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 evrasia.spb.ru, 88005050145 \u0438 008' the following bulkloader used: transformers: - kind: mykind connector: csv connector_options: property_map: - property: texts external_name: texts what should decoded? upd. i've tried following python_preamble: - import: codecs ... - property: texts e

angularjs - required on custom directive select -

i have created own select dropdown using unordered list , ng-repeat. problem directive not work normal select/input/textarea can use required when using in html form. so how implement option required/ng-required (as directive) validation on custom directive? should use own implementation of validation? dropdown.html <!-- displayed text on select --> <div class="title" ng-class="{'placeholder': !hasselected(), 'selected': isopened}" ng-mousedown="openselect()"> {{gettitle()}} <div class="icon" ng-class="{'active': isopened}"> <i class="fa fa-caret-down"></i> </div> </div> <!-- displayed options when opening select dropdown --> <div class="options"> <ul ng-show="isopened"> <!-- first option shown when empty option required --> <li ng-click="select(n

php - Algorithm to calculate referenced formulas only once -

i looking nice algorithm solve following problem. i have following listing of variables , formulas (result of var sum of formulas): var1, result=10 - 5+5=10 var2, result=15 - var1+5 var3, result=30 - var1+var2+5 now looking nice way calculate references. if changing var1 , result 15 now, have calculate referenced var1. first came across var2 , recalc var2, if result of var2 changed have recalc referenced formulas var2. therefore recalc var3 twice (var2 changed, var1 changed)... is there solution not calc var3 twice in scenario? thx! yes, can ensure recalculate each variable once (at most), using fact there no cyclic dependencies (no way variable x needs y in order calculated, , in same time y needs x ). this done modeling problem graph , variables vertices, , "needed" relation directed edge. (so, if variable x "needs" variable y calculated, there edge (y,x) ). now, since no-cyclic dependency, directed acyclic graph , can topol

python - Trying to start up django app on Heroku: Application Error -

i'm using tutorial trying launch django web app on heroku. get application error: error occurred in application , page not served. please try again in few moments. if application owner, check logs details. heroku logs: 2014-12-16t09:28:40.524655+00:00 heroku[run.3259]: starting process command `python manage.py createsuperuser` 2014-12-16t09:28:40.780639+00:00 heroku[run.3259]: state changed starting 2014-12-16t09:28:56.130238+00:00 heroku[run.3259]: process exited status 0 2014-12-16t09:28:56.139256+00:00 heroku[run.3259]: state changed complete 2014-12-16t09:29:06.983439+00:00 heroku[router]: at=error code=h10 desc="app crashed" method=get path="/" host=shielded-reef-1163.herokuapp.com request_id=36ca5f9e-ed07-4b6e-96fb-767d70962e84 fwd="71.198.214.186" dyno= connect= service= status=503 bytes= 2014-12-16t09:29:08.063637+00:00 heroku[router]: at=error code=h10 desc="app crashed" method=get path="/favicon.ico" host=shi

swift - NSPredicate Filtered childs in array -

good day, i'm using new language apple swift , using nsarray: [ { "section" : "title1", "items" : [ {"nr" : "101"}, {"nr" : "201"}, {"nr" : "301"}, {"nr" : "401"} ] }, { "section" : "title2", "items" : [ {"nr" : "102"}, {"nr" : "202"}, {"nr" : "302"} ] }, { "section" : "title3", "items" : [ {"nr" : "1102"}, {"nr" : "2102"}, {"nr" : "3102"} ] } ] i want use search, , display content found as understand have use "filteredarrayusingpredicate" ,

java - The method decodeByteArray(byte[], int, int) in the type BitmapFactory is not applicable for the arguments (byte[][], int, int) -

i put in asynctask got error. the method decodebytearray(byte[], int, int) in type bitmapfactory not applicable arguments (byte[][], int, int) private class saveimagetask extends asynctask<byte[], void, void>{ @override protected void doinbackground(byte[]... params) { // todo auto-generated method stub bitmap bitmappicture = bitmapfactory.decodebytearray(params, 0,params.length); return null; } } } i think need: bitmap bitmappicture = bitmapfactory.decodebytearray(params[0], 0,params[0].length); params array , therefore need specify index.

java - QueryDSL sorting not working with Spring Data -

i using jpasort spring data commons 1.9.1 , spring jpa 1.7.1. need use querydsl because jpa not allow defining sort null values . this repository public interface datasheetrepository extends jparepository<datasheet, long>, jpaspecificationexecutor<datasheet> i doing in controller: page<datasheet> page = m_datasheetrepository.findall( new pagerequest( pagenumber, pagesize, createsortfordatasheets() ) ); this had jpa: private sort createsortfordatasheets() { // first sort on component type name, on subtype name return new jpasort( jpasort.path( datasheet_.componentsubtype ).dot( componentsubtype_.componenttype ).dot( componenttype_.name ) ) .and( new jpasort( jpasort.path( datasheet_.componentsubtype ).dot( componentsubtype_.name ) ) ); } this have changed querydsl: private sort createsortfordatasheets() { return new qsort( new orderspecifier<>( order.asc, qdatasheet.datasheet.componentsubtype.componenttype.name,ordersp

Is there any algorithm for finding a shape from a point? -

is there algorithm finding shape point? consider if have list of polygon, got 2 shape: shape 1: x , y [10,10,] [10,40,] [40,10,] [40,40,] shape 2: x , y [40,40,] [40,80,] [80,40,] [120,120,] if have point lets point 1 x , y [119,199] that means choose shape 2, there algorithm determine shape point? there many different data structures performing kind of query - tree structures represent polygons in spatial hierarchy of sort. personal favourite r-tree, has very implementation in recent versions of boost libraries . build r-tree list of polygons , it's simple (and efficient) matter perform query given point see polygon(s) lies within.

android - Application crash during createVideoThumbnail -

currently i'm using listview create file explorer video thumbnail. app crash when createvideothumbnail , after removing code app works fine. below snippet of part createvideothumbnail . for (int = 0; < files.length; i++) { file file = files[i]; if (!file.ishidden() && file.canread()) { path.add(file.getpath()); if (file.isdirectory()) { item.add(file.getname() + "/"); } else { item.add(file.getname()); bitmap bmap = thumbnailutils.createvideothumbnail(file.getpath(), mediastore.video.thumbnails.micro_kind); rowimage.setimagebitmap(bmap); } } } below whole class source code public class video extends listactivity { list<string> item = null; list<string> path = null; string root;

matrix - Gauss Elimination C++ segmentation fault -

i'm stuck code gauss elimination in c++, need return upper triangular matrix still thing segmentation fault. know there must sort of going of allocated memory can't find where. code: #include <iostream> using namespace std; double ** allocatedynamicarray(int order){ double ** dynarray = new double *[order]; int cols = order+1; double *pool = new double [order * cols]; for(int = 0;i < order; i++, pool += cols){ dynarray[i] = pool; } return dynarray; } void deallocatedynamicarray(double **dynarray){ delete [] dynarray[0]; delete [] dynarray; } void addandprintarray(double **dynarray, int order){ cout << "zadejte prvky pole radu " << order << endl; for(int i=0; i< order; i++){ for(int j=0; j< order+1; j++){ cout << "pole[" << << "][" << j << "]: "; cin >> dynarray[i][j];

Android Center Crop Image Not working on device but working in Eclipse -

Image
i have list view image background each list item. trying set src downloading image given url. need center crop imageview view image occupies entire screen (width , height). this xml list item: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/list_item" android:layout_width="match_parent" android:layout_height="match_parent" > <imageview android:id="@+id/img_askers_collage" android:layout_width="match_parent" android:layout_height="match_parent" android:adjustviewbounds="true" android:scaletype="centercrop"/> <linearlayout android:id="@+id/ll_question_text" android:layout_width="wrap_content" android:layou

sql - Correlation name'Split' is specified multiple times in a FROM clause -

i trying break comma seperated columns in rows here last asked question i got solution asked suppose if want same on multiple columns here trying select operationtypeid ,[user],[action], split.a.value('.', 'varchar(100)') changedcolumns, split.b.value('.', 'varchar(100)') oldvalue, split.c.value('.', 'varchar(100)') newvalue ( select cast ('<x>' + replace(newvalue, ',', '</x><x>') + '</x>' xml) newvalue , cast ('<x>' + replace(oldvalue, ',', '</x><x>') + '</x>' xml) oldvalue, operationtypeid ,[user],[action] ,cast ('<x>' + replace(changedcolumns, ',', '</x><x>') + '</x>' xml) changedcolumns allrows)as outer apply changedcolumns.nodes ('/x') split(a) outer apply oldvalue.nodes ('/x') split(b) outer apply newvalue.

ubuntu - Python sudo in new terminal window without passing password -

i have problem. i'm trying run sudo command in new terminal window python script every time have put password in new window. here code: import subprocess import sys import os def run_lirc(): subprocess.call(['x-terminal-emulator','-e','sudo lircd']) run_lirc() is solution allow me not pass root password? have open lirc in new terminal window. apart calling subcommand in "terminal window" being bad idea, issue sudo configuration. sudo assigns tty cookies sessions, limiting session timeout tty got authentication. you can prevent happening disabling tty_tickets option in /etc/sudoers : defaults !tty_tickets

python - How do I get a function inside of a while loop in a function to work properly? -

i have looked , looked answer, new python , answers find seem on head or not quite need. trying take code , turn multiple functions complete simple task of receiving grades user , displaying input user want it. more clear when see code. import sys gradelist = [] def validate_input(): try: gradelist.append(int(grades)) except: return false else: return true def average(count, total): ave = total / count return ave def exit(gradelist): if gradelist == []: print "you must enter @ least 1 grade program work. bye." sys.exit() #def get_info(): while true: grades = raw_input("please input grades.(or enter once have entered of grades): ") if not grades: break elif validate_input() == true: continue else: print "please enter number." continue def give_answers(gradelist): while true: print "\n", print "ple

sparse matrix - R Recommenderlab - Getting the user_id out the RealRatingMatrix containing UBCF recommendations -

recommenderlab - getting user_id out realratingmatrix containing ubcf recommendations. i'm trying use recommenderlab (with rstudio) recommendations.when i'm using ubcf can't extract user id out of realratingmatrix containing predictions, although can popular , ibcf methods.that's sample code i'm using: library(recommenderlab) data(jester5k) jester5k r <- sample(jester5k, 1000) rec_pop <- recommender(jester5k[1:1000], method = "popular") #rec_pop recom_pop <- predict(rec_pop, jester5k[1001:1002], n=100, type="ratings") #recom_pop as(recom_pop, "matrix") getlist(recom_pop,decode=true,ratings=true) getdata.frame(recom_pop,decode=true,ratings=true) user_id , item_id displayed correctly each of 3 alternatives rec_ib <- recommender(r[1:100],method="ibcf", param=list(normalize = "z-score",method="jaccard",minrating=1)) #rec_ib recom_ib <- predict(rec_ib, jester5k[1001:1002], n=100, t

javascript - Code coverage on multiple files -

i have application in node.js using mocha framework . have 2 javascript source files ,for want take code coverage (viz a.js , b.js). using istanbul purpose . here problem not getting how take code coverage multiple files . using following format : istanbul cover node_modules/mocha/bin/_mocha a.js istanbul cover node_modules/mocha/bin/_mocha a.js b.js but unfortunately both commands giving same code coverage, think taking a.js code . there solution finding code coverage multiple files? the problem here how arguments istanbul being parsed. assuming mocha a.js b.js works expect, should equivalent istanbul command: istanbul cover node_modules/mocha/bin/_mocha -- a.js b.js istanbul split arguments @ -- , pass ones on right node script on left. once working correctly, istanbul's coverage reports work correctly. an improvement on top of give mocha directory instead of explicit filenames, if possible. way, code not have change if filenames change. you can

How do I multiply a complex number with a scalar quantity (non-complex number) in Excel? -

i'm using microsoft excel compute data analysis project in electrical engineering. need multiply complex number non-complex/scalar number. excel keeps showing me "#value!" error. the complex number in 1 cell, , real/scalar/non-complex number in cell. i'm using formula multiply 2 numbers, , result placed in third cell. error message keeps showing every time compute. what can do? you make complex number 0 imaginary part , use improduct multiply them:- =improduct(a1,complex(b1,0)) where a1 complex , b1 real.

angularjs - angular leaflet custom markers (using angular directives) -

i'm trying create "leaflet marker" using angular directive. design purposes, separate presentation , model different persons can work on different parts of application. issue, more likely, more "scope" problem "leaflet" problem. i'm trying pass object used in angular directive, while i'm adding markers on "$scope", in controller. directive, "" in app, tag in "message" property on each marker object presented in map. has attribute "estacao" in portuguese same "station". so, code here: angular.foreach($scope.estacoes, function(estacao) { $scope.markers.push({ lat: estacao.latitude, lng: estacao.longitude, message: "<popup estacao='estacoes[" + + "]'></popup>" }); i++; }); http://plnkr.co/edit/evaqpqgzuz39y7mnqbo7?p=preview the problem seams "

requirejs - using require() in karma tests -

i'm using karma 0.12.28, karma-requirejs 0.2.2 (and karam-jasmine) run tests. config identical 1 docs (test files in requirejs deps , window.__ karma __.start callback). works fine basic tests. problem starts when use require() instead of define() or try change context. this: var ctx = require.config({ context: 'my-context' }); ctx(['dep1'], function(){ //.... }); the problem dep1 fails load. in devtools can see <script/> created , can see request in network tab proper url status canceled. can open url using context menu i'm sure correct question remains - why can't use require() in karma tests?

ruby - Commit details not show after upgrade gitlab from 6-7-stable to any other version -

i have gitlab community edition 6-7-stable with. when upgrade other version, cannot see commit details @ -- error 500. can see, gitlab work after upgrade, except "little" trouble above. production.log; started "/myproject-ru/myproject_ru_rating/commit/b01d59be5ac7345c2eef984018b9cf6a1c3697e0" 94.190.193.26 @ 2014-12-15 07:36:06 -0500 processing projects::commitcontroller#show html parameters: {"project_id"=>"myproject-ru/myproject_ru_rating", "id"=>"b01d59be5ac7345c2eef984018b9cf6a1c3697e0"} completed 500 internal server error in 190ms nomethoderror (undefined method `system=' #<note:0xacc4548>): app/models/project.rb:269:in `build_commit_note' app/controllers/projects/commit_controller.rb:25:in `show' app/controllers/application_controller.rb:59:in `set_current_user_for_thread' root@gitlab:/home/git/gitlab# sudo -u git -h bundle exec rake gitlab:env:info rails_env=production sy

Download file to website using php -

this question has answer here: download file server url 10 answers i have file url ! $url = "http://www.example.com/aa.txt"; and want download file , save path on website this website ( online ) $path = "server/username/"; i want $url file saved $path ,, i try if (file_exists($file)) { header('content-description: file transfer'); header('content-type: application/octet-stream'); header('content-disposition: attachment; filename='.basename($file)); header('expires: 0'); header('cache-control: must-revalidate'); header('pragma: public'); header('content-length: ' . filesize($file)); readfile($file); exit; } ?> when test code , make file download computer not website you can use file_put_contents(); see manual here: http:

c# - access object properties after it was added to db -

i have create method add new employee object database, after employee added want go edit page able enter more details employee if wish. the edit action method takes 1 parameter, employeeid, employeeid dynamically assigned database once object added employee table. how access id of newly added employee after _db.savechanges() within same action method? here part of method looks like: [httppost] [validateantiforgerytoken] public actionresult create(employee employee) { _db.employees.add(employee); _db.savechanges(); //access employee , gets id??? //var id = id??? return redirecttoaction("editemployeeviewmodel", new { id = id}); } you use this: employee.id the employee object synchronized changes make db . hence, when add objects employees , call savechanges , objects saved db , it's state updated, having id of employee . specifically, stated here : entity framework default follows each insert select scope_identity() when autogenerate

how to set small image over large Imageview match parent without distorted or stretched in android -

hi new in android capturing image custom camera , camera preview , image resolution saved image has quality want view image in activity big layout (image-view) image distorted vertically problem samsung tab , note(because image size small , layout full screen). how set small image in full screen image view please give me solution spend hole week not solution .sorry bad english, in advance.

java - State parameter value does not match with expected value -

i have requirement in our project sign-in user using other providers facebook,google. this, using social auth plugin. working fine facebook,but googleplus , getting error "state parameter value not match expected value", error comes when user redirect in our app after google, means in getuserprofile().so how can resolve this. dependencies : runtime "org.brickred:socialauth:4.7" compile "org.brickred:socialauth:4.7" my socialauth controller is def authenticate(){ socialauthconfig config = socialauthconfig.getdefault() //you can pass input stream, properties object or properties file name. config.load() //create instance of socialauthmanager , set config socialauthmanager manager = new socialauthmanager() manager.setsocialauthconfig(config) // url of application called after authentication string successurl = grailsapplication.config.auth.redirec

java - Compilation (genericity) issues overriding Properties.putAll -

for javafx ui, implemented class observableproperties extends java.util.properties , enables listen changes of properties (in particular, localized texts of ui). it works fine override putall method , having issues that. first, properties extends hashtable<object,object> , expect able override @override public void putall(map<object,object> that) but compile won't let me (saying i'm not overriding super method), have use @override public void putall(map that) i want perform action on entries of that tried usual for (map.entry entry : that.entryset()) but compiler tells me type mismatch: cannot convert element type object map.entry . however, second snippet set<map.entry> set = that.entryset(); (map.entry : set); it compiles... to sum up, know : why have remove bounds of map<k,v> in signature why first for loop not compile whereas seems equivalent second one thanks in advance ! you have signature of putall m

Can't open file from PHP -

i have following code: <?php $myfile = fopen("code2.css", "w") or die("unable open file!"); $txt = "john doe\n"; fwrite($myfile, $txt); $txt = "jane doe\n"; fwrite($myfile, $txt); fclose($myfile); ?> ?> code2.css in same folder php file, throws me: unable open file time. how can fix this? update: after playing permissions error dissapeared, still file won't updated. check properties of code2.css. must found "read only" permission it, , change "read , write". after code work. if using linux system, execute: sudo chmod 777 code2.css

node.js - What am I doing wrong trying to make this run with meteor? -

i trying adapt full text search made here work meteor. exported mongodb url 1 running 2.6.1. make full text search compatible getting these errors server/search.js:2:15: unexpected token . and server/search.js:42:7: unexpected token ) . missing? server.js meteor.methods({ meteor.ensureindex("posts", { smaintext: "text" }, function(err, indexname) { assert.equal(null, err); }); ) }; meteor.methods({ feedupdate: function(req) { posts.find({ "$text": { "$search": req } }, { smaintext: 1, submitted: 1, _id: 1, posts: { $meta: "posts" } }, { sort: { textscore: { $meta: "posts" } } }).toarray(function(err, items) { (e=0;e<101;e++) { meteor.users.update({ "_id": this.userid }, { "$addtos

python - client terminating earlier in IbPy -

i trying run ibpy in linux server machine, using ibgateway connect api code ib. ordering limit order, problem ibgateway terminating client connection. places order connection closed, making me unable order status. (this same code works when run in windows machine.) the code using place order: def place_single_order(self,order_type,action,lmtprice,expiry_date,quantity,conn) : conn=connection.create(host='localhost', port=7496, clientid=1,receiver=ib, sender=none, dispatcher=none) conn.connect() conn.register(self.error_handler, 'error') conn.register(self.executed_order, message.execdetails) conn.register(self.validids,message.nextvalidid) conn.register(self.my_order_status,message.orderstatus) newcontract = contract() newcontract.m_symbol = 'es' newcontract.m_sectype = 'fut' newcontract.m_exchange = 'globex' newcontract.m_currency = 'usd' newcontract.m_expiry = expiry_date

angularjs - dynamic css style not working on ie? -

i have simple problem of dynamic css setting not working on ie properly: i have code: <div class="i-storage-bar-chart-bar-container"> <div class="i-storage-bar-chart-bar" style="height: {{(storage.totalstorage * 100) / model.maxstoragecapacity}}%"> <div class="i-storage-bar-chart-bar-inner" style="height: {{(storage.usedstorage * 100) / storage.totalstorage}}%"></div> </div> this kind of code simple chart height of told inside curly braces, working ok in chrome , firefox, in ie doesn't anything, way working doing following: (non dynamic) <div class="i-storage-bar-chart-bar-container"> <div class="i-storage-bar-chart-bar" style="height: 20%"> <div class="i-storage-bar-chart-bar-inner"

Php removes part of string -

i have simple string variable: $query="select * striscie previous, striscie current previous.linea=current.linea , current.ident=$striscia , previous.position<current.position , previous.position>current.position-$stops"; yet, when echo or use it, turns to: select * striscie previous, striscie current previous.linea=current.linea , current.ident=897524 , previous.positioncurrent.position-3 select * striscie previous, striscie current previous.linea=current.linea , current.ident=920173 , previous.positioncurrent.position-2 by deleting whole part of string. tried restarting apache no avail. might be? < being treated html browser. don't blindly output stuff that.

OpenCV on Android: Couldn't load opencv_java from loader - do I have to compile with NDK? Have I missed something? -

i feel i've missed obvious here. i'm trying opencv run on android. wanted use static initialization method, copied appropriate native library files opencv sdk app/libs/armeabi-v7a folder within android studio project. know google glass (what i'm developing for) uses architecture - , in case, have /lib/armeabi folder in case. i searched here on stackoverflow, , of course answers.opencv.org down. answers found didn't solve problem. far understand it, i: install ndk android download , extract opencv sdk import android library , add module dependency copy library files /libs/armeabi-v7a (within android studio project) use following code , library should load correctly: if (!opencvloader.initdebug()) { log.e("opencv","unable load opencv"); } else { log.e("opencv","opencv has loaded!"); } however, error: 12-16 08:46:08.047 1838-1838/com.company.opencvsdktest d/opencv/statichelper﹕ trying library list 12-16