Posts

Showing posts from May, 2014

python - Library needs to store object in a Web session: suggestions on API design -

python - Library needs to store object in a Web session: suggestions on API design - i'm developing openid consumer library [1] job in 2 separate web requests: when user requests authentication library discovers info url provided user. this info used during web request when library finishes authentication. i want advice on how best design library api persisting "discovery information" between 2 requests: i inquire caller provide own session object both calls , library store , read own object it: result = openid.request(session, url) # stores discovery in `session` # ... openid.authenticate(session, auth_data) # reads discovery `session` i don't aesthetically looks inversion of control: bring own buffer, we'll utilize you. also, "session" not well-defined interface , may expose limitations. example, sessions in django default want store json-serializable objects , object representing discovery info of custom class json doesn't ...

c - When a library my program depends depends on another library -

c - When a library my program depends depends on another library - when library programme depends depends on library, shall specify both libraries when compile programme either static or dynamic linking? when compile programme dynamically linking, shall create both libraries found during loading? thanks. when exe depends on dll should add together import library a.lib linker when linking exe. when dll depends on dll b should add together import library b.lib linker when linking a.dll. when run exe both dlls shall available in search path. edit building executable module (i.e. exe or dll) comprises compiling of source files , linking compiler output libraries executable. when consume dll #include header file defines interface dll while compiling sources. import libraries of dlls (a.lib, b.lib) not required here. in sec stage of build process linker creates executable module. linker input compiler output, static libraries, import libraries of runtime ms...

c - How represent in printf a variable type unsigned long -

c - How represent in printf a variable type unsigned long - this question has reply here: how printf “unsigned long” in c? 6 answers to print var of int in printf have %i or %d should add together unsigned long %lu right format specifier unsigned long c printf

python - Searching a blob for a string -

python - Searching a blob for a string - i have base64 blob have loaded database. have decoded , need search string. blob can , contain binary (non printable) bytes. my code far simply for row in cursor: b = base64.standard_b64decode(row[2]) so need find position of string 'xyx' in b a "binary blob" string in python, can utilize str.index : i= b.index('xyx') i becomes value of 0-based index of position of 'xyx' in b . note count bytes, not characters. you can utilize str.find , if don't want raise exception in case 'xyx' not in b python string search

java - Different parameters for dev and production environments using Gradle -

java - Different parameters for dev and production environments using Gradle - in android java project gradle build configured using android studio ide, want have variables alter according build environment. for instance, if there's public static final boolean use_local_backend = false; in utils.java, production should have false value , development may want have true utilize local server debugging. i'm not expert gradle, i'd appreciate detailed guide on how configure project have 2 different properties files each environment, each has same keys different values. the simplest solution, far, move use_local_backend buildconfig : android { // other stuff here buildtypes { debug { buildconfigfield "string", "server_url", '"http://test.this-is-so-fake.com"' } release { buildconfigfield "string", "server_url", '"http://prod.this-is-so-...

c# - Why does switching my logo give me a corrupt PDF file? -

c# - Why does switching my logo give me a corrupt PDF file? - i creating pdf file in asp.net c# windows console application, using itextsharp. i have 1 piece of code. if site 'lmh', pdf can open adobe reader. if not, error: there error processing page. there problem reading document (114). here code: string applicationpath = system.io.directory.getcurrentdirectory(); pdfptable table = new pdfptable(4) { totalwidth = 800.0f, lockedwidth = true }; float[] widths = new[] { 80.0f, 80.0f, 500.0f, 140.0f }; table.setwidths(widths); table.horizontalalignment = 0; table.defaultcell.border = 0; if (activeprofile.site == "lmh") { image hmsimage = image.getinstance(applicationpath + "\\" + "hms logo.png"); hmsimage.scaletofit(80.0f, 40.0f); pdfpcell hmslogo = new pdfpcell(hmsimage); hmslogo.border = 0; hmslogo.fixedheight = 60; table.addcell(hmslogo); } else { image blankimage = image.getinstance(applicationpath + ...

How to have my PHP script make images square, while maintaining their original ratio? -

How to have my PHP script make images square, while maintaining their original ratio? - i have been developing website time now, , looking create improve 1 little detail. currently, when user creates , account, can view "my page" , sorts of things, including alter profile image default 1 have provided, whatever want. unfortunately, if upload image ratio of greater or less 1:1, i.e. 300x200, script re-size fit avatar form, keeps ratio, , makes image float top of box. here image of avatar not have 1:1 ratio: as can see, image describe above. time makes perfect square when image user uploads has 1:1 ratio. here example: obviously, unreasonable expect user upload 1:1 image. looking help me tweak script, provide, on avatar uploads, if image has 1:1 ratio, pretty much mount image black "canvas", lack of improve wording, , center image on canvas both vertically , horizontally. here mean, using image edited in photoshop give black canvas: as can see, prof...

vb.net - How do I construct the initial ConnectionString for EF 6.0 and above? -

