Posts

Showing posts from July, 2012

ios4 - Xcode 3.2.3 (SDK 4) cannot support device iPod touch(iOS 4.1) and iPad(iOS 3.2.2). Any help? screen shots are attached -

Image
i cant test apps on devices. following screenshots. ipod: ipad: for 4.1 ipod, need download latest sdk , screenshot telling you. for ipad, need update device ios 4.1, , download 4.1 sdk.

cluster computing - Websphere 7 clustered deployment -

we have j2ee application ear file deployed in 7, making application availability high needs deployed in 3 clusters. have quartz scheduler class job upload data 1 database daily @ 2:00 am. now, problem if ear deployed in 3 different nodes load balancing , high availability, 3 ear file trigger upload @ same time. how can handle this. possible configuration in 7 environment. help/suggestion appreciated. thanks you have 2 possibilities: the quartz database backend nodes connect same database quartz uses synchronizing task running. can configured prevent task running on several nodes simultaneously. ejb 3.x timer. see instance example . works ensuring member each of clusters fire timer.

mod rewrite - Activate site maintenance via RewriteCond -f check? -

i thought hitting file via -f (i think is) in mod_rewrite rewritecond, if file exists, rewrite maintenance page. don't think performance penalty should big, maybe people had other experiences or objections on idea? why not this: rewriterule !^maintenance$ maintenance [l] and in there repond 503 status code .

iphone - how to make array of words contained in string? -

i have string gpbusd buy update hit 40 pips hit 110 pips gpbusd buy break update hit 100+ gpbusd buy 1.5500/25 1.5455 new 40 100+ gpbusd buy update close 0 10 pips n gpbusd buy 1.5335/50 1.5320 new 40 80+ gpbusd buy update 15-20 pips close keep open gpbusd buy 1.5530/50 1.5505 update hit 80 keep open gpbusd buy 1.5530/50 1.5465 new 40 80 100+ gbpjpy sell 131.05/.130.75 132.15 new 60 100 keep open eurusd sell 1.2840/20 1.2870 stop update i want make array of words contained between spaces of string?how can it? you can try with nsarray *words = [mystring componentsseparatedbystring:@" "]; more here

javascript - Lazy loading and dependency resolution -

some time ago, reading article(a library built guy) how library can lazy loading of js resolve dependencies between js (typically encountered when trying "include" 1 js another) include files once. thought specified multiple times regardless of how called (either directly specifying file or specifying 1 of dependencies) i forgot bookmark it, mistake . can 1 point me can above. know dojo , yui library have this, looking can use jquery i looking 1 more feature well. my site has asp.net user controls (reusable server side code snippets) have js. of them fired right away, when page loading gives bad user experience. yahoo performance guidelines specify js should @ bottom of page, not possible in case require me separate js , corresponding server side control different files , maintenance difficult. can put jquery document.ready() in user control js make sure fires after dom has loaded, looking simpler solution. is there anyway "begin executing any js a...

php - Get authed user's settings -

sorry title im pretty worthless @ php/mysql couldnt figure out title i'm creating community fun. i need able of authed user's info throughout site. whats best way this? right have query in index.php (i include pages thru index.php) querys users table id = session[id]. guess slow down site every user keeps reloading pages. what wonder is, there smarter way? get information when user first logs in, keep data need in $_session array.

regex - Python regular expressions: search and replace weirdness -

i use python regular expression problem. you'd expect result of import re re.sub("s (.*?) s", "no", "this string") to "this no string", right? in reality it's "thinotring". sub function uses entire pattern group replace, instead of group want replace. all re.sub examples deal simple word replacement, if want change depending on rest of string? in example... any appreciated. edit: the look-behind , look-forward tricks won't work in case, need fixed width. here actual expression: re.sub(r"<a.*?href=['\"]((?!http).*?)['\"].*?>", 'test', string) i want use find links in string don't begin http, can prefix in front of links (to make them absolute rather relative). your regex matches first s last s, if replace match "no", "thinotring". the parentheses don't limit match, capture text matched whatever inside them in special variable...

forms - How to change variable values between namespaces / classes? -

