Posts

Showing posts from September, 2010

regex - Basic Matching in Ruby -

i working through book , gives example x = "this test".match(/(\w+) (\w+)/) we looking @ parentheses , being able access passed separately. when put expression above irb get: matchdata "this is" 1:"this" 2:"is"> why doesn't include a , test ? would have include .match(/(\w+) (\w+) (\w+) (\w+)/) ? the 'match' method not matching regex globally. returning first match. can use 'scan' method rather 'match' , should return array of matches of regex. [~]$ irb 1.8.7-p371 :001 > x = "this test".match(/(\w+) (\w+)/) => #<matchdata "this is" 1:"this" 2:"is"> 1.8.7-p371 :002 > x = "this test".scan(/(\w+) (\w+)/) => [["this", "is"], ["a", "test"]]

sql - Varying RI Constraints between 3 tables. How does deletion in table A affect table C? -

Image
please refer below image, manager attribute refers id attribute in employee table , project refers code attribute in project table. suppose manager has on delete cascade , project attribute has on delete restrict. happen if deleted employee manager project in potential customers table? oracle go down chain of references , stop on on "ora-02292: integrity constraint (.) violated - child record found" if finds "restricted" foreign key constraint. if fk constraints in chain defined "cascade", rows in project associated manager ids matching deleted rows in employee deleted , similarly, rows in potential_customers having project ids deleted in project deleted.

SignalR, Not a Function -