vb.net - How do I construct the initial ConnectionString for EF 6.0 and above? - vs2013 update 3, ef 6.1 using code first, vb i have both mvc5 project , forms project in place larn how utilize ef 6. both projects work fine in local environment , both default utilize .\sqlexpress server. notice these initial template projects not have connectionstring in ~.config files. however, mvc5 project has defaultconnectionfactory element forms project has nil related ef. 1) how these projects establishing connection sql server? 2) if want connect different sql server add together connectionstring element ~.config file? assuming reply (2) above correct, first create connectionstring specify same connection in utilize have known spot work from. i found should valid connection string constructions in server explorer, have details of 'data source', 'initial catalog', , 'integrated security' flag. don't understand utilize name element of connectio...

symfony2 - query builder add condition on field type array -

symfony2 - query builder add condition on field type array - my question simple : possible add together statment using doctrine , query builder on field type array ? inside entity have next : /** * @var array * * @orm\column(name="weekdays", type="array") */ private $weekdays; in object view array this: array( 1 => false, 2 => false, 3 => true, 4 => false, 5 => false, 6 => false, 7 => false ); an it's representation 1 time serialize , inserted database : a:7:{i:1;b:0;i:2;b:0;i:3;b:1;i:4;b:0;i:5;b:0;i:6;b:0;i:7;b:0;} what seek accomplish : $q = $this->em->getrepository('acmebundle:notification') ->createquerybuilder('n') ->andwhere('e.weekdays = :day') <-- wrong ->setparameter('day', date('n')) ; typically result in sql select * notification weekdays '%i:1;b:1%' -- if date('n') = ...

SSL on MQ : CPU Performance -

SSL on MQ : CPU Performance - i deploy ssl on mq server know if current cpu capacity back upwards ssl. (i not have budget increment number of cpu cores , mq pvu) my specs: windows 2003 server sp2, 1 core of intel xeon cpu e5-2690 2.9ghz, 2 gb ram, 1 qmgr, linear logging, persistants messages, dqm 5 parteners, 10 senders channels, 10 receivers channels for month: we exchange in average 3 1000000 messages our partners on total of 15gbytes of data. (so 5k per message). had in average variations of cpu between 20% , 40% had 4 peaks of 100% cpu do think scheme can cope ssl cipher rc4_md5_export ? best regards, pascal i don't think it's possible provide definitive reply whether server can cope enabling ssl using rc4_md5_export cipher on mq channels short of trying , assessing impact. may want take @ processor queue length using windows performance monitor tool see how many processes waiting cpu time when usage increases. as cpu provides hardware ...

html - Overflowing navbar to a second row using Bootstrap -

html - Overflowing navbar to a second row using Bootstrap - i'm getting started bootstrap, , doing designed page myself scratch. i'm still stuck on navbar of now. here's how want work: on desktop/tablets, should work conventional navbars, 1 header element on left , list of alternative on right. on mobile, however, instead of having navbar collapse menu, want - of - move row within navbar. i tried making class of part want overflow "sidebar", list still renders vertically, collapse menu. a friend of mine has implemented on site @ "thepickletheory .com" (can't add together direct link lack of reputation), , works there. he's used wordpress theme, however, , code isn't in bootstrap too, can't implement myself either. here pictures show i'm trying accomplish. navbar in desktop/tablet view [name] --- [item 1] [item 2] navbar in mobile view [name] [item 1] [item 2] here's code navbar i've written far, move...

ruby - How do I add an Rails form helper HTML attribute that does not contain a quoted value? -

ruby - How do I add an Rails form helper HTML attribute that does not contain a quoted value? - for example, "required." rails chokes on effort add together attribute thus: <%= f.email_field :email, :"ng-model" => "whatever", :class => "form-control input-lg", :"required" %> just utilize boolean values: <%= f.email_field :email, :"ng-model" => "whatever", :class => "form-control input-lg", :"required" => true %> ruby-on-rails ruby

c++ - How to write multiple if conditions -

c++ - How to write multiple if conditions - i have 2 variables a , b , want write code if 1 of 2 variables equal 151 or 156 or 720 and other not equal 1 of these numbers 3rd variable c = 0 equal one. so illustration 1) if = 151 , b = 700 c = 1 2) if = 151 , b = 720 c = 0 3) if = 140 , b = 700 c = 0 this code int = 0 cin >> a; int b = 0 cin >> b; int c=0; int decklist[3] = {151,156,720} for(int d=0; d<3;d++){ if(a== decklist[d]){ for(int w=0; w<3;w++){ if(b==decklist[w]) c=0; else c=1; } } if(b== decklist[d]){ for(int w=0; w<3;w++){ if(a==decklist[w]) c=0; else c=1; } } } is ok? there other improve ways of doing it? this exclusive or, xor. there no logical xor in c++, can utilize bit-wise xor case , exploit fact result of logical operator bool map 0 or 1: #include <iostream> int ...

ios - Get facebook profile picture URL -

