Posts

Showing posts from March, 2012

iphone - Mistake in autoResizingMask -

i have implemented small viewdidload() show picture autoresizing, doesn't work, please me , mistake in code in line 3 , 4???? imageview = [[uiimageview alloc] initwithimage:img]; imageview.frame = self.view.frame; imageview.autoresizingmask = uiviewautoresizingflexibleheight; imageview.autoresizingmask = uiviewautoresizingflexiblewidth; i hope me? if im not mistaken should following way: imageview.autoresizingmask = ( uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight ); the way it, override autoresizingmask.

Jboss Startup error -

on existing application trying startup jboss server , following error. unfortunately not know yet, has been configured , being used on jboss. now; want error sorted out. if looking @ stack trace, can suggest kind of configuration missing or should looking @ fix problem; i'll grateful. any appreciated. ------------------after skaffman's below; able reduce stacktrace this------------------ 07:36:36,971 error [urldeploymentscanner] incomplete deployment listing: --- mbeans waiting other mbeans --- objectname: xyz.management:service=queue,name=managementqueue state: configured depend on: jboss.messaging:service=serverpeer objectname: xyz.management:service=queue,name=indexqueue state: configured depend on: jboss.messaging:service=serverpeer objectname: xyz.management:service=queue,name=adaptivelearningqueue state: configured depend on: jboss.messaging:service=serverpeer objectname: xyz.management:service=queue,name=xyzerrorqueue state: co...

database - Two tables one view ASP MVC -

i need help. trying show locations of device belonging specific project. on projects page have button goes google map. projects have projects model , controller. i've got 2 tables, table containing location of device , project table. want display device locations belonging project on google map. google maps part working , managed show device locations on 1 map, problem can't seem link devices project. need on how achieve this. in location table ive got foreign key projects table. many-to-onerelation. project can have multiple devices, device can linked 1 project. have defined relation follows in location model: [belongsto("projectid")] public project project { { return _project; } set { _project = value; } } in location controller use following code(theres more moment not relevant): public actionresult index() { return view(devicelocation.findall()); } this lists locations in location tab...

java ee - Are EJBs applications like Web Services? -

