Posts

Showing posts from February, 2015

javascript - catching a 500 response when setting the src of an iframe -

i'm doing similar code: $('#myiframe').attr('src', 'dosomethingthatreturnsadocument.aspx'); the page gets called returns document, whether word doc, pdf etc , prompts user open/save , working fine. the problem have if goes wrong @ server side 500 response returned. don't seem have way of catching error. i've tried try catch around line. .error function of iframe doesn't seem catch it. does know of way allow me catch 500 can act accordingly ui? you should first check response , set in iframe. can try this: var loading_url = "/dosomethingthatreturnsadocument.aspx" $.ajax({ url: loading_url, type: 'get', complete: function(e, xhr, settings){ if(e.status === 200){ $('#myiframe').attr('src', 'dosomethingthatreturnsadocument.aspx'); }else if(e.status===500){ // } } });

My java game isn't working -

so i'm still beginner managed code didn't work wanted, main problem every time press 1 resets enemy instead of keeping same one. appreciate if me. far have made writing 1 something. package game; import java.util.random; import java.util.scanner; public class main { public static void main(string[] args) { scanner in = new scanner(system.in); random r = new random(); system.out.println("welcome dragon heart"); system.out.println("1. start"); system.out.println("2. quit"); int input = 0, enemyhealth = 75, enemyattack = 15, playerhealth = 100, playerattack, random; boolean enemydead = true, playerdead = false; input = in.nextint(); if (input == 1) { system.out.println("game started!"); while (0 != 1) { if (enemydead = true) { enemyhealth = r.nextint(50) + 51; enemyattack = r.n...

android - When to use object.recycle() in java? -

i learning android development , have basic knowledge of java. see .recycle() being used in different codes. reading few documents learnt method used recycle bitmaps save memory avoid exceptions outofmemoryerror (however, may alternative on android version 3.0 , higher, saw somewhere). however, reading tutorial custom views , came know method recycle() used typedarray ; left me wondering other possible uses of method. questions are: what other areas recycle should used? should recycle method used objects of user created class if grow complex? i may entirely wrong concepts above, if can please point me right direction proper links articles 'when use recycle() , why?', thanks.

Does double buffering for the purpose of vertex streaming do anything in webgl? -

Image
i trying render many moving objects can webgl , updating objects position glbufferdata/glbuffersubdata each frame.i found recommended use double buffer reduce synchronization issues between gpu , cpu: https://developer.apple.com/library/ios/documentation/3ddrawing/conceptual/opengles_programmingguide/techniquesforworkingwithvertexdata/techniquesforworkingwithvertexdata.html , https://www.opengl.org/wiki/buffer_object_streaming , google's webgl optimizationg slides . so have implemented double buffering , drawing expected. however, there no performance gains. (in fact made slower) curious if double buffer technique described in above 3 documents approriate webgl. here doing (capture webgl inspector): frame x: frame x+1:

python - pandas raises ValueError on DatetimeIndex Conversion -

i converting iso-8601 formatted values unix values. inexplicable reason line a_col = pd.datetimeindex(a_col).astype(np.int64)/10**6 raises error valueerror: unable convert 0 2001-06-29 ... (abbreviated output of column name: datecol, dtype: datetime64[ns] datetime dtype this odd because i've guaranteed each value in datetime.datetime format can see here: if a_col.dtypes (np.dtype('object') or np.dtype('o')): a_col = a_col.apply(lambda x: x if isinstance(x, datetime.datetime) else epoch) a_col = pd.datetimeindex(a_col).astype(np.int64)/10**6 epoch datetime.datetime. when check dtypes of column gives me error it's "object), i'm checking for. there i'm missing? assuming time zone us/eastern (based on dataset) , dataframe named df , please try following: import datetime dt time import mktime import pytz df['job start date'] = \ df['job start date'].apply(lambda x: mktime(pytz....

javascript - Full calendar Timezone Moment js Issue -

i've been wrestling while now, reaching out bit of please. i have realtime multi timezone application uses signal r, datetimes stored , broadcast using utc , want manipulate them client side avoid multiple broadcasts different users if 1 appointment updated. i'm trying fullcalendar display dates in appropriate timezone user, not based on browser local string held when user logs on. is possible? or need store offsets , way (i hoping avoid this). using eventrender manipulate giving me other issues , have raise bug. my code is: $(document).ready(function() { function rendercalendar() { $('#calendar').fullcalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaweek,agendaday' }, editable: true, timezone: "europe/istanbul", eventlimit: true, // allow "more" link when ...

C create array of struct using constructor function -

i have c struct: typedef struct { dataset *datasets; int ndatasets; char *group_name; enum grouptype type; } datasetgroup; it has constructor function this: datasetgroup * new_datasetgroup(char *group_name, enum grouptype type, enum returncode *ret) { datasetgroup *dg; dg = (datasetgroup *) malloc(sizeof(datasetgroup)); if (dg == null) { *ret = ememory_error; } // allocate space few datasets dg->datasets = malloc(sizeof(dataset) * increment); if (dg->datasets == null) { *ret = ememory_error; } dg->group_name= malloc(sizeof(char) * strlen(group_name)); strcpy(dg->group_name, group_name); dg->type = type; groupcount++; return dg; } i want dynamically create array of these structs. whats best way this? so far have like: datasetgroup * make_array(){ datasetgroup *dg_array; // allocate space few groups dg_array = (datasetgroup *) malloc(sizeof(datase...

objective c - iOS UI causes crash after pushing/popping second view controller -

Image
in ios app, entire user interface coded programmatically, meaning no xibs or storyboards. works until add view controller via uinavigationcontroller . the first view controller works well, , when second view controller pushed, works too. after second view controller pops itself, , first view controller re-appears, interaction of elements of user interface crashes app. any idea may causing this? update: screenshot of exception there's crash log that's generated when app crashes. messages, along stack backtrace there. you can see device's crash logs connecting mac, opening devices window, , viewing device logs. but it's easier debug within xcode, connecting device, building , running in xcode, on device. when app crashes (due exception), xcode can catch this, , control transferred debugger. you can add exception breakpoint in xcode stop app exception occurs. to add exception breakpoint, switch breakpoint navigator. click small + button @ b...

php - Parsing XML too slow? -

i read similar questios, don't understand how can xml data url faster? why code runs slow: while($id = $getfix->fetch()){ $odds=$this->soccer->getalloddsbyfixturematchid(array("fixturematch_id"=>$id['id'])); } if(!empty($odds)){ $stmt = $this->pdo->prepare("call insupd_odds(:fixturematchid, :bookmaker, :updateddate, :type,:homeodds, :drawodds, :awayodds, :handicap)"); foreach($odds $key=>$value){ $stmt->bindparam(':fixturematchid',$value->fixturematch_id); $stmt->bindparam(':bookmaker',$value->bookmaker); $stmt->bindparam(':updateddate',$value->updateddate); $stmt->bindparam(':type',$value->type); $stmt->bindparam(':homeodds',$value->homeodds); $stmt->bindparam(':drawodds',$value->drawodds); $stmt->bindparam(':awayodds',$value->awayodds); $stmt-...

search - Searching for row with string value in R data frame -

i new r , have question regarding searching data.frame row. i have column msg no tmp sensor lat lon alt 1 8d4008b858c381ff633cca3d1b59 0 277102796 13020203 0.00000 0.000000 0.00 2 8d4008b858c37575032db3f2f30e 1 136520046 13020203 51.03620 5.892563 11574.78 3 8d40690958af7480e6c539db2d28 2 902340359 13020203 0.00000 0.000000 0.00 4 8d4008b858c37574612e52e5843d 3 185870171 13020203 51.03243 5.904694 11574.78 5 8d4008b858c375764f2c6ea82b0e 4 615986062 13020203 51.04392 5.867767 11574.78 6 8d4008b858c375749f2e15a34831 5 665795000 13020203 51.03387 5.900040 11574.78 7 8d4008b858c37207a9349cd60077 6 576273468 13020203 51.04486 5.864621 11574.78 8 8d40690958af847ff0c66f60ea8e 7 742755281 13020203 0.00000 0.000000 0.00 the data frame huge (1.5 million value). need check whether there row particular msg . ie ,is there row msg=8d4008b858c37207a9349cd60077 (here row 7) . if so, return no (here return 6) value. if th...

Designing a REST API path for importing products from an csv file -

in application, upload csv file having products using html file upload . internal worker process gets notification via trigger file directory file upload completed. @ point internal worker process calls rest api (with name of file only) start processing csv file insert database. i don't know whether call process csv file restful. came following paths considering products resource. design restful? if not restful, shouldn't use behavior rest use wcf or such rpc calls. http://localhost/products/import/productsfile.csv *(get method)* http://localhost/products/productsfile.csv/import *(get method)* http://localhost/products/ *(post method name of file)*

c# - Task.Factory.StartNew with async lambda and Task.WaitAll -

i'm trying use task.waitall on list of tasks. thing tasks async lambda breaks tasks.waitall never waits. here example code block: list<task> tasks = new list<task>(); tasks.add(task.factory.startnew(async () => { using (dbcontext = new databasecontext()) { var records = await dbcontext.where(r => r.id = 100).tolistasync(); //do long cpu process here... } } task.waitall(tasks); //do more stuff here this doesn't wait because of async lambda. how supposed await i/o operations in lambda? task.factory.startnew doesn't recognise async delegates there no overload accepts function returning task . this plus other reasons (see startnew dangerous ) why should using task.run here: tasks.add(task.run(async () => ...

php - Symfony2 fail during installation -

i trying use symfony2 local wamp server. used php -r "readfile('http://symfony.com/installer');" > symfony i moved symfony file c:\wamp\www\test . and php symfony php symfony new myproject but message appear warning: include(phar://c:/wamp/www/symfony/symfony/vendor/symfony/process/symfo ny/component/process/processutils.php): failed open stream: phar error: canno t open phar archive "c:/wamp/www/symfony/symfony" reading in phar://c:/wamp/ www/symfony/symfony/vendor/composer/classloader.php on line 412 the line 412 function includefile($file) { include $file; } why did have error during installation ? did not perform other actions except following instructions on official website. why don't use composer?the composer make more "symfony" command file.

angularjs - Can't redefine service defined as constant -

here temp.js angular.module('temp', []) .service('tempfactory', function() { this.a =10; }); and here temp.spec.js describe('temp', function() { var tempfactory; beforeeach(function() { var mockedtempfactory = {}; module('temp', function($provide) { $provide.value('tempfactory', mockedtempfactory); }); mockedtempfactory.a = 20; inject(function(_tempfactory_) { tempfactory = _tempfactory_; }); }); it('console.log of property', function() { console.log(tempfactory.a); }); }); in console value of 20. but if define tempfactory this: angular.module('temp', []) .constant('tempfactory', { a: 10; }); in console value of 10. why can't redefine tempfactory defined constant, can redefine tempfactory defined service, value or factory? because when create service , provide const...

Redirecting to previous page after authentication in node.js using passport.js -

i'm trying establish login mechanism using node.js, express , passport.js. login works quite nice, sessions stored nicely redis have troubles redirecting user started before being prompted authenticate. e.g. user follows link http://localhost:3000/hidden redirected http://localhost:3000/login want him redirected again http://localhost:3000/hidden . the purpose of is, if user access randomly page needs logged in first, shall redirected /login site providing credentials , being redirected site tried access. here login post app.post('/login', function (req, res, next) { passport.authenticate('local', function (err, user, info) { if (err) { return next(err) } else if (!user) { console.log('message: ' + info.message); return res.redirect('/login') } else { req.login(user, function (err) { if (err) { return next(err); ...

c# - Waiting for ThreadPool to finish -

Image
i developed application saves 10000 lines of lorem ipsum in .txt file on disk. used streamwriter write these lines, , threadpool distribute computational process available threads/cores. the saving fast, 1 million lines, problem is, not lines saved , last 1 saved partially . when close program, writes file again reason. i have following string: string loremipsum = "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; and rest of code is: private streamwriter writer = new streamwriter("loremipsum.txt"); private object lockobject = new object(); // button...

F# computation expression transparent state passing with Bind -

i have following code try read possibly incomplete data (image data, example) network stream using usual maybebuilder: let image = maybe { let pos = 2 //initial position skips 2 bytes of packet id let! width, pos = readstreamasint 2 pos let! height, pos = readstreamasint 2 pos let! data, pos = readstream (width*height) pos advanceinstream pos return {width = width; height = height; pixels = data} } so, readstream[asint] [numbytes] [offset] function returns [data] or none if data has not arrived yet in networkstream. advanceinstream function executed when whole network packet read. i wonder if there way write custom computation expression builder hide pos passing user, since it's same - read data , position in stream , pass next read function last parameter. p.s. maybebuilder used: type maybebuilder() = member x.bind(d,f) = option.bind f d member x.return d = d member x.returnfrom d = d member x.zero() = none let maybe = new ...

html - jQuery selectors, targeting the div $(this) is nested a couple of levels inside -

i have following js function: function makearticlefeed(response) { $('#articles-feed').empty(); if(response.length > 0) { for(var x = 0; x<response.length; x++) { //format date var posted = new date((response[x].posted * 1000)); //format extract line brakes var extract = response[x].extract.replace(/(\r\n|\n|\r)/gm,"<br>"); //format categories var categories = response[x].cat_name.split(","); //make variable store html var articlehtml = ( '<div class="article-box"><h1><a href="#">' + response[x].title+ '</a><h1><h3><a href="#">' + response[x].name + '</a>&nbsp;|&nbsp;' + posted.tolocaledatestring() + ...

c# - Rewrite XMLDocument to use namespace prefix -

i have xmldocument which, when save file, repeats namespace on of elements, in <test> <test xmlns="http://example.com/schema1"> <name xmlns="http://example.com/schema2">xyz</name> <addressinfo xmlns="http://example.com/schema2"> <address>address</address> <zipcode>zzzz</zipcode> </addressinfo> ... is possible amend file uses namespace prefix throughout document, ie like <test xmlns="http://example.com/schema1" xmlns:p="http://example.com/schema2" > <p:name>xyz</p:name> <p:addressinfo"> <p:address>address</p:address> <p:zipcode>zzzz</p:zipcode> </p:addressinfo> ... i have tried adding doc.documentelement.setattribute("xmlns:p", "http://example.com/schema2"); but whilst adds namespace header, main body of file unchange...

paperclip - delayed_paperclip is not hitting sidekiq -

i have set delayed paperclip , sidekiq, when try photo upload again, log's out put below: [activejob] enqueued delayedpaperclip::jobs::activejob (job id: f9bf0100-2c5b-4c30-af04-9fb9b4ee8c5e) inline(paperclip) arguments: "carphoto", 32, "image" [activejob] [delayedpaperclip::jobs::activejob] [f9bf0100-2c5b-4c30-af04-9fb9b4ee8c5e] performing delayedpaperclip::jobs::activejob inline(paperclip) arguments: "carphoto", 32, "image" [activejob] [delayedpaperclip::jobs::activejob] [f9bf0100-2c5b-4c30-af04-9fb9b4ee8c5e] carphoto load (0.5ms) select "car_photos".* "car_photos" "car_photos"."id" = $1 limit 1 [["id", 32]] which indicates activejob doing job.. , on other side in sidekiq console, don't see being logged out.. wondering if missing anything. you haven't told activejob use sidekiq using inline adapter. # config/application.rb module yourapp class application ...

ember.js - Reference RSVP hash from inside the same hash -

i'm trying load 2 different models on same route, found stack overflow explained can use ember.rsvp.hash() done, here i've done make work. model: function(params) { return ember.rsvp.hash({ flyer: this.store.find('flyer', params.flyer_id), images: this.store.find('image', '-jrgar1tsaruw-_pijqx') }); }, as can see have hard coded id of images record need load, should come returned flyer flyer.imagesid but when error in console, stack trace... error while processing route: flyers flyer not defined referenceerror: flyer not defined @ model (http://localhost:4200/assets/flyer-creator.js:338:38) @ emberobject.default.extend.deserialize (http://localhost:4200/assets/vendor.js:32872:19) @ applyhook (http://localhost:4200/assets/vendor.js:55667:32) @ object.handlerinfo.runsharedmodelhook (http://localhost:4200/assets/vendor.js:53668:22) @ object.subclass.getmodel (http://localhost:4200/assets/vendor.js:538...

ruby - Wrapping instance variables in accessor methods -

sandy metz says (poodr book, page 26): because possible wrap every instance variable in method , therefore treat variable if it's object, distinction between data , regular object begins disappear. i not sure if understand explaining. when define accessors, wrapping instance variables (data) on method methods not objects. mean when says can treat variables if they're object? the primary difference between data , objects behaviour. objects can modify internal state without changing interfaces, while data static structures. when wrap data access within method, same benefits of object - interface remains static consumers if underlying data structure needs change.

php - Migrate multiple databases with Propel -

i maintaining system many databases. 1 “central" db, , many other “client” dbs. each time client registers, create client db using sql file. system using propel + php + mysql. now problem is, there changes when version-up. it’s possible use propel migration central db, there many client dbs, , in propel.yaml/ propel-config.php have 1 connection string client this: $manager = new \propel\runtime\connection\connectionmanagersingle(); $manager->setconfiguration(array( 'classname' => 'propel\\runtime\\connection\\connectionwrapper', 'dsn' => 'mysql:host=127.0.0.1;dbname=' . $shopdbname . ';charset=utf8', 'user' => 'dba', 'password' => ‘******', 'attributes' => array( 'attr_emulate_prepares' => false, ), )); in $shopdbname global variable identified string sent client devices. so, how can automate process of migration clien...

jquery replace part of text with html content -

how can replace part of text html? <span class="squaremeter">3000m2</span> var content = $(".squaremeter").text().replace(/\[m2\]/g,'m<sub style="font-size:0.5em;">2</sub>') $(".squaremeter").html(content); the above not work...

What is the proper syntax of using broadcast variables in Spark using Scala? -

i want use broadcast variable in spark scala. can't find enough on how use them. say, have object of class a, declare follows in scala. val = new a() what syntax of declaring broadcast variable. , how call methods? if sc sparkcontext , val broadcasted = sc.broadcast(a) broadcast a . can access broadcasted.value .

git - Github: Permission denied (publickey) but I got "You've successfully authenticated" message -

step had done: https://help.github.com/articles/generating-ssh-keys/ follow exactly. $ eval "$(ssh-agent -s)" agent pid 31944 $ ssh-add enter passphrase /home/centos7/.ssh/id_rsa: identity added: /home/centos7/.ssh/id_rsa (/home/centos7/.ssh/id_rsa) $ ssh-add -l 4096 ab:4d:23:23:99:ce:bb:9d:9f:9e:f9:b2:c8:1a:cd:f7 /home/centos7/.ssh/id_rsa (rsa) however, when run $ git clone git@github.com:privaterepo/repo.git cloning 'repo'... authenticity of host 'github.com (192.30.252.130)' can't established. rsa key fingerprint 56:27:ac:a5:36:28:2d:36:23:1b:56:4d:eb:df:a6:48. sure want continue connecting (yes/no)? yes warning: permanently added 'github.com,192.30.252.130' (rsa) list of known hosts. permission denied (publickey). fatal: not read remote repository. below output run $ ssh -tv git@github.com openssh_6.6.1, openssl 1.0.1e-fips 11 feb 2013 debug1: reading configuration data /home/centos7/.ssh/config debug1: /home/centos/.ssh/confi...

mysql - Sending Facebook user data to server fails - Android -

i have app facebook login (4.2), when user logs in, pass data (name, birthday, etc) mysql online database. problem on devices empty strings, , can't figure out why? the user data sent server in oncompleted() method, inside onsucces() after saved preferences: public class splashactivity extends activity { private loginbutton loginbutton; callbackmanager callbackmanager; private editor editor; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getwindow().requestfeature(window.feature_action_bar); getactionbar().hide(); setcontentview(r.layout.splash); facebooksdk.sdkinitialize(getapplicationcontext()); callbackmanager = callbackmanager.factory.create(); loginbutton = (loginbutton) findviewbyid(r.id.login_button); loginbutton.setreadpermissions(arrays.aslist("public_profile, email, user_birthday, user_friends")); editor = t...

strongloop - Loopback: How to change the name of a model? -

i have model name "aaa_bbb", want change name aaa-bbb, know how can achieve that? or can change name directly in model json file? here current model.json file. { "name": "aaa_bbb", "base": "persistedmodel", "idinjection": true, "options": { "validateupsert": true }, "properties": { ... }, "acls": [], "methods": [] } typically there 3 steps: 1 - change model name in server/model-config.js { ... "aaa_bbb": { // change "aaa-bbb" "datasource": "db", "public": true } } 2 - change model name in common/models/aaa-bbb.json : { "name": "aaa_bbb", // change "aaa-bbb" "base": "persistedmodel", ... } 3 - change model name in `commmon/models/aaa-bbb.js: module.exports = function(aaabbb) { // change this... }; ...howev...

Inserting with empty string in cakePHP -

i new in cakephp framework version 2.0 problem when save data or insert new record field empty or no data save how can fix this. . my model class post extends appmodel{ public $name = 'posts'; } my controller public function add(){ if($this->request->is('post')){ $this->post->create(); if($this->post->save($this->request->data)){ $this->session->setflash('the posts saved'); $this->redirect('index'); } } } my view echo $this->form->create('create posts'); echo $this->form->input('title'); echo $this->form->input('body'); echo $this->form->end('save posts'); you need put validation rules in post model, can check validate data or not in controller action before save model. see following model , controller in model class post extends appmodel{ public $name = 'po...

ruby - Rails pagination displaying wrong number of output -

in rails application, want order @students latest assignment date. point noted it's not necessary every student should have assignment on same date or that. means student can have assignment @ date. the code of controller is: @section = current_user.section @students = @section.students.includes(:assignments).order('assignments.assignment_date asc').paginate :page => params[:page], :per_page => 10 the problem is, in view, there 10 students in list, 6 items etc. mean random between 1 10. there should wrong in logic. please me resolve issue. update: i found there nothing wrong pagination. problem is, @section.students.includes(:assignments) fetching duplicate student_id being eliminated. you can try below. @section = current_user.section @students = @section.students.includes(:assignments).order('assignments.assignment_date asc').paginate( :page => params[:page], :per_page => 10)

objective c - IOS IAP: Buying same item multiple times -

hello developer community, please let me know think best idea solve problem, 1 item cannot sold multiple times if non-consuming. background: have product dropbox. can buy packages space e.g.: package 1: 100 mb package 2: 200 mb package 3: 300 mb every package 1 year valid. 3 month before package ends, should possible customer buy same package next 365 days or in other words extend bought package für 1 more year. example: user buys package 100 mb on january 1st. on october 1st can open store inside app , sees again same 300 products: package 1: 100 mb package 2: 200 mb package 3: 300 mb problem: non-consumable, can buy 1 item once. should (dirty :-)) tricks put different product identifiers same thing year? 100mbfirstyear 200mbfirstyear 300mbfirstyear 100mbsecondyear 200mbsecondyear 300mbsecondyear questions: 1.) best approach this? 2.) how should name product ids? best regards fipsi why didn't use subscription iap subscriptions:: can provid...

mvc c# file upload as byte array -

i have upload files , other data in single submit of uploadfile.cshtml form i have base class input of mvc action in home controller. my base class, mvc action method , cshtml part razor script given below i have file byte array in mvc action while submitting uploadfile.cshtml form my base class public class fileupload { public string name {get;set;} public int age {get;set;} public byte[] photo {get;set;} } mymvcaction [httppost] public void uploadfile(fileuploadobj) { fileuploaddata=obj; } mycshtmlform @modelmvc.models.fileupload @using(html.beginform("uploadfile","home",formmethod.post)) { <fieldset> <legend>file upload</legend> <div class="editor-label"> @html.labelfor(model=>model.name) </div> <div class="editor-field"> @html.editorfor(model=>model.name) </div> <div class="editor-label"> @html.labelfor(model=>model.age) </div> <div cl...

android - Custom rendering for text with special syntax -

i have text gathered api , consists of custom syntax. display using textview need render special part of text , convert text elements. example of text below. oh, that's great idea! check (user: someuser)'s answer this. can @ (ref: forum post title) or: (ref: forum post) hint you! (hint: should displayed mini icon when clicked, tooltip should opened) here spoiler you. ---- spoiler ---- spoiler. text should not displayed directly should converted button element. when button clicked, text should shown ---- spoiler ---- so, need convert (user: someuser) link in view shown "someuser" when clicked, open new intent. (ref: topic) keyword, it's same. when hit spoiler , want make nice button indicating it's spoiler , when user clicks, expand. how can parse text , show correctly in view? don't have problem parsing problem displaying elements in view. methods tried i tried webview instead of textview thinking can convert html/js performance terribl...

ruby on rails - How can find domain name in Grape::API -

i not able fetch request object in grape::api, method is module artical module railsapp module v1 class articleapi < grape::api include railsapp::v1::defaults resource :articleapi desc "return article" "", root: :articles error!({:error_message => "please provide article id."}, 422) end desc "return acticle" params requires :id, type: string, desc: "id of photo" end ":id", root: "photo" @artical = contents.where(id: params[:id],content_type: 'article').first if @artical.present? error!({:success_message => "record found",:result => @artical }, 300) else error!({:error_message => "record not found"}, 422) end # photos.where(:id => @id).update_all(publish_status: @status_value) end end in grape endpoint can access request object "request...

Complex Python Bottle App + WSGI -

i have python bottle application inside of single folder that's been organized function , convert existing cherrypy usage on apache mod_wsgi. the folder structure looks following: - project -- app.py (loads webserver class , runs it) -- app --- common --- logs --- modules --- tools --- web ---- webserver.py the reason structure code common used within tools , web without issue. imports done in style of "from app.common.blah import utility". when trying setup mod_wsgi, expects load simple application. is possible run mod_wsgi folder structure this? if not, there recommendations setting structure allow mod_wsgi, sharing of common utilities between folders tools , web? from bottle deployment docs on deployment : all need app.wsgi file provides application object. object used mod_wsgi start application , should wsgi-compatible python callable. file /var/www/yourapp/app.wsgi : import os # change working directory relative paths (and template ...

ruby on rails - How to insert hint information right after the input box? -

not issue question need is possible attached html values right after input box? small text info below input box i have did similar not pretty. f.inputs "blog" f.input :view_counts, :input_html => { :readonly => true } f.input :slug li raw("<label class='label'>&nbsp;</label><span class='text-info'>your slug automatically based on title or can choose enter own slug title</span>") f.input :title f.input :content, :as => :ckeditor f.input :is_active f.input :admin_user_id, as: :hidden, :input_html => { :value => current_admin_user.id } end the code between :slug , :title. catch draft of trying do. thanks you can add label like: <label for="slug" class="hint">your slug automatically based on title or can choose enter own slug title</label> then add css styling like: .hint { font-weight: normal; color: #777; font-size: .85em; } ...

php - change Image In Responsive? -

Image
i have created web site, it's non responsive site. want change site responsive site. when resize browser checking responsiveness it's showing not showing top picture? how change image responsive? <?php session_start(); require_once("conf.php"); $section = $_request['section']; $logout = $_request['logout']; $buttombanner="<img src=\"images/buttombanner.gif\" />"; ?> <html> <head> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> <meta name="handheldfriendly" content="true"> <title>lms</title> <link rel="stylesheet" href="style/style.css" type="text/css"/> <link rel="stylesheet" href="style1.css" type="text/css" /> <s...

c# - Content Binding only works for integers and Strings -

i new xaml , have work on existing project university. unfortunately confused how deal content binding. have following xaml code (snippet): <!-- snapshotsv.xaml --> <s:scatterview grid.row="1" grid.column="1" grid.rowspan="2" panel.zindex="2" name="snapshotsscatterview" itemssource="{binding path=snapshotscollection}" allowdrop="false" background="#ff151515" width="{binding scrollcontainerwidth}"> <s:scatterview.itemcontainerstyle> <style targettype="s:scatterviewitem"> <setter property="height" value="300"/> <setter property="width" value="300"/> <setter property="orientation" value="0"/> <setter property="canscale" value="false"/> <setter property="canmove" value="t...

javascript - How do you vertically center text with an image in a div element? -

i trying make small segment have image on left side text vertically centered right of image. second image below, want image on right, , text vertically centered left of image. <div id="segment2"> <h2>fig tree discussion tool helps organizations innovate</h2> <h3>we took basics of discussion thread , added...</h3> <div style="height:259px;" id="branching"> <section class=leftboundpic> <h4>discussion branching</h4> <img src="somephoto.png" alt="figtree"/> </section> <span> bunch of text <br> should next image. </span> </div> <div style="height: 259px; margin-top: 50px;" id="contenthubs"> <section class=rightboundpic> <h4>content hub</h4> <img src="somephoto.png" ...

asp.net mvc 4 - Unable to display a table properties through Jquery UI Autocomplete -

this controller. public class homecontroller : controller { string commstring = ""; public homecontroller() { fwutility.connstring = "data source = developer1; initial catalog = fr8demodb; uid=sa; pwd=123;"; } public actionresult index() { return view(); } public actionresult fillautocomplete() { commstring = "select brandid, brandname brandmaster order brandname"; list<brandmaster> listbrandmaster = fwutility.getlist<brandmaster>(fwutility.getdatatable(commstring)); return json(listbrandmaster, jsonrequestbehavior.allowget); } } public class brandmaster { public string brandid { get; set; } public string brandname { get; set; } } } this view. @using system.data; @using jqeryuiautocompleteonclickdisplaybrandidofbrandname.controllers; @model string <scrip...