Posts

Showing posts from February, 2010

json - Getting the number of properties in JQuery object -

i'm trying figure out how many properties in following object. obviously, can see 2, need know dynamically. var test = $.parsejson('{ "ddsize": "size", "ddcolor": "color" }'); if try: var mylen = test.length; .length undefined. number of properties in object change. it's 1, 2 or 3, can't figure out how test it. this javascript json object. length function not available. first solution pure javascript: var data = $.parsejson('{ "ddsize": "size", "ddcolor": "color" }'); var keys = []; (key in data) { keys.push(key); } // numberofkeys should equal 2 var numberofkeys = keys.length; second solution if prefer jquery: var data = $.parsejson('{ "ddsize": "size", "ddcolor": "color" }'); var keys = []; $.each(data, function(key, value) { keys.push(key) }); // numberofkeys should equal 2 var numberofkeys = keys.length; documenta...

objective c - Locating the nearest open space within a UIView -

i have uiview user can add subviews to. need application automatically place subview user @ first found open location. a location considered open if frame of subview placed not intersect other subviews. the calculation locate open area not need instant - run when user first enters scene, @ point saves location if user placed it. the container uiview large enough have open space place subview (there limited number of subviews user can add). what simplest way determine location place subview? i posted description of algorithm commonly used solve these sorts of problems in answer question: finding largest rectangle in 2d array . it's easy adapt solution problem. in question filled spaces on grid, made determining amount advance scan line little easier, have more careful. other question looking empty rectangle maximal area, can exit algorithm find first fit. of course, if subviews same size, solutions identical. hope helps.

javascript - How do I detect IE 8 with jQuery now that $.browser is deprecated? -