is developping ejb application considered web services ? or 2 different ? or can make ejbs web services ? my answer yes , no. no in sense ejb programming model . programming model contains concepts such security, transaction demarcation, state management , persistency (stateful or stateless beans), , more. while web service more remoting technology , is, way connect systems, soap in case of web service. under perspective both different topic (web service compared rmi-iiop though). yes in sense both referred technologies expose service outside (as long it's stateless). under perspective belong same category. , ejb can indeed exposed web service annotating bean accordingly. hope brings light distinction.

oracle - Would you send this simple SQL back for rework? -

we have web application in users perform ad-hoc queries based on parameters have been entered. might mention response time of high importance users. the web page dynamically construct sql execute based on parameters entered. example, if user enters "1" "business unit" construct sql this: select * fact business_unit = '1' --and other criteria based on input params i found user not specify business_unit following query constructed select * fact business_unit '%' --and other criteria based on input params imho, unnecessarily (if not grossly) inefficient , warrants sending code bad modification since have higher rate of sending code rework others, believe may earning reputation being "too picky." if inappropriate question because not direct coding q, let me know , delete immediately. confused whether subjective questions allowed or not! i'll watching replies. ty update: i using oracle database. my impression orac...

c# - display time in a textbox and modify with up down arrows -

i want display time in textbox or in numericupdownextender used in ajax user can change time desires.. i have used control show numbers , increase accordingly.. is there way this.. new code not desired... <asp:textbox runat="server" id="txthour"></asp:textbox> <ajaxtoolkit:numericupdownextender id="txthour_numericupdownextender" runat="server" enabled="true" maximum="12" minimum="1" targetcontrolid="txthour" width="70"></ajaxtoolkit:numericupdownextender> <asp:textbox runat="server" id="txtminute"></asp:textbox> <ajaxtoolkit:numericupdownextender id="txtminute_numericupdownextender" runat="server" enabled="true" maximum="60" minimum="1" targetcontrolid="txtminute" width="70"></ajaxtoolkit:numericupdownextender> <asp:textbox runat="serv...

flash cs4 - Soft scroll with ActionScript 3.0 -

i'm noob trying develop first site flash. made scrollers, aren't smooth... the code used was: const scrollupper:int = -151; const scrolllower:int = 366; const scrollrange:int = scrolllower - scrollupper; var dragbounds:rectangle = new rectangle(scroller_mc.x, scrollupper, 0, scrollrange); var viewableheight:int = 545; var textupper:int = text_mc.y; var textlower:int = textupper + text_mc.height; var textrange:int = text_mc.height - viewableheight; scroller_mc.addeventlistener(mouseevent.mouse_down, startscrolling); stage.addeventlistener(mouseevent.mouse_up, stopscrolling); stage.addeventlistener(event.mouse_leave, stopscrolling); stage.addeventlistener(event.deactivate, stopscrolling); function scroll(e:event = null){ const pctmoved:number = 1 - (dragbounds.bottom - scroller_mc.y) / dragbounds.height; text_mc.y = textupper - (pctmoved * textrange); } function startscrolling(event:mouseevent):void{ addeventlistener(event.enter_frame, scroll); scroller_mc.startdrag(t...

keyboard - semi-unmanaged code with c# -

public delegate void keyboardhookcapturehandler(keyboardhookeventargs keyboardevents); public class keyboardhookeventargs : eventargs { private keys _pressedkey; private int _pressedkeycode; public keys pressedkey { { return _pressedkey; } } public int pressedkeycode { { return _pressedkeycode; } } public keyboardhookeventargs(int vkcode) { _pressedkey = (keys)vkcode; _pressedkeycode = vkcode; } } public class keyboardhook { private delegate intptr lowlevelkeyboardproc(int ncode, intptr wparam, intptr lparam); public event keyboardhookcapturehandler keyintercepted; private const int wh_keyboard_ll = 13; private const int wm_keydown = 0x0100; private lowlevelkeyboardproc _proc; private intptr _hookid = intptr.zero; public keyboardhook() { _proc = hookcallback; _hookid = sethook(_proc); } public bool unhookkey() { return unhookwindowshookex(_hookid); } private in...

How to share FxCop rules amongst all developers? -

all our developers using vs2010 professional code analysis not available. want them use fxcop analyze code before checking in. have gone through rules , disabled bunch of them , added couple of them. want developers use same set of rules since rules used in msbuild. how distribute rule set used in fxcop? files need distributed , supposed go to? when using stand-alone fxcop, can create fxcop project file (with extension .fxcop) contains list rules used in analysis. (typically, file include list of target assemblies, although optional.) file may checked source control code in order distribute developers working on shared code base.

regex - Java Unicode Regular Expression -

i have text this. every person haveue280 sumue340 ambition i want replace ue280, ue340 \ue280, \ue340 regular expression is there solution thanks in advance something this? string s = "every person haveue280 sumue340 ambition"; // put backslash in front of all "u" followed 4 hexadecimal digits s = s.replaceall("u\\p{xdigit}{4}", "\\\\$0"); which results in every person have\ue280 sum\ue340 ambition not sure you're after, perhaps it's this: static string tounicode(string s) { matcher m = pattern.compile("u(\\p{xdigit}{4})").matcher(s); stringbuffer buf = new stringbuffer(); while(m.find()) m.appendreplacement(buf, "" + (char) integer.parseint(m.group(1), 16)); m.appendtail(buf); return buf.tostring(); } (updated according axtavt nice alternative. making cw.)

android - How to get compass direction -

i want show direction on screen phone facing. example: 0 |- [] |_ south --- north in above diagram phone display "north". since user (the stick 0 head) holding out phone (the [] in diagram) pointing north. i found this example . understand it's doing except seems calculate yaw, pitch, roll, , inclination. , how use them find way phone pointing? also android documentation mentions x, y, , z axises don't see anywhere says how axises correspond phone? z going bottom of phone top? this how axis (axiy?) like. i couldn't find link cheat sheet use, looked sort of this . in summary, want register listen sensor.type_orientation, incoming array of values get, value[0] , should show angle (from north believe). some example *android.com

Flash Game Creating Score-Dynamic Text Field (AS3) -

creating pacman-like game, player eats objects. when movieclip (box) eats circle on stage, score in dynamic text field should go 10 points. receiving error: line: `scorefield.text = " " + string(currentscore); error message: call possibly undefined method string. package { import flash.display.sprite; import flash.display.movieclip; import flash.events.event; import flash.events.keyboardevent; import flash.ui.keyboard; public class move extends movieclip { //var scoreobjects:array = new array(); // creates scoreobjects array var circle:movieclip; private var keyright:boolean=false; private var keyleft:boolean=false; private var keyforward:boolean=false; private var keybackward:boolean=false; private var forwardmove:int=0; private var sidemove:int=0; private var inertia:int=8; //amount of friction //var score_field:string; //var point:movieclip; //private var playerscore:int; var...

c# - Interfaces and Coupling -

from design , loose coupling standpoint. idea have interface each class in project might part of composition model? i have project i'm doing this, i'm getting rather lot of interfaces, in attempt keep things relatively loosely coupled. without knowing specifics of design, that's how interface segregation principle (pdf) supposed work. you should provide interface every class may need swap out implementation (i wouldn't create interface each dto, example).

Javascript replace a function with a new one containing dynamic contents -

my javascript knowledge less experienced, might use wrong descriptions in following. i have object in static .js file: var info = { methoda: function() { // call methodb. this.methodb('test'); }, methodb: function(value) { // stuff } } now, in .aspx file, create function methodc(value) varying contents (depending on data), want insert instead of above definition of methodb(value): ... var methodc = function(value) { // different stuff } ... my idea has far been replace methodb methodc in following fashion: ... info.methodb = methodc; ... using ie's buildin developer tool, following error when calling this.methodb('test'); info.methoda(): object doesn’t support property or method removing 'this' this.methodb('test') results in error: object expected i don't errors using firebug - because use various frameworks, might catch error. how should or should use different a...

xml - Is there an example on how to use Spring 3.0 content negotiation for RESTful services? -

i reading spring 3.0 documentation , blog posts (followups) on how create rest style services spring mvc can't find working example on how use contentnegotiatingviewresolver. have test controller this @controller public class indexcontroller implements serializable { @requestmapping("/index") public modelandview index() { modelandview mav = new modelandview(); mav.setviewname("index"); return mav; } } and tried use this <bean class="org.springframework.web.servlet.view.contentnegotiatingviewresolver"> <property name="mediatypes"> <map> <entry key="html" value="text/html" /> <entry key="xml" value="text/xml" /> <!-- <entry key="json" value="application/json"/> --> </map> </property> ...

javascript - Styling select element (jQuery) -

i tried plugins come own styling takes quite time rid of. there plugin minimal styling (or simple way) apply custom background select element? need simple. thanks i found one. degrades automatically if javascript disabled. http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/

How do i retrieve the url of an image uploaded via Facebook's graph api -

i've uploaded image user's album using following code: $ch = curl_init(); $url = 'https://graph.facebook.com/'.$uid.'/photos?access_token='.$token; curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_header, false); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_postfields, $args); $data = curl_exec($ch); can tell me how retrieve public link image? i have more experience fql however, looks might work: https://graph.facebook.com/me/picture documentation under "connections" http://developers.facebook.com/docs/reference/api/user if choose use fql: http://developers.facebook.com/docs/reference/fql/ http://developers.facebook.com/docs/reference/fql/profile

javascript validation error -

here's code, says error when run through w3.validator.org. for (var = 0; < checkbox.length; i++) error message - character "<" first character of delimiter occurred data how fix this? if "using" xhtml need wrap code in cdata: <script type="text/javascript"> //<![cdata[ // rest of javascript goes here //]]> </script>

apache - How can I create a simple index.html file which lists all files/directories? -

we use apache server not allow directory listing. there specific directory allow listing of. how can make simple html file contain contents of directory? you can either: write server-side script page php, jsp, asp.net etc generate html dynamically or setup web-server using (e.g. apache) automatically directories doesn't contain welcome-page (e.g. index.html) specifically in apache read more here: edit httpd.conf: http://justlinux.com/forum/showthread.php?s=&postid=502789#post502789 or add autoindex mod: http://httpd.apache.org/docs/current/mod/mod_autoindex.html

c# - Check if a date range is within a date range -

i have following class: public class membership { public datetime startdate { get; set; } public datetime? enddate { get; set; } // if null lasts forever } i need make sure when adding following list new item doesn't overlap dates existing item: var membership = new list<membership> { new membership { startdate = datetime.utcnow.adddays(-10), enddate = datetime.utcnow.adddays(-5) }, new membership { startdate = datetime.utcnow.adddays(-5), enddate = null } }; for example doing: var newitem = new membership { startdate = datetime.utcnow.adddays(-15), enddate = datetime.utcnow.adddays(-10) }; // allowed var newitem2 = new membership { startdate = datetime.utcnow.adddays(-15), enddate = null }; // not allowed if (allowededtoadd(newitem)) membership.add(newitem); if (allowededtoadd(newitem2)) membership.add(newitem2); i thought simple far attempts have been wrong , i'm starting confuse myself , hoping had done similar share. thanks ...

xcode - bus error in simple Mac OSX C program -

i writing simple c program create twelve tone matrix. code compiles, run time error 'bus error'. in debugger says exc_bad_access . int main () { int j,k,l; int twelve[13][13]; void mat(int twelve[13][13]); printf("input original tone row \n"); for(j=0;j<=11;j++) { scanf("%2i",&twelve[j][0]); } mat(twelve); for(k=0;k<=11;k++) { for(l=0;l<=11;l++) { printf("%i ",twelve[l][k]); } printf("\n"); } return 0; } void mat(twelve) int twelve[13][13]; { int j,k,l; int temp; /*inversion*/ for(j=1;j<=11;j++) { twelve[0][j] = 12 - twelve[j][0]; } /*fill in columns*/ /*this sections seems what's crashing */ for(k=1;k<=11;k++) { for(l=1;1<=11;l++) { temp = twelve[0][k] + twelve[l][0]; if(temp >= 12) { ...

C struct static -

i through c source (pjsip) , find sctucture. don't know how conceive. static struct user_agent { pjsip_module mod; pj_pool_t *pool; pjsip_endpoint *endpt; pj_mutex_t *mutex; pj_hash_table_t *dlg_table; pjsip_ua_init_param param; struct dlg_set free_dlgset_nodes; } mod_ua = { { null, null, /* prev, next. */ { "mod-ua", 6 }, /* name. */ -1, /* id */ pjsip_mod_priority_ua_proxy_layer, /* priority */ &mod_ua_load, /* load() */ null, /* start() */ null, /* stop() */ &mod_ua_unload, /* unload() */ &mod_ua_on_rx_request, /* on_rx_request() */ &mod_ua_on_rx_response, /* on_rx_response() */ null, /* on_tx_request. */ null, /* on_tx_response() */ &mo...

php - When I retrieve value from table to another it inserted blank -

i have 2 tables users registered_members i want confirm values user table , insert in registered_members table problem .. values selected users table inserted in registered_members blank values why?? <? include('conf.php'); // passkey got link $passkey=$_get['passkey']; $tbl_name1="users"; // retrieve data table row match passkey $sql1="select * $tbl_name1 confirm_code ='$passkey'"; $result1=mysql_query($sql1) or die ("error1") ; // if queried if($result1){ // count how many row has passkey $count=mysql_num_rows($result1); // if found passkey in our database, retrieve data table "users" if($count==1){ $rows=mysql_fetch_array($result1); $username=$_post['uname']; $fname=$_post['fname']; $password=$_post['password']; $email=$_post['email']; $age=$_post['age']; $gender=$_post['gender']; $tbl_name2="registered_members"; // insert data retriev...

annotations - introspection - table name of an object managed by Hibernate (JavassistLazyInitializer) -

i want through introspection table name of object managed hibernate (in lazy). my object contains "org.hibernate.proxy.pojo.javassist.javassistlazyinitializer" in property handler. my object of type "mypackage.myobjectdo_ _javassist_2 $ $" , not contain annotations class "mypackage.myobjectdo" contains (i seek annotation javax.persistence.table). how can do? i want through introspection table name of object managed hibernate (in lazy). this unusual need (hibernate supposed abstract away) let's need it... my object of type (...) , not contain annotations class (...) contains you'll have unproxy proxy. here little method a previous answer (from bozho): public static <t> t initializeandunproxy(t var) { if (var == null) { throw new illegalargumentexception("passed argument null"); } hibernate.initialize(var); if (var instanceof hibernateproxy) { var = (t) ((hibernatepr...

php regex: find inline javascript in HTML document -

i need find inline javascript php regex. can find external script, not inline, can me? here pattern external: "/<script(.*?)src(.*?)>(.*?)<\/script\s*>/smi" any ideas? update : , <script> nodes without src attribute set: "/<script((?:(?!src=).)*?)>(.*?)<\/script>/smix" (my first look-ahead regex ;))

database - Using DTO Pattern to synchronize two schemas? -

i need synchronize 2 databases. databases stores same semantic objects physically different across 2 databases. i plan use dto pattern uniformize object representation : db ----> dto ----> mapping (getters / setters) ----> dto ----> db i think it's better idea physically synchronize using sql query on each side, use hibernate add abstraction, , synchronize object. do think, it's idea ? doing orm might slower order of magnitude well-crafted sql script. depends on size of db. edit i add decision should depend on amount of differences between 2 schemas, not expertise sql. sql common developers should able write simple script in clean way. sql has advantage know how run script, not know how run custom tool (this problem encountered in practice if migration operated else). for schemas slightly differ (e.g. names, or simple transformation of column values), go sql script. more compact , straightforward use , communicate. for schemas major d...

Is NHibernate SchemaUpdate safe in production code? -

for simplicity's sake. i'm using fluent nhibernate's automapping combined nhibernate's schemaupdate during runtime. on each run automapper creates mappings entity classes , schemaupdate applies schema existing database. pleasantly surprised works correctly against empty database well. it's worked fine far in development environment , has allowed me respond bugs rather quickly. my question whether reliable enough leave in production code. doesn't need run every time program starts in production environment useful incremental product updates (though don't plan on making major changes domain after product ships). (perhaps real question should how safe use these 2 tools in conjunction?) update the application has 2 versions: standalone desktop , multiuser client/server. due nature of business domain (tax software) have luxury of starting clean database each year. for able run in production code, account production application uses connect da...

iphone - saving text from uitextview to plist -

for application able read description of place selected table row , display in uitextview. needed next able save content edited user in uitextview plist. need guide because had been searching in vain..thanks you don't need use plist store string, can use -[nsstring writetofile:atomically:encoding:error:] method, , create single file. if you're dead set on creating plist, can use nspropertylistserialization class read , write plists.

Oracle OCI: Query with Date field -

client compiled oci: 10.2.0.4.0 server: oracle9i enterprise edition release 9.2.0.4.0 the problematic query is: select codigo log tel = :telnumber , date_proc = '05-jul-08' table description: sql>describe log; tel not null varchar2(15) codigo not null varchar2(20) date_proc not null date as simple might look, when executed directly on server sqlplus, returns result, when executed app uses oci, query returns oci_no_data always . in beginning, date value placeholder, found out giving literal '05-jul-08' didn't work. have tried following: i've tried basics: querying db client work. it's 1 gives me trouble the following work: select codigo log tel = :telnumber executing alter session set nls_date_format="dd-mm-yyyy"; before query in both server , client. same result: server returns data, client oci_no_data tried changing date_proc format, combining use of to_date() . same result. searched, searched, searched. no answer ...

html - How do I select all the rows in a table, except a particular row, using CSS? -

i apply style every row in table except specific row (could first, or 1 unique class or id - doesn't matter). how do that? the easiest cross-browser way apply style override it, this: table tr td { background: blue; } table tr.someclass td { background: none; } since 1 class, id, etc more specific, it'll have different styling...just put whatever properties you're setting rows in selector overrides/reverses styling. benefit of approach doesn't need partially supported (css3) selectors, works in browsers.

php - $_SERVER['document_root']? -

is pointing directory current file executed? no, points root of webserver - topmost folder of website. if want directory of current file, use: dirname(__file__);

php - How to develop modular application using Zend framework? -

how develop modular application using zend framework? go through tutorial modular application zend framework . there tutorials on youtube, zend framework-modular application

PHP Sorting associative-array by other array -

i need sort associative-array in exact order of content of array. arrays retrieve 2 separate sql-requests (stated below). requests not combined 1 request, have sort second array order of first one. these arrays: #array contains id's in needed order $sorting_array = array(1,2,3,8,5,6,7,9,11,10...); #array contains values id's, in order of "id" asc $array_to_sort = array( array("id" => "1", "name" => "text1", "help" => "helptxt2"); array("id" => "2", "name" => "text2", "help" => "helptxt2"); ); the sql-queries: sql-ouery $sorting_array: (the db-field 'conf' setup "text", maybe problem have first explode , implode entries before use next query.) $result = sql_query("select conf config user='me'", $dbi); $conf = sql_fetch_array($result, $dbi); $temp = explode(...

Image as Label with Checkbox in Flex -

i want use image in checkbox label, know how ? when tried doing same thing radiobutton while back, ended having create own component. did: iconradiobutton.mxml <?xml version="1.0" encoding="utf-8"?> <mx:hbox xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:script> <![cdata[ import mx.controls.radiobuttongroup; [bindable] public var imglabel:class; [bindable] public var groupname:radiobuttongroup; [bindable] public var selected:boolean; [bindable] public var value:string; ]]> </mx:script> <mx:radiobutton id="radiobtn" group="{groupname}" groupname="{groupname}" selected="{selected}" label="" value="{value}" visible="{visible}" includeinlayout="{includeinlayout}" />...

Can I get via javascript the HTTP expires header of a HTTP resource? -

my page needs know when cache included javascript file expire, retrieve again. the xmlhttprequest object has getresponseheader method can call: // following script: var client = new xmlhttprequest(); client.open("get", "test.txt", true); client.send(); client.onreadystatechange = function() { if (this.readystate == 2) { alert(client.getresponseheader("expires")); } }

WPF DataGrid cannot Add a row when datasource is empty -

canuseraddrows="true" 'works' when there's data in itemssource of datagrid . if happens there no rows in original list of items, datagrid doesn't display placeholder row entering new items, though i've set canuseraddrows="true" . why?! thanks in advance, trindaz this seem known issue wpf datagrid. see discussion here (starting 4th comment) seem fixed in .net 4. i've made tests issue on 3.5 , 4 (beta2) frameworks. pls, see results below: first defined 3 types of item collections: public class testgriditems0 : arraylist { } public class testgriditems1 : list<testgriditem> { } public class testgriditems2<t> : list<testgriditem> { } where testgriditem below: public class testgriditem { public string 1 { get; set; } public string 2 { get; set; } public string 3 { get; set; } } .net 3.5 testgriditems0 , testgriditems1 didn't show empty line empty collection; testgriditems2 did work...

mouse - Cocoa's NSView getting insane mouseDown events? -

hullo - i've got nsview subclass move programmatically on mousedown. works, has odd side effect: i click subview. subview moves away [good] i wait while. not move mouse. since subview has moved it's no longer under cursor. i click mouse again. i expect underlying window mousedown event (since subview no longer under cursor), subview somehow gets event [odd] the mousedown event shows click outside bounds of subclass [odd] the mousedown event shows click count has incremented, though i've waited several seconds between mouse clicks [odd] ... there's gotta explanation i'm seeing. here's code - create new cocoa application project called "oddmouse", , copy following oddmouseappdelegate.h file: #import <cocoa/cocoa.h> @interface oddmouseappdelegate : nsobject <nsapplicationdelegate> { nswindow *window; } @property (assign) iboutlet nswindow *window; @end @interface oddview : nsview { } @end ... , following oddmouseappdele...

Reading an image file in C/C++ -

i need read image file in c/c++. great, if 1 can post code me. i work on gray scale images , images jpeg. read images 2d array make work easy. thanks in advance you write own looking @ jpeg format . that said, try pre-existing library cimg , or boost's gil . or strictly jpeg's, libjpeg . there cximage class on codeproject. here's big list .

opengl - float vs double on graphics hardware -

i've been trying find info on performance of using float vs double on graphics hardware. i've found plenty of info on float vs double on cpus, such info more scarce gpus. i code opengl, if there's info specific api feel should known, let's have @ it. i understand if program moving lot of data to/from graphics hardware, better use floats doubles require twice bandwidth. inquiries more towards how graphics hardware it's processing. understand it, modern intel cpus convert float/double 80-bit real calculations (sse instructions excluded) , both types equally fast. modern graphics cards such thing? float , double performance equal now? there strong reasons use 1 on other? in terms of speed, gpus optimized floats. i'm more familiar nvidia hardware, in current generation hardware, there 1 dp fpu every 8 sp fpu. in next generation hardware, they're expected have more of 1 2 ratio instead. my recommendation see if algorithm needs double precisi...

How to create a secure Contact Form (cf) using CodeIgniter -

i want create secure cf using codeigniter. i'm new using codeigniter. library should use or should create 1 formhelper , emailhelper. also, if go creating 1 helpers, how can spams taken care of? cis form helper automatically escape data submitted secure it, although can specify additional functions/purifying etc using form validation class ie $this->form_validation->set_rules('username', 'username', 'required|xss|trim'); as custom call functions. as spam, can use built in captcha library, "ok" not fantastic. there's plenty of documentation out there implement recaptcha instead. in short you'll want form helper, form validation library, email helper , possibly captcha plugin or extension.

time complexity - Big O Notation of an expression -

if have algorithm takes 4n^2 + 7n moves accomplish, o? o(4n^2)? o(n^2)? i know 7n cut off, don't know if should keep n^2 coefficient or not. thanks you should drop coefficients because question asking "on order of", tries characterize linear, exponential, logarithmic, etc... is, when n large, coefficient of little importance. this explains why drop +7n, because when n large, term has relatively little significance final answer. if familiar calculus, might lim n->inf(4*n^2+7n) ~= lim n->inf(4*n^2) ~= lim n->inf(n^2) you can think in graphical sense... is, if graph function 4n^2 + 7n larger , larger values of n, mathematician might "it looks n^2". granted, have liberal mathematician, isn't rigorous statement, that's o(...) trying convey.

multithreading - What causes scheduled threads not to run in Java? -

i have developed small java application runs 2 scheduled threads via scheduled executor service. on computers application runs fine. in testing have come across computer threads not running should or not @ all. have 1 thread scheduled run on 250 ms intervals. checks see if there read on std in, if there reads , executes command. thread runs sporadically never should. other thread runs every 5 seconds , prints screen. runs once , never gets ran again. here code using: scheduledthreadmanager.schedulewithfixeddelay(new runnable() { @override public void run() { try { if(inputreader.ready()) { string command = inputreader.readline(); executecommand(command); } } catch(ioexception e) { system.out.println(e.tostring()); e.printstacktrace(); } } ...

iphone - Geolocation based push notification -

i'd like to push an alert to my iphone users that are within a geographic range. i can get their location when my app is "alive," but not otherwise. would a good approach be: send the localized alert based on users that appeared "in-range" in the last hour? otherwise, i'm not sure how to only alert relevant users. is there a smarter approach? the lack of background processing hurts applications this. think solution best approach, given rather severe limitation. however, should offer ability tone down, start annoying.

google maps - Android MapView is not loading -

im having problems mapview because not loading map. i've been reading around, , find many people same issue. checked possible issues , seems ok :p on manifest, inside tag i have before tag in emulator 3g working since can navigate browser , google maps loads perfectly i checked twice apikey, , seems ok. im using windows, in cmd navigate folder java keytool located, once there execute next command fingerprint , apikey: keytool -list -alias androiddebugkey -storepass android -keypass android -key store c:\path\where\the\file\is\located\debug.keystore here of code: public class mapa extends mapactivity { private mapview mmapview = null; private mapcontroller mc = null; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.mapa); geopoint gpoint = new geopoint(40331175,-3765780); mmapview = (mapview) findviewbyid(r.id.mview); mmap...

java based calculation engine based on Open Office Calc -

the requirement build calculation engine performant , supports excel formulas. these formulas need applied on huge data sets (millions of rows of data). i thinking if built on top of openoffice calc service , make available calculation engine. does have experience in doing ? there other alternatives ? know possible using excel service open source shop. m$ ruled out. any pointers helpful. edited based on high performance mark's inputs. numerics calculations needed. scientific calculations not in scope (ie., sin(x), tanh(x) etc) calculation not performed end users. formulas stored in db , applied on datasets. formulas (like tax calculation) configured. if formula changes, recalculation triggered via application. spreadsheet formulas understood wider audience , should easier read , maintain. there wrapper around r (or such equivalent) convert spreadsheet formula r syntax ? well, little googling finds several open-source java-written spreadsheets, 1 of...

mysql - Multiple criteria with count of matches -

i have 2 tables, table of people peopleid , name, , table of pledges have made has pledgeid (1 6) personid came from, , amount field. we need have query gives distinct list of people, how have pledged in total, , number of pledges have got correct (pledgeids 1,3 , 5 regarded correct) so need know example john smith has pledged £500 in total , matched 2 pledges (because had made pledges on 1,3 , 6 example) , sally james has pledged £2000 , has pledged on ids 1,3 , 5 , has therefore matched 3 i hope clear. appreciate one. many thanks dave sounds work: select personid, sum(amount) totalpledged, sum(case when pledgeid in (1,3,5) 1 else 0 end) correctpledges personpledges group personid

html - Is there a CSS selector for the first direct child only? -

i have following html <div class="section"> <div>header</div> <div> contents <div>sub contents 1</div> <div>sub contents 2</div> </div> </div> and following style: div.section div:first-child { ... } for reason don't understand style getting applied "sub contents 1" <div> "header" <div> . i thought selector on style apply first direct child of div class called "section". how can change selector want? what posted literally means "find divs inside of section divs , first child of parent." sub contains 1 tag matches description. it unclear me whether want both children of main div or not. if so, use this: div.section > div if want header, use this: div.section > div:first-child using > changes description to: "find divs direct descendents of section divs...

ruby on rails - Why does nginx + memcache corrupt my response body? -

i'm caching web pages in memcache. when read page directly cache, page formed ... !doctype html public "-//w3c//dtd xhtml 1.0 transitional//en"-:-- 0 "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> but when use browser or curl read nginx (version 0.8.50), looks response headers ending in body of response ... �{ " etag"'"16bb9f51667d334aa4e7663ca28d308a""x-runtime177"content-type"text/html; charset=utf-8"content-length"5428"set-cookie""cache-control"(private, max-age=0, must-revalidate"4<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"...

javascript - How do you create a custom css pop-up to open on page load once per visitor per week -

okay have below code, allow me either click link or hover on link show pop-up. able edit make open on page load. able have open once per visitor per week. i new great! thanks <head> <style type="text/css"> #fade { display: none; background: #000; position: fixed; left: 0; top: 0; z-index: 10; width: 100%; height: 100%; opacity: .80; z-index: 9999; } .popup_block{ display: none; background: #fff; float: left; font-size: 1.2em; position: fixed; padding: 20px; border: 20px solid #ddd; top: 50%; left: 50%; z-index: 99999; -webkit-box-shadow: 0px 0px 20px #000; -moz-box-shadow: 0px 0px 20px #000; box-shadow: 0px 0px 20px #000; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; } img.btn_close { float: right; margin: -55px -55px 0 0; } .popup p { padding: 5px 10px; margin: 5px 0; } /*--making ie6 understand fixed posit...

Fighting client-side caching in Django -

i'm using render_to_response shortcut , don't want craft specific response object add additional headers prevent client-side caching. i'd have response contains: pragma: no-cache cache-control : no-cache cache-control: must-revalidate and other nifty ways browsers interpret directives avoid caching. is there no-cache middleware or similar can trick minimal code intrusion? you can achieve using cache_control decorator. example documentation : from django.views.decorators.cache import never_cache @never_cache def myview(request): # ...

iphone - App Store error: The binary you uploaded was invalid -

the notorious error haunts me in app store: "the binary uploaded invalid. signature invalid, or not signed apple submission certificate." steps i've taken: 1) i'm using monotouch / monodevelop. 2) app works on iphone simulator , on device. 3) i've made distribution build according examples in monotouch documentation (using distribution profile). 4) i've checked xxxx.app package contains file "embedded.mobileprovision". 5) i'm zipping (in os x gui) app bundle (only xxxx.app file). 6) i've checked integrity of xxxx.app file command "codesign -vvvvv xxxx.app" 7) i've cleared keys , profiles xcode organizer , keychain, , added keys/profiles again. no luck. ideas? /pom make sure you're using provisioning profile app store (not ad hoc distribution) then select profile when building app.

Android: How do you capture a screenshot of your own app programatically -

i know need root access if want capture screenshot using background application. possible grab screen content of current visible activity owned process? not seem security constraint since user has installed app using app. if how work? the thing can imagine work (not tested) instance of root layout node , manually call draw(canvas) own canvas instantiated empty bitmap , save bitmap. sounds lot of work thing can think of @ moment.

Bash echo all array members when array is referenced as a variable in a loop -

the "echo" below failing , retarded figure out why. trying echo of array members in loop. #!/bin/bash foo=bar1,bar2 in ${foo//,/" "} declare -a ${i}='(null null null null)' echo ${i[*]} done thanks help! try eval "echo \${$i[*]}" why doing way? there easier , more direct way whatever ultimate goal is. if describe it, perhaps can avoid unnecessary complication.

xcode - How NSZombie works when it finds error on iPhone SDK -

if set on nszombie, tells me i'm releasing object released , gives me memory address, helpful... can't see object it's... because app stopped working... any help? thank you you looking for: malloc_history http://www.friday.com/bbum/2010/01/10/using-malloc-to-debug-memory-misuse-in-cocoa/

matlab - Undefined variable "modem" or class "modem.pskmod" when calling from java -

i have written code in matlab modulate , demodulate signals. deploy them using deploytool , .jar works in 1 application without gui gives me undefined variable "modem" or class "modem.pskmod". in application gui. basically, want know cause error occur have around, don't find documentation on error. as don't understand why work in 1 application fails in when code use similar when calling method. ok, after testing , comparing difference between application without gui , application gui. found solution problem. as application without gui run init method start of application (there 1 thread) import matlabfunction.*; public static void main(string[] args) { matlabfunction test = new matlabfunction(); test.runfunction(1, lstabc.toarray()); } but in code gui run init method within jframe (main() contain init code) inside edt public static void main(string[] args) { swingutilities.invokelater(new runnable() { public...

javascript - Pressing "Return" in a HTML-Form with multiple Submit-Buttons -

let's imagine html-form with 2 submit buttons. 1 of them positioned in upper half of form , less important. other button actual submit button, saves entered data. button positioned @ end of form. 2 buttons trigger different action-urls. experienced users submit forms pressing "enter" or "return" instead of clicking on according button. unfortunately, browser first submit-button of current form , use execute form-submit. since in form second button actual submit-button, need tell browser use particular button (or action-url associated it). i don't link javascript listeners, looking key pressed or that. i'm looking better approach problem. however, javascript or jquery solutions (without keypressed-listerner) welcome. thank in advance. you could, theoretically @ least, have 3 submit buttons in form. button 2 existing 'less-important' button (from halfway down form), button 3 existing 'actual-submit' button existing f...

.net - C# fundamentally not portable? -

i've been using c# while, , have started working on adding parallelism side project of mine. so, according microsoft, reads , writes ints , floats atomic i'm sure these atomicity requirements workout fine on x86 architectures. however, on architectures such arm (which may not have hardware floating point support), seems these guarantees hard. the problem made more significant fact 'int' 32-bits. there many embedded devices can't atomically perform 32-bit write. it seems fundamental mistake in c#. guaranteeing atomicity of these data types can't done portably. how these atomicity guarantees intended implemented on architectures there no fpus or 32-bit writes? there 2 issues regard "portability": can practical implementation of language produced various platforms will program written in language expected run correctly on various platforms without modification the stronger guarantees made language, harder port various platform...