Posts

Showing posts from June, 2013

gitosis - What does invalid option mean when I do a git push? -

i have set own git server gitosis. seems functioning correctly when git push error message counting objects: 5, done. delta compression using 2 threads. compressing objects: 100% (3/3), done. writing objects: 100% (3/3), 388 bytes, done. total 3 (delta 0), reused 0 (delta 0) : invalid optione: line 2: set: - set: usage: set [--abefhkmnptuvxbchp] [-o option-name] [arg ...] ssh://git@mytestserver/~/repositories/gitosis-admin.git a subsequent pull work , seems correctly merge. ideas? that error coming shell on remote system (bash likely). login shell on remote system trying execute source file (like ~/.profile) broken. be, example, user's shell /bin/bash somewhere in git or execution path ssh invoking, calling /bin/sh instead (which might older less options).

java - Load Balancing webservers using Httpurlconnection on client side -

my application needs connect web service xml data. have 4 web service endpoints. what best way load balance between web service? i know best way use hardware/software load balancer have on client side. i have develop client using httpurlconnection working fine 1 end point. i planning use hashmap url's , after call 1 one. regards, imran without central point co-ordinate distribution of connections between service endpoints, you're pretty limited choosing arbitrary one-of-four each time establish connection. reasonable approach may use each endpoint in turn successive interactions client (starting 1 chosen @ random ensure there isn't heavy bias towards single endpoint @ times when clients may restarted). alternatively, implement endpoint returns preferred connection, client make subsequent calls. implementation assign clients round robin style, or reference load reported each endpoint @ given time. of 2 approaches, former far simpler , should give r...

java get the longest string in enum -

i find longest string within java enum. best way this? havent been working enums suggestion welcome. these enums public enum domain_languages { eng, swe; public static list<domain_languages> getdomainlanguages(){ list<domain_languages> languages = new arraylist<domain_languages>(); languages.add(eng); languages.add(swe); return languages; } } public enum domain_state { live, pending_renewal, pending_transfer_out, } edit: i didnt define question , hence edit it. whant 2 enums function takes of 2 kind of enums have defined , finds longest literal. in domain_state "pending_transfer_out". hope makes things bit easier understand. edit 2 so i'v gotten som has been great, im not sure why code not work. complains when try use enumlist.values()? reason couldnt find solution in first place, missing? =) public string calculatedropdownlistwidth(enum enumlist){ int chars = 0; ...

flex - Style of tabulation : replace spaces by dots -

multiple choice questions, format text : answer............................a longanswer....................b veryveryveryverylong answer............................c (display in richtext or label) data come xml : <answer_a>answer</answer_a> <answer_b>longanswer</answer_b> ... i tried 3 labels in horizontal layout each lines doesn't work third case. now use tabstops alignment, work well, can't find how replace spaces dots in proper way. hum, interesting problem. personally, think put answers in datagroup item renderer show answer right , answer label left, overriding updatedisplaylist function, draw points (1 pixel 'squares') leftmost text rightmost. however, third possibility, lot more difficult achieve. can't think of way right now.

javascript - Dynamic Navigation bar (with images) with jquery and php - problems with mouseover effects -

i'm building dynamic navigation bar controlled php, , i'm using images within list. , i'm applying jquery 'hover' effects. php code: $path = $_server['php_self']; $page = basename($path); $page = basename($path, '.php'); and in navigation list i'm setting 'display:none' , 'display:inline' depending on return value of $page using php 'if' statement. see code: <ul id="cssdropdown"> <li class="headlink"> <a class="lightnav" href="index.php" <?php if($page == 'index'){echo "style='display:none !important'";}else{echo "style='display:inline'";}?>><img src="images/navbuttons/home.png" /></a> <a class="darknav" href="index.php" <?php if($page == 'index'){echo "style='display:inline !important'";}else{echo "style='display:none...

delphi - Connection timed out when trying to TidSMTP.Connect -

trying connect gmail smtp server fails. it hangs there ~20 seconds , throws error "socket error #10060 connection timed out". i've tried copy , paste post , doesn't work also. procedure tform1.btn1click(sender: tobject); var email : tidmessage; idsmtpgmail: tidsmtp; idsslgmail : tidssliohandlersocketopenssl; begin idsslgmail := tidssliohandlersocketopenssl.create(nil); idsslgmail.ssloptions.method := sslvtlsv1; idsslgmail.ssloptions.mode := sslmunassigned; idsmtpgmail := tidsmtp.create(nil); idsmtpgmail.iohandler := idsslgmail; idsmtpgmail.usetls := utuseexplicittls; email := tidmessage.create(nil); email.from.address := 'from'; email.recipients.emailaddresses := 'recipient'; email.subject := 'test subject'; email.body.text := 'test body'; idsmtpgmail.host := ...

.net - Efficiently persisting calendar data with Entity Framework? -

i working on school project involves managing driving instructor calendars. the application stores time periods on instructor available. public partial class availabilityperiod // kind of pseudo code { instructor instructor; datetime start; datetime end; } it stores individual appointments instructor, in similar fashion. when customer says, example, "i want 2-hour lesson", have fetch availability periods , appointements of instructors in order compute "actual availability" , find having more 2 hours free in his/her schedule. is there better way ? my question exact duplicate of time calendar data structure , know it. but, well... we're in 2011 , i'm interested in entity framework-specific info, or @ least doing whith object relational mapping :-) i wrote similar scheduling application, , ended taking little different approach (though approach work). in system, schedule broken down 15 minute increments, called blocks, , store...

web services - asp.net webservice object manipulation -

possibly not specific webservices, but... i have webmethod returns: list<tadpole> mylist = getlist(); return new { data = mylist , count = 5 }; it returns json. my code checks mylist[x].fishsticks isn't part of tadpole class (so errors). wondering, can add fishsticks attribute mylist somehow avoid error, gets included when return data? is there perhaps elegant solution doing this? in example, you'll have add fishsticks property tadpole . public class tadpole { //.... public int fishsticks { get; set; } } also, why adding .count property json type? wouldn't make more sense .data.count , or return list , skip wrapper entirely? i haven't checked properties of list<> serialized lately, it's possible it's not included, if that's case make more sense this: list<tadpole> mylist = getlist(); return new { data = mylist , count = mylist.count }; or, create descendant class overrides .count , adds ser...

java - Why does right shift (>>) bit operation over byte give strange result? -

there byte [01100111] , i've break in such way [0|11|00111] after moving parts of byte different bytes i'll get: [00000000] => 0 (in decimal) [00000011] => 3 (in decimal) [00000111] => 7 (in decimal) i've try such code: byte b=(byte)0x67; byte b1=(byte)(first>>7); byte b2=(byte)((byte)(first<<1)>>6); byte b3=(byte)((byte)(first<<3)>>3); but got: b1 0 b2 -1 //but need 3.... b3 7 where i've mistake? thanks your results being automatically sign-extended . try masking , shifting instead of double-shifting, i.e.: byte b1=(byte)(first>>7) & 0x01; byte b2=(byte)(first>>5) & 0x03; byte b3=(byte)(first>>0) & 0x1f;

How to prevent SQL injection if I don't have option to use "PreparedStatement" in Java/J2EE -

i have 1 application in can’t user “preparedstatement” on of places. most of sql queries like…. string sql = "delete " + tablename; so know how fix “sql injection” problem in code. regards, sanjay singh =======================edited after getting answer , verify solution========== according provided suggestion have identified 1 strategy prevent sql injection in case …. know views, working on veracode certificate our application… filter data not content space , escape sql character (so if there injected code, it’ll not going part of dynamic sql, column name , table name can’t use inject sql query). public static string gettabcolname(string tabcolname) { if(tabcolname == null || "".equals(tabcolname.trim())) return ""; string tempstr = stringescapeutils.escapesql(tabcolname.trim()); //if value content space means not valid table // or column name, don’t use in dynamic generated sql //use spac...

c# - Handling button clicks in dynamically generated table -

<%foreach (var indication in model.findall(m => m.model != null && m.model.trx != null).orderby(m => m.model.trx.primarysponsor.company)) { %> <tr> <td><%= indication.displayuser %></td> <td><%= indication.activeindicationusers[0].fullname %></td> <td><%= string.isnullorempty(indication.model.trx.primarysponsor.company) ? "not yet saved" : indication.model.trx.primarysponsor.company %></td> <td><%= indication.timeopened.tostring(chatham.web.data.constants.format.datetimesecondsformatstring) %></td> <td><%= indication.model.trx.productcollection[0].producttypefriendlyname %></td> <td><%= (!indication.model.trx.id.hasvalue) ? "not yet saved" : indication.model.trx.id.value.tostring() %></td> <td><i...

php - Get a static property of an instance -

if have instance in php, what's easiest way static property ('class variable') of instance ? this $classvars=get_class_vars(get_class($thing)); $property=$classvars['property']; sound overdone. expect $thing::property or $thing->property you need lookup class name first: $class = get_class($thing); $class::$property $property must defined static , public of course.

c++ - How to set the text in a TextBox control from native code? -

is possible manipulate .net controls native code? particularly, i'd set text of textbox native code. want done way keep business logic separated user interface, precisely native code knows how appropriately format data (some bytes received within protocol). i know window handle through handle property, once there, how call desired method? is string handling option? should native code build message displayed on control? the "native" way of setting text on textbox send textbox wm_settext message: // handle initialized textbox::handle postmessage(handle, wm_settext, 0, _t("some text")); read on postmessage , sendmessage , too. depending on how allocate , build text, may need use sendmessage avoid deallocating prematurely.

scaling - Qt Needs to Scale Entire Application Easily -

my problem have developed product using 480x800 on 10" lcd display, , want "give idea" customer has pc. no modestly-priced laptop has vertical resolution of 800 these days, because of 720p standards, digress. basically, want take suggestion designer, used qt, , suggest work. has stated impossible, suspect laziness talking. as .net developer, know how easy scale winforms application, don't want suggest have no expertise, , while searching stackoverflow , google tips scaling , qt have yielded no results. is there easy cause entire application scale downwards in qt? thanks can provide. if mean normal scaling widgets retain sizes , scale, yes, it's easy (like winforms developer achieves anchors if remember correctly). just matter of using layouts , spacers . grid , form layouts flexible in case more complicated layout needed it's easy add subcontainer has different layout. layout concept similar java swing , awt layouts. also, if used qt...

Android: How to Make A Drawable Selector -

i feel kind of silly question, here go anyways. have image button, , want able change it's image everytime clicked. api seems best way go doing create xml resource in drawable folder contains selector , values. when go make new android xml resource, there's no option drawables. missing? as far know, android xml editor doesn't allow create xml drawables. have go source tab (labeled: filename.xml) , paste in text manually. should like: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:drawable="@drawable/cell_top_selected" /> <item android:drawable="@drawable/cell_top" /> </selector>

algorithm - left to right radix sort -

radix sort sorts numbers starting lease significant digit significant digit. have following scenario : my alphabet english alphabet , therefore "numbers" english language strings. characters of these strings revealed 1 @ time left right. is, significant digit , strings, revealed first , on. @ stage, have set of k character long strings, sorted. @ point 1 character more revealed every string. , want sort new set of strings. how do efficiently without starting scratch ? for example if had following sorted set { for, for, sta, sto, sto } and after 1 more character each revealed, set { form, fore, star, stop, stoc } the new sorted set should {fore, form, star, stoc, stop } i m hoping complexity o(n) after each new character added, n size of set. if want in o(n) have somehow keep track of "groups": for, | sta | sto, sto within groups, can sort strings according last character keeping set sorted. storing groups can done in various ways. @ fi...

tsql - Writing code to Process 25,000 records C#, T-SQL, Quick Performance is key -

what efficent way loop through 25,000 records, , based on prewritten vb logic wont ever change(99% sure), update result column in table value of 1, 2 or 3? performance , reliabilty important here. called via client server app on network nice able call web app. thinking 3 different ways t-sql, c#. a. write object executes stored procedure gets 25,000 records, use foreach collection go through each record , based on c# logic, call object @ each record executes stored procedure update row. call object 25,000 times (and proc assume reuse execution plan) or b. write stored procedure gets 25,000 records, use forbidden cursor go through each record , based on t-sql logic, update row in stored procedure. or updated: solution it's worth going persisited computed columns, , breaking loop smaller update statements update column (all wrapped in transaction). see article below. think fast, compared loop.. http://technet.microsoft.com/en-us/library/cc917696.aspx you ...

java - Image pixel manipulation: Use native APIs or 3rd party libraries? -

i need write application in java need able manipulate pixels of image regardless of format of image ( jpeg , bitmap , gif , ...). it means need access pixels , need calculate attributes of image such size , resolution , contrast , brightness , compression algorithm . i need manipulate bits of individual pixels. need know can these means of pure java se classes or need use third party library? if so, best me? jai , imagej , ...? take @ java advanced imagining api faq , should able decide whether want use native java apis or 3rd-party library. (the concept of manipulating pixels can vary tremendously in complexity. examples mentioned not difficult other operations may be.) getting size, resolution , compression alg trivial attributes of objects use in image manipulation. (though resolution relative.) working contrast , brightness little more involved not much. see here interesting sample . java2s has lots of java image-manipulation snippets available . here's li...

c++ - Is there an implicit template<typename T>operator<<(const ostream&,T)? -

i have class i've written, meant represent vectors (in linear algebra sense). started writing isn't finished, i've pasted , test code here i'm not sure what's going on. going write overloaded operator<< testing in second, went ahead , put in main function (so use compiler errors make sure i'd written properly). what warning mean? why looking @ address of v? tried removing parentheses v, , end this , bunch of horrible template errors: ` in function 'typename boost::range_const_iterator<c>::type boost::range_detail::boost_range_begin(const c&) [with c = vect<float, 3u>]': /usr/local/include/boost/range/begin.hpp:164: instantiated 'typename boost::range_const_iterator<c>::type boost::begin(const t&) [with t = vect<float, 3u>]' prelude/more_stdlib_ostreaming.hpp:64: instantiated 'void more_stdlib_ostreaming_detail::print_range(std::basic_ostream<_chart, _traits>&, const range&) [wi...

model - Polymodel on App Engine suggestion -

i'm designing model posting system entry contains image or without comment. user can reply either comment or image entry well. as there can more properties imageentry, came design polymodel. not sure if best way this. storage-wise, commententry less imageentry? any suggestions great. class entry(polymodel.polymodel): comment = db.textproperty() reply_to = db.selfreferenceproperty() # reference entry created_at = properties.datetimeproperty(auto_now_add=true) updated_at = properties.datetimeproperty(auto_now=true) class commententry(entry): created_by = db.referenceproperty(user, collection_name='comment_entries') class imageentry(entry): created_by = db.referenceproperty(user, collection_name='image_entries') image_url = db.linkproperty(indexed=false) slug = db.stringproperty(indexed=false) this model work fine, , yes, commententry smaller imageentry same user if imageentry has image url and/or slug. however, i'...

How to push a copy of an object into array in PHP -

i tried add objects array in php didn't work, tried 2 methods: #1 $obj->var1 = 'string1'; $obj->var2 = 'string1'; $arr[] = $obj; $obj->var1 = 'string2'; $obj->var2 = 'string2'; $arr[] = $obj; #2 $obj->var1 = 'string1'; $obj->var2 = 'string1'; array_push($arr,$obj); $obj->var1 = 'string2'; $obj->var2 = 'string2'; array_push($arr,$obj); both methods add latest object entire array. seems object added array reference. there way add array value ? objects passed reference in php 5 or later. if want copy, can use clone operator $obj = new myclass; $arr[] = clone $obj;

python csv module error -

when use pythons csv module, shows me "delimiter" must 1-character string" my code this sep = "," srcdata = cstringio.stringio(wdata[1]) data = csv.reader(srcdata, delimiter=sep) wdata[1] string source. how fix problem? you have from __future__ import unicode_literals @ top of module or using python 3.x+ need this: sep=b"," # notice b before " srcdata=cstringio.stringio(wdata[1]) data = csv.reader(srcdata,delimiter=sep) this tells python want represent "," byte string instead of unicode literal.

perl - How to save entire scrollable canvas as PNG? -

i have scrollable canvas who's content want png image. the problem photo of canvas, missing non visible part of canvas @ given time. how whole scrollable canvas png image? my current code following: my $canvas_to_get_photo=$mw->photo(-format=>'window', -data=>oct($canvas_to_get->id)); $canvas_to_get_photo->write('somepath/image.png', -format=>'png'); there isn't native way it; tk paints windows, not image-based surfaces. options therefore either: scroll canvas, taking snapshots, , stitch them together generate encapsulated postscript (which does support going on whole canvas, provided use right options) , generate image tool ghostscript.

internet explorer - Using a background image on a flot diagram/excanvas in IE -

i'm trying use excanvas/jquery based "flot" plugin use background image. @ moment there bug means it's not possible set background image canvas using css - bug described here , here . has managed around bug? it's incredibly frustrating using css provide background image canvas appears valid in every other browser; not using ie , excanvas! any appreciated! i've tried nested divs , more - , i'm running out of ideas! in advance edit: there's possible workaround here - http://code.google.com/p/flot/issues/detail?id=129 - seems bit outdated lot of flot code isn't same anymore. guess give me start however! if has easier solution i'd happy hear it!

silverlight - How can i prevent RIA service change tracking for certain fields? -

how can prevent ria service change tracking on properties. have partial class , want ria service should not track changes it. how can that? currently if see in generated code, can methods onxxxchanging() nad onxxxchanged() etc etc. want these should not generated custom properties. thanks in advance :) to stop ria services tracking (or generating) property, add [exclude] attribute property (either in .shared.cs or in metadata class. if add [datamember] attribute, wcf still serialize/deserialize it, ria services won't care it.

asp.net - UpdatePanel + AutoCompleteExtender + jQuery = Problems! -

i've got asp.net web form uses updatepanels allow partial page postbacks. within 1 of updatepanels, i'm using autocompleteextender ajaxcontroltoolkit call webmethod on page asynchronously retrieve list of projectnames , associated projectid values. when select item list, i'm using jquery save projectid value hiddenfield server control. need value when click on submit button within updatepanel execute database query. far, works great. here's relevant client-side code: <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <asp:textbox id="txtprojectname" width="200" tooltip="type first few characters of project search for" runat="server"></asp:textbox> <ajaxtoolkit:autocompleteextender id="autocomplete1" targetcontrolid="txtprojectname" minimumprefixlength="2" completioninterval="250" c...

javascript - Finding a DOM node in the subtree of a node? -

i have html like <div class="foo"> <h1>foo 1</h1> ..</div> <div class="foo"> <h1>foo 2</h1> ..</div> finding div nodes using getelementsbytagname('div') not problem. while iterating of div nodes need find first h1 inside subtree of div nodes. there getelementbytagname() on dom node? no. use array notation first element found: var firstheading = div.getelementsbytagname('h1')[0]; edit if asking if use getelementsbytagname on nodes other document , yes can. dom element nodes plus document node have getelementsbytagname method.

CRL and OCSP behavior of iOS / Security.Framework? -

i'm trying figure out ios' policy when verifying certificates using security.framework regarding revocation of certificates. cannot find information in docs ios. in context of ipad project i'm working on @ moment, there reason demand checking revocation status certs. ideas on how force crl / ocsp checking during cert verification using security.framework? or need "fall back" openssl accomplish this? it seems on mac os x 10.6 crl / ocsp checks done optionally , have turned on manually through keychain access. martijn i have answer question apple guys, posted full answer here: details on ssl/tls certificate revocation mechanisms on ios to sum up, there several things keep in mind ocsp implementation on ios: ocsp policy cannot configured @ moment it works ev certificates only high-level stuff, such nsurlconnection or uiwebview use tls security policy, uses ocsp sectrustevaluate blocking network operation it works "best attempt" -...

exchange server - MAPI: How do I count the amount of folders in a mailbox -

i've used mapi on project traverse mailboxes , export them .msg files know bit efficiently count folders inside mailbox. can done mapi tables somehow? there magic property this? appreciated. normally immediate child folders. can pass convenient_depth flag child folders returned. if remember correctly, work online exchange stores (both mailbox , pf).

c - Can you transpose array when sending using MPI_Type_create_subarray? -

i'm trying transpose matrix using mpi in c. each process has square submatrix, , want send right process (the 'opposite' 1 on grid), transposing part of communication. i'm using mpi_type_create_subarray has argument order, either mpi_order_c or mpi_order_fortran row-major , column-major respectively. thought if sent 1 of these, , received other, matrix transposed part of communication. however, doesn't seem happen - stays non-transposed. the important part of code below, , whole code file available @ this gist . have ideas why isn't working? should approach doing transpose work? i'd have thought would, having read descriptions of mpi_order_c , mpi_order_fortran , maybe not. /* ----------- transpose ----------- */ /* find opposite co-ordinates (as know it's square) */ coords2[0] = coords[1]; coords2[1] = coords[0]; /* rank process */ mpi_cart_rank(cart_comm, coords2, &rank2); /* send these new coordinates */ tag = (coords[0] + 1) * (c...

php - fwrite saves same message multiple times -

i use fwrite in php log errors in logs.txt. the problem when open db_errors.txt see message saved multiple times instead of once. my fwrite code not inside loop, definately executed once. same think happended using third party logger classes. if (!$result = mysqli_query($link, $query)){ $today = getdate(); $handle = fopen("logs/db_errors.txt", "a"); fwrite($handle, $today['mday'].'/'.$today['mon'].'/'.$today['year']." | ".mysqli_errno($link)." : ".mysqli_error($link)." | ".$query." \n"); fclose($handle); } this writes in 3 lines inside db_errors.txt same output. 11/4/2011 | 1054 : unknown column 'uids' in 'field list' | select uids users user_id=6 limit 1 11/4/2011 | 1054 : unknown column 'uids' in 'field list' | select uids users user_id=6 limit 1 11/4/2011 | 1054 : unknown column 'uids' in 'field list' | se...

java - JVM Garbage Collection Application Stopped Time Discrepancy -

i'm running large instance of tomcat following version of java: java version "1.6.0_20" openjdk runtime environment (icedtea6 1.9.7) (6b20-1.9.7-0ubuntu1~10.04.1 openjdk 64-bit server vm (build 19.0-b09, mixed mode) and following parameter set: -xms13152m -xmx13152m -xmn768m -xx:+useconcmarksweepgc -xx:cmsinitiatingoccupancyfraction=60 -xx:+cmsincrementalmode -xx:+cmsincrementalpacing -xx:cmsincrementaldutycyclemin=0 -xx:cmsincrementaldutycycle=10 -xx:+disableexplicitgc with gc debug statements enabled. every few hours see behavior in minor gc occurs , application stopped long time, gc not appear taking time: {heap before gc invocations=392 (full 74): par new generation total 707840k, used 698252k [0x00000004bfa00000, 0x00000004efa00000, 0x00000004efa00000) eden space 629248k, 99% used [0x00000004bfa00000, 0x00000004e607de48, 0x00000004e6080000) space 78592k, 87% used [0x00000004ead40000, 0x00000004ef0a5370, 0x00000004e...

php - mass image optimizer -

i have folder 5000 images in it. i can use php, or software on local version of images if required. whats best way go through , optimize/shrink size/compress them , efficiently possible 20 width , 20 height? anything gui works on xp? tools mogrify or convert (from imagemagick ) fine, when comes resizing images. after, if want optimize images further (reducing size in bytes) , should take @ software : optipng or pngcrush png, or jpegtran jpeg if goal optimization website, take @ best practices speeding web site - images , points follow (i'm thinking css sprites) edit after edit of op : hu... gui ? no idea, sorry (i have kind of tools run automatically, scripts, on linux servers) . why not write script call tools on images, , let run night ?

Can I use COM from Java via JNA? -

perhaps i'm crazy, i'm starting have fun idea if learning experience: i'm trying use com java calling ole32.dll functions via jna . according com spec com interface pointer pointer pointer points array of function pointers. thought since jna allows call function pointers should able call com interface methods if can vmt (the array of function pointers). here iunknown interface: @iid("00000000-0000-0000-c000-000000000046") public interface iunknown { int queryinterface(guid riid, pointerbyreference ppvobject); int addref(); int release(); } and here bit of code create iunkown interface, given clsid: public static iunknown createinstance(guid clsid) { iid iida = iunknown.class.getannotation(iid.class); if (iida == null) throw new illegalargumentexception("interface needs annotated iid"); guid iid = new guid(iida.value()); ole32 ole32 = windowsjna.ole32.get(); pointerbyreference p = new pointerbyreference(...

css - <!doctype html> width render issue input element -

i have problem when rendering input text elements. if add <!doctype html> file input element gets stretched, input submit button not. have tested in several different browsers , consistent, me :(. in example text element rendered width of 304 pixels. when remove first line render @ 300 pixels. example: <!doctype html> <html> <style type="text/css"> *{ margin: 0px; padding: 0px; } input { width: 300px; } </style> <body> <input/><br/> <input type="submit"> </body> </html> does know causing it, more importantly how can fixed? when don't have doctype, page rendering in quirks mode . in quirks mode, border , padding of input counted inside 300px width. when add the doctype , page rendering in standards mode, , border , padding no longer part of 300px - that's "extra" 4px coming from. see here: http://www.quirksmode.org...

delphi - System Menu for Layered Windows? -

Image
we're having issue layered windows , system menus in delphi 2009. is, our layered windows (which have no border) have no system menu. when system menu, referring menu when clicking application's icon, right clicking it's title-bar or (in windows 7, addition of shift key,) right clicking application in task-bar: when attempt access system menu, e.g. right-clicking on task-bar icon, of such layered window, instead layered window risen. why this? there sort of style set, or sort of event handle? here's hastily made demo showing issue. can reproduced form bsnone borderstyle, though. http://ompldr.org/vodd5dw you need add ws_sysmenu style removed bsnone border style. type tlayeredform = class(tform) procedure formcreate(sender: tobject); protected procedure createparams(var params: tcreateparams); override; end; ... procedure tlayeredform.createparams(var params: tcreateparams); begin inherited; params.style := params.style or ws_...

jquery - problem with javascript callback -

so here code have: $.getjson("http:\/\/tinygeocoder.com\/create-api.php?g=" + lat + "," + lng + "&callback=?", function(data) { alert(data);}; and it's working fine in chrome , safari... fails in mobile safari. here error i'm getting: http://tinygeocoder.com/create-api.php?g=39.67997936,-104.(removed space)&callback=jsonp1302553994489 syntaxerror: parse error anyone have ideas? when try browse url, response back: bummer, we've had many queries , 1 of our data sources has decided not work. please <a href="mailto:info@tinygeocoder.com">let know</a>. as not json, causes parsing error.

apache - How to test many cookies in .htaccess with mod_rewrite? -

i want make internal redirection based on value of 2 cookies use of htaccess/mod_rewrite. don't know how refer both values of tested cookies backreferences. here want do: foo = value_of_cookie_foo bar = value_of_cookie_bar if (foo , bar) { rewriterule ^(.*)$ mysite/foo/bar [r,l] } sadly, following code not work. because (according apache documentation) backreferences apply last rewritecond . first 1 not taken account. rewritecond %{request_uri} ^/whatever$ rewritecond %{http_cookie} cookie_foo=([^;]+) [nc] rewritecond %{http_cookie} cookie_bar=([^;]+) [nc] rewriterule ^(.*)$ mysite/%1/%2 [r,l] for cookie cookie_foo=foo; cookie_bar=bar; above code redirects http://mydomain.com/mysite/bar instead of http://mydomain.com/mysite/foo/bar . should enclose testing of both cookies in 1 rewritecond ? how? you should reorder cookie values them both @ once: rewritecond %{request_uri} ^/whatever$ rewritecond %{http_cookie} (^|;\s*)cookie_foo=([^;]+) rewritecond ...

objective c - nonatomic in multi threaded iOS environment -

most iphone code examples use nonatmoc attribute in properties. involve [nsthread detachnewthreadselector:....]. however, issue if not accessing properties on separate thread? if case, how can sure nonatomic properties won't accessed on different in future, @ point may forget properties set nonatomic. can create difficult bugs. besides setting properties atomic, can impractical in large app , may introduce new bugs, best approach in case? please note these these questions ios , not mac in general. first,know atomicity not insure thread safety class, generates accessors set , properties in thread safe way. subtle distinction. create thread safe code, need more use atomic accessors. second, key point know accessors can called background or foreground threads safely regardless of atomicity. key here must never called 2 threads simultaneously. nor can call setter 1 thread while simultaneously calling getter another, etc. how prevent simultaneous access depends o...

vb.net - NullReferenceException error in VB Application? -

i'm building voting system calls, , have tried build in vb. far have: dim con new oledb.oledbconnection dim dbprovider string dim dbsource string dbprovider = "provider=microsoft.jet.oledb.4.0;" dbsource = "data source = c:\phonepoll.mdb" con.connectionstring = dbprovider & dbsource con.connectionstring = "provider=microsoft.jet.oledb.4.0;data source = c:\phonepoll.mdb" con.open() 'sql = "select * voting" 'da = new oledb.oledbdataadapter(sql, con) 'da.fill(ds, "voting") if inc <> -1 dim cb new oledb.oledbcommandbuilder(da) dim dsnewrow datarow dsnewrow = ds.tables("voting").newrow() dsnewrow.item("voted") = radiobutton1.checked.tostring dsnewrow.item("voted") = radiobutton2.checked.tostring dsnewrow.item("voted") = radiobutton3.checked.tostring dsnewrow.it...

Lisp symbols without package bindings -

i've been working on project. should able numerical , symbolic computing. stuck on 1 problem , don't know how resolve it. specific , short, let's in package (in-package #:brand-new-package) where have symbol database (defvar var-symbol-database (make-hash-table :test #'equal)) reading , setting functions (defun var-symbol (name) (get-hash name var-symbol-database)) (defun set-var-symbol (name value) (setf (get-hash name var-symbol-database) value)) (set-var-symbol 'temperature 300) ;k (set-var-symbol 'f 200) ;hz (set-var-symbol 'k 1.3806504e-23) ;j k^-1 and in file (but same package) try evaluate equation (eval '(+ 2 (var-symbol 'f))) it won't work. problem particular reason value of key in hash table is. brand-new-package::f i though solve problem defining function this (set-var-symbol 1 '(var-symbol 'f)) ;hz but interpreted as (brand-new-package::var-symbol brand-new-package::f) the probl...

c++ - Converting a string representing binary to a string representing equivalent hex -

so have string x = "10101" , need put string y hex value of binary in x. if x="10101" y="0x15" i don't want provide complete answer. that said, basic idea should fill start of string 3 zero's can split string substrings length of 4. can turned hex variety of ways, easiest being using switch case statement. there 16 cases'

Android License response "Respond normally" -

i implementing android license paid app. test response can set “respond normally”. expected behavior when response set “respond normally”? need set response “respond normally” when our application official published? i believe response specifications apply accounts/emails have been entered "test accounts" list, on publisher edit page. when publish app, genuine licensed apps receive proper response, unless users exist in test accounts list, in case receive response have specified. the test accounts list testing how app respond when receives, example, "licensed" response server. test how app respond when receives response of "unlicensed", change dropdown item unlicensed, or whichever response trying test. also aware server can take little while register test account, , can take little while unregister 1 well. hope helps.

c# - Open a portrait page from Pivot Page Listbox with "LineThree" text in it -

as title says... if start app project pivot page(mainpage.xaml) , choose click example "design two" link in databinded listbox. possible bind "linethree" text "design two" link in separate portrait page? do have make new portrait page every "linethree"-link? or can generate "mainviewmodelsampledata.xaml" data single portrait page depending on "lineone"-link click in pivot page in start? hope question understandable... :p if understand correctly, want have main page contains list of data, , details page contents dependent on item clicked in main page. answer question "yes". there number of ways achieve this, of include global variables, custom navigation service, storing value in isolated storage , on. personal preference use context of navigationservice , pass id or index in query string target page. your call navigate details page looks this: application.current.navigate(string.format("/vi...

objective c - What is the right pattern for instantiating a device specific view controller in a Universal App? -

i'm new objective-c so, bear me. started universal app template in xcode4 , built application. there convention template starts off tried stick with. each view controller, there's main file , subclass each device type. example: project/ exampleviewcontroller.(h|m) - iphone/ - exampleviewcontroller_iphone.(h|m|xib) - ipad/ - exampleviewcontroller_ipad.(h|m|xib) for part, pretty convenient. of logic goes in superclass , subclasses take care of device specific implementation. here's part don't get. have code same thing in each subclass because need load different xib each device. example: exampleviewcontroller_iphone - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { content *selectedcontent = (content *)[[self fetchedresultscontroller] objectatindexpath:indexpath]; contentdetailviewcontroller_iphone *detailviewcontroller = [[contentdetailviewcontroller_iphone alloc] init]; detai...

computational geometry - Determine if a set of lines lie in one side of a point and another set of lines lie in the other side -

given 2 set , b of lines n lines in total , point p. how u determine if lines lie in 1 side of p , b lines lie in other side? unless of lines mutually parallel, they'll always cross both sides of p , since go on forever. otherwise, draw line parallel 1 of other lines passes through p , , line divide 2 sets.

.net - Question about a argument in using Task -

guys, used use method task.factory.startnew(new action(()=>{}), cancellationtoken); i have question second argument cancellationtoken . because cancellationtoken variable in method, in lambda expression, can cancel task using field msdn does; i'm not sure it's recommend. in case, second argument necessary here? passed in startnew method, not used. there scenario need use argument? you need argument if want cancel task. if you're application doesn't support or require cancellation say task.factory.startnew(() => { ... }); note cancellation cooperative code must poll cancellation , respond accordingly. for example: cancellationtokensource cts = new cancellationtokensource(); cancellationtoken token = cts.token; task mytask = task.factory.startnew(() => { (...) { token.throwifcancellationrequested(); // body of loop. } }, token); // ... elsewhere ... cts.cancel(); you have...

javascript - Nested Panels / Toolbars in Sencha Touch -

i'm trying create constant bottom toolbar, controls panel above it. panel above should have toolbar of own (at top). i've attempted below code, works, can't see html of sub-page inner panels. think it's because panel isn't taking remaining height, don't know why. anyone have ideas? thanks! ext.setup({ onready: function() { // sub-page sections var blah = { style: "background-color: #b22222; color:#ff0000;", title: "one", html: "why can't see html", layout:"fit", flex: 1 }; var blah2 = { style: "background-color: #404040; color:#000000;", title: "one", html: "why can't see html", layout:"fit", flex: 1 }; // main portion of page, includes top toolbar , content var page1 = new ext.tabpanel({ dock: "bottom", layout: "card...