possible duplicate: best way detect html5 <canvas> not supported now $.browser is being taken out of jquery in favor of $.support, how detect ie8 jquery, or plain javascript? if ($.browser.msie && parseint($.browser.version, 10) === 8) { alert('ie8'); } sorry, html not work me. can not this: <!--[if ie 8]> <script type="text/javascript"> ie = 8; </script> <![endif]--> specifically, looking work canvas tag , ie8 not support canvas, jquery.support not detect canvas support. test feature instead: var el = document.createelement('canvas'); if (el.getcontext && el.getcontext('2d')) { // canvas supported } edit: as in link suggested in comments brandon boone, here's function it: function iscanvassupported(){ var elem = document.createelement('canvas'); return !!(elem.getcontext && elem.getcontext('2d')); }

c# - Returning a value from a stored procedure to a method -

i have stored procedure returns whether student locked or not: return @islocked i execute stored procedure like: public int isstudentlocked(string studentname, int lockouttime) { sqlconnection connobj = new sqlconnection(); connobj.connectionstring = util.studentdatainsert(); connobj.open(); sqlcommand comm = new sqlcommand("uspchecklockout", connobj); comm.commandtype = commandtype.storedprocedure; comm.parameters.add(new sqlparameter("@studentname", studentname)); comm.parameters.add(new sqlparameter("@lockouttime", lockouttime)); comm.executenonquery(); connobj.close(); //how can return @islocked value below? return ((int)(@islocked)); } to use return statement in t-sql (which can return integer values), have add parameter retrieve it: public int isstudentlocked(string studentname, int lockouttime) { sqlconnection connobj = new sqlconnection(); connobj.connectionstring = util.studentdatainsert(); connobj.open(); sqlcommand comm = new sqlcomma...

jquery - li element hover event and show sub menu? -

html codes <ul class="menu"> <li>deneme</li> <li>deneme <ul> <li>alt menu</li> <li>alt menu</li> <li>alt menu</li> <li>alt menu</li> <li>alt menu</li> </ul> </li> <li>deneme <ul> <li>alt menu</li> <li>alt menu</li> <li>alt menu</li> <li>alt menu</li> <li>alt menu</li> </ul> </li> <li>deneme</li> <li>deneme</li> <li>deneme <ul> <li>alt menu</li> <li>alt menu</li> <li>alt menu</li> <li>alt menu</li> <li>alt menu</li> </ul> </li> <li>deneme</li> </ul>​ javascript: $(document).ready(function(){ $("ul.menu > li").css("color","red"); $("li ul li").css("color","blue") $("li ul li").hide(); $("u...

Android : how to edit the bar at the top of the screen? -

i'm beginning learn android development , have bar @ top of app, containing title of activity , app icon. want know how edit (change text, background color, etc), , remove ? want know how edit title of app, because it's name of main activity... thanks lot. edit androidmanifest.xml <application android:icon="@drawable/icon" android:label="@string/app_label" > ... <activity android:name="foo.myactivity" android:label="@string/activity_label" > </activity> </application> if don't want titlebar, add attribute: android:theme="@android:style/theme.notitlebar" to application tag.

cuda - Conversion from Matlab CSC to CSR format -

i using mex bridge perform operations on sparse matrices matlab. need convert input matrix csr (compressed row storage) format, since matlab stores sparse matrices in csc (compressed column storage). i able value array , column_indices array. however, struggling row_pointer array csr format.is there c library can in conversion csc csr ? further, while writing cuda kernel, efficient use csr format sparse operations or should use following arrays :- row indices, column indices , values? which on give me more control on data, minimizing number for-loops in custom kernel? compressed row storage similar compressed column storage, transposed. simplest thing use matlab transpose matrix before pass mex file. then, use functions ap = mxgetjc(spa); ai = mxgetir(spa); ax = mxgetpr(spa); to internal pointers , treat them row storage. ap row pointer, ai column indices of non-zero entries, ax non-zero values. note symmetric matrices not have @ all! csc , csr same. which format use heavily...

php - Adding linking functionality to my XSLT in Drupal -

i have xml feed have transformed html dynamic drupal page, courtesy of nice users @ drupal.stackexchange.com . issue, however, xml feed lists possibly ever need known, , requirements each page renders subset of information. essentially, presentation schedule needs broken down. my example feed follows: <track name="track 1"> <session name="session 1" starttime="2012-06-06 10:45" endtime="2012-06-06 12:45"> <presentation name="presentation 1"> <author>name 1</author> <author>name 2</author> <abstract>summary of presentation</abstract> </presentation> <presentation name="presentation 2"> ...presentation info </presentation> </session> <session name="session 2" starttime="2012-06-06 10:45" endtime="2012-06-06 12:45"> <presentation name="presentation 3"> ...presentation info </presentation> ...

Android Base Activity: Base's Global Variables, Can't get from some activites -

i'm taking android class now, new android app development. my first assumption base activity it's global variables , it's values available activities. have found available main activity, not activities after that. in base activity storing arraylist of objects. load data xml in there adds objects arraylist. once in main activity still have access arraylist , it's values. use fill list. when go next activity, knows arraylist thinks empty. do need create methods in base activity retrieve arraylist , add objects array list? any appreciated. thank you, michelle global variables need declared static . accessible class. example: public class globals { public static string mystring; } any class can read/write mystring this: globals.mystring = "foo"; or string bar = globals.mystring;

html - How to stop Navbar overlapping my blog's slider and article headers? -

blog link: http://confabtest.blogspot.co.uk/ the navbard on blog overlapping other elements such featured article slider, , when open article top of header , social sharing widget on side partially overlapped. http://imm.io/voxw anyone know how can fix this? here code navbar: .menu-secondary-container{position:relative;height:40px;z-index:300;background:#000;padding-left:5px} .menu-secondary{} .menu-secondary ul{min-width:160px} .menu-secondary li a{color:#fff;padding:12px 15px 11px 15px;text-decoration:none;font:12px &#39;oswald&#39;,sans-serif;text-transform:uppercase} .menu-secondary li a:hover,.menu-secondary li a:active,.menu-secondary li a:focus,.menu-secondary li:hover &gt; a,.menu-secondary li.current-cat &gt; a,.menu-secondary li.current_page_item &gt; a,.menu-secondary li.current-menu-item &gt; a{color:#000;background:url(http://www.colorhexa.com/ff0033.png) repeat-x;outline:0} .menu-secondary li li a{color:#fff;background:#51abee;padding:10px 15...

java - How to convert this code into javacv? -

i had went through many tutorials , guide lines , able convert part of it. don't know how convert last line in javacv. please can 1 me convert code in javacv? img = cv2.imread('sofud.jpg') gray = cv2.cvtcolor(img,cv2.color_bgr2gray) ret,thresh = cv2.threshold(gray,127,255,1) contours,hierarchy = cv2.findcontours(thresh,cv2.retr_list,cv2.chain_approx_simple) cnt in contours: x,y,w,h = cv2.boundingrect(cnt) if 10 < w/float(h) or w/float(h) < 0.1: cv2.rectangle(img,(x,y),(x+w,y+h),(0,0,255),2) you can use last line in java cv: opencv_core.cvrectangle(image, opencv_core.cvpoint(m,n), opencv_core.cvpoint(i,j), opencv_core.cvscalar(0,0,255,0), thickness, 8, 0); where parameters mean: opencv_core.cvrectangle(cvarr* img, cvpoint , cvpoint, cvscalar color, int thickness=1, int linetype=8, int shift=0) and @ link more information. edit: this example of finding contours: cvfindcontours(grayimage, memory, contours, sizeof(cvcontour.class) , cv_retr_ccomp, cv_chain_a...

I have this jQuery Validation function issue. Validation only works once -

the function below works should. it's validate form. in short, have couple input fields. if hit submit , no text has been entered in either input, validation errors appear. if fill in 1 field, 1 of fields update. if hit "submit" again, without filling in second form input, else{} gets fired, not if{} should assure it's filled out, etc. not familiar, return false; issue? if ($('input[type="text"]:visible').val().length == 0) { $('.submitmodal').click(function () { $('.modal').modal('show'); }); } else { $('.submitmodal').click(function () { $('.modal').modal('hide'); }); } any idea im doing wrong? this backwards thinking. bind click, period. not conditionally. on click, decide want happen (even if means ignoring click). if bind click, filling out form differently isn't going unbind it. , though unbind it, there's no great reason to. if .submitmodal submit input element (rather anchor o...

javascript - How do I counter iframe security problems? -

i heard there many security issues arise when use iframes. handle xss, else should make sure no problems happen? i came across js codes use top.window, concern client-side code not reliable, else can server side? (i using php, awesome if solution generic) update: make things clearer, using iframe, because don't want headers, menues etc.. refreshed every time. trying find way use iframe without falling security problems. you set x-frame-options header deny. let browsers know if resource loaded via iframe don't display. you can read more & configuring server send header @ mdn . also, in php can use header("x-frame-options: deny")

eclipse - Dynamic refresh of a composite -

i have tree viewer next specialized viewer. when selected in tree viewer, details object shown in specialized viewer. treeviewer tree , composite control , , myspecializedviewer viewer instance variables. public theeverythingviewer(composite parent) { control = new composite(parent, swt.none); control.setlayout(new gridlayout(2, false)); tree = new treeviewer(control); tree.setcontentprovider(new mycontentprovider()); tree.setlabelprovider(new mylabelprovider()); tree.setusehashlookup(true); tree.getcontrol().setlayoutdata(new griddata(griddata.beginning, griddata.fill, false, true, 1, 1)); tree.addselectionchangedlistener(new iselectionchangedlistener() { @override public void selectionchanged(selectionchangedevent event) { try { istructuredselection sel = (istructuredselection) event.getselection(); myclass myinput = (myclass) sel.getfirstelement(); if (viewer != null) if (!viewer.getcontrol().isdisposed()) viewer.getcontrol().dispose(); viewer = new myspecializedviewer(control, t...

python - How to create ModelForm with objects that are owned by a particular user -

possible duplicate: how filter foreignkey choices in django modelform? say have models this: from django.db import models django.contrib.auth.models import user class author(models.model): first_name = models.charfield(max_length=100) last_name = models.charfield(max_length=100) owner = models.foreignkey(user) class book(models.model): title = models.charfield(max_length=100) authors = models.manytomanyfield(author) owner = models.foreignkey(user) if create modelform book model, users allowed select all authors, not ones own. how create modelform book model lets user select authors s/he owns? you can override model form's __init__ method , restrict queryset author model choice field . class bookform(forms.modelform): class meta: model = book # exclude owner , set in view exclude = ('owner',) def __init__(self, *args, **kwargs): super(bookform, self).__init__(*args, **kwargs) if self.instance.owner: self.fields['author'].queryset = author.objects.filter...

sql - difficulty in entering correct script for dateformat -

this query select fullname, rank, id_no, tin, birthdate, hair, eyes, blood, height, weight, marks, name, address [******_domain\****_*****].*******view i want change dateformat default yyyymmdd mm/dd/yyyy , i'm having difficulties writing correct script changing dateformat. thanks in advance use this select convert(varchar,datecolumn,101) tablename 3rd argument here supported format numeral. for more info go here

join two query using SQL -

Image
select test2.user_id,mytable1.mycol1 testingtable2 test2 lateral view explode(test2.purchased_item.product_id) mytable1 mycol1; i getting below output result using above query. user_id | mycol1 -------------+--------------- 1015826235 220003038067 1015826235 300003861266 1015826235 140002997245 1015826235 200002448035 if compare above output query below table2 data, last line table2 data missing in above query output. and second table2. buyer_id | item_id | created_time -------------+--------------------+-------------------------- 1015826235 220003038067 2012-06-21 07:57:39 1015826235 300003861266 2012-06-21 21:11:12 1015826235 140002997245 2012-06-14 20:10:16 1015826235 200002448035 2012-06-08 22:02:17 *1015826235* *260003553381* *2002-01-30 23:12:18* i need print last line using join , output should after join between query wrote above , table2 data. *1015826235* *260003553381* *2002-01-30 23:12:18* so need join between above query wrote , table2 data , data not ther...

how to join a subquery with conditions in Squeel -

prologue i've embraced squeel – , enjoying every step! thank sharing, ernie miller! i'm developing ruby 1.9.2 , squeel 1.0.2 , rails 3.2.5 (i'll confess having restructured question entirely - hoping increase readability , better chances of getting answer) <:) use case i'd (super)user able assign authorizations , permissions this a user_group should able have multiple authorizations an authorization should able have multiple permissions a permission should able control access (manipulating) data via controller (the request path) on instances of class on particular instance the acl system should lazy – ie if no roles/authorizations given, users not concern acl @ all. migrations i identified role , (a polymorphic) roleable entities use case have a role right out of ordinary create_table :roles |t| t.references :ox t.string :name t.boolean :active, default: true t.timestamps end and roleable bit more descriptive create_table :roleables |t| ...

version control - How should I organize files in VCS? -

i'm making website , making multiple design prototypes. want keep of them future reference. is suitable place use branches, or should put them in folders? how should manage external dependencies (e.g. jquery), should include minified version every design or keep 1 whole project or link online version? branches fine if: you want compare differences of same file across several variation of website develop in parallel said variations, in isolation (see "when should branch?") . that won't prevent top deploy in different directories (you checkout each branch in different folder on web server) any common part (like jquery script) should in sub-directory versioned in own repo , referenced main web repo submodule .

jquery - Hiding popup window in parent window using JavaScript -

in site registration done step step process. in first step open popup window using javascript , close popup window automatically after tasks in window have been completed. next go next step clicking button. there button in second step return first step. when come first step clicking on button in second step popup window in first step loaded. it not need load pop window when return first step. how can this? this javascript code : function show_gal() { var windowsizearray = [ "width=935,height=580", "width=935,height=600,scrollbars=yes" ]; var url1 = "<?php echo base_url();?>plugin/index.php"; var id = $("#hidtuid").val(); var url = url1+"?usrid=" + id; var windowname = "image upload"; var windowsize = windowsizearray; window.open(url, windowname, windowsize); } this code in popup window after completing task in popup window: window.close(); its more logical question, find different ways this. 1 way is: are ...

javascript - Load webpage in div on mouse-over effect of link -

i developing website (using php, html , css). have page "news , events" contains list of urls. want on mouse-over on link, small miniature of corresponding website should loaded in div, user knows type of news link contains. i have tried code on mouse-over images , videos, unable same webpage. for image : <a href="happy-birthday-1.gif" rel="enlargeimage" rev="targetdiv:loadarea,link:dynamicdrive.com">happy birthday</a><br /> <div id="loadarea" style="width: 600px"></div> for video : <a onclick="document.getelementbyid('dynloadarea').innerhtml='<iframe src=\'osmosis.mpg\' width=\'300\' height=\'300\' scrolling=\'auto\' frameborder=\'0\'></iframe>'"> osmosis</a> <div id="dynloadarea"></div> -thanks in advance ! use blockui examples here : http://jquery.malsup.com/block/#demos ...

asp.net mvc 3 - Manage Roles for Users in MVC 3 application -

i trying add , delete aspnet roles user in mvc 3 application. i need work 3 tables described below. my problems are: i need display user's existing selected roles, , other roles available not selected user using "checkboxes" i need save selected values table aspnet_usersinroles table this have done far: i have created viewmodels called assignedrolesdata.cs i have altered models aspnet_users , aspnet_users hold icollection navigation properties aspnet_usersinroles i have created method usercontroller called "populateassignedroledata" populate existing roles per user my problems: i cannot selected roles checkboxes i don't know how save them afterwards the keys of type guid models **using system; using system.collections.generic; using system.componentmodel.dataannotations; namespace www.models { public class aspnet_roles { public guid applicationid { get; set; } [key] public guid roleid { get; set; } public string rolename { get; set; } pu...

How to use rabbitmq as a distributed task queue? -

in knowledge, rabbitmq ha message queue. is possible use task queue. requirement: load balanced should consider worker node idle resource should dynamic add/del worker thread worker node hot-plugging can dynamice set routing. as rabbitmq consumer can fetch message , define callback function handle message. possible that. don't know how use flexible,dynamically. can give example or idea? in rabbitmq, if more 1 consumers binds queue, messages load-balanced in round-robin fashion. to better understand, can read article. https://techietweak.wordpress.com/2015/08/14/rabbitmq-a-cloud-based-message-oriented-middleware/ thanks, saravanan s.

jquery - Remove next row cell if rowspan is found -

i have loop through table in every tr if td have csstdgreen , have attribute rowspan. have remove cell have text remove me. function cleartable() { if ($("tr").has("td.csstdgreen").length > 0) { if ($('td[rowspan]') == 1 || $('td[rowspan]') == 2 || $('td[rowspan]') == 3) { var $this = $(this); var = $this.index(); } } } $('table tr').each(function(){ var indexofthis,indexofcolspan,numrows; if($('td[rowspan]',this).length!=0) { indexofthis =$('table tr').index(this); indexofcolspan = $('td',this).index($('td[rowspan]',this)); numrows = $('td[rowspan]',this).attr('rowspan'); $('table tr:gt('+indexofthis+')').each(function(){ $('td:eq('+indexofcolspan+')',this).remove(); }); } }); ​ this should give helping hand need. js fiddle not working me atm. there little tinkering not number of rows, whole grid. main part done.

haskell - converting list to tuple -

i have few command-line options (5 example) , want convert them tuple. problem expect them appear in correct order, tuple can built list using pattern-match, in real life options can provided in random order, don't know if head of list contain verbose option or log file name? i tried think how using continuation-passing style, nothing useful comes mind. is ever possible? i think can "sort" list have in predicted order, not good. also rid of tuple , create data record - still lead checking type of attribute , set correct field of record. still lot of typing. given describe, think have 2 options. of two, converting dictionary easiest, converting tuple work , little clumsy so, take definition: options :: [optdescr (string, string)] options = [option ['a'] ["alpha"] (reqarg (\a -> ("alpha", a)) "empty") "", option ['b'] ["beta"] (reqarg (\a -> ("beta", a)) "empty") "...

java - How does LCP help in finding the number of occurrences of a pattern? -

i have read longest common prefix (lcp) used find number of occurrences of pattern in string. specifically, need create suffix array of text, sort it, , instead of doing binary search find range can figure out number of occurrences, compute lcp each successive entry in suffix array. although using binary search find number of occurrences of pattern obvious can't figure out how lcp helps find number of occurrences here. for example suffix array banana : lcp suffix entry n/a 1 ana 3 anana 0 banana 0 na 2 nana how lcp find number of occurrences of substring "banana" or "na" not obvious me. any figuring out how lcp helps here? i not know way of using lcp array instead of carrying out binary search, believe refer technique described udi manber , gene myers in suffix arrays: new method on-line string searches . the idea this: in order find number of occurrences of given string p (length m) in text t (length n), you use binary search against suffix arra...

image processing - Camera properties for 3d using specular reflection -

could 1 in clarifying following description taken article "local shape mirror reflection" savarese, chen , perona. "let c center of projection of camera. image plane positioned l distance units in front of c, perpendicular view direction v. given scene point p let q image of p observed on image plane through specular reflection on mirror surface @ r." to understanding both c, v , l properties of camera, how can find them? as p moves along scene plain q , r shift respectively c,v , l constant or should new center of projection, image plane , view direction calibrated separately each point? image setup of system: c , v not intrinsic properties of camera, location , orientation. however, l focal length, intrinsic parameter. both intrinsic , extrinsic parameters can recovered through calibration procedure. if matlab, google jean-yves bouguet's camera calibration toolkit. has been ported opencv since forever, if you'd rather c or c++. the extrinsic pa...

How to disable fringe in Emacs? -

Image
first, try use (fringe-mode -1) , picture below, there thin fringe on right of linum line. and then, try use (set-fringe-mode '(0 . 0)) specify left-fringe , right-fringe zero. fringes disappear. got strange appearance. while emacs start up, frame thinner , thinner, until narrow thin line(i don't how explain it, see pictures below). startup - loading dotfiles getting thiner finally and now, set (set-fringe-mode '(0 . 1)) , , there 1 fringe on right of buffer. how (set-fringe-mode 0) ? that's value no-fringes in fringe-styles alist. if doesn't work, too, think should submit bug report.

How to convert java object into C struct -

how can convert java object c struct? know can translate data xml need more quick , easy way this? possible solutions? data serialisation buzz word here. for quiet impressive list of techniques might read here: http://en.wikipedia.org/wiki/comparison_of_data_serialization_formats

java - Handling multiple forms in spring mvc -

Image
in jsp having multiple tabs containing separate forms,see below image: problem: since tabs present in same jsp, reached 1300 lines. can not neglected. since using spring mvc,i need bind 4 objects(abc,abc sub1,abc sub2,abc sub3) while returning view, not acceptable. i thinking of dividing whole page 4 different jsp's (and including jsp's based on requirement or event), still not satisfied solution. can body give me other solutions...???? thanks .....!! use ajax submit need @ once.

html - Efficient Javascript for DOM modifications -

say, i've got html file want process using javascript. example: add dom elements, span or div wrappers. change document styling bit, base font size, line-height, etc. use hyphentor add &shy; entities. what efficient way this, i.e. i'd minimum amount of reflows. the ideal case having js-code run before first layout. possible? know, it's bad idea execute expensive scripts before page has been displayed make page blank time , it's bad experience. however, i'm going need work offline , not issue project. or, there's way dom modifications in 1 bunch, i.e. reflow triggered after alterations have finished? there several ways. primary goal of them end causing single - or @ least few possible - reflows/repaints. off-dom element you can work elements without appending dom, , append once everything's set up. the issue if code needs reference offset dimensions, since elements not yet in dom not have any. var container = document.createelement(...

sql - Ordering records by the number of associated records -

users can submit resources , post comments. i want show users 'active' selecting users have submitted resources , comments , order results user has submitted resources , comments combined least. **resource** has_many :users, :through => :kits has_many :kits belongs_to :submitter, class_name: "user" **user** has_many :resources, :through => :kits has_many :kits has_many :submitted_resources, class_name: "resource", foreign_key: "submitter_id" **kits** belongs_to :resource belongs_to :user **comments** belongs_to :user i new kind of sql in rails. how can record set? first, need add comments association user model: has_many :comments with this, simplest solution this: user.all.sort |a,b| (a.submitted_resources.count + a.comments.count) <=> (b.submitted_resources.count + b.comments.count) end this slow, if want better want add counter caches. in migration: def add_column :users, :submitted_resources_count, :integer add_column :...

api - How can I disable Django's csrf protection only in certain cases? -

i'm trying write site in django api urls same user-facing urls. i'm having trouble pages use post requests , csrf protection. example, if have page /foo/add want able send post requests in 2 ways: as end user (authenticated using session cookie) submitting form. requires csrf protection. as api client (authenticated using http request header). fail if csrf protection enabled. i have found various ways of disabling csrf, such @csrf_exempt, these disable entire view. there way of enabling/disabling @ more fine-grained level? or going have implement own csrf protection scratch? there section of django's csrf protection documentation titled view needs protection 1 path describes solution. idea use @csrf_exempt on whole view, when api client header not present or invalid, call function annotated @csrf_protect .

php - Sign up/in using google account for localhost application -

i want use "sign up/in using google account" on localhost web application. used apis provided google it's not working. it gives me error http error: (0) couldn't connect host is necessary have security certificate (ssl) localhost use api? what can problem? that can't done guess. you'll need domain name or dns entry website on trying integrate google sign-in.

image - how to draw pixels to pf1bit in Delphi? -

Image
how draw pixels timage in pf1bit bitmap format? have tried result the whole of image black . here code i've tried : image1.picture.bitmap.loadfromfile('example.bmp'); // image rgb pf24bit 320 x 240 px resolution image1.picture.bitmap.pixelformat := pf1bit; i:=0 round(image1.picture.bitmap.canvas.height/2) - 1 begin j:=0 round(image1.picture.bitmap.canvas.width/2) - 1 begin image1.picture.bitmap.canvas.pixels[i,j]:=1; // correct? ... := 1? i've tried set 255 (mean white), still black end; end; note image size 320x240 pixel. thanks before. you need pack 8 pixels single byte 1 bit color format. inner loop this: var bm: tbitmap; i, j: integer; dest: ^byte; b: byte; bitsset: integer; begin bm := tbitmap.create; try bm.pixelformat := pf1bit; bm.setsize(63, 30); := 0 bm.height-1 begin b := 0; bitsset := 0; dest := bm.scanline[i]; j := 0 bm.width-1 begin b := b shl 1; if odd(i+j) b := b or 1; inc(bitsset); if bitsset=8 begin dest^ := b; inc(dest); b := 0; bitsset := 0...

hadoop - Hbase quickly count number of rows -

right implement row count on resultscanner this for (result rs = scanner.next(); rs != null; rs = scanner.next()) { number++; } if data reaching millions time computing large.i want compute in real time don't want use mapreduce how count number of rows. use rowcounter in hbase rowcounter mapreduce job count rows of table. utility use sanity check ensure hbase can read blocks of table if there concerns of metadata inconsistency. run mapreduce in single process run faster if have mapreduce cluster in place exploit. $ hbase org.apache.hadoop.hbase.mapreduce.rowcounter <tablename> usage: rowcounter [options] <tablename> [ --starttime=[start] --endtime=[end] [--range=[startkey],[endkey]] [<column1> <column2>...] ]

iphone - CoreData sqlite3 db - populating timestamp column with python script -

i have coredata model backed sqllite db. want populate db initial data. i have been using python far , has been working well. bit isn't working inserting dates. understand coredata stores dates in epoch format inserting them via python this: time.mktime(datetime(2012, 7, 1, 12, 30, 30).timetuple()) however, doesn't give me correct date when data loaded via coredata. ideas on how format date read in correctly via coredata? *note: realise people recommend doing via small app uses same model rather using python script, find python syntax more concise constructing , inserting lots of objects. e.g. can call methods insert data this: insertdata(con, 1, 1, 'data 1', 'description') vs objective-c long-winded method calls: [self insertdata withcon:con id: 1 i2:1 val:@"data 1", desc:@"description"]; core data appears use 1 january 2001, gmt reference date (same nsdate method timeintervalsincereferencedate ) , not 1970, mktime function i...

android - Ant rebuilding library projects every time -

i have android project includes 2 android library projects. i'm using command ant debug build project , takes around 1min , 20sec. i've counted 17 seconds used compile first android library project , 42 seconds used compile second android library project. since these 2 dependency projects updated it's not necessary compile them each time. how can avoid ant compiling 2 android library projects each build? add dont.do.deps=1 local.properties (or pass property ant other way)

c++ - cout is not a member of std -

i'm practicing using mulitple files , header files etc. have project takes 2 numbers , adds them. pretty simple. here files: main.cpp #include <iostream> #include "add.h" int main() { int x = readnumber(); int y = readnumber(); writeanswer(x + y); return(0); } io.cpp int readnumber() { int x; std::cout << "number: "; std::cin >> x; return x; } void writeanswer(int x) { std::cout << "answer: "; std::cout << x; } add.h #ifndef add_h_included #define add_h_included int readnumber(); void writeanswer(int x); #endif // #ifndef add_h_included the error showing in io.cpp. exact errors are: http://gyazo.com/117f407f4717ad4472f52b57b628c514.png does have idea why may happening? thanks. edit: made small project yesterday same amount of files (2 .cpp , 1.h) , didn't include iostream header in other .cpp , still compiled , ran fine. add #include <iostream> start of io.cpp too.