ios - Get facebook profile picture URL - i logged user app using facebook sdk, how can url profile picture? far have: func loginviewfetcheduserinfo(loginview : fbloginview!, user: fbgraphuser) { activityindicator.startanimating() println("user: \(user)") println("user id: \(user.objectid)") println("user name: \(user.name)") var useremail = user.objectforkey("email") string println("user email: \(useremail)") } i tried println( user.objectforkey("picture") string) doesnt seem work. you can generate url long have users facebook id. using user.objectid code: let avatarlocation = "https://graph.facebook.com/\(user.objectid)/picture" that give little variant of users avatar. can specify size, , they'll seek , match size request. let avatarlocation = "https://graph.facebook.com/\(user.objectid)/picture?width=640&height=640" both st...

c# - Add value to Drop Down list when exception occurs -

c# - Add value to Drop Down list when exception occurs - i have asp .net(4.0) web app. web app has form view contains drop downwards list. drop downwards list populated so: <asp:dropdownlist id="ddlstaff" runat="server" datasourceid="staffdatasource" datatextfield="staffname" datavaluefield="staffname" appenddatabounditems="true" selectedvalue='<%# bind("staff") %>' > <asp:listitem value=""></asp:listitem> </asp:dropdownlist> <asp:sqldatasource id="staffdatasource" runat="server" connectionstring="<%$ connectionstrings:connectionstring %>" selectcommand="*****"> </asp:sqldatasource> the staff list changing issue selectedvalue throws error because staff fellow member not exist anymore. i know can check if item exists in list , grab exception. know if there way display "...

mercurial - cannot get "hg log file" to display anything -

mercurial - cannot get "hg log file" to display anything - i want find out alter sets have modifications file called wrapper.cpp. i have tried "hg log [relative_path_to_file]wrapper.cpp" i have tried changing directories [relative_path_to_file] , "hg log wrapper.cpp" neither gives me output. i on windows. what doing wrong? mercurial case sensitive. sure case on file name you're entering command matches how it's committed? "hg manifest" should help check. mercurial

Is there a way to query the AUTHID property setting for a list of Oracle Stored Packages? -

Is there a way to query the AUTHID property setting for a list of Oracle Stored Packages? - does 1 know of easy way (short of parsing top of each bundle definition) see authid property settings list of oracle packages? you can query [dba|all|user]_procedures . specifically, authid column sql> ed wrote file afiedt.buf 1 create or replace bundle authid_pkg 2 authid current_user 3 4 procedure foo; 5 procedure bar; 6* end; 7 / bundle created. sql> select owner, object_name, procedure_name, authid 2 all_procedures 3 object_name = 'authid_pkg'; owner object_name ------------------------------ ------------------------------ procedure_name authid ------------------------------ ------------ scott authid_pkg foo current_user scott authid_pkg bar current_user scott ...

c# - Windows Phone Maps: Layer from GeoServer -

c# - Windows Phone Maps: Layer from GeoServer - what easiest way draw map layer geoserver on windows phone? from geoserver's output formats (geojson, kml, georss, shapefile, csv...) think more manipulated , converted windows phone's map layer's element such polygon? what apis or tutorials recommend these subject? i've opted geojson format: string _buldingurl = "http://localhost:8080/geoserver/utad/ows?service=wfs&version=1.0.0&request=getfeature&typename=utad:build&maxfeatures=50&outputformat=application/json"; that string standard output when select layer geojson. need pay attending &maxfeatures=50 parameters , set for value need. then i've method handles json result, , uses map command parameter. async public void drawroomsonmap(map mapa) { ... //response reading //used the: https://github.com/geojson-net/geojson.net var reader = new geojsonreader(); ...

javascript - Dynamically require with browserify and angular -

javascript - Dynamically require with browserify and angular - i'm trying require files dynamically iterating json , phone call them require method, unfortunately cannot read module unknown reason. why fail require module if exists? i created file json list requirement paths browserify should require. { "vendor": { "angular-translate" : "angular-translate", "angular-sanitize" : "angular-sanitize.min", "ui-boostrap" : "ui-bootstrap-tpls-0.11.2.min", "dialogs" : "dialogs" } } then created file iterate json , seek require path of so: package.js var dependencies = require('./../dependencies'); module.exports = function(angular) { angular.foreach(dependencies.vendor, function(value,key) { var path = '../vendor/' + value; require('./' + path); }); } the on main ...

java - What is a Null Pointer Exception, and how do I fix it? -

java - What is a Null Pointer Exception, and how do I fix it? - what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing programme terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider next code declare variable of primitive type int: int x; x = 10; in illustration variable x int , java initialize 0 you. when assign 10 in sec line value 10 written memory location pointed x. but, when seek declare reference type different happens. take next code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in sec line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned ob...

Not able to read Image in OpenCV, C++ Visual Studio -

