Posts

Showing posts from February, 2014

How to send http request without scheme in python? -

enurl='res.iweshow.com' sr = requests.get(enurl) print(sr) when send http request using requests module in python, here traceback: raise invalidschema("no connection adapters found '%s'" % url)requests.exceptions.invalidschema: no connection adapters found if intention use http, indicated in question, answer "add http scheme in". use urlparse check if scheme absent url. in case of proxy, default scheme http see here , here

How to use “Native Wifi API” Windows API functions with ruby -

my setup: windows 7, ruby 1.9.3 i want manage wireless nic access different wireless routers, here's have tried: method 1: netsh wlan managing wlan adapter through netsh command tools. so setup wireless network in windows , exported using netsh wlan export profile name="wuhongliang" folder = "d:\" interface="wireless" key=clear which worked, can add profile , connect doing: > netsh wlan add profile ^ filename="d:\wireless-wuhongliang.xml" ^ interface="wireless" profile wuhongliang added on interface wireless. > netsh wlan connect name="wuhongliang" ^ ssid="wuhongliang" connection request completed successfully. which works , connects me wlan using exported profile. so looking @ xml profile: <?xml version="1.0" ?> <wlanprofile xmlns="http://www.microsoft.com/networking/wlan/profile/v1"> <name>wuhongliang</name> <ssidconfig>

firefox - Two weeks future date from calendar selenium ide -

i using selenium ide plugin , want select future date 14 days today's date. way can using calendar pop-up. have used variable store setdate+14 function, unable understand how can used date choose calender? also, how can navigate next month when current date more 16/ 17th of current month. thanks

cordova - Tap/Touch events not working on Samsung Android 4.4.4 and 5 -

i developed app cordova worked fine until android 5.0. issue app can swipe cannot tap/touch specific elements within app (actually works if tap multiple times). taps work expected such buttons. other elements images etc. doesn't work (i have images in carousel when tapped executes function) can why happening , happening on android 4.4.4 , up. my code below nova.touch.bindclick = function(selector, func) { if (nova.application.istouchable === false) { $(selector).click(function(e) { func.call(this, e); }); return; } var ismoving = false; var starttime = null; $(selector).bind(this.eventnames.touchstart, function(e) { ismoving = false; starttime = new date(); $(this).addclass("touching"); }); $(selector).bind(this.eventnames.touchmove, function(e) { ismoving = true; }); $(selector).bind(this.eventnames.touchend, function(e) { var $me = $(this); $

html - PHP mail function doesn't complete sending of e-mail -

<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'customer inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } ?> i've tried creating simple mail form. form on index.html page, submits separate "thank submission" page, thankyou.php , above php code embedded. code submits perfectly, never sends email. please help. there variety of reasons script appears not sending emails. it's difficult diagnose these things unless there obvious syntax error. without 1 need

c# - JavaScript executes and works on MSVS but doesn't work when published -

i working lightswitch, , using javascript hide buttons based on current user permissions. following tutorial msdn: https://msdn.microsoft.com/en-us/library/ff852062.aspx this page /// <reference path="~/generatedartifacts/viewmodel.js" /> myapp.inicio.visualizaragenda_execute = function (screen) { window.location = "../webforms/agenda.aspx"; }; myapp.inicio.visualizarcorridaexecutadacompleta_execute = function (screen) { // write code here. window.location = "../webforms/corridaexecutadacorridacompleta.aspx"; }; myapp.inicio.coletamotoristacorridas_execute = function (screen) { window.location = "../webforms/coletamotoristacorrida.aspx"; }; myapp.inicio.created = function (screen) { //screen.getcanexecuteclientes().then(function success() { // screen.findcontentitem("showbrowseclientes").isvisible = true; //}, function error() { // screen.findcontentitem("showbrowseclientes").isvisible = false; //}) /

Need to know how to process 1 XML file with 2 XSL files using PHP SimpleXML -

i new xsl. need process same xml file 2 xsl files using php simplexml. have tried few different approaches no luck. $xmlfile = 'media/xml_files/article.xml'; if (file_exists($xmlfile)) { $xml = simplexml_load_file($xmlfile) or die("error: cannot create object");} $xslfile = media/xsl_files/jats-html.xsl; $xsl = simplexml_load_file($xslfile); $proc = new xsltprocessor; $proc->importstylesheet($xsl); echo $proc->transformtoxml($xml); i need process xml jats-pmccit.xsl before goes through jats-html.xsl transform. can please point me in right direction? can't seem find answer online anywhere. you can try using xsltprocessor::transformtodoc() process first transformation , intermediate transformation result in domdocument object type. can pass domdocument object transformtoxml() final transformation result.

Chart.js - Getting data from database using mysql and php -

i'm trying convert static data using database results. i'll using mysql , php. this example code have var randomscalingfactor = function(){ return math.round(math.random()*100)}; var linechartdata = { labels : ["january","february","march","april","may","june","july"], datasets : [ { label: "my first dataset", fillcolor : "rgba(220,220,220,0.2)", strokecolor : "rgba(220,220,220,1)", pointcolor : "rgba(220,220,220,1)", pointstrokecolor : "#fff", pointhighlightfill : "#fff", pointhighlightstroke : "rgba(220,220,220,1)", data : [randomscalingfactor(),randomscalingfactor(),randomscalingfactor(),randomscalingfactor(),randomscalingfactor(),randomscalingfactor(),randomscalingfac

Marshall map to XML in Go -

i'm trying output map xml data, receive following error: xml: unsupported type: map[string]int marshalling maps works fine json don't why wouldn't work same xml. using struct way? i ended solving using xml.marshaler suggested dave c // stringmap map[string]string. type stringmap map[string]string // stringmap marshals xml. func (s stringmap) marshalxml(e *xml.encoder, start xml.startelement) error { tokens := []xml.token{start} key, value := range s { t := xml.startelement{name: xml.name{"", key}} tokens = append(tokens, t, xml.chardata(value), xml.endelement{t.name}) } tokens = append(tokens, xml.endelement{start.name}) _, t := range tokens { err := e.encodetoken(t) if err != nil { return err } } // flush ensure tokens written err := e.flush() if err != nil { return err } return nil } source: https://gist.github.com/jackspirou/4477e3

c++ - std::ostream to QString? -

is there way convert std::ostream qstring? allow me expand in case useful: writing program in c++/qt , used (not) deal / debug exceptions using std::cout, in example: std::cout << "error in void cat::eat(const bird &bird): bird has negative weight" << std::endl; now want throw errors qstrings , catch them later, write instead: throw(qstring("error in void cat::eat(const bird &bird): bird has negative weight")); my issue i've been overloading operator << can use many objects, instance bird , have written: std::cout << "error in void cat::eat(const bird &bird): bird " << bird << " has negative weight" << std::endl; is there way can throw qstring now? able write like: std::ostream out; out << "error in void cat::eat(const bird &bird): bird " << bird << " has negative weight" << std::endl; throw(qstring(out)); but doesn'

php - Multiple Associations to the Same Model in CakePHP 3 -

i using cakephp version 3.x. when query messagestable want users data the sender , receiver of message. have done many times in cakephp 2 cant figure out why isn't working in version 3.x. i have userstable , messagestable. userstable $this->hasmany('messages'); messagestable $this->belongsto('users', [ 'foreignkey' => 'sender_id', 'propertyname' => 'sender', ]); $this->belongsto('users', [ 'foreignkey' => 'user_id', 'propertyname' => 'receiver' ]); this query using $messages = $this->messages->find() ->where(['messages.user_id' => $this->auth->user('id')]) ->orwhere(['messages.sender_id' => $this->auth->user('id')]) ->order(['messages.created' => 'desc']) ->contain([ 'users.pictures', ]); i ge

python - Scrapy Limit Requests For Testing -

i've been searching scrapy documentation way limit number of requests spiders allowed make. during development don't want sit here , wait spiders finish entire crawl, though crawls pretty focused can still take quite awhile. i want ability say, "after x requests site i'm scraping stop generating new requests." i wondering if there setting may have missed or other way using framework before try come own solution. i considering implementing downloader middleware keep track of number of requests being processed , stop passing them downloader once limit has been reached. said i'd rather use mechanism in framework if possible. any thoughts? thank you. you looking closespider_pagecount setting of closespider extension : an integer specifies maximum number of responses crawl. if spider crawls more that, spider closed reason closespider_pagecount . if 0 (or non set), spiders won’t closed number of crawled responses.

How can I Vectorize this For Loop in MATLAB Code? -

i have loop (outlined below) in code takes while run. calc function have defined; dis matrix; y matrix; k vector. there way can vectorize code such away loop? contribution highly appreciated. for column = 1:n q(:,column) = calc(d,y(:,column), k(column)); end the calc function outlined below: function [x] = calc(a, y, s) [m, n] = size(a); % y m x 1 vector % s integer r = y; index_cols = []; atoms = []; = 1 : s [max_r, lambda_t] = max(abs(r'*a)); index_cols = [index_cols, lambda_t]; atoms = [atoms, a(:,lambda_t)]; x_t = pinv(atoms)*y; r = y - atoms*x_t; end x = zeros(n,1); x(index_cols) = x_t; end i expand on rayryeng's comment. vectorization means grouping elementary operations in such way can jointly handled low-level routine. bulk of execution time of code computation of pinv(atoms) ; else not expensive. if task saw several pieces of wood, can clamp them , saw them @ once. that's vectorization. but not work when you're mechani

c# - Error trying to modify JSON object in Fiddler -

Image
i'm trying change json object in fiddler can test different conditions varying http responses. however, after changing 1 string "ok" "warning", says there invalid text (at different position added) , no longer recognizes json object. first check 'unlock editing' on request want modify. using inspectors tab modify 'raw' value. however, when click 'json' tab, says there invalid text , no longer json object. i've tried modifying in editor, changing in fiddler no avail. is there way might recommend using fiddler change json object? help my problem response encoded. able modify values once clicked yellow bar in picture below.

javascript - How to pass a variable to jQuery's .fadeOut() -

i have object want pass .fadeout() . before that, here's how can pass object .click(): this.$title.click({story: this}, function (event){ var story = event.data.story; } simple enough. now want similar .fadeout : this.$title.fadeout("fast", {story: this}, function(){ var story = ??? }); which doesn't work. idea? how can pass this anon function? i'm looking cleanest solution. barring that, i'm looking solution that's in line i've done .click() . thanks! aside: there cleaner way pass this .click() ? this rather question js jquery; can that: var story = this.$title.click(function () { /* story still available */ }) this.$title.fadeout('fast', function () { /* same here */ }) or more fancy (this preserves content of story @ moment of assignment if gets overwritten in upper scope later on): this.$title.click((function (story) { return function () { /* story available */ /* passed $(...)

.net - How does returning a text from controller without a view show it in browser? -

this might silly question i'm curious , i'm sure i'll end knowing more what's going on. in typical .net mvc website, if create controller without view , return string index() function, string show in browser. so, without view, how happen ? my understanding server returns string , browser shows it. simple that. means browser creates html include text? feel i'm missing core concepts of web here. would appreciate details. browsers can read text, html, jpeg, xml, json, pdf , lot of other formats. aren't html exclusive. when return string, mvc doing writing response directly return buffer (aka response body) , setting content-type plain/text (i think?). and browser display server served.

memory leaks - Dumping heap of Go process at runtime -

we have go process in production using gigabytes more memory usual. it's suffered unusual memory leak. stopped input process allow gc settle. still running res of multiple gigabytes. there way attach process , dump heap in way can analyzed using hprof visualization tools? for now, can use runtime package write heap profile file, , analyze gpreftools visualization tool.

excel vba - Is there a way for Visual Basic to know if a 3rd party program is minimized? -

i trying make program in excel visual basic communicate a, rather archaic program, in company stores of sales information. i hoping way allow excel program know when 3rd party program done it's task. i have created macro within other program, ends minimizing program, , wondering if vba can know window of other program minimized or not. although realize found work-around in comments, thought i'd post solution else finds question. can use api call isiconic test whether window minimized: private declare function findwindow lib "user32" alias "findwindowa" _ (byval lpclassname string, byval lpwindowname string) long private declare function isiconic lib "user32" _ (byval hwnd long) boolean public sub example() shell "notepad.exe", vbminimizednofocus dim hwnd long hwnd = findwindow(vbnullstring, "untitled - notepad") debug.print isiconic(hwnd) end sub

android - Transition with new Material Design Support lib -

i've tried make animation floating action button new activity said in page : http://android-developers.blogspot.be/2014/10/implementing-material-design-in-your.html in section: activity + fragment transitions but don't see transition on screen. problem??? in original activity: <android.support.design.widget.floatingactionbutton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right|bottom" android:src="@drawable/ic_add_white_48dp" app:backgroundtint="@color/spg_rosa" android:transitionname="@string/transition_add_pdv" app:borderwidth="0dp" app:elevation="8dp" app:fabsize="normal" /> in destination activity, in mainlayout: <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" androi

How can I optimize this MySQL query, select rows that are NOT IN another table -

i have query: select * ( select ign, max(aktualizacja) wywalony, datediff(curdate(),max(aktualizacja)) wywalony_dni_temu dump_armijny group ign ) ign not in ( select distinct ign dump_armijny aktualizacja = ( select max(aktualizacja) dump_armijny ) ) order wywalony desc but takes ~2 seconds on 13k rows table, , grows fast, how can optimize it? here query: select a.* (select ign, max(aktualizacja) wywalony, datediff(curdate(), max(aktualizacja)) wywalony_dni_temu dump_armijny group ign ) ign not in (select distinct ign dump_armijny aktualizacja = (select max(aktualizacja) dump_armijny ) ) order wywalony desc; typically not exists more optimized not in , select distinct unnecessary in in subquery anyway. write query this: select

c# - Truncating HTML content at the end of text blocks (block elements) -

mainly when shorten/truncate textual content truncate @ specific character index. that's complicated in html anyway, want truncate html content (generated using content-editable div ) using different measures: i define character index n serve truncation startpoint limit algorithm check whether content @ least n characters long (text only; not counting tags); if it's not, return whole content it check n-x n+x character position (text only) , search ends of block nodes; x predefined offset value , n/5 n/4 ; if several block nodes end within range, algorithm select 1 ends closest limit index n if no block node ends within range find closest word boundary within same range , select index closest n , truncate @ position. return truncated content valid html (all tags closed @ end) my content-editable generated content may consist of paragraphs (with line breaks), preformatted code blocks, block quotes, ordered , unordered lists, headers, bolds , italics (which

Pass GNUplot variable to system(/usr/bin/awk) -

this command works in gnuplot script find line in file value -1.98 system("/usr/bin/awk '/-1.98/{print $2 $1}' /path/to/myfile.txt") given gnuplot variable stats_min_y resulting plot command, how pass stats_min_y system() call in place of -1.98 value? system("/usr/bin/awk '/stats_min_y/{print $2 $1}' /path/to/myfile.txt") and similar variants fail demand missing parenthesis. you can pass result sprintf directly system . example: a = system( sprintf("awk '/%g/{print $2,$1}' myfile.txt", stats_min_y) )

css - How to make iFramed form responsive in WordPress? -

i have website several years old. have updated several times. however, last time tried major update few years ago. created new install, added content, new theme ... few people filled out form , i've been hesitant since. ever since google's release of mobilegeddon (search algo update supposedly giving preference mobile friendly sites) adwords traffic has been cut in half. had hoped search algo update not effect paid ads driven traffic appears did. the old theme scaled fit on phone's screen. form got small conversion rate still good. google's own numbers show visitors prefer site - - 5 1 mobile on desktop. none of matters algo though traffic levels way down. so i've chosen responsive theme vendor like. scales except iframed form. i'm changing site , don't want change form well. if conversions go way or way down won't know if form or site responsible. so need way make form: http://forms.emmetrics.com/criminal_defense/ responsive on site: http:

matlab - How should I modify the initial guess for normalised version of optimisation task? -

i solving large optimization problem. problem contains 500 decision variables , few hundred constraints. since constraints tight , nonlinear, random initial guess doesn't yield solution. fortunately have initial guess can solve problem. initial guess obtained solving problem in dynamic simulation software. the problem , when normalize objective function ( [minf-f(x)]/range ), problem not converge solution. how should modify initial guess normalized version of problem? i using matlab

python - SQLAlchemy query occassionally throws StatementError -

i have flask application uses sqlalchemy connected mysql db running on production server (ubuntu machine). 75% of times issue post request application raises statementerror following stacktrace. [2015-06-18 17:25:46,512] {/home/dsaltares/conjugate/env/local/lib/python2.7/site-packages/flask/app.py:1423} error - exception on /conjugate/conjugate [post] traceback (most recent call last): file "/home/dsaltares/conjugate/env/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() file "/home/dsaltares/conjugate/env/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) file "/home/dsaltares/conjugate/env/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) file "/home/dsaltares/conjugate/env/local/lib/python2.7/site-packages/flask/app.py"

java - Spring security - Limiting access to my update profile page -

i using spring security in application , ran problem. application has update profile page. have added preauthorized() request mapping as @preauthorize("isauthenticated()") @requestmapping (value="/user/{uid}/profile/update", method = get) public string updateprofileview(@modelattribute("form") userprofileform form, @pathvariable ("uid") integer userid, model model){ it works fine, , unauthenticated user can not access page. but issue every authenticated user can access page . for example : user logged in application, he/she able update every one's profile. my customuserdetailservice class @service @transactional public class customuserdetailsservice implements userdetailsservice { @resource userservice userservice; @override public userdetails loaduserbyusername(string email) throws usernamenotfoundexception { com.analyst.future.domain.user user = userservice.getuser(email); simplegrantedauthority auth = new simpl

linux - Bash script to execute commands on system boot up -

i trying make bash script check 2 data values , weather or not set 1 or 0 want something. these values set on system bootup , defined after system (that why using while loop keep checking until defined): so far have this, getting error: #!/bin/bash shopt -s expand_aliases alias gd126='gdget 126' # output either 1 or 0 alias gd3='gdget 3' # output either 1 or 0 alias gd5='gdset 5 1' # set data 1 gd126 gd3 while true; if [ gd126 -eq 0 ] && [ gd3 -eq 1 ]; gd5; break; fi; done here output when run myscript.sh: [root@server tmp]# ./myscript.sh 0 0 ./myscript.sh: [: gd126: integer expression expected ./myscript.sh: [: gd126: integer expression expected could please tell me why? tried changing '-eq' '==' , stalls there no output. there no happy ending when using aliases, not in scripts. use functions instead. in case, use "$(somecommand)" if want output of com

io - how to reattach sys.stdout to console window in python? -

my python 3 doodling went this: import io, sys sys.stdout = io.stringio() # no more responses python terminal funnily enough my question how reattach when pass in 1+1 example it'll return 2 console? this in python interpreter on 32-bit python running on windows 7 64 bit. you're looking sys.__stdout__ : it can used restore actual files known working file objects in case have been overwritten broken object. however, preferred way explicitly save previous stream before replacing it, , restore saved object.

objective c - Problems with the loop of the array -

i new in ios. making app in getting data parse back-end working fine. application order , delivery of food. have cart add items. if product in cart added again, should increase quantity , not create 1 in basket. tried implement aid of loop not working should. product added instead of increasing quantity. hope assistance. + (void)additem:(pfobject *)item { cart *cart = [cart sharedinstance]; (nsuinteger = 0; < [cart.items count]; i++) { if ([item valueforkey:@"objectid"] == [cart.items[i] valueforkey:@"objectid"]) { nsdecimalnumber *sumqtynew = [nsdecimalnumber decimalnumberwithmantissa:1 exponent:0 isnegative:no]; nsdecimalnumber *sumqty = [nsdecimalnumber decimalnumberwithmantissa:1 exponent:0 isnegative:no]; sumqtynew = [item valueforkey:@"qty"]; sumqty = [cart.items[i] valueforkey:@"qty"]; sumqty = [sumqty decimalnumberbyadding:sumqtynew]; [[cart.items[i] valueforkey:@"obj

html - Two divs next to each other, one moves down when text is in the other -

i have 2 divs displayed using display: inline-block , in order have them next each other. works when neither of divs have text in them. however, when put text in 1 div, moves down dramatically, while other keeps same position. happens regardless of div put text in; if put in both, however, left div go down. here's codepen show mean: http://codepen.io/anon/pen/mwekpp @import url(http://fonts.googleapis.com/css?family=open+sans:400,700); #main_container { width: 1000px; height: 95%; margin: 0 auto; font-size: 0px; } #logo { display: inline-block; height: 200px; width: 200px; background-color: aqua; font-size: 20px; } #title_area { display: inline-block; font-size: 20px; height: 200px; width: 800px; background-color: rgb(60,105,123); font-family: "open sans"; font-size: 60px; } <div id="main_container"> <div id="logo_title_area">

excel - Dynamic formula or vba to offset a vertical list by one, and move the bottom of the list to the top? -

Image
here trying do, have sheet has list of names no duplicates varies in length. have either formula or vba sub, have next row copy original list of names , offset one, top name on original last name of second list. need have @ end 10 list none of same names in same row. here sample of i'd like. columnb columnc columnd columne name1 name2 name3 name4 name2 name3 name4 name1 name3 name4 name1 name2 name4 name1 name2 name3 like game of sudoku, none of names in each row or column can have duplicate. i not sure how best achieve since mentioned above length of list variable. ideally i'd create first list, have other 9 list auto populate. suggestions? edit___________________ @paul drye, following results formula columnb columnc columnd columne name1 name2 name3 name4 name2 name3 name4 name1 name3 name4 name1 name1 name4 name1 name1 name1 as can see, last 2 column

Setting an object attribute from a hidden field Ruby on Rails -

i'm trying update idea attribute challenge_id through hidden form field. here field: <%= f.hidden_field :challenge_id, :value => @challenge.id %> it passes challenge id param when idea created idea controller#create method: started post "/ideas.js" ::1 @ 2015-06-18 15:39:49 -0400 processing ideascontroller#create js parameters: {"utf8"=>"✓", "idea"=>{"title"=>"adsf", "description"=>"asf", "domain_tokens"=>"20", "challenge_id"=>"5"}, "commit"=>"create idea"} this challenge_id => 5 should saved idea in line @idea = idea.new(idea_params) below: ideas_controller.rb def create @idea = idea.new(idea_params) respond_to |format| if @idea.save idea_count = @idea.user.ideas_created_count @idea.user.update(:ideas_created_count => idea_count + 1) @idea.domains.

Apache Rewrite to File System Or Proxy -

i want create apache mod_rewrite rule two things : serve contents of file system directory when /file-system-target requested and proxy whenever /file-system-target not requested. e.g.: rewriterule ^/file-system-target /path/to/file/system/target [l] rewriterule ^/(.*) http://localhost:8080 [p] however when watching output of rewritelog , latter rule matched , former never matched . missing? as turns out, statement "latter rule matched & former never matched" may not have been true; had confusing httpd.conf in rewrite logging enabled in more 1 place. in event, first rule incomplete. should this: rewriterule ^/file-system-target(.+)$ /path/to/file/system/target/$1 [l] i added additional rule handle (lack of) trailing slash: rewriterule ^/file-system-target$ /path/to/file/system/target/$1 [l] so ended with: rewriterule ^/file-system-target$ /path/to/file/system/target/$1 [l] rewriterule ^/file-system-target(.+)$ /path/to/file/system/t

Where in Django project to store a single image file that is never served to the user -

suppose have django project contains view generates pdf, , requires logo on top of pdf. logo stored image file, , not ever referenced in template. static files stored in s3 bucket. it feels logo should not static file, since not need stored in s3. user should never grab file directly; view generates pdf thing ever open file. file not need url see online. feels isn't media file, since not uploaded user. lastly, don't think needs stored in database, image not have "model" of other objects ever need created. where in project structure should type of file stored? there standard location type of file? you can use multiple storage classes. suppose default_file_storage = 'storages.backends.s3boto.s3botostorage' . can still create exeption default this: from django.db import models django.core.files.storage import filesystemstorage fs = filesystemstorage(location='/media/photos') class car(models.model): ... photo = models.imagefie

Kotlin JS - string to number conversion? -

how string number conversion in kotlin js app. using following code , having trouble converting htmlinputelement value double. fun c2f(self: any) { console.log("self object: ${self} ") val celsius = document.getelementbyid("celcius")?.getattribute("value") double val fahrenheit = celsius * 1.8 + 32 console.log("fahrenheit value: ${fahrenheit} ") window.alert("celcius (${celsius}) -> fahrenheit (${fahrenheit}) ") } also not seeing todouble() function on string class in case of jvm app. answering own question helpful somebody. you can use kotlin.js top level parse functions string <-> number conversion. fun parseint(s: string, radix: int = 10): int fun safeparseint(s : string) : int? fun safeparsedouble(s : string) : double?

css - Sticky Footer not working with mobile responsive Off-Canvas Menu -

i using bootstrap sticky footer , off-canvas menu. sticky footer works fine on desktop view, footer begins overlap content on mobile view. think due .row-offcanvas position being set relative on mobile media query. if remove offcanvas menu sticky footer works expected on mobile devices. other issue when scroll down in mobile view white space appears under footer. <!doctype html> <html lang="en"> <head> <!-- bootstrap core css --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- custom styles template --> <link href="css/master-simple.css" rel="stylesheet"> </head> <body> <div class="container-fluid"> <div class="row row-offcanvas row-offcanvas-left"> <header> <div class="container">

java - Portable datasource jndi for JBoss and OC4j -

i new jboss development, migrating 1 application oc4j jboss, came know jndi names different in oc4j , jboss application server, have 1 jndi datasource named jdbc/sampledatasource in oc4j datasource configuration. have done configuration jboss named java:/jdbc/sampledatasource. as ear should able deploy on both application server, facing issues while making code compatible jboss oc4j for e.g @resource(mappedname = "jdbc/sampledatasource") private sampledatasource datasource; how can make above parameter compatible jboss oc4j jndi name different in both server? there bean level data source injection: @resource( name = "jdbc/sampledatasource", type = javax.sql.datasource.class, mappedname = "jdbc/sampledatasource", authenticationtype = resource.authenticationtype.container), so please let me know changes need perform make code compatible jboss as7 , oc4j well.

html - CSS selector not working with children -

i want add css rules .container.picture in .medium-width. html is: <div class="block medium-width"> <div class="container picture"> <img src="img/car4.png" title="car"> </div> <div class="container text"> </div> </div> css is: .medium-width > .container.picture { width: 50%; float: left; } is wrong in selector? no. may have other rules applied, or context prevent selector working. here, selector's right

opencv - Understanding Snake -

i trying make snake active contour program , been looking @ different websites shows how programmed snake none of them explain cv_value or coefficient usage , how initialized it. here code working on not know problem is. void snake(mat copy){ threshold(copy, copy, 170, 255, cv_thresh_binary); float alpha = 0.1; //continuity snake float beta = 0.5; //curvature snake float gamma = 0.4; //movement snake //have odd cvsize size; size.width = 5; size.height = 5; cvtermcriteria criteria; criteria.type = cv_termcrit_iter; criteria.max_iter = 10000; criteria.epsilon = 0.1; int cpt = 40; cvpoint pointsarray[5]; pointsarray[0].x = 0; pointsarray[0].y = 95; pointsarray[1].x = 5; pointsarray[1].y = 95; pointsarray[2].x = 10; pointsarray[2].y = 95; pointsarray[3].x = 15; pointsarray[3].y = 95; pointsarray[4].x = 20; pointsarray[4].y = 95; //the code (image, points, length, alpha (consistency), beta (curve), gamma (movement), coefficien

arrays - knockout foreach add row number to grid -

Image
i have grid fills array within array. creates according 1 array , fills column array. <div id="formula" data-bind="with:currentformula"> <!-- ko foreach:$parent.tones--> <div class="col-sm-2" data-bind="foreach:$parents[1].levels"> <a href="#" class="thumbnail img-responsive" data-bind="click: $root.hascurrent() ? $root.currentformula().setending.bind($index(),$parentcontext.$index()) : $root.currentformula().setstarting.bind($index(),$parentcontext.$index())"> <img data-bind="attr:{ src: '/content/images/colors/' + $index() + $parentcontext.$index() + '.png' }" alt="" /> </a> </div> <!-- /ko--> </div> what need create new column before col 1 , add $index() + 1, or row number work column. i've looked on , have not found works. how t

c# - Creating buffer/ processing multiple files SSIS -

i have watch folder task monitors folder. when file dropped runs execute package task. have loop make run time. i'm having problems when 2 files dropped before execute package task completed. there 2 files coming in @ once. need process both files. is there way of doing this, maybe create buffer keep track of files coming in folder? this different other question suggested because files not in folder. moved folder @ random times, , multiple files can come in @ once. understood other question suggested files in folder when package executed. not case.

ruby on rails - RSpec expect HTTP error status -

in example, create project, send post create project same name. should, raises activerecord::recordnotunique. want check returns 409 http status, since raises error, automatically fails test. how can check returns 409? require 'rails_helper' rspec.describe 'project requests', type: :request 'refuses duplicate projects' project_1 = factorygirl.create(:project) post '/projects', name: project_1.name expect(response.status).to eq(409) end end here's rspec output: failures: 1) project requests refuses duplicate projects failure/error: post '/projects', name: project_1.name activerecord::recordnotunique: pg::uniqueviolation: error: duplicate key value violates unique constraint "index_projects_on_name" detail: key (name)=(dr. brain) exists. : insert "projects" ("name", "created_at", "updated_at") values ($1, $2, $3) returning &

powershell - Script to add protection status registry key -

i need create script in powershell following ps command , create registry key in computer\hkey_local_machine\software\policies\microsoft\fve results of "protection status: protection off or on". ps> manage-bde -status -cn localhost see output sample below: bitlocker drive encryption: configuration tool version 6.1.7601 copyright (c) microsoft corporation. rights reserved. computer name: localhost disk volumes can protected bitlocker drive encryption: volume c: [osd] [os volume] size: 232.59 gb bitlocker version: windows 7 conversion status: encryption in progress percentage encrypted: 45% encryption method: aes 128 diffuser protection status: protection off lock status: unlocked identification field: none key protectors: tpm to determine whether protection on or off: [string]$protectionstatus if(@((manage-bde -status -cn localhost) -like '*protection on').coun

java - Type check in a Json String -

i wrote method verify types of json string: public static boolean loginmessagecheck(string json){ boolean ret = false; jsonobject o = new jsonobject(json); object ty = o.get("type"); object ex = o.get("expansions"); if(ty instanceof string){ if(ex instanceof string[]){ ret = true; } } return ret; } so testing method this. public static void main(string[] args){ string[] expansions= {"chat", "test"}; loginmessage_client lm = new loginmessage_client("login", expansions); gson gson = new gson(); string json = gson.tojson(lm); system.out.println(loginmessagecheck(json)); } it returns false because of - if(ex instanceof string[]). how can check if array string array? because if(ty instanceof string) and ty being not string

javascript - Json Data Structure Issue -

i list data following structure: the datas published today: data1, data2, datas published yesterday: data1, data2 i data in json format. how json structure should data that? the html structure is: <div class="list dark"> <div class="item item-divider"> today </div> <a class="item item-avatar-left" href="#"> <img src="image"> <h2>tyrant</h2> <p>desc</p> </a> <a class="item item-avatar-left" href="#"> <img src="image"> <h2>tyrant</h2> <p>desc</p> </a> <div class="item item-divider"> yestarday </div> <a class="item item-avatar-left" href="#"> <img src="image">