i trying send data sql server. model @ hand. got error saying addbug not function. post:29 uncaught typeerror: chat.client.addbug not function can please me in debugging error. cannot find mistake , sorry totally new signalr , trying somethings , running server. client-side <script src="~/scripts/jquery-1.10.2.min.js"></script> <script src="~/scripts/jquery.signalr-2.2.0.min.js"></script> <script src="~/signalr/hubs"></script> <meta name="viewport" content="width=device-width" /> <title>post</title> <script> var chat; $(document).ready(function () { chat = $.connection.additems; console.log('connection done'); $.connection.hub.start(); console.log('connection secured'); }); function test() { console.log('clicked'); var = { id: $('#txtid').val(), n

java - Displaying a part of an image in libGDX - looks stretched -

Image
i'm trying build progress bar in libgdx , have 1 full horizontal image , in 2 lines trying display 2 different widths of image: imagefull: imagefull.draw(batch,10,80,600,50); imagefull.draw(batch,10,20,100,50); the result is: its looks when width 'small' stretched , looks bad. why can't display part of image without destroying left side of image? any ideas how fix it? that normal behavior. if stretch image without keeping it's aspect ratio deform, not know stretchable part itself. 9-patch here cannot draw sprite doing (maybe spritedrawable though?). if use scene2d actor named progressbar . feed 9-patch image, should stretch correctly. or use image if want control yourself, , feed image ninepatch. a quick way create ninepatch specify it's stretching regions hardcoding it. texture = new ninepatch(yourtexture, a, b, c, d) where abcd corresponds following image: now create scene2d image ninepatch , should stretch properly

javascript - exam portal questions and answers cache procedure -

i learner , trying develop webportal online mocktests. in portal, after being redirected mocktest page, exam page like... php page having 1. timer on top 2. 2 iframes - 1 on left , 1 on right - src php file the left iframe contain buttons displaying questions number. right frame display question , answer options radio buttons. the problem caching questions. once check radio button of questionx, navigate other question , come questionx again, checked option not visible.. question again queried database , displayed afresh. want visited questions, selected answers cached. how should accomplish this? the mocktest web page looks this code mocktest web page include frames below - <!-- questions numbers left div --> <div class="left"> <iframe id="frame1" name="iframe1" src="questions/quantitativeaptitude.php" ></iframe> </div> <!--div classs=left --> <!-- display question right

php - Magento translation package doesn't work well -

after installing magento , downloaded package translation portuguese in this link , replaced vendor folder content downloaded . though changed language in account portuguese , cleaned cache, translation not satisfactory. little has been translated. administrator area still has of elements in english. contact screen , user registration screen still in english! tried modify files pt_br.csv within i18n folders, not seem have effect . how translate magento screens effectively?

protection - Run c++ programm only on authorized computer -

i wrote c++ program , want protect it. need program can run on authorized computer, , i'd stop program when want. thought 2 solutions, i'm not knowing if these or cracked. the first solution: local_mac_address = get_mac_address(); if(local_mac_address == "\* authorized addr */") return true; else return false; the second solution: upload html page secret code on website. page = download_page(url); if(page == "my_secret_code") return true; else return false; if i'll change code in html source program won't start. what think these 2 solution ? safety? edit: executable works on computers in office, want avoid can copy , use on theyr computer i'd both of these easy circumvent. the first undone preloading shared library implementing get_mac_address() function returning expected result. the second defeated intercepting network traffic , returning expected reply. additionally, both disabled after lit

hmac - Amazon SES HTTPS Query API Authentication error -

i have been trying send email using amazon ses https query api. signature calculate , send aws not accepted. i error message. <errorresponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> <error> <type>sender</type> <code>signaturedoesnotmatch</code> <message>the request signature calculated not match signature provided. check aws secret access key , signing method. consult service documentation details.</message> </error> <requestid>c97bd130-24c9-11e6-924a-b59d7ac9182b</requestid> </errorresponse> here java code public class sendsesmail { public static void main(string[] args) throws invalidkeyexception, nosuchalgorithmexception, ioexception, signatureexception { simpledateformat format = new simpledateformat("eee, dd mmm yyyy hh:mm:ss z"); string datestring = format.format(new date()); final string endpoint = "https://email.us-east-1.amaz

php - Rewrite class with fopen and using curl instead in Laravel -

really new in laravel , still trying learn please me bit here. there 1 class pull data site. problem is using fopen in matter of server security function off must use curl. const cache_key = 'rate'; public static function getrate() { if (cache::has(self::cache_key)) { return cache::get(self::cache_key); } $onehourtimestamp = \carbon\carbon::now()->addhours(1); $tenminutestimestamp = \carbon\carbon::now()->addminutes(10); $page = trim(file_get_contents('https://example.com/')); $rates = json_decode($page, true); if (!$rates) { cache::put(self::cache_key, '-', $tenminutestimestamp); return '-'; } $rate = @$rates['1']['2']; if (!$rate) { cache::put(self::cache_key, '-', $tenminutestimestamp); return '-'; } cache::put(self::cache_key, $rate, $onehourtimestamp); return $usdrate; } update: like this? function get_cur

debugging - Stack calls are out of code segment? -

i have crash dump our user on windows 10 pc. visual studio 2015 shows me following stack: comctl32.dll!`duitelemetry::instance(void)'::`2'::`dynamic atexit destructor 'wrapper''(void) unknown comctl32.dll!clvdrawitemmanager::computetextwidth(int,int,int,struct lvfakedraw *,struct taglvitemw *,unsigned short *,int) unknown app.exe!006e0065() c++ app.exe!00730075() unknown user32.dll!_ntusermessagecall@28() unknown user32.dll!realdefwindowprocworker() unknown user32.dll!defwindowprocw() unknown user32.dll!__internalcallwinproc@20() unknown user32.dll!usercallwinproccheckwow() unknown user32.dll!callwindowprocw() unknown mfc120u.dll!cwnd::defwindowprocw(unsigned int nmsg, unsigned int wparam, long lparam) line 1116 c++ mfc120u.dll!cwnd::windowproc(unsigned int message, unsigned int wparam, long lparam) line 2095 c++ mfc120u.dll!afxcallwndproc(cwnd * pwnd, hwnd__ * hwnd, unsigned int nmsg, unsign

security - Anti hacking android project -

i need more information how enable project not hacked. 1st: yes know need rooted device hack games , app on phone. 2nd: yes know more memory reading , adjustments cheat engine. i need know or info how it. if familiar japanese made game "battle cats", know trying memory scan result in game instantly going browser change , trying connect api reports user. i wanted know how possible , how can make this, better security details know japanese have done , need further project's security. if know anything, please give me information. also yes have tried in google , anti-virus android / mobile devices, bit frustrating least. the, thing talking in more generalized way called reverse engineering , impossible rid of, apart there other ways too, hijack data transfered device external network(web), though if using ssl(https), can done using famous attack called mitm , can achieved using tool mitmproxy, security researchers finds out way break system, question po

How do I initialize this 2D array with null in Java? -

i have made 2-d array store references objects of children classes of parent class student . student[][] = new student [5][4]; now want initialize array null ? how do it? trick doing @ once? also, wanted know if possible store references of children class in array of base class in java? i want initialize values null . also, let's values filled , want overwrite values null . how do that? by default java initialises reference objects null.

php - MySql : Get user details using nested relational table -

Image
show below tables users , stu_master , stu_info , emp_master , emp_info . users stu_master stu_master_user_id = users.user_id stu_info stu_info_id = stu_master.stu_master_stu_info_id emp_master em_user_id = users.user_id emp_info emp_info_id = emp_master.em_emp_info_id i have user first name or last name using above 5 tables single query; i have main 2 types of user 1 student , employee login details store in single table name users . store first/last name related details store in 2 different table based on user type. if user type s . first/last name in stu_info using stu_master table because user_id relation available in stu_master table other wise user type e , first/last name in emp_info using emp_master table because user_id relation in emp_master table. my table relations : for student = users->stu_master->stu_info, for employee = users->emp_master->emp_info, i have try below query not expected results. se

android - NavigationDrawer main page and styling -

this first application creating using navigationdrawer . have pretty simple question. how make first page in navigationdrawer main one? i'm not familiar formatting since first time using drawer appreciate if more familiar tell me if doing correctly. right each page displays text more. , 1 of questions how make clicking page in drawer can open new page using relativelayout example. understanding adapters views, create new activity , call startactivity() in iteration drawerclick? if so, efficient? meaning take long time page load? main activity is: public class mainactivity extends activity { private string[] mpages; private drawerlayout mdrawerlayout; private listview mdrawerlist; private actionbardrawertoggle mdrawertoggle; private charsequence mdrawertitle; private charsequence mtitle; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.drawer_layout); mpages = getresources().getstringarr

class - WooCommerce - excelling eCommerce Multiple shipping classes per product? -

i've got great problem woocommerce. im selling different type of products individual / collections. i want define local , international shipping each, price of them different per product type, need defining multiple shipping classes per product. (when creating product choose shipping classes each product.) mean : shipping methods: individual product: - local delivery (cost a) - international delivery (cost b) collection product: - local delivery (cost c) - international delivery (cost d) example : - product y need local delivery + international delivery - prod. x local delivery 2 + international delivery 2 hope thats clear. have idea how can that? thank much!

php - LIKE using Multiple AND in MySql -

Image
select * name name 'a%' , lower(main_cat)='girl' , lower(sub_cat_url)='indian-girl-names' limit 0,50 i want find record name starting a , and query multiple time. have following data in database no result above query. the names start capital "a"s. so, try this: select * name name 'a%' , lower(main_cat)='girl' , lower(sub_cat_url)='indian-girl-names' limit 0,50; note: using limit without order by suspicious , cause unexpected results.

ios - Tableviewcell not displays image | Swift -

admin can add image/text, content displays, image doesn't after adding. need add text make image displayed. example can add lots of images, in table, not viewed until admin add text. the thing convert image in base64, add array, , cellforrowatindexpath decode , add cell. func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingimage image: uiimage, editinginfo: [string : anyobject]?) { var data = nsdata() data = uiimagepngrepresentation(image)! let base64string = data.base64encodedstringwithoptions(nsdatabase64encodingoptions.encoding64characterlinelength) let newimage = "imagebase64" + base64string content.append(newimage) self.dismissviewcontrolleranimated(true, completion: nil) } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell{ if content[indexpath.row].rangeofstring("imagebase64") == nil { let cell = self.articletableview.dequeue

c - read() return extra characters from file -

i trying read text file print.. while trying if give char buffer size returns character .. #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <fcntl.h> int main(){ int fd = open("text.txt",o_rdonly); char cbuffer[100]; int =0; if(fd>0){ puts("file open"); ssize_t len = read(fd,cbuffer,sizeof(cbuffer)); =printf("%s",&cbuffer); printf("\n return data count %d",a); } return 0; } if instead of ssize_t len = read(fd,cbuffer,sizeof(cbuffer)); to ssize_t len = read(fd,cbuffer,10); returns 10 chars . can explain why happening? this happens because, read() not null-terminate output. need null-terminate destination buffer before using string . basically passing non-null terminated char array printf() argument %s creates undefined behavior there can out of bound memory access. one way of achieving 0 -initialize d

login - Blocking a user in Asp.NET -

i'm developing website in asp.net users can register , login. want block users 10 mins , after introduce wrong password 3 times.is there other solution excepting membershipprovider ? tried implement it, failed. after introduce in web.config, code below, else should ? thanks. <membership defaultprovider="mymembershipprovider"> <providers> <clear/> <add name="mymembershipprovider" type="mymembershipprovider" autogenerateschema="true" connectionstringname="myconnectionstring" enablepasswordretrieval="false" enablepasswordreset="true" requiresquestionandanswer="false" requiresuniqueemail="false" passwordformat="hashed" maxinvalidpasswordattempts="3" minrequiredpasswordlength="8"

r - Problems displaying LOESS regression line and confidence interval -

Image
i having issues trying compete loess regression data set. have been able create line, unable plot correctly. i ran through data this. animals.lo <- loess(x15p5 ~ period, animals, weights = n.15p5) animals.lo summary(animals.lo) plot(x15p5~ period, animals) lines(animals$x15p5, animals.lo, col="red") at point received error "error in xy.coords(x, y) : 'x' , 'y' lengths differ" i searched around , read issue due points needing ordered, proceeded. a <- order(animals$period) lines(animals$x15p5[a], animals.lo$period[a], col="red", lwd=3) there no errors @ point, loess line still not showing in plot. points displayed correctly, not line. this similar data set using... structure(list(site = c("cat", "dog", "bear", "chicken", "cow", "bird", "tiger", "lion", "leopard", "wolf", "puppy"

ios - Why Xcode don't prompt a crash reason? -

Image
i have issue long time. xcode not prompt more information compiling error. if create new project, xcode show error reason. but in project, not show detail information error. i have no idea resolve issue. os x: 10.11.5 xcode: 7.3.1 some known exception can catched xcode , shown right error description. can add allexception break point make code break onthrow inspect/debug code

A portable way to suppress an "unused dummy argument" warning in Fortran -

is there portable way suppress "unused dummy argument" warning in fortran specific variable similar (void)var; trick in c/c++? a motivational example (by request vladimir f). strategy pattern, gof example different line-breaking strategies, unnecessary details omitted. module linebreaking type, abstract :: linebreaking_compositor contains procedure(linebreaking_compositor_compose), deferred, pass(this) :: compose end type abstract interface subroutine linebreaking_compositor_compose(this) import linebreaking_compositor class(linebreaking_compositor), intent(in) :: end subroutine linebreaking_compositor_compose end interface type, extends(linebreaking_compositor) :: linebreaking_simple_compositor contains procedure, pass(this) :: compose => linebreaking_simple_compositor_compose end type linebreaking_simple_compositor type, extends(linebreaking_compositor) :: linebreaking_tex_compositor contains proce

java - Finding the closest possible position for a rectangle in a field of rectangles -

Image
i programming on 2d castle defense , faced problem today not able find solution for. see following picture: http://imgur.com/zoe2muv i want find closest possible position place red rectangle in field of rectangles without overlapping rectangles. closest possible position mean position closest current mouse position, closest possible position given point. what right algorithm problem? thanks!!! this optimization problem constraints linear , objective function (piecewise) quadratic or linear, depending on how want define distance cursor. assuming rectangles defined x_i, y_i, w_i, h_i i=1..n , red rectangle has size w, h , decision variables x, y position red rectangle. the non-overlapping constraints then: x >= x_i + w_i or y >= y_i + h_i or x <= x_i - w or y <= y_i - h i=1..n there multiple ways define objective (the distance of red rectangle cursor): proper eucledian squared distance between cursor , nearest point of red rectangle (res

python 3.x - Looping through lists, error : "float' object is not subscriptable". -

i want create new list of floats es. first value in es = first value in l1. rest of es based on below formula: need without using library/package. formula: es1 = (a * l1t) + (1 - a) * es t-1 l1 = [430.92, 437.39, 535.03, 496.54, 520.72, 628.35, 679.06, 636.99, 574.81, 579.04, 598.50, 683.85] = 0.25 es = [] es.append(float(l1[0])) in range(1, len(l1)): es1 = (a * (l1[i])) + ((1 - a) * es[i-1]) es.append(float(es1[i])) print(es) the error message tells all. if closely interpreter tells line in error occured. in line ( es.append(float(es1[i])) ) try subscript value assigned float in previous line. can rid of float constructors: l1 = [430.92, 437.39, 535.03, 496.54, 520.72, 628.35, 679.06, 636.99, 574.81, 579.04, 598.50, 683.85] = 0.25 es = [] es.append(l1[0]) in range(1, len(l1)): es_i = (a * (l1[i])) + ((1 - a) * es[i-1]) es.append(es_i) print(es)

c++ - Inserting data in a singly link list by specifying the nth node position -

so logic goes this: suppose link list consists of (6,7,8) data , pass insert(1,5) ,so list (5,6,7,8) . on insert(3,2) link list (6,7,2,8) . i tried compiling below code gives me error stating- undefined reference main '-start' i tried debugging,even searching answers found no help.kindly suggest solution.any further suggestions , bug fixes shall welcomed. (i have used codepad compiling) #include<iostream> using namespace std; class link_no { struct node { int data; node *next; }; void insert(int n,int d,node *head) { node *temp=new node(); temp->data=d; temp->next=null; node *temp1; if(n==1) { temp->next=head; head=temp; return; } else temp1=head; { for(int i=0;i<n-1;i++) { temp1=temp1->next; } temp->next=temp1;

javascript - How to hide refferer from a website -

this question has answer here: remove http referer 8 answers for example have website x , don't want other site y, know url adress if goes site y through website x. how do that? there noreferrer value rel attribute: https://html.spec.whatwg.org/multipage/semantics.html#link-type-noreferrer https://developer.mozilla.org/en-us/docs/web/html/link_types prevents browser, when navigating page, send page name, or other value, referrer via referer: http header. (in firefox, before firefox 37, worked in links found in pages. links clicked in ui, "open in new tab" via contextual menu, ignored this). example: <a href="http://www.example.com" rel="noreferrer">example</a> there library tries support noreferrer on older/non-supportive browsers: https://github.com/knu/noreferrer

android - getParcelable() returns object with null data members for Parcelable object -

i'm doing course on udacity(final project stage 1) , need make popular movies app. unable pass movie object detailsactivity. movie object parcelable. public class movie implements parcelable{ int id; string original_title; string poster_path; string overview; string backdrop_path; string vote_average; string release_date; public movie(string _original_title, string _poster_path, string _overview, string _backdrop_path, string _vote_average, string _release_date, int _id){ this.original_title = _original_title; this.id = _id; this.overview = _overview; this.poster_path = _poster_path; this.backdrop_path = _backdrop_path; this.vote_average = _vote_average; this.release_date = _release_date; } protected movie(parcel in) { id = in.readint(); original_title = in.readstring(); overview = in.readstring(); poster_path

Sending content from my frontend to my PHP/MySQL-backend -

when send content frontend reaches if (!empty)-statement table in phpmyadmin/mysql-database not recieve information , not add it. i have 2 tables. 1 varchar (text) named "photo" , id called "id" a_i. with current code send (well attempt send) text "photo" nothing id a_i? maybe need add addiotional code , might issue here , reason database not seem add content send? <?php $value = json_decode(file_get_contents('php://input')); $mysql_pekare= new mysqli ("", "","", ""); if(!empty($value)) { echo "you reached if-statement"; $stmt = $mysql_pekare->prepare("insert photoalbum(`photo`) values(?)"); $stmt->bind_param("s", $value['photo']); $stmt->execute(); $stmt->close(); $mysql_pekare->close(); } ?> in frontend when send content recieve in log: {"photo":"test"} and rec

php - This basic login form is not doing anything -

i have edited code answers far getting these errors warning: mysqli_num_rows() expects parameter 1 mysqli_result, boolean given in c:\xampp\htdocs\test\index.php on line 18 warning: mysqli_fetch_array() expects parameter 1 mysqli_result, boolean given in c:\xampp\htdocs\test\index.php on line 28 line 18 - $checkuser= mysqli_num_rows($query); line 28 - while ($row = mysqli_fetch_array($query)) { can shed light on please <?php require_once('config.php'); if(isset($_post['login']) && isset($_post['uname']) && isset($_post['pass1'])) { // here check if input sent $uname = $sql-> real_escape_string($_post['uname']); $pass1 = $sql-> real_escape_string($_post['pass1']); if ( !empty($uname) && !empty($pass1)) { // check if input not empty $query= mysqli_query($sql, "select uname, pass1 login uname='$uname'"); $checkuser= mysqli_num_rows($query); if($chec

android - Query using LIKE isn't working using GreenDAO -

i have table column string 3 characters, each character has value 0 or 1. i'd select rows according case. i'd perform query that: select * item group_type ? ? can 100 or 101 or 011 or 111 or 001. combination 0 , 1 in 3 characters. i'm trying query using like wherecondition = null; switch (condition) { case case1: = itemdao.properties.grouptype.like("1%"); break; case case2: = itemdao.properties.grouptype.like("%1%"); break; case case3: = itemdao.properties.grouptype.like("%1"); break; } list<item> items = itemdao.querybuilder().where(where).list(); case1 returning starts 1 expected. case3 returning ends 1 expected. case2 returning everything! doesn't metter value in beggining, middle or end. it's returning everything. case1 , case3 working fine. however, case2 isn't working. there problem that?

nsurl - Getting the file kind by extension on iOS -

when take .dae file , file, info on osx's finder see kind: digital asset exchange (dae) .rtfd shows kind: rich text document attachments but osx. now, how discover kind of file on ios nsurl of file? there may other ways, 1 way use uniform type identifier (uti) services provided mobilecoreservices . import mobilecoreservices just description associated extension's uti: if let uti = uttypecreatepreferredidentifierfortag(kuttagclassfilenameextension, pathextension, nil)?.takeretainedvalue(), let description = uttypecopydescription(uti)?.takeretainedvalue() { print(description) } see how system identifies type of content in file in file system programming guide.

android - Two separate ASyncTasks wrongly combining data when processing JSON -

i have project tablayout + viewpager scroll through 2 different fragments (one shows data happening , other shows data). in oncreateview's of both of these call same asynctask class difference being params changing. fetchitems asynctask = new fetchitems(getcontext(), this); asynctask.executeonexecutor(asynctask.thread_pool_executor,"someparams"); the json result processed here: try { linkedlist<leagueitem> leagues = new linkedlist<>(); leagueitem newleague; //for every league in array (int = 0; < jsonbody.length(); i++) { newleague = new leagueitem(); //hold league games jsonobject jsonleagueinfo = jsonbody.getjsonobject(i); newleague.setleaguename(jsonleagueinfo.getstring("name")); jsonarray leaguematches = jsonleagueinfo.getjsonarray("matches"); //for every match in league for(int j = 0;j<leaguematches.l

Apache Tomee & Hibernate ORM: Windows Server 2012 R2 or SuSE Linux Enterprise Server 11 SP4 -

i given possibility chose between windows server 2012 r2 , suse linux enterprise server 11 sp4 , while renting virtual server. needs of server want create, wish install apache tomee web application server. intend use hibernate orm. is there known problems/bugs (still not fixed) regarding apache tomee or hibernate, , 1 of 2 os can choose between? suggest 1 on other, except preference between windows , linux? windows vs linux what more comfortable administrating? if have no linux experience, use windows. that being said, linux offers thousands of advantages on windows, ability create lxc containers, it's security record, it's lightweightness, it's remote administration capabilities. have ability use thousands of portable unix command line tools, whereas windows, you're limited non-portable powershell. hibernate orm generally recommend people not use hibernate. instead, stick official jpa annotations , apis only, , let application container choose i

html - How can I make an iframe inside of a <td> 33 percent of the screen width? -

i have frame inside of <td> element. i'd dynamically scale iframe takes 33% of screen width (and automatically fixes height ). when try this: <iframe src="google drive presentation url" frameborder="0" width="33vw" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe> it takes 33% of <td> element (which has text in it). also, tried using width="33%" didn't work either. how can fix this? you must give width using css instead. body { margin: 0 } td { width: 33.3%; background: red } iframe { width: 100% } <table> <tr> <td> <iframe src="google drive presentation url" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe> </td> <td>

python - How to understand this doc -

this the python docs . don't understand this, can give examples? if class defines slot defined in base class, instance variable defined base class slot inaccessible (except retrieving descriptor directly base class). renders meaning of program undefined. in future, check may added prevent this. i tried make example of failed. when run program below prints 1 , variable not inaccessible. when be? class base(object): __slots__ = 'a' def __init__(self): self.a = 1 class subclass(base): __slots__ = 'a' def __init__(self): super(subclass, self).__init__() print self.a subclass() when run program below prints 1, variable not inaccessible. you have two a instance variables here. 1 defined base not accessible through attribute access; object of type subclass , accesses self.a , including 1 inside base.__init__ , go instance variable defined subclass . if retrieve base.a descriptor manually

Checking memory and CPU usage in Haskell program itself -

i try make db in haskell, , want find way check memory , cpu usage in program. i try search using keywords "haskell memory usage" or "haskell memory checking" , "haskell cpu usage" , ..., there no answer want (memory , cpu checking in haskell program itself ). is there portable way memory , cpu usage in itself , while program running? please let me know. what using snmp that? snmp used remotely monitor devices, nothing prevents running agent locally , querying (a thread in) haskell application. way, cpu , memory usage information collected separate application (the snmp agent) , application ask when needs. in order that, use 1 these haskell packages: snmp or netsnmp . you'll able find lot of useful information/tutorials/examples regarding process monitoring using snmp in internet (if not familiar it) , once understood them, implementing need in haskell using packages should straightforward. also, found related question .

Downloading image file into WebView Android -

i have arcive of several files format jpg, pdf, zip , want download files app. pdf , zip files being downloaded can not download jpg files. idea how can download jpg files well? html page here http://www.sotkora.com/xy/ex_download.html public class downloadingexample extends activity { webview webview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_downloading_example); this.webview=(webview) this.findviewbyid(r.id.webview_if); this.webview.getsettings().setsupportzoom(false); this.webview.getsettings().setjavascriptcanopenwindowsautomatically(false); this.webview.loadurl("http://sotkora.com/xy/ex_download.html"); this.webview.setwebviewclient(new webviewclientdemo()); this.webview.setdownloadlistener(new downloadlistener() { public void ondownloadstart(string url, string useragent,

Xcode commands via OS X Terminal -

i have mac os x version 10.5.7 downloaded xcode version 4.6.3 , launched it. according many tutorials (such this ) supposed install further command line tools via terminal: xcode-select --install but little manual page: usage: xcode-select -print-path or: xcode-select -switch <xcode_folder_path> or: xcode-select -version arguments: -print-path prints path of current xcode folder -switch <xcode_folder_path> sets path current xcode folder -version prints xcode-select version information i went applications directory , tried run command there, same outcome. in fact, content of applications directory revealed through following command strange: ~ cd applications ~ ls chrome apps.localized what missing or doing wrong?

sql - "Error converting data type nvarchar to float" with CASE WHEN Statement -

i'm trying run query following 1 of select statements, , keep getting error "error converting data type nvarchar float." i've been converting vba iif statements cases , can't seem conversions right. fld2 nvarchar(15) , fld1 float data type. need pinpointing why error being thrown. case when (isnumeric([fld2]) = 1) round(convert(nvarchar,[fld2]) + ' / ' + convert(nvarchar,[fld1]),(len(convert(nvarchar,[thedata])) - charindex(convert(nvarchar, [fld2]),'.'))) else [fld2] end, as is, example produce quite funny expression sql server evaluate. let's substitute values fld1 , fld2 , , thedata example see you're trying do: [fld1] = 42.0 [fld2] = n'69.56' [thedata] = n'something' (an n before string makes nvarchar instead of varchar ) with substitutions, resulting query this: case when (isnumeric(n'69.56') = 1) round(convert(nvarchar,'69.56') + ' / ' + convert(nv

php - How To Separate Mysqli Query result After Coma -

i bit confused @ 1 situation. have table called slam-book in have column named favorite games. user enters data like "cricket, foot ball, hockey, basket ball" now want separate result , want give link like, <a href="/game.php=cricket">cricket</a>, <a href="/game.php=foot-ball">foot ball</a>, <a href="/game.php=hockey">hockey</a>, <a href="/game.php=basket-ball">basket ball</a> so, can list users specific interest, please me such result. want code can give me results #2 code. it's hard 'guess' structure mysql database in order i'll try anyways. if understood correctly example of column in database: cricket, foot ball, hockey, basket ball if so, query below: select favorite_games slam-book user_id=id then iterate result set doing like: foreach ($row = $result->fetch_assoc()) { // list of games $games = explode(',', $row['

java - after compilling code JFrame does not appear -

i'm using intelij idea platform. i have following code: package gui.test; import javax.swing.*; public class ramka extends jframe{ ramka(){ setvisible(true); setsize(100,100); } public void main (string[] args){ new ramka(); } } i expected see jframe after compiling code, nothing appeared. kind of problem can be? also must admit, haven't possibility run method "main". inteligidea propose me compile ramka.java. after compilling intelijideay says, compilation complited sucessfully, thats , nothing happened. in previous exersises allways ran method "main". you should this: public static void main (string[] args){ java.awt.eventqueue.invokelater(new runnable() { public void run() { new ramka().setvisible(true); } }); } besides missing static identifier @ main , have make sure frame runs in right thread check "concurrency&quo

android - seekbar not updating textview in Dialog custom layout -

Image
i have layout seekbar , textview using inside dialog. when try update textview seekbar nothing happens. i doing changes in onprogresschanged. here code milage_main.class: public class milage_spinner extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); seekbar seekbar = (seekbar)findviewbyid(r.id.seekbar); seekbar.setprogress(10); seekbar.setmax(10); final textview sbv = (textview) findviewbyid(r.id.drivetime); final edittext drive_time = (edittext)findviewbyid(r.id.runtime); seekbar.setonseekbarchangelistener(new seekbar.onseekbarchangelistener(){ @override public void onprogresschanged(seekbar seekbar, int progress, boolean fromuser) { sbv.settext(string.valueof(progress)); drive_time.settext(progress); } @override public void onstarttrackingtouch(seekbar seekbar) { } @override public void onstoptrackingtouch(seekbar seekbar) { } }); } } and here dialog builder in mainactiviy.class getting layout milage_