i have main form textbox1 string value : asd namespace crystal { public partial class mainform : form { //here textbox1 text "asd" } } i want change textbox1 text class: namespace crystal.utilities { public class logging { //textbox1.text = "dsa"; } } the problem is, cant change value of textbox1 logging class, because doesnt exists there :/ how this? don't need expose entire textbox - don't want others mess other things text, , think it's more readable , simple call method that, instead of accessing textbox directly. namespace crystal { public partial class mainform : form { public void settextbox1text(string newtext) { textbox1.text=newtext } } } namespace crystal.utilities { public class logging { mainform.settextbox1text("new text"); } }

memory management - How to declare and use huge arrays of 1 billion integers in C? -

i'm implementing sequential program sorting quicksort. test performance of program in huge array of 1 or 10 billions of integers. problem obtain segmentation error due size of array. a sample code of declaration of array: #include <stdio.h> #include <stdlib.h> #include <time.h> #define n 1000000000 int main(int argc, char **argv) { int list[n], i; srand(time(null)); for(i=0; i<n; i++) list[i] = rand()%1000; return 0; } i got proposition use mmap function. don't know how use ? can me use ? i'm working on ubuntu 10.04 64-bit, gcc version 4.4.3. thanks replies. michael right, can't fit on stack. however, can make global (or static) if don't want malloc it. #include <stdio.h> #include <stdlib.h> #include <time.h> #define n 1000000000 int list[n]; int main(int argc, char **argv) { int i; srand(time(null)); for(i=0; i<n; i++) list[i] = rand()%1000; return 0; }

ruby on rails - push new element into array within hash -

i have hash which, have keys uniquely identify each element within hash. , within each element, have array. question is, how put element inside array within hash. {"apple"=>[1, 5.99], "banana"=>[5, 9.99]} i'm looping through result set, , i'm little bit lost how add element array... any appreciated cheers if hash called, example, hsh , "apple" array can accessed hsh["apple"] . can use variable, add value array hsh["apple"] << some_value . so: irb> hsh = { "apple" => [1, 5.99], "banana" => [5, 9.99] } irb> hsh["apple"] << 9999 => { "apple" => [1, 5.99, 9999], "banana" => [5, 9.99] }

android - How can I replicate the home screen dots? -

on android, home screen has dots indicate screen on. want similar in app. there control contains dots , lights up? no... have self. take @ tweetdeck app fro android... have similar.

asp.net mvc - What are web parts? -

what web parts? what benefits , drawbacks using them? there difference between web parts in asp mvc , sharepoint? web parts part of classic asp.net webforms. special type of user controls. sharepoint being built classic webforms uses web parts extensively add functionality. web parts not used in asp.net mvc. remember there's no viewstate nor postback concepts in asp.net mvc. similar functionality achieved view models , partial views.

hosting - How to forwarding bare domain to www.domain for google app hosted site -

i in process of porting sites own server google (ghs). i've used zoneedit manage dns needs , in past - wrongly or rightly - configured that: domain.com , www.domain.com pointed to: <my known ip address> with www sub-domain fine , ( www.domain.com ) resolves ghs.google.com (via cname entry) , site displayed. however, if try , reach bare domain ( domain.com ) ff states unable establish connection. assume because dns configuration has no a ip-address entry anymore. i considering forwarding url domain.com www.domain.com , although possible zoneedit not recommending think because telling forward requests http://domain.com , leave http://www.domain.com (i.e cname configured). am handling best way? please advise. according article on url forwarding in google apps help, forwarding naked domain www domain best way handle it. and leave cname record www domain point ghs.google.com, have done.

c# - Disable image loading from webbrowser control before the documentcompleted event -

i want prevent images in page being loaded in webbrowser control. want happen before documentcompleted event occurs. there way this? you can set dispid_ambient_dlcontrol ambient property or change browser's process's wininet session use programmable proxy.

jQuery Drag Drop - how to fetch the dropped value in the server end? -

i have application uses jquery ui drag li 1 ul another. asp code same follows: <script type="text/javascript" src="../../jquery/jquery-1.3.2.js"> </script> <script type="text/javascript" src="../../jquery/ui.core.js"> </script> <script type="text/javascript" src="../../jquery/jquery-ui-1.5.3.custom.min.js"> </script> <script type="text/javascript"> $(function() { $("#selectedusers").sortable({ connectwith: ["#userlist"] }); $("#userlist").sortable({ connectwith: ["#selectedusers"] }); }); </script>   tea coffee juice ...

php - Reload the table with JQuery -

i have following issue. here index.php : <div id="tabs"> <ul> <li><a href="#tabs-1">a projects</a></li> <li><a href="#tabs-2">b projects</a></li> </ul> <div id="tabs-1"> <?php echo loadtabs(1);?> </div> <div id="tabs-2"> <?php echo loadtabs(2);?> </div> here 2 php functions build tables: function loadtabs($settingid){ $query = 'select * deployments_settings id="'.$settingid.'"'; $result = mysql_query($query); $html = '<div id="tab'.$settingid.'_container">'; while ($row = mysql_fetch_array($result)) { $html .= '<div id="tab'.$settingid.'_buttons">'; $html .= '<button id="add_project">'.$row['addbuttoncaption'].'</butto...

erlang - Actor-model library, framework, or language written in C? -

the actor-model defined in 1973 paper carl hewitt, has been popularized erlang language. believe parts of erlang aren't self-hosted (written in erlang) written in c; beam , hipe written in c. alternative actor-model implementations (languages, frameworks, or libraries) written in c? consider libdispatch .

internet explorer 6 - jquery find('object') problem in ie6 -

i have problem ie6 when searching inserted object jquery. this: var obj = $('<div></div>').html($('#embedded_video').val()).remove().find('object'); where in embedded_video textbox insert object taken youtube or so. works great in ff , ie7&8 not seem work in ie6. tried modify command else ... find('a') , works in ie6 problem appears when search 'object'. can find method search? thanks i'd curious find out more. when this. see object in html? alert($('<div></div>').html($('#embedded_video').val()).remove().html()); also, happens if use closest() instead of find(). although, if you're looking more 1 object, maybe isn't you.

pointers - How to include a dynamic array INSIDE a struct in C? -

i have looked around have been unable find solution must asked question. here code have: #include <stdlib.h> struct my_struct { int n; char s[] }; int main() { struct my_struct ms; ms.s = malloc(sizeof(char*)*50); } and here error gcc gives me: error: invalid use of flexible array member i can compile if declare declaration of s inside struct char* s and superior implementation (pointer arithmetic faster arrays, yes?) thought in c declaration of char s[] is same as char* s the way have written , used called "struct hack", until c99 blessed "flexible array member". reason you're getting error (probably anyway) needs followed semicolon: #include <stdlib.h> struct my_struct { int n; char s[]; }; when allocate space this, want allocate size of struct plus amount of space want array: struct my_struct *s = malloc(sizeof(struct my_struct) + 50); in case, flexible array member array of char, ,...

.net - Entity Framework select from link table with list -

using following database table structure: order table: orderid ordername orderitem table: orderid itemid item table: itemid itemname i have 'order' entity has 'items' collection. need return orders contain items. example: orders items id: 1, 4 , 5 (i don't care if has other items well). have selected id's in list object (it doesn't have list though). have tried various ideas 'contains' method no avail. because orderitem link table, can't access entity itself. if presumably do: context.orderitems.where(m => selectedids.contains(m.itemid)) or that. is there way of doing in single query without having loop around results? thanks context.orders.where(o => o.items.any(i => selectedids.contains(i.itemid))) this requires ef 4.

html - Alert the count of <li>s in an adjacent <div> to a button being clicked -

this first post website has been useful here goes... oh , im beginner ;-) i have button (a div class) , div inside element side side. inside second div have ul , number of li's dynamically change. when button clicked, need count of li's in div next button only the various alerts i've used wrong , return count of li's inside 'hidden-row-content' not adjacent 'hidden-row-content' div returns 4 instead of 2 :-( html code: <td> <div class="show-hidden-row"><!-- --></div> <div class="hidden-row-content"> <ul> <li>item</li> <li>item</li> </ul> </div> <em>persons name</em> </td> <td> <div class="show-hidden-row"><!-- --></div> <div class="hidden-row-content"> <ul> <li>item</li> ...

.net - WPF WebBrowser: How I do access progress and new window events -

i'm building wpf app uses webbrowser control. i'm struggling on couple of points: how current progress of download control. winforms webbrowser control raises progresschange events - how can replicate feature wpf variant? how capture links trying open in new window. again winforms webbrowser had newwindow event. use stop ie being started , open link in same window. possible wpf variant? having found information wanted thought i'd update question interested. at bottom of http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser(v=vs.90).aspx there comment entitled "getting native iwebbrowser2". this shows how required interface , seems works well. edit : adding content of link here comments @ msdn keep disappearing on me.. there functionality of native web browser control our managed wrapper not yet expose. following code snippet shows how iwebbrowser2 interface wpf webbrowser control. allows access methods on obje...

gdb - Can I debug a core generated by a C++ binary without debug symbols using the same binary recompiled with debug symbols -

i trying debug core file generated c++ binary without debug symbols. in order effective debugging, need debug symbols, i've recompiled same code -g option in order generate debug symbols in recompiled binary. can debug same core file generated first binary (without debug symbols) using second binary (has debug symbols, else same) ? thanks lot ! if compiled original executable e.g. g++ -o2 ... , can not (as have discovered) use new executable built g++ -g ... debug core -- gdb needs symbols match, , not (due difference in optimization levels). what can build new executable same optimization original, also debug symbols: g++ -o2 -g ... . after you've built new executable, run nm old.a.out > old.nm , nm new.a.out > new.nm , compare outputs. should identical or very close. if are, should able debug core produced old.a.out using new.a.out. in future, should build executable debug symbols, keep full copy, ship copy without debug info: cp a.out a...

MySQL/phpMyAdmin freezes from DELIMITER -

running procedure causes mysql (or phpmyadmin) freeze. have stop mysql xampp command, freezes , "is not responding" 20 seconds before stopping. believe caused delimiter command, on it's own begins problems. have tried using different delimiter ("//") no effect. delimiter $ create trigger coroner after insert on events each row begin update teams id = new.victim set live = live-1; update teams id = new.shooter set score = score+points; end $ delimiter ; as turns out, phpmyadmin has field marked "delimiter:" below sql query box. using rather command solves problem. further research explains "delimiter" not sql command, command implemented sql ui's.

Problems POSTing data to an asp.net webpage (problem in Desktop C# end) -

thank taking time read post! having problem posting data c# desktop application c# asp.net web page. believe problem lies in desktop application (or @ least 1 of problems does!) post asp.net code using. if asp.net not speciality, don't worry, wondering if there glaringly obvious there well. i had create asp.net website post data windows forms application. working perfectly. here code using. not working discussed below. bad @ asp.net stuff, can provide appreciated. if (system.net.networkinformation.networkinterface.getisnetworkavailable() && result == dialogresult.yes) { string test = "test"; webrequest request = webrequest.create("http://localhost/test.aspx"); byte[] bytearray = encoding.utf8.getbytes(test); request.method = "post"; request.contenttype = "application/x-www-form-urlencoded"; request.contentlength = byt...

How to make WPF DataGrid scrollbar look like WinForm DataGridView? -

i'm trying migrate wpf , evaluating datagrid. first, tried make datagrid , feel similar old datagridview. problem scrollbars in datagrid cover scrollable area. means, column , row header areas shown in background color, looks ugly me. how can make scrollbar extend edge of control? there property in datagrid this? by way, did create style datagrid make have similar , feel of datagridview (e.g. datagrid grid line black default, row header doesn't cool, , it's missing selection triangle, , scrollbar problem described here, , on) edit: can see screenshot .

sql - How to search between columns in mysql -

i have 2 columns store values(numbers), how select given number between values in 2 columns? example `id | col1 | col2` `1 | 20 | 50` `2 | 200 | 400` `3 | 500 | 650` if have value of 25, how can select records value of 25 between them in case row 1 select * mytable 25 between col1 , col2;

mysql - Exclude records from one table based on count in joined table -

i have 2 tables: coupons , responses. the coupons table includes fields such as: vendorid [key] couponid [key] coupondescription the responses table includes fields such as: respondentid [key] couponid [key] (vendorid not repeated in table.) accepted [true/false] rejected [true/false] rating [1 5] when accepts coupon, rate in responses table. likewise, when rejects coupon, rejection appears in responses table. when fetching list of available coupons coupons table, i'd exclude vendors received 2 or more rejections respondent. instance if respondentid 3 rejected 2 or more coupons vendor 47, coupons vendor 47 no longer shown respondentid 3. two things make difficult sql novice myself. the first how write subquery counts rejections from particular vendor , by particular respondent. the second how join-back (so speak) responses table coupons table sub-query of responses table bases result on respondentid (which in responses table) , vendorid (which not...

Specifying a unicode-named column in dynamic where clause (Entity Framework) -

when set clause of entitydatasource contains unicode column name, exception occurs: the simple identifier 'عنوان_قرارداد' must contain basic latin characters only. use unicode characters, use escaped identifier. near line 6, column 4. and part of code: griddatasource.where = "it.عنوان_قرارداد == \"something\""; i tried using escaped identifier new exception occurred: the query syntax not valid., line 6, column 4 is there solution problem? finally found solution: griddatasource.where = "it.[عنوان_قرارداد] == \"something\"";

tcl/tk button or toplevel pathname conventions -

when 1 creates new toplevel or button in tk, 1 needs enter pathname. have seen basic code looks like: toplevel .a ... button .a.b ... my question is: dots treated differently letters? sort of hierarchy delimiters, create parent child relationship? have looked @ wiki tk , failed find answer that. many thanks, -lior as other answers have said, dots used represent hierarchy, / or \ used represent filesystem hierarchy. placing widgets in hierarchy not, strictly speaking, necessary. 1 advantage in doing geometry managers such grid , pack default managing children in parents. example 'pack .a.b.c' pack widget a.b.c within widget .a.b. makes easy simple layouts. the same effect in many cases can achieved telling grid , pack container child should placed. foe example, 'pack .c -in .a.b' put widget .c in container .a.b. let's keep hierarchy shallow, , makes refactoring little easier. see http://www.beedub.com/book/2nd/tkintro.doc.html introduction tk ...

testing - How do I test my iOS Apps -

my question maybe silly, can coach me? except doing test(most white box testing) while coding, after app built, have testing tools or special method doing test? all can imaging now, manual testing functionality of app. thanks everyone. update: added section 'automated testing ios4' as professional tester suggestion should have healthy mix of automated , manual testing. examples below in .net should easy find tool whatever technique using. automated testing unit testing use nunit test classes, functions , interaction between them. http://www.nunit.org/index.php automated functional testing if it's possible should automate lot of functional testing. frame works have functional testing built them. otherwise have use tool it. if developing web sites/applications might want @ selenium. http://www.peterkrantz.com/2005/selenium-for-aspnet/ continuous integration use ci make sure automated tests run every time in team makes commit project. http://m...

c# - NHibernate Validator Dynamic rules -

i'm using nhibernate , have requirement validation rules must change in time. framework i'll use nhibernate validator, don't know how make dynamic rules, validation quite simple xml files or attributes in entity class, catch make rules updatable. there way achieve this? well, since nobody answered i'll explain how can achieved. can done special attributes within class [email] [notnull] [notempty] etc, , can changed/overridden xml files. in configuration file of nhibernate validator add tags each 1 of classes should controled this: <mapping file="path.to.xml.validation.file"> and change default_validator_mode property overrideattributewithexternal hope helps :)

iphone - multiple regionDidChangeAnimated calls - what gives? -

i have mkmapview inside uitableview custom cell (don't ask ;) - don't know if matters really), register regiondidchangeanimated delegate method. method gets called 3 times when uitableview loaded - once actual region , 2 more times region way off. in simulator, consistently region center (+37.43997405, -97.03125000). on device, seems depend on location reported location manager, initializes map view. why getting 3 regiondidchangeanimated calls? , why center coordinates last 2 of them off? this code use center coordinates: - (void)mapview:(mkmapview *)mapview regiondidchangeanimated:(bool)animated { cllocation *l = [[cllocation alloc] initwithlatitude:self.mapview.centercoordinate.latitude longitude:self.mapview.centercoordinate.longitude]; (....) i have set map view inside custom table view cell , added cell table view (although should not matter where/how map view displayed). i not see unexpected calls regiondidchangeanimated: delegate method. i see...

How do you properly escape json to be sent over ajax? (Using Datatables) -

i know how escape json code. using datatables plugin , json failing. "6\\\\\\\' 5\\\\\\\" ford hd ", it looks (without opening/closing brackets , comma): 6\\\' 5\\\" ford hd how escape this? you should not escape ' character. correct json be "6\\\\\\' 5\\\\\\\" ford hd " a place can validate data http://www.jsonlint.com/ .

casting - Integer division in Common Lisp? -

when (/ 7 2) , should result 3 ? if (/ 7 2.0), 3.5 , expected. (floor 7 2) ref: http://rosettacode.org/wiki/basic_integer_arithmetic#common_lisp

iphone - Stopping video in viewWillAppear:(bool)animated method -

in viewwillappear:(bool)animated method want stop video playing. how can this? new don't know much. playing video on screen. have tab shows table view. when click on tab table view shown video playing in background: can hear music. if using mpmovieplayercontroller, call -pause on object.

Messing with GIT history destroyed recent commits...how to recover? -

so. i'm new git. , think may have broken beyond ability repair (hooray). here's breakdown: i made remote directory, , accidentally included large files in initial commit. made difficult people it. (i didn't realize @ first, , had made modifications, , had been using directory on own awhile) i learned merely removing files , commiting removal doesn't people cloning directory, , learned modifying history through commands like: git filter-branch --tree-filter 'rm -f public/vidos/*' head which would, knowledge, remove files public/vidos/ directory, , rid of memory of them. this seemed happen. clone things succesfully (no out of memory errors), , cloned copy didn't have super large files in them. then, morning, (after stupidly making sure matched remote depository (i.e. got rid of local stuff, thinking should date except large files) started work directory, , realized files seem on initial check in (no modifications, , there lot of things modi...

oop - Why setters are bad in interfaces? -

why setters bad in interfaces if speaking domain objects? clarification: i have domain object stores in db. has several fields costly set. i.e. class jurasicpark { private long area; ...other fields ... getters , setters .... private collection<dinosaur> dinosaurs; private collection<exotictree> flora; public collection<dinosaur> getdinosaurus(){ ... } public collection<exotictree> getflora(){ ... } } fields dinosaurs , flora costly init , set. in many cases don't need fields set every time. the problem if return user instance of jurasicpark class dinosaurs or flora don't initialized fill lead either npe or expection throw myself. don't want make api user think , remember fields may not set. so solve thought creating 2 interfaces ijurasicpark , ifulljurasicpark first declare access methods simple fields, former declare access methods flora , dinosaurs fields. interface ifulljurasic...

html - Check if javascript is enabled in browser -

i have code checks if js enabled , redirects: <noscript><meta http-equiv="refresh" content="0;url=http://www.domain.se/act.html"></noscript> however, wonder if se friendly... this because have added website url yahoo recently, , instead of title appearing in search results, text "aktivera_javascript.html" above appears. why that? thanks update: if code above isn't proper checking js availability, other method should use instead? the noscript tag user agents can't execute script. since yahoo! spider 1 of agents, guess (but can't certain) respects content of noscript tag , therefore http-refresh directive contained within. result thinks site lives @ http://www.skuffen.se/aktivera_javascript.html , , displays content in search results. to fix issue suggest either: use progressive enhancement ensure basic content available without javascript, , layer advanced features on top. user agents without ja...

algorithm - Evenly distributed hash function -

i need hash function takes few (eg. 2 or 3) unsigned integers input, , returns floating point value between -1 , +1. the collection of these returned values must evenly distributed. sequence of outputs function must appear random sequence, if input numbers sequential. faster better, i'm calling lot of times. i hope isn't ask :s... you can employ standard scheme such tasks: (a0 + q*a1 + q^2*a2 + q^3*a3 + ...) % m m large prime number , q coefficient of choice. once have random enough hash in range [0, m) , converting floating point number [-1, 1] trivial. or can remove % m , allow integer overflow happen, although i'm not sure how secure (from 'evenly distributed' perspective). a sequence of outputs function must appear random sequence, if input numbers sequential. can instead of ai use ai*ai in expression. anyway, here's simple implementation in java. double hash(int... a) { int q = 433494437; int result = 0; (int n : ...

asp.net - Having SQL injection like text in a texbox results in 401.1 on Submit -

this follow post in august: asks ad credentials / "connection interrupted" on postback the issue popped again new record , have determined offending text "... sharepoint site[semi-colon] update team schedule ...". notice "[semi-colon] update team"? it's valid, not sql injection. change comma, submits no problem. change "update" sql keyword, user gets prompted credentials (which rejected) , displays iis 401.1 page. yes, need replace [semi-colon] character, because won't let me post. in @page , have validaterequest="false" (yes, contents textboxes going through httputility.htmlencode parameterized input stored procedure) any ideas? this sounds load balancer or similar seeing ;update , suspecting sql injection. piece of offending hardware between , web server. to confirm, try posting offending text session directly on web server itself. guessing have no problem doing so.

zend framework - Zend_OpenId with Codeigniter -

i using openid library zend codeigniter , working fine except verify function. $status = ""; if (isset($_post['openid_action']) && $_post['openid_action'] == "login" && !empty($_post['openid_identifier'])) { $consumer = new zend_openid_consumer(); if (!$consumer->login($_post['openid_identifier'])) { $status = "openid login failed."; } } else if (isset($_get['openid_mode'])) { if ($_get['openid_mode'] == "id_res") { $consumer = new zend_openid_consumer(); if ($consumer->verify($_get, $id)) { $status = "valid " . htmlspecialchars($id); } else { $status = "invalid " . htmlspecialchars($id); } } else if ($_get['openid_mode'] == "cancel") { $status = "cancelled"; } } the openid library needs zend session start included libr...

list - Represent sequence of tetrahedral numbers in Haskell -

i've been wanting learn haskell while now, , know , similar languages have support various kinds of infinite lists. so, how represent sequence of tetrahedral numbers in haskell, preferably explanation of what's going on? 0 0 0 1 1 1 2 3 4 3 6 10 4 10 20 5 15 35 6 21 56 7 28 84 8 36 120 in case it's not clear what's going on there, second column running total of first column, , third column running total of second column. i'd prefer haskell code retain of "running total" approach, since that's concept wondering how express. you're correct, haskell nice doing things this: first_col = [0..] second_col = scanl1 (+) first_col third_col = scanl1 (+) second_col first_col infinite list of integers, starting @ 0 scanl (+) calculates lazy running sum: prelude docs we can verify above code doing right thing: prelude> take 10 first_col [0,1,2,3,4,5,6,7,8,9] prelude> take 10 second_col [0,1,...

iphone - How to using the framework called Springboard -

the framework called springboard iphone kernel.i want make supported multitasking. springboard user-land application hosts "homepage" , many other services (e.g. converting hid events gsevents, receiving push notification, alarms, etc.) there aren't framework nor kernel extensions called springboard. if want multitasking, install backgrounder .

How to split a string into tokens in C? -

how split string tokens '&' in c? strtok / strtok_r char *token; char *state; (token = strtok_r(input, "&", &state); token != null; token = strtok_r(null, "&", &state)) { ... }

multiplayer game with bluetooth [iphone] -

i doing multiplayer game bluetooth, able connect 1 iphone via picker. problem how can make 2 phones play 1 same screen synchronize , play character? i'm new this, there simple bluetooth games out there can get? need this, lot. apple has bluetooth game sample online. check examples in iphone developer program .

c - char pointer initialization -

i have come across line given below char *ch=(char*)3000 i want know meaning of line ..... it looks pointer, ch, being assigned absolute memory address 3000. bad idea, unless you're working on embedded system no paging , know exactly what's @ memory location 3000.

objective c - How to get content from URL asynchronously? -

i'm trying here create nsxmlparser content of url, work there way can make url content received asynchronously , later create nsxmlparser ? nsurl *url = [[nsurl alloc] initwithstring: @"http://www.xmlfile.com"]; nsxmlparser *parser = [[nsxmlparser alloc] initwithcontentsofurl:url]; [url release]; use nsurlconnection fetch data asynchronously nsdata, use initwithdata instead of initwithcontentsofurl.

why C# and C++ use _<variableName> coding convention? -

i have seen c# , c++ code variable naming convention seems ask programmers write variable names using underscore before text of variable. e.gr. int? _countmoney; what's rationale supporting convention? in c# prefix _ private fields never local variables. rationale behind when need private variable type _ , intellisense filters list , easier find. way able distinguish between private local variables , no longer need type this.variablename class fields _variablename .

c# - XML parser: implementation design -

i've assumed xml documents convenient way store information. i've found in xml way "instruct" application. delicous. my problem integrate xml parsing in application classes. i'm using c# system.xml interface, think it's , portable (right?). is there standard interface defines methods organize recursion on xml tags, or methods implement common xml implementations (maybe in base class)? initially can think write interface defines void read(xmlreader xml); void write(xmlreader xml); what nested tags, common tags , on... p.s.: don't think implement using linq, except in case it's supported in mono (how determine this)? thank much! :) i think might looking serialization , beginners tutorial on serialization

javascript - Facebook Dom Placeholder on Password -

facebook has "dom placeholder" on password field when logging on. when click on input password, placeholder disappears , allows me type password "masked". is javascript related , how go on replicating script? yes, can done via javascript, browsers support natively. placeholder attribute html5 addition; browsers (such webkit-based browsers) support already. example using jquery 1.4 <!-- work automatically browsers --> <input type="text" placeholder="enter text"> <!-- script browsers don't support natively --> <script type="text/javascript"> $.fn.placeholder = function(){ // quit if there's support html5 placeholder if (this[0] && 'placeholder' in document.createelement('input')) return; return .live('focusin',function(){ if ($(this).val() === $(this).attr('placeholder')) { $(this).val(''); } }).live...

exception - Selecting Android Spinner Causes WindowManager$BadTokenException -

i created custom alertdialog display spinner , edittext elements. when select menu option, custom alertdialog gets launched. works fine until select spinner try , select item, @ point badtokenexception. i've read other stackoverflow posts saying similiar exceptions result of trying display diaglog using getapplicationcontext() rather passing activity.this. i'm not explicitly passing getapplicationcontext() related alertdialog. to setup custom alertdiaglog, created layout file containing spinner , edittext elements, , made alertdialog use layout: layoutinflater inflater = (layoutinflater)getapplication().getsystemservice(layout_inflater_service); view layout = inflater.inflate(r.layout.custom_layout, (viewgroup)findviewbyid(r.id.custom_layout_root)); spinner = (spinner)layout.findviewbyid(r.id.custom_layout_spinner); arrayadapter adap = arrayadapter.createfromresource(activity.this, r.array.data, android.r.layout.simple_spinner_item); adap.setdropdownviewresource(android...

loops - Trying to create multiple folders with VBScript -

i need create set of empty folders, starting @ 10, going 180. script i'm trying use, creates 10, , nothing else. option explicit dim objfso, objfolder, strdirectory, strdirectory = "\path\to\main\folder" set objfso = createobject("scripting.filesystemobject") = 180 while < 180 set objfolder = objfso.createfolder(strdirectory & i) = i+1 wscript.quit wend i'm pretty new vbscript, maybe problem obvious, don't see it. tried using for loop, didn't seem work @ all. thanks in advance reads this. i have modified script follows: option explicit dim objfso, objfolder, strdirectory, strdirectory = "c:\temp\test\folder" set objfso = createobject("scripting.filesystemobject") = 10 '' <===== changed! while < 180 set objfolder = objfso.createfolder(strdirectory & i) = i+1 ''wscript.quit '' <===== commented out! wend with script, managed create ...

moq - Should Mock<SomeClassType>.SetupAllProperties() cause properties to return the values they are assigned? -

when use setupallproperties on mock, works expected: /// <summary> /// demos setupallproprties on interface. seems work fine. /// </summary> [test] public void demo_setupallproperties_foraninterface() { var mock = new mock<iaddress>(); mock.setupallproperties(); var stub = mock.object; stub.city = "blahsville"; var retrievedcity = stub.city; assert.areequal("blahsville", retrievedcity); } however, when try on class, fails: /// <summary> /// demos setupallproprties on class. seems work fine mocking interfaces, not classes. :( accessor returns null after setting property. /// </summary> [test] public void demo_setupallproperties_foraclass() { var mock = new mock<address>(); mock.setupallproperties(); var stub = mock.object; stub.city = "blahsville"; var retrievedcity = stub.city; assert.areequal("blahsville", retrievedcity); } did wrong? trying ...

gzip - How do the compression codecs work in Python? -

i'm querying database , archiving results using python, , i'm trying compress data write log files. i'm having problems it, though. my code looks this: log_file = codecs.open(archive_file, 'w', 'bz2') id, f1, f2, f3 in cursor: log_file.write('%s %s %s %s\n' % (id, f1 or 'null', f2 or 'null', f3)) however, output file has size of 1,409,780. running bunzip2 on file results in file size of 943,634, , running bzip2 on results in size of 217,275. in other words, uncompressed file smaller file compressed using python's bzip codec. is there way fix this, other running bzip2 on command line? i tried python's gzip codec (changing line codecs.open(archive_file, 'a+', 'zip') ) see if fixed problem. still large files, gzip: archive_file: not in gzip format error when try uncompress file. what's going on there? edit : had file opened in append mode, not write mode. while may or may not pro...

vbscript - Call https page via .vbs script fails ... why? -

here's script. tried executing ... nada. tried executing via task scheduler ... nada. if hit url below via ie works. ideas??? ''//force script finish on error. on error resume next ''//declare variables dim objrequest dim url set objrequest = createobject("microsoft.xmlhttp") ''//put url link appending variables. url = "https://myurlhere.com" ''//open http request , pass url objrequest object objrequest.open "get", url , false ''//send html request objrequest.send ''//set object nothing set objrequest = nothing "in internet explorer 8, vbscript syntax not supported" -- http://msdn.microsoft.com/en-us/library/ms535874%28vs.85%29.aspx could problem?

drupal - Enabling a Feature via Drush -

when enable feature through site ui, goes expected. however, when enable feature drush drush pm-enable , following don't happen: strongarm configurations not applied module_disable (in new custom module) not performed why this? looks had conflict in 2 features. fine now.

iphone - UIDatePicker help please -

i have uidatepicker displays date in uitableviewcell. i define datepicker change date format in uitableviewcell according device international settings. how can define it? thanks! take @ nslocale class reference .

html - JQuery selection problem -

with html: <label for="dateofbirth"> <span>* </span> date of birth: </label> how select , remove span element using jquery? like this: $("label[for='dateofbirth'] span").remove(); this selector matches <span> elements inside <label> elements have for attribute of dateofbirth . you write span:has('*') match <span> elements contain * in text.

Help with CakePHP Model Relationships -

three simple tables... feedname (eg. news or events) names of rss feeds. posts belong feedname user, owns posts i want use form helper automatically give me select box when add post can select feedname assign to. it seems posts belong both feedname , user can't correct combination of belongsto , hasmany in model/ .php files. select box feedname shown, there nothing in it. can point me in right direction? the tables @ moment: create table `feednames` ( `id` int(10) unsigned not null auto_increment, `name` varchar(50) collate utf8_unicode_ci default null, `created` datetime default null, `modified` datetime default null, primary key (`id`) ) engine=myisam default charset=utf8 collate=utf8_unicode_ci; create table `posts` ( `id` int(10) unsigned not null auto_increment, `title` varchar(50) collate utf8_unicode_ci default null, `body` text collate utf8_unicode_ci, `created` datetime default null, `modified` datetime default null, `user_id` int(...

Help with Linq to Entities simple subquery -

i learning entity framework , trying following scenario work. i have person class , message class. message class has property , property, both of type person. want retrieve list of messages using linq entities. db tables message , person. message has columns , of type int pointing pk id of person table. below code have far populate queryable essage list. issue here loading person data. how can go doing in efficient way. explanations regarding method appreciated. var messages = m in _entities.message select new bizobjects.message { messageid = m.messageid, = new bizobjects.person { personid = m.from }, = new bizobjects.person { personid = m.to ...

Data appears on the grid in a form but is not saved on the table in Visual FoxPro 9 -

i have simple form grid user enters data save click event. worked after while (and few modifications later), when 1 hits save button, appears saved on grid. after closing screen , re-opening, data doesn't appear more. tried looking @ tables , nothing although recordid (autoincrement integer) has increased, no data saved. form data session proerty set private. help? thanks fred kenya several things can double check. using tableupdate() , verifying returns true (.t.)? common problem. once know failing can use aerror() determine why. if tableupdate(.t., ) * well, nothing else aerror(laerror) * message user , determine content of laerror , how failed. endif another common problem not using alias on tableupdate(), third parameter. because see data in grid assume have bound correctly, potential pitfall. verify recordsource of grid correct , each column controlsource valid. one other thing. if using view , have view table in data environment might ha...

How to send SMS from Mac terminal via GSM modem? -

i have mio a701 communicator use gsm modem sending sms mac. what i've found far 1 can send @ commands directly terminal special ports /dev/ttyusb0 if modem connected via usb port or /dev/rfcomm0 if connection handled via bluetooth. problem when try issue command "permission denied" response: "at+cmgs=test\r" > /dev/ttyusb0 -bash: /dev/ttyusb0: permission denied also "ls /dev" shows neither ttyusb0 nor rfcomm0 files present there can't update permissions on these files. any appreciated, in advance. update: problem solved. first of mio a701 appears wrong choice since not support @ commands sending sms. this php code works fine nokia 3310c connected via bluetooth: $number="<phone number in international format + sign>"; $message="hello world\ntest"; // far i've tested \n turns line break in sms on mio, nokia , alcatel phones $port="/dev/tty.phone"; // path set in "mac preferences...

xaml - WPF: How do I create a button "template" that applies a style & has an image in it? -

there multiple places in wpf application need button looks & feels regular button, but: it shows specific icon on (defined {staticresource editicon} ) it applies style (defined {staticresource grayoutbuttonstyle} ) i prefer define these attributes in single location, rather repeating them each place button used. what appropriate way in xaml? -- if helps, below i'm doing, told wrong: updated: wrong way? there way fix "right way"? i define button template key editbutton : <controltemplate x:key="editbutton" targettype="{x:type button}"> <button style="{staticresource grayoutbuttonstyle}" command="{templatebinding command}"> <image x:name="editimage" source="{staticresource editicon}" /> </button> </controltemplate> then, declare button template editbutton each place want use in application. indicate command invoke here: ...

python - Google app engine, multiple languages -

i'm working on on project django i'm thinking going jython route. doing so...since i'll using java instance instead of cpython wouldn't able use java, scala, ruby , other other languages run on top of jvm if need be? scala works on gae . so ruby . if want know other jvm languages, google search google app engine followed name of language of interest. also see this page .

c# - How can I strip zeros and decimal points off of decimal strings? -

the following code outputs: 12.1 12.100 12.1000 12.00 12 12.0000 how can change outputs: 12.1 12.1 12.1 12 12 12 math.round seems thing, makes me define how many decimal places want, want them variable above. if there no mathematical way it, i'll strip zeros , decimal points off right side of strings, think there math way handle this. using system; using system.collections.generic; namespace test8834234 { public class program { static void main(string[] args) { list<string> decimalsasstrings = new list<string> { "12.1", "12.100", "12.1000", "12.00", "12", "12.0000" }; foreach (var decimalasstring in decimalsasstrings) { decimal dec = decimal.parse(decimalasstring); console.writeline(d...

ruby on rails - Rspec, Spork, & Autotest Error -

i'm trying teach myself rails going through http://railstutorial.org/ . quit working on tutorial app last night , came today. i'm getting error when start spork server. here trace of error. spork using rspec loading spork.prefork block... can't convert nil hash (typeerror) /usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.0/lib/active_model/validations/validates.rb:90:in merge' /usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.0/lib/active_model/validations/validates.rb:90:invalidates' /usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.0/lib/active_model/validations/validates.rb:83:in each' /usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.0/lib/active_model/validations/validates.rb:83:invalidates' /users/chietala/desktop/rails_projects/sample_app/app/models/user.rb:20 /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:454:in load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependen...