Posts

Showing posts from August, 2011

ruby on rails - Carrierwave and Jcrop not cropping with Minimagick -

i'm following ryan bates tutorial on how crop images carrierwave , jcrop. but, images not being cropped. x,y,w,h values being passed in parameters, no cropping taking place. im using minimagick. appreciate someone. i've followed similar issues in stackoverflow none give solution. thank you photo_uploader process :resize_to_fit => [800,800] version :big process :resize_to_limit => [800,600] process :convert => 'jpg' end version :thumb, :from_version => :big process :crop resize_to_fill(100,100) end def crop if model.crop_x.present? resize_to_limit(600, 600) manipulate! |img| x = model.crop_x.to_i y = model.crop_y.to_i w = model.crop_w.to_i h = model.crop_h.to_i img.crop "#{model.crop_x}x#{model.crop_y}+#{model.crop_w}+#{model.crop_h}" img end end end view <%= image_tag @photo.photo_url(:big), id: "cropbox" %> m...

networking - Local Area Connection State: Batch File -

i trying write batch script identify whether or not "local area connection" adapter plugged in or not. set nicvalue= /f "delims=" %%a in ('netsh interface show interface "local area connection"') @set nicvalue=%%a echo %nicvalue% if "%nicvalue%"=="connect state: connected" echo on i able right output , save variable called %nicvalue% , however, not able run 'if' command based off of output. of right now, trying echo "on" if batch file can see "connect state:" , "connected", @ loss. appreciated! why don't filter : , in for /f loop , clean value. so: set nicvalue= /f "tokens=3 delims=: " %%a in ('netsh interface show interface "local area connection"') @set nicvalue=%%a echo %nicvalue% if "%nicvalue%"=="connected" echo connected but think issue using echo on statement, you're turning echo on s...

java - App cannot pass values between activities -

i working on app in user inputs number 1 activity, , number shows on next activity. have far. first activity: entertext.java public class entertext extends activity { //this string passed next activity public static string mynumber = "com.example.listviewexplorer.message"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_enter_text); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.enter_text, menu); return true; } //this onclick, button invoke sendmessage //sendmessage supposed start next activity public void sendmessage(view view){ intent intent = new intent (this, displaytext.class); edittext edittext = (edittext) findviewbyid(r.id.edittext1); mynumber = edittext.gettext()...

d3.js - How does D3's projection function work for paths and points? -

my understanding of d3's projection functions same thing scale functions. map gps coordinates pixel coordinates. projection i'm using. (i don't understand variables in detail fiddled around them until map showed up) var projection = d3.geo.albers() .center([-122.436269,37.798107]) .rotate([0, 0, 0]) .parallels([36, 38]) .scale(300000); this draws map fine: .attr("d", d3.geo.path().projection(projection)) when try plot points though numbers crazy. .attr("cx",function(d) { return projection([d._lon,d._lat])[0]; }) .attr("cy",function(d) { return projection([d._lon,d._lat])[1]; }); how this? here examples of points i'm getting through projection function: [5175.3799972560955, 1808.5108650794136] [5158.315547249338, 1823.564395627589] [5143.958532762888, 1831.9879789081751] on 1280x800 screen these way off. if scale them dividing 100, they'll...

html - PHP image gallery from given folders -

i using following code output folders inside directory: $path = 'uploads/eventos/'; $results = scandir($path); foreach ($results $result) { if ($result === '.' or $result === '..') continue; if (is_dir($path . '/' . $result)) { echo $result."<br />"; } } then use files (images), inside each of directories found: $dirname = "uploads/eventos/directory1/"; $images = glob($dirname.'*.{jpg,jpeg,png,jpg,jpeg,png}', glob_brace); this works. idea being able generate similar image gallery. first list of "links" folders, when click, open in same page showing images inside. please, point me information? need simple solution, learning, not complex image gallery. :) thank you!! ---- edit ---- clear explanation! i have folder structure (for example): folder1/ image1.jpg image2.jpg ... folder2/ image1.jpg image2.jpg image3.jpg ... i'd able o...

xmlhttprequest - Excel 2010 VBA - XMLHTTP -

what purpose of these lines of codes: xmlhttp.setrequestheader "content-type", "text/xml" xmlhttp.setrequestheader "user-agent", "mozilla/5.0 (windows nt 6.1; rv:25.0) gecko/20100101 firefox/25.0" i have tried running xmlhttp code .open"get" , .responsetext statements , w/o above 2 lines , didn't notice difference in outputs. missing or 2 lines ensure significant parameters? using excel 2010 vba. appreciate insight... the content-type entity-header field indicates media type of entity-body sent recipient or, in case of head method, media type have been sent had request been get. if no file content uploaded, not server purpose in request header. the user-agent request-header field contains information user agent originating request. statistical purposes, tracing of protocol violations, , automated recognition of user agents sake of tailoring responses avoid particular user agent limitations. in many cases, s...

android - Parse join query using Javascript pointer -

Image
i have 2 parse objects 'content' , 'detail' below have added screen shot of both classes in data browsers. i have column in 'content' called descid detail objects objectid , pointer 'detail' class. need know how obtain data both classes. attempt var details undefined. var ibeacon = parse.object.extend('details'); var content = parse.object.extend('content'); var query = new parse.query(ibeacon); query.include('descid'); query.find({ success: function(results) { // // returned parse.object values (var = 0; < results.length; i++) { var object = results[i]; var details = object.get('details'); (function($) { $('#ibeacontable').append('<tr><td id = "uuid" >' + object.get('uuid') + '</td><td = "proxid">' + object.get('proximity') + '</td>...

Adding a VersionOne expression using the REST API -

i trying create new 'expression' in versionone - adding new 'comment' conversation. in theory, rest-1.v1/data api should allow this, can't figure out how - there precious little documentation using api (using post) create objects. fwiw, here's i'm doing (after accessing server valid credentials): url: /rest-1.v1/data/expression xml: <asset href="<server base uri>/rest-1.v1/data/expression"> <attribute name="assettype">expression</attribute> <relation name="inreplyto" /> <attribute name="authoredat">2014-05-28t21:48:37.940</attribute> <attribute name="content">a new comment</attribute> <attribute name="assetstate">64</attribute> <relation name="author"> <asset href="<server base uri>/rest-1.v1/data/member/2015" idref="member:2015" /> </relation> <relation nam...

javascript - Angular to check a particular checkbox automatically -

i have form few checkboxes , form being processed via angularjs. have no knowledge angular read find solution problem. want checkbox checked automatically when form load. when @ codes below don't understand need help. html: (i think dynamically generates few < li > options in form gui) <ul class="sublist" style="padding-top:{{ $index * 38}}px;" ng-init="index=$index" ng-if="foractive == k" ng-repeat="(k, v) in fordata"> <li class="selected" ng-repeat="val in v"> <a href="" title="">{{ val }} </a> <input value="{{ k }} > {{ val }}" type="checkbox" class="flc" ng-click="addforvalue(k + ' > ' + val)" /> </li> </ul> content of array in angular: $scope.design.fors = [adults > men,adults > plus] for example, when form load, checkbox value = adults > ...

How can you nest curly-braced model delimiters in AngularJS? -

i have app user can select database table name dropdown, app makes http call out database, retrieves table column names data columns, , returns data script. far, good. code set handle fact not know table - column names, nor how many columns table has. dump data object called tabledata, tabledata.columns contains of column names , tabledata.results contains data contained in rows columns in database. object may this: { "columns": [{ "name": "lo_code"}, { "name": "lo_desc"}, { "name": "lo_inactive"}], "results": [{ "lo_code": "7" , "lo_desc": "staff area 7" , "lo_inactive": "0"}, { "lo_code": "12", "lo_desc": "staff area 12", "lo_inactive": "0"}, { "lo_code": "15", "lo_desc": "staff area 1...

android - Restrict zoom in webview app -

Image
i have simple android webview app little except load url , display , links within app. via css, i've set webpage 720px x 1280px (theoretically) fill screen of galaxy s3 completely. within webview's java code, i've tried make page cannot zoomed in or out, , displays fullscreen, following code: requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); mwebview.getsettings().setsupportzoom(false); mwebview.getsettings().setloadwithoverviewmode(true); mwebview.getsettings().setusewideviewport(true); i've verified webpage right size (720 x 1280) using css ruler built, can see, webview app doesn't display @ scale when loads: i can double-tap on screen , zoom in, though thought disabled zoom in java code. then, doesn't zoom 100%...it zooms more that: so basically, how manipulate webview show page @ desired size, without allowing user change scale? ...

c++ - To check whether an integer is a palindrome in O(1) space(Wrong answer) -

i tried solving question reversing number ,using bitwise operations:- example if number's binary representation 00000110 ,what code is, send 0000011 code , left shift reverse_num 5 times 01100000, reverse of original,after program "&" of number original number.if answer 1 ,then number said palindrome else false returned.is there flaw in logic? if there ,i think it's in & part. class solution { public: bool ispalindrome(int x) { if(x<0) return false; int num=x; int reverse_num=x; int count=sizeof(x); num >>= 1; while(num) { reverse_num <<= 1; reverse_num |= num & 1; num >>= 1; count--; } reverse_num <<= count; if(!(reverse_num&x)) return true; else return false; } }; i still want know wrong previous code . sorry asking such...

xml - Does ss:AutoFitHeight work for text? -

i have xml file save .xls work on in excel: <results> <result> <companyname>fnatic</companyname> <serviceid>1045</serviceid> <startdate>01-01-2014 00:00:00</startdate> <enddate>01-02-2014 00:00:00</enddate> <hours>1</hours> <description>couple of paragraphs of text. 3 of them.</description> </result> ... more results </results> i use excel xml define structure , styles of xml data. thing left make "description" cell, merged set of columns, adjust height automatically amount of text in it. ss:row seems have ss:autofitheight . no changes happen resulting .xls file when utilize them. ss:autofitheight not work text ss:autofitwidth doesn't work text in ss:column ? ... rest of typical declarations <xsl:template match="results"> <styles> <style ss:id="default"...

c# - Query SQL Server CE to Listbox (Windows phone) -

i have code: public void mostrar(listbox medicinas_visual) { var query = medicamento in usuario_data.current.medicamento orderby medicamento.id_med select new {medicamento.id_med, medicamento.nombre}; medicinas_visual.itemssource = query.tostring(); } and when execute code returns: {id_med = 1 nombre= prepilon} string query, when want returns values code xaml of listbox listbox x:name="medicinas_visual" margin="0,56,0,4" fontfamily="/li_health;component/fonts/fonts.zip#helvetica s" fontsize="24" horizontalalignment="left" width="166"/ implement this. should work: display id_med , nombre listbox xaml: <listbox x:name="medicinas_visual" margin="0,56,0,4" fontfamily="/li_health;component/fonts/fonts.zip#helvetica s" fontsize="24" horizontalalignment="left" width="166"> <listbox.i...

javascript - Setting up disclosure triangles for Bootstrap 3 accordion -

i pretty frustrate bootstrap 3 accordion control doesn't seem have built-n class toggle open/close on heading of accordion. i need have accordion 1 css class on header when child open, , closed. i'm close following code, doesn't cover situation when user closes , opened pane without choosing different pane -- works right if keep choosing different panes. the 3 things need headers correctly show state: when pane set opened default (add "in" class html of pane) when manually opened or closed, show right class when closed clicking different pane open i far have $(function() { $('h4.panel-title').each(function() { // check headers see if have open children var isopen = $(this).closest('.panel').find('.panel-collapse').hasclass('in'); // and, if yes, set class "open" if (isopen) { $(this).addclass('open'); } }); $('h4.panel-title...

powershell - table not showing output in new line -

Image
i'm sure there simple solution, i'm stuck. output in members column this {domain\domain admins, domain\joerod... how can show $member value on each line? function get-admingroups{ foreach($i in (get-content c:\users\joerod\desktop\remove_users.txt)){ #test if machine on network if (-not (test-connection -computername $i -count 1 -quiet -erroraction silentlycontinue)) { write-warning "$i unavalible" "`r" } else { (invoke-command { $members = net localgroup administrators | ? {$_ -and $_ -notmatch "command completed successfully"} | select -skip 4 new-object psobject -property @{ computername = $env:computername users=$members } } -computer $i -hidecomputername | select * -excludeproperty runspaceid ) } } } get-admingroups |ft table powershell format share | improve question asked may 29 '14...

How to add highlight to php tags in netbeans -

in netbeans these tags default appear plain text black no highlight: <?php ?> i'd highlight them light color, don't see them option in tools > options >fonts , colors> highlighting, , not in php or misc options either. never mind found option here: under tools > options > fonts & colors > syntax language: php php open/close tag

scatterplotMatrix in R: explanation of options -

Image
quick question scatterplotmatrix "car" package. pulling data excel r analysis, i'm unsure of lines being plotted , "car" package info on cran isn't specific. have code below: clipboard <- read.table("clipboard",sep="\t",header=t) view(clipboard) x1 x2 x3 x4 3 1 5 3 1 1 5 4 2 1 6 1 3 2 5 2 1 1 5 4 2 1 6 5 3 2 6 4 2 2 5 3 3 2 6 2 1 1 5 5 3 2 3 3 2 2 5 4 3 2 3 3 2 2 5 3 3 1 6 5 scatterplotmatrix(~x1+x2+x3+x4,clipboard) thick red line regression curve, dotted lines? defined confidence interval bound? know diagonals kernel densities, green line? green line particular smoothing function? the green line (straight) robust-regression line each pair. the thick red line (curvy) non-parametric regression smoother (default gam, change it) the dotted red lines represent confidence envelope smoother (more specific description in sprea...

javascript - Assigning returned JSON to global variable in chrome -

this code: var accountstatus; function getaccountstatus() { $.ajax({ type: "post", url: "/getaccountstatusjson.php", async: false, data: "id_alumno=1", datatype: "json", success: function (account) { console.dir(account); accountstatus= account; console.dir(accountstatus); } }); } and output of these console.dir lines: (apparently can't use images i'll have write out.) chrome: object adeudo: "840" descuento: "0" total: "840" [object object] firefox: adeudo: "840" descuento: "0" total: "840" adeudo: "840" descuento: "0" total: "840" so json object copied global variable in firefox, in chrome can't use json global variable, if try print example: accountstatus.total "undefined" value. miss...

c++ - Server - Client RSA keypair exchange -

i'm new programming , i've got little project going diploma , need on little code. server->client c++ code server generates , sends rsa keypair client. problem both server , client codes compiled without problem when start client side doesn't keypair blank. here server code: #include <iostream> #include <cstdlib> #include <openssl/ssl.h> #include <openssl/err.h> #include <openssl/rsa.h> #include <openssl/pem.h> #include <stdio.h> #include <string.h> #define key_length 1024 #define pub_exp 3 #define print_keys #define write_to_file using std::exit; #define int_error(msg) handle_error(__file__, __line__, msg) void handle_error(const char* file, int lineno, const char* msg) { std::cerr << "\n** " << file << ":" << lineno << " " << msg << "\n"; err_print_errors_fp(stderr); exit(-1); } void init_openssl() { std::cout << ...

jQuery UI Dialog Iframe - Remove From Browser History Upon Close -

i use jquery ui dialog iframe in order provide in-page "pop-up" editing. every time dialog opened, adds 2 requests browser history: 1 url loaded when opened, , 1 setting src blank when dialog closed. if end-user clicks button, don't see happening, because it's going in iframe no longer being displayed. so, understand why happening, i'm having trouble figuring out how prevent it. there way "rewind" history on iframe when closed? $(document).ready(function() { var $iframe = $('<iframe id="uidialogiframe" data-reload="0" frameborder="0" marginwidth="0" marginheight="0" width="800" height="450" />'); var $dialog = $('<div id="uidialogiframewrapper" />').append($iframe).appendto('body').dialog({ autoopen: false, modal: true, resizable: false, width: 'auto', height: 'auto...

php - Preg Match a string with $, numbers, and letters -

i'm trying preg_match string. $word = "$1$s"; or $word = "$2$s" if(preg_match('/^\$[1-9]{1}\$s$/' ,$word)){ echo 'true'; } else { echo 'false'; } i tried not giving true result. how can make true. php trying render variable $s in double quoted string . use single quotes instead , can remove {1} inside regular expression because not necessary. $word = '$1$s'; if (preg_match('/^\$[1-9]\$s$/', $word)) { echo 'true'; } else { echo 'false'; } you can escape $ in double quoted string: $word = "$1\$s"; // note $1 doesn't need escaped since variables can't start numbers finally, can see why wasn't working seeing $word equaled (with error reporting enabled): $word = "$1$s"; // notice: undefined variable: s on line # echo $word; // $1

java - Rendering exponential and periodic Julia fractals -

Image
i've read how render julia fractals here . i'm pretty thorough two-degree julia sets equations of form f(z)=z 2 +c don't know how render complex julia functions f(z) = e z - 0.65 , other complex functions involve sine , cosine. how render these type of functions? also, color mapping should used in exponential functions? for instance want achieve following image , others given on wikipedia page . edit : here tried: complexnumber.java package plane.complex; /** * code>complexnumber</code> class implements complex numbers in java. * includes basic operations can performed on complex numbers such as, * addition, subtraction, multiplication, conjugate, modulus , squaring. * * @author abdul fatir * @version 1.0 * */ public class complexnumber { /** * real, re(z), part of <code>complexnumber</code>. */ private double real; /** * imaginary, im(z), part of <code>complexnumber</code>. */ private double imaginary; /...