Not able to read Image in OpenCV, C++ Visual Studio - below code. don't know issue is. same code works on other machine. have reinstalled visual studio 2012 desktop, express edition, several times , have reinstalled opencv several times. when debug program, img empty. i don't know now, can perchance in order code work in current development environment wiz: windwos 8.1, opencv 2.4.9. int main( int argc, const char** argv ) { mat img = imread("my_image.jpg",1); //read image info in file "mypic.jpg" , store in 'img' if (img.empty()) //check whether image loaded or not { cout << "error : image cannot loaded..!!" << endl; //system("pause"); //wait key press homecoming -1; } namedwindow("mywindow", cv_window_autosize); //create window name "mywindow" imshow("mywindow", img); //display image stored in 'img' in "mywindow" window wait...

actionscript 3 - Flash AS3 - Google Drive implementation -

actionscript 3 - Flash AS3 - Google Drive implementation - anyone come across illustration of using google drive save/load files as3/air app? i'm trying load , modify sound files, backing cross platform solution. you can refer project integrating drive api air project: https://code.google.com/p/google-drive-as3-api-client/ i've found question related yours, in mentioned best way interact between as3 , api should through google javascript client , utilize externalinterface. can find more info here: flash , google drive sdk cannot talk each other actionscript-3 air google-drive-sdk

php - Laravel 4 - How to get the data from the foreign table from each item in collection -

php - Laravel 4 - How to get the data from the foreign table from each item in collection - i have standardoverall table next columns: sto_id | sto_transaction_id | sto_standard_id | sto_count | sto_total and standard table next columns: std_standards_id | std_code | std_description | std_notes sto_standard_id in standardoverall table foreign key std_standards_id in standard table. i homecoming rows standardoverall table belong sto_transaction_id . how can homecoming info foreign table well, in 1 collection? code in controller: $transactionid = session::get('transactionid'); $standardstats = standardoverall::whereid($transactionid)->get(); the standardoverall model: class standardoverall extends eloquent { /** * database table used model. * * @var string */ protected $table = 'sto_stat_overall'; protected $primarykey = 'sto_id'; public function standards() { homecoming ...

Access/Edit pixel values of a jpeg image in python -

Access/Edit pixel values of a jpeg image in python - i'm involved in image processing project , utilize python. i'm new python, please bear lack of knowledge. want read jpeg image, split r,g,b . have alter add together value each pixel r,g,b separately. finally, have merge 3 of them create new image , save it. from pil import image im = image.open("/home/pi/desktop/codes/lena.jpg") im.show() r,g,b =im.split() are r,g,b matrices containing pixel values? can alter values of pixels directly? , can 1 please tell me how access each pixel? first split image individual bands. then maniplulate each pixels want using point. then merge 3 bands using merge. the split method returns tuple image.split() split image individual bands. method returns tuple of individual image bands image. example, splitting “rgb” image creates 3 new images each containing re-create of 1 of original bands (red, green, blue). python jpeg python-ima...

android - BroadcastReceiver and screen off -

android - BroadcastReceiver and screen off - i have service sends message when been destroy broadcastreceiver declared in fragment. when screen on works fine , if screen turns off service sends message broadcast, never receives it my code thanks! try not unregistering on onpause() method android broadcastreceiver fragment screen

c++ - Cannot resize stack of type template -

c++ - Cannot resize stack of type template - im trying resize stack programme keeps terminating after 'cout'. on output terminal displays 1 , programme terminates. in case t int , size set 10 default. help much appreciated. #include <iostream> #include <fstream> using namespace std; template <typename t> class stack { public: int topstack; t* stack1; int size; void copy(const stack& other); void move(stack&& other); // constructor stack (); // destructor ~stack() { delete[] stack1; }; // re-create constructor stack (const stack&); // re-create assignment stack& operator= (const stack&); // move constructor stack (stack&&); // move assignment stack& operator= (stack&&); t& top() const; // homecoming top element void pop (); // remove top element void push(const t&); // add together element on top of stack...

inheritance - How to subclass an array class in Swift? -

inheritance - How to subclass an array class in Swift? - i new in swift. have base of operations class: class foo{} i want implement foo collection class: class foos: array<foo>{} but compiler complaining: inheritance non-protocol, non-class type of 'array' i have tried other syntax (e.g. [foo] , nsmutablearray<foo> ) none of them passes compiler check. this should simple have googled day , not figure out. know if possible , if is, right syntax? swift's array type structure, , in swift, base of operations classes must actual classes (that is, class foo ) , not structures. so cannot trying via inheritance array , unfortunately. could, however, store array field within class , forwards methods it, perchance implementing protocols want support, et cetera. arrays inheritance swift

java - S-Pen Button Click -

java - S-Pen Button Click - i trying create first app uses s-pen. problem @ online tutorial, samsung has different classes , libraries libraries have downloaded website. the thing want, @ moment, events (hover, s-pen's button clicked, etc). which s-pen sdk utilize development? java android samsung-mobile-sdk

web component - detect unresolved elements in polymer-polyfilled browser -

web component - detect unresolved elements in polymer-polyfilled browser - i'm trying observe if custom element has been registered yet, e.i if still unresolved. in browser supports custom-element (e.g chrome) can checking is not instance of htmlunknowelement , doesn't match pseudo-class ":unresolved" element.matches or vendor-prefixed equivalent. but when i'm working under polyfill, matches/webkitmatchesselector/mozmatchesselector function breaks when called ":unresolved" is there way have peek on list of unresolved elements ? or other way work under polyfilled browser ? thanks edit just found doc bookmarklette detects unresolved element on current page. problem doesn't work on polyfilled browsers. the reason check if consctrucor is still htmlelement whereas in polyfilled browser constructor is always htmlunknownelement polymer web-component custom-element

Is it bad to break out of php inside a function? -

Is it bad to break out of php inside a function? - more point, 1 of these faster or considered 'better' other? function name_field($name){?> <div class="input-wrap"> <label for="name">name:</label> <input type="text" id="name" value="<?php echo $name; ?>"/> </div> <?php } compared to: function name_field($name){ $output = '<div class="input-wrap">'; $output .= '<label for="name">name:</label>'; $output .= '<input type="text" id="name" value="' . $name . '"/>'; $output .= '</div>'; echo $output; } what preference ... use mustache , save name_field.html <div class="input-wrap"> <label for="name">name:</label> <input type="text" id=...

php - Limiting the display of password_hash -

php - Limiting the display of password_hash - i displaying password using password_hash function , since it's long, causes contents overflow in table. know have utilize substr can't right. here's code: <?php echo password_hash('$row->password', password_default). "\n";?> substr(string, start_position, end_position) <?php echo substr(password_hash('$row->password', password_default), 0, 50). "\n";?> php

javascript - Highcharts datetime tick start and interval -

javascript - Highcharts datetime tick start and interval - the info starts @ 6am on mon , has info point each hour. having problem getting xaxis tick marks read "6am monday", , repeat every 24 hours. any tips? here fiddle http://jsfiddle.net/4x136qxg/1/ here main graphing function: var dayinmilliseconds = 3600 * 1000 * 24; $(function () { $('#chart1').highcharts({ chart: { type: 'area' }, title: { text: 'orders' }, xaxis: { type: 'datetime', datetimelabelformats: { // month: '%a', }, // tickinterval: dayinmilliseconds, title: { text: null }, labels: { align: 'left', x: 3 }, // startontick: true, // endontick: true, // min: 1413352800000, ...

ruby on rails 4 - How to pass the variables in model#create to model#show after redirection -

ruby on rails 4 - How to pass the variables in model#create to model#show after redirection - i have photo_link variable want display in show.html so click create in view, , brings me effects#create def create @effect = effect.new(effect_params) @effect.save @pid = params[:effect][:pid] @photo_link = apply_effect1(@pid) respond_with(@effect) end when check log, think redirect effects#show before display show.html started post "/effects" 127.0.0.1 @ 2014-10-19 13:56:21 +1100 processing effectscontroller#create html parameters: {"utf8"=>"✓", "authenticity_token"=>"zfqmgjkuqess+kqui1ewwl1t6beec9lzarrli8tkrcy=", "effect"=>{"effect1"=>"0", "effect2"=>"0", "effect3"=>"0", "pid"=>"37"}, "commit"=>"create effect"} unpermitted parameters: pid (0.1ms) begin transaction ...

hadoop - Error in the code. pig language -

hadoop - Error in the code. pig language - hello programmers okay? i programming , run pig command returns me syntax error in code , unable solve. below post code , error raised. apparently error occurs in syntax of line 41 sortedresults code: --load files relations month1 = load 'hdfs:/data/big/data/weather/201201hourly.txt' using pigstorage(','); month2 = load 'hdfs:/data/big/data/weather/201202hourly.txt' using pigstorage(','); month3 = load 'hdfs:/data/big/data/weather/201203hourly.txt' using pigstorage(','); month4 = load 'hdfs:/data/big/data/weather/201204hourly.txt' using pigstorage(','); month5 = load 'hdfs:/data/big/data/weather/201205hourly.txt' using pigstorage(','); month6 = load 'hdfs:/data/big/data/weather/201206hourly.txt' using pigstorage(','); --combine relations months = union month1, month2, month3, month4, month5, month6; /* splitting relations split mon...

ios - Positioning UIButtons at top of Screen -

ios - Positioning UIButtons at top of Screen - what want have 5 buttons as spaced out @ top of screen. tried using constraints buttons squished. i have code far: - (void)viewdidload { [super viewdidload]; //i know 2 buttons nsuinteger space = (_backround.frame.size.width - _squareone.frame.size.width * 5) / 6; cgrect newframeone; newframeone = cgrectmake(space, 50, 55, 55); cgrect newframetwo; newframetwo = cgrectmake(space * 2 + _squareone.frame.size.width, 50, 55, 55); _squareone.frame = newframeone; _squaretwo.frame = newframetwo; } the buttons never show up... , don't know other ways this... any help? could seek below? update: i've written code using xcode time (previously typed memory). see below screenshot final result. view controller header file @interface viewcontroller : uiviewcontroller @property (nonatomic, strong) uibutton *btn1; @property (nonatomic, strong) uibutton *btn2; @property (nonatomic...

xamarin - Getting the filename/path from MvvmCross Plugins.DownloadCache -

xamarin - Getting the filename/path from MvvmCross Plugins.DownloadCache - i'm using mvvmcross downloadcache -- , it's working alright -- nice when need drop in image url , automagically downloads / caches image , serves uiimage. i hoping leverage code 1 other utilize case -- i'd grab source images url's , cache files on local file system, want other utilize case image path on local file scheme instead of uiimage itself. what help me if illustration of how might accomplish that. possible create happen in pcl, or need go platform specific code? if @ source plugin, you'll find https://github.com/mvvmcross/mvvmcross/blob/3.2/plugins/cirrious/downloadcache/cirrious.mvvmcross.plugins.downloadcache/imvxfiledownloadcache.cs - give local file path cached file: public interface imvxfiledownloadcache { void requestlocalfilepath(string httpsource, action<string> success, action<exception> error); } you can hold of service imple...

Query Mysql Error : Not unique table/alias -

Query Mysql Error : Not unique table/alias - can please help me out. have sql query: select tenagapengajars.id, tenagapengajars.nama, tenagapengajars.pendidikan, tenagapengajars.created_at, programstudis.nama tenagapengajars left bring together tenagapengajars on programstudis.id = tenagapengajars.id_prodi and somehow says #1066 - not unique table/alias: 'tenagapengajars' you selecting tenagapengajars , joining on tenagapengajars. if want that, have specify alias. otherwise mysql doesn't know chich table mean. from tenagapengajars t1 left bring together tenagapengajars t2 you selecting info programstudis, not in query. copied wrong table , meant like: select tenagapengajars.id, tenagapengajars.nama, tenagapengajars.pendidikan, tenagapengajars.created_at, programstudis.nama tenagapengajars left bring together programstudis on programstudis.id = tenagapengajars.id_prodi mysql table joi...

php - Simple way to get only non-numeric keys from an array -

php - Simple way to get only non-numeric keys from an array - so have php array so: array ( [0] => array ( [offset] => 1 [0] => 1 [name] => value:990937970 [1] => value:990937970 ) [1] => array ( [offset] => 2 [0] => 2 [name] => value:482758260 [1] => value:482758260 ) [2] => array ( [offset] => 3 [0] => 3 [name] => value:2045053536 [1] => value:2045053536 ) ) but want alter numeric keys not returned, this: array ( [0] => array ( [offset] => 1 [name] => value:990937970 ) [1] => array ( [offset] => 2 [name] => value:482758260 ) [2] => array ( [offset] => 3 [name] => value:20...

javascript - How to test AngularJS $asyncValidators including a $http call -

javascript - How to test AngularJS $asyncValidators including a $http call - i'm trying write jasmine test angularjs email availability checker, uses angular latest feature - $asyncvalidators pipeline. here directive: au_helper.directive('recordavailabilityvalidator', ['$http', function ($http) { homecoming { require: 'ngmodel', link: function (scope, element, attrs, ngmodel) { var apiurl = attrs.recordavailabilityvalidator; var ownid = attrs.recordavailabilityid; ngmodel.$asyncvalidators.unavailable = function(value) { homecoming $http({method: 'get', url: apiurl, params: {v: value, id: ownid}}); }; } } }]); in test seek setup backend response so: $httpbackend.when('get', 'api/users/emailavailable?v=test@email.com') .respond(400, {flash: 'not available'}); $scope.user = {email: null}; var element = ...

c# - WinForms WebBrowser HTMLDocument strips tags -

c# - WinForms WebBrowser HTMLDocument strips tags - i having issues working htmldocument object contained/provided webbrowser control. it seems when utilize getelementsbytagname("ol") , returned result stripped downwards version of webbrowser.documenttext property contains. there reason this? doing wrong elements out? here's example: string html = "<html><head></head><body><ol type=\"i\"><li>someitem</li></ol></body></html>"; //this part allows me load html htmldocument of webbrowser control, // without having render command on form this.webbrowser1.navigate("about:blank"); this.webbrowser1.document.write(html); //then document object in order work elements properly. htmldocument doc = this.webbrowser1.document; //then lists contained in document... , play those. htmlelementcollection ol_lists = doc.getelementsbytagname("ol"); foreach(htmlelement ol in o...

ruby on rails - Replace method implementation when stubbing with mocha -

ruby on rails - Replace method implementation when stubbing with mocha - i'm used rspec in can stub method implementation block evalueted lazily. now i'm working pull request project uses test::unit , mocha mocking library. i need able similar rspec example, i.e. replace method implementation dynamic 1 depends on object state, can not utilize static calls provided mocha #returns method. is there way same functionality mocha, wasn't able find documentation on this? i need implement similar (rspec 2.14 syntax) class somecontroller < applicationcontroller before_filter :authenticate def authenticate # original method need replace end def some_other_method :bar end end describe somecontroller before controller.stub :authenticate redirect_to root_path if some_other_method == :foo end end 'should test something' controller.stub(some_other_method: :foo) :index response.should redirect_to root_path...

My Rails 4 app config.eager_load = true will load activerecord datetime fields using Ruby Time class instead of ActiveSupport::TimeWithZone -

My Rails 4 app config.eager_load = true will load activerecord datetime fields using Ruby Time class instead of ActiveSupport::TimeWithZone - i pushed rails 4 application new production env , noticed timestamp showed utc zone. have been shown correctly in other environment pst , application config.time_zone set in application.rb. farther triaging problem, discovered that, in production env, timestamp attributed of ruby class time, not activesupport::timewithzone my_record.start_at.is_a?(activesupport::timewithzone) => false but, in test env, timestamp attributed class activesupport::timewithzone my_record.start_at.is_a?(activesupport::timewithzone) => true this same code base, , vm cloned test, software versions same. checked production.rb file , didn't see anythings changes behavior. had require 'rails/all' in application.rb should load active back upwards modules @ start of app the rest of application seems working fine, other active b...

android - add data to a list view from database -

android - add data to a list view from database - i want add together info database list view, have been able pass info textview don't know how list view code. public class viewclass extends activity{ listview mylist; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.homepage); initialize(); database viewagenda = new database(this); viewagenda.open(); string info = viewagenda.getagendadata(); viewagenda.close(); test.add(data); } private void initialize() { // todo auto-generated method stub mylist = (listview) findviewbyid(r.id.panel_bottom); } } you can add together info database in arraylist , add together arraylist in list arraylist<string> list_data = new arraylist<>(); list_data.add("item"); // likewi...

eclipse - "Open Declaration", etc., pops up "The resource is not on a include path of a javascript project" in a Nodeclipse MEAN project -

eclipse - "Open Declaration", etc., pops up "The resource is not on a include path of a javascript project" in a Nodeclipse MEAN project - in nodeclipse, "open declaration" "open type hierarchy" , "open phone call hierarchy" seem pop message saying "the resource not on include path of javascript project". issue encountered existing mean stack project (available @ pactvote.com) i'm getting started on. first time working mean , nodeclipse. if want seek , replicate above-mentioned project, may have increment memory usage in eclipse.ini , implement workaround described @ https://github.com/nodeclipse/nodeclipse-1/issues/159 . downloaded enide-studio-2014-011-20140228-macosx-cocoa-x86_64. plugin installed mercurialeclipse 2.1. thought of trying fiddle build path, when right-clicked on project , moused on build path said "no actions available." didn't see alter in project properties either. the project c...

scala - Apache Spark K-Means clustering - RDD for input -

scala - Apache Spark K-Means clustering - RDD for input - i'm trying run spark's k-means clustering on grouped info i'm getting variety of errors when seek cluster each group. the input rdd looks (userid: long, coords: [vector]) i.e.: org.apache.spark.rdd.rdd[(long, seq[org.apache.spark.mllib.linalg.vector])] the vector contains x y coordinates i.e. pairs of doubles. want identify coordinate clusters each userid, i'm mapping on rdd, , trying run k-means each group: val userclusters = usercoordvectors.map { case (userid, coords) => val clusters = 4 val iterations = 30 // need convert coords rdd input k-means val parseddata = sc.parallelize(coords) // apply k-means val model = kmeans.train(parseddata, clusters, iterations) ... etc } but when run this, npe line: val parseddata = sc.parallelize(coords) the problem is, have convert coords rdd k-means operation. on other hand, if collect input rdd first, don...

ios - sectioned table view returning blank table -

ios - sectioned table view returning blank table - i found code examples online creating tableview alphabetical sections , have tried adapt tableview. however, simulator returning blank table. i've gone wrong, mind pointing out mistakes? every alter create doesn't help. give thanks you #import "rcviewcontroller.h" @interface rcviewcontroller () @end @implementation rcviewcontroller @synthesize content = _content; @synthesize sectiondata; @synthesize sectionnames; -(nsarray *)content { nsarray *words = [nsarray arraywithobjects:@"tee", @"club", @"green", @"putt", nil]; nsarray *sortedwords = [words sortedarrayusingselector:@selector(caseinsensitivecompare:)]; nsstring *currentletter = @""; (nsstring *string in sortedwords) { if (string.length>0) { nsstring *letter = [string substringtoindex:1]; if (![letter isequaltostring:currentletter]) { [sectionnames ad...

Out of Memory with MultiPart Post, Python 2.7 -

Out of Memory with MultiPart Post, Python 2.7 - i have 300 mb file need upload, , current code isn't cutting it. #---------------------------------------------------------------------------------- def _post_multipart(self, host, selector, fields, files, ssl=false,port=80, proxy_url=none,proxy_port=none): """ performs multi-post agol, portal, or ags inputs: host - string - root url (no http:// or https://) ex: www.arcgis.com selector - string - after host ex: /pwjussdojdp7sglj/arcgis/rest/services/gridindexfeatures/featureserver/0/1/addattachment fields - dictionary - additional parameters token , format info files - tuple array- tuple file name type, filename, total path ssl - alternative utilize ssl proxy_url - string - url proxy serv...

Rails fabricator - how to get value from association field? -

Rails fabricator - how to get value from association field? - let's have model user has many notes. each note has field user_name. notes fabricator this: fabricator(:note, class_name: note) user content faker::lorem.paragraph(1) user_name user.full_name end what i'm trying set user_name value full_name method user exists. i'm getting next error: undefined method `full_name' #<fabrication::schematic::attribute:0x0000000a279c50> any help appreciated. found out in documentation there attributes hash can use: fabricator(:note, class_name: note) user content faker::lorem.paragraph(1) user_name { |attrs| attrs[:user].full_name } end ruby-on-rails ruby-on-rails-4 fabrication-gem

php - Get page source of external URL and manipulate with javascript/jquery -

php - Get page source of external URL and manipulate with javascript/jquery - i'd somehow page source of external url, , that, able contents of h1 element. for example, logic: var url = "http://example.com"; var src = // page src of url // instead of document, utilize variable src var headertext = document.getelementsbytagname("h1")[0].innerhtml; alert(headertext); i know can stuff curl/php, have heard larger sites cause server strain. i'd prefer maintain efficient possible. not sure start. this cannot done, by policy. in web pages, javascript (and client-side scripts in general) aren't allowed access raw external resources different domain, in general. the closest you're going using ajax (jquery helps) access resource, (in general) need requesting url under same domain. javascript php jquery curl

iis 7.5 - 404 error on redirect using URL Rewrite -

iis 7.5 - 404 error on redirect using URL Rewrite - i'm using next rule in web.config redirect xpda.com/bugpage xpda.com/bugs . need subfolders , url parameters passed along, , correctly. now remove folder bugpage , when server shows 404 error whenever utilize url xpda.com/bugpage . empty folder named bugpage prevent error. is there rule form can use, or maybe iis setting, prevent 404 error? (i need subfolders , parameters carried along new url.) <rule name="bugpage" stopprocessing="true"> <match url=".*" ignorecase="true" /> <conditions> <add input="{request_uri}" pattern="/bugpage(.+)" /> </conditions> <action type="redirect" url="/bugs{c:1}" appendquerystring="false" redirecttype="permanent" /> </rule> change add together input line this: <add input="{request_uri}" pattern="^/bugpag...

javascript - jQuery , changing value with live odds -

javascript - jQuery , changing value with live odds - this 1st time posting here, sorry if i'm not gonna clear wiht question first shoot :). ok, allow me explain i'm stuck. got portal odds can changed second, means, if u pick 1 odd now, can changed second, means u have alter bet on odd. this site best illustration of wanna get. http://www1.betuniq.eu/it/live (pick match u can see odds betting) when pick odd, odd hovered css class, when same odd alter it's value, hover disappears. wanna next. when odd alter value wanna color of hover ?! in short, thats problem. hope wrote understandable. kind regards it can done jquery. it's this. not elegant way, maybe else can suggest littlebit more clear solution. till time, can check this: jquery <script type="text/javascript"> $(function() { $('.odd').click(function() { if (!$(this).hasclass('clicked')) { $(this).addclass('click...

c++ - Position percentage to degree -

c++ - Position percentage to degree - double x = ...; // -1.0 1.0 double y = ...; // -1.0 1.0 int deg = (int) ((atan(x / y) * 57.2958) + (y > 0 ? 540 : 360)) % 360; some basic geometry can't seem figure out right now. spent while on it. above code works ok-ish seems mirrored wrong , i'm pretty sure mod isn't required here. i have aa rather odd scenario, need grade outputs when reddish dot @ position. mirrored unit circle. looking easy implementation (and maybe geometry refresher). you need: degrees = atan2(x, y) * 360.0 / (2.0 * m_pi) + 180.0; note utilize of atan2 valid 4 quadrant result. need add together π radians (180 degrees) since atan2 returns values in range -π π. note x , y transposed compared more conventional usage ( atan2(y, x) ). live demo c++ math geometry

c++ - cmake error ' Could NOT find CXX11 ' VS 2010? -

c++ - cmake error ' Could NOT find CXX11 ' VS 2010? - well have searched, know vs2010 bit dated that's have right now. so assume vs2010 isn't c++11 compliant assume error in cmake complaining about, here error. trying build little game engine. cmake error @ c:/program files/cmake/share/cmake-3.0/modules/findpackagehandlestandardargs.cmake:136 (message): not find cxx11 (missing: cxx11_flags) phone call stack (most recent phone call first): c:/program files/cmake/share/cmake-3.0/modules/findpackagehandlestandardargs.cmake:343 (_fphsa_failure_message) cmake/findcxx11.cmake:60 (find_package_handle_standard_args) cmakelists.txt:13 (find_package) the problem findcxx11 module. normal(ish)/regular error message find module. 'c++11 compatibility' reddish herring. post findcxx11.cmake file or don't utilize on windows/msvc. c++ cmake vs2010-express

List of Tuples as a function Parameter in Haskell -

List of Tuples as a function Parameter in Haskell - how define function parameter list of tuples? illustration of input [("hey", false), ("you", true)] my function takes list of tuples as: [(string, bool)] here looks like: afunc :: [(string, bool)] -> bool afunc ???? = so fill in ???? able access tuple? help great. thanks. edit: afunc :: [(string, bool)] -> bool afunc atuple = mapm_ lookup atuple? so how access tuple in function? doesn't work. it looks you're trying implement own version of lookup . can write simple version using list comprehension: lookup' :: string -> [(string,bool)] -> bool lookup' k lkp = head $ [v | (k',v) <- lkp, k'==k] or using filter : lookup'' :: string -> [(string,bool)] -> bool lookup'' k lkp = snd $ head $ filter ((==k) . fst) lkp notice these versions unsafe - is, they'll fail ugly , uninformative error if list doesn't con...