Posts

Showing posts from April, 2014

Scheme problem (using a function as a parameter) -

i'm scheme newbie , trying make sense of homework. i've function made earlier called duplicate , , looks this: ( define ( duplicate lis ) (if (null? lis) '()) ((cons (car lis) (cons (car lis) (duplicate (cdr lis)))) )) a typical i/o i: (duplicate '(1 2 3 4)) o: (1 1 2 2 3 3 4 4), basicly duplicates in list. moving on: i'm supposed make function that's called comp . it's supposed built this: (define (comp f g) (lambda (x) (f (g (x)))) where input '(1 2 3 4) , return (1 1 4 4 9 9 16 16) so f = duplicate , g = lambda . know lambda should this: (lambda (x) (* x x)) but here's problem starts, i've spent several hours on this, , can see not made progress. any appreciated. best regards. use map : > (map (lambda (x) (* x x)) (duplicate '(1 2 3 4))) => (1 1 4 4 9 9 16 16) or, modify duplicate take procedure second argument , apply each element of list: (define (duplicate lst p)

javascript - new Function() with variable parameters -

i need create function variable number of parameters using new function() constructor. this: args = ['a', 'b']; body = 'return(a + b);'; myfunc = new function(args, body); is possible without eval() ? thank much, guys! actually, a+b not primary concern. i'm working on code process , expand templates , needed pass unknown (and variable) number of arguments function introduced local variables. for example, if template contains: <span> =a </span> i need output value of parameter a . is, if user declared expanding function var expand = tplcompile('template', a, b, c) and calls expand(4, 2, 1) i need substitute =a 4 . , yes, i'm aware function similar eval() , runs slow don't have other choice. you can using apply() : args = ['a', 'b', 'return(a + b);']; myfunc = function.apply(null, args); without new operator, function gives same result. can use array functions

java - Sorting JTable Rows manually and with TableRowSorter simultaneously -

i have create table can sorted clicking on table header , reordering single , multiple rows hand. i made buttons move selected rows in table model up, down, top or bottom. buttons alter table model , afterwards update jtable. alone works fine. but when start sorting rows clicking on columns in table header goes wrong. manual sorting works collection in table model, sorting clicking header works kind of table view. is there way move rows manually in table view , not in table models collection? or there other better solution? the jtable api addresses relationship between model , view co-ordinates respect sorting. in particular, says, "in examples area, there demonstration of sorting algorithm making use of technique interpose yet coordinate system order of rows changed, rather order of columns." might compare you're doing relevant example in sorting , filtering .

Packet Sniffing from a BlackBerry app -

i want develop app basic packet sniffing. so, know if packet sniffing feasible blackberry. i don't think possible. can keep track of number of packets sent , received on radio, not see actual contents. see radioinfo.getnumberofpacketsreceived() , radioinfo.getnumberofpacketssent() .

ipad - Multitasking in iphone -

how implement multitasking open other application application (for example: opening pdf document in ibooks app)? see documentation uidocumentinteractioncontroller . offers functionality give user preview of document , present list of apps in can open document. afaik not possible send pdf ibooks programmatically without user interaction.

actionscript 2 - send a tweet from flash using as2? -

i need send tweet flash, i've been looking solution on net, found using as3. since don't know of as3, becomes difficult edit everything. i wonder if it's possible. does know solution? posting tweet requires user being authenicated via oauth. assuming have user authenicated, can post data url: http://twitter.com/statuses/update.xml w/ post vars: status , in_reply_to_status_id (optional) something this: var lv:loadvars = new loadvars() lv.status = 'mystatus' lv.in_reply_to_status_id = 'xxxxxx' lv.ondata = mydatahandlerfunction lv.sendandload( 'http://twitter.com/statuses/update.xml', lv, 'post'); the authentication process oauth complex. there few oauth libs out there flash, as3. if set on as2, can use serverside oauth library can interface as2 app with. twitteroauth all signs point learning as3 if plan on doing real flash/twitter work, can , running as2 little more work.

jquery - The problem about usage the of animate -

i have list example copy code 1. <ul id="applications"> 2. <li id="id-1" class="util"></li> 3. <li id="id-1" class="app"></li> 4. <li id="id-1" class="util"></li> 5. <li id="id-1" class="app"></li> 6. </ul> then want select of list animate effect, first of elements disappear, elements wanted display 1 one code: copy code 1. $('#applications li').each(function (index) { 2. settimeout(function (e) { 3. e.hide("slow"); 4. }, index * 100, $(this)); 5. }); 6. $('#applications li[class="app"]').each(function (index) { 7. settimeout(function (e) { 8. e.fadein("fast"); 9. }, index * 100, $(this)); 10.

linux - Maximum number of Bash arguments != max num cp arguments? -

i have been copying , moving large number of files (~400,000). know there limitations on number of arguments can expanded on bash command line, have been using xargs limit numbers produced. out of curiosity, wondered maximum number of arguments use was, , found this post saying system-dependant, , run command find out: $ getconf arg_max to surprise, anwser got was: 2621440 just on 2.6 million . said, number of files manipulating less -- around 400k. need use xargs method of moving , copying these files, because tried using normal mv * ... or cp * ... , got 'argument list long' error. so, mv , cp commands have own fixed limit on number of arguments can use (i couldn't find in man pages), or missing something? as ignacio said, arg_max maximum length of buffer of arguments passed exec() , not maximum number of files ( this page has in-depth explanation). specifically, lists fs/exec.c checking following condition: page_size*max_arg_pages-siz

c# - execute custom sql with entity framework4 -

i have receive workorders database, specific user. the filter users different, 1 must order shipped uk, ont 5 other countries, 1 high value things, 1 al order containt > 10 items etc. so, came idea (shoot @ if have better one!) i create view each user, , views return same data, filter different. in ado.net this: string sql = "select * vwworkorders" + username; [rest of ado.net here] but i'm using ef4, , wondering equivalent of kind of code. you can use executestorequery method in following example: context.executestorequery<vwworkorder>(sql); this method allows execute storage sql , obtain strongly-typed results. in case need pass parameters, pass necessary objectparameter instances in call of executestorequery.

GWT 2.1 in UiBinder put Cell Widgets -

how work? i see no tags defined example add celltable in uibinder.ui.xml file, the documentation sparse on this. so if doesnt work, should put cell widgets, in uibinder class or presenter? look in expenses sample provided gwt 2.1.0. basically need add <ui:binder tag: xmlns:c='urn:import:com.google.gwt.user.cellview.client' and use example as: <c:celltable addstylenames='{desktop.table}' width='100%' ui:field='table' /> this expensereportlist class. ui widgets should not go in presenter. celltabel has interfaces communicate data between presenter , view.

.net - How to format excel file cells when data exported from SQL Server database -

i'm exporting data have in database excel. although below code works fine, know how manipulate headers, colours, , way cells look? page.aspx <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:connectionstring %>" selectcommand="select id, number, title, name requests"> <selectparameters> <asp:querystringparameter defaultvalue="" name="id" querystringfield="id" type="int32" /> </selectparameters> </asp:sqldatasource> <asp:detailsview id="detailsview1" runat="server" height="50px" width="125px" autogeneraterows="false" datakeynames="requestid" datasourceid="sqldatasource1"> <fields> <asp:boundfield datafield="id" headertext="id" sortexpression=&qu

android - How to highlight ImageView when focused or clicked? -

a example of either on twitter launch screen (the screen large icons seen when application first launch) or @ application tray when focus application icon. basically need highlight imageview highlight contours image within imageview , looks it's border image. customize highlight have color , fade out. thanks, groomsy you need assign src attribute of imageview state list drawable. in other words, state list have different image selected, pressed, not selected, etc. - that's how twitter app it. so if had imageview: <imageview style="@style/titlebarlogo" android:contentdescription="@string/description_logo" android:src="@drawable/title_logo" /> the src drawable (title_logo.xml) this: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/ti

android - Export blender design to OpenGL ES 1.1 -

i'm developing , android application. i have model on blender , want export use opengl es 1.1. on android. how can export model set of points , vertex? is there other suitable format use opengl es 1.1? i'm not using rendering engine. thanks. you can use wavefront (.obj) export, , put assets directory of project. there few different .obj importers sample code available on web. 1 of them earth live wallpaper here . from studying code, looks me index buffer unnecessary, , earth wallpaper using draw arrays instead of draw buffers, because none of vertices reused. i suppose expand on code identify identical vertices , merge them, might slow down load time lot.

matrix sort of graphics in C -

Image
i making program graphics.h in c.i trying implement matrix screen saver stuck here in code.the alphabets fall once.i want them keep on falling (removing text before).please guide me how clear old contents void main_page(void) { int i,j,k,l,m,n,size; setcolor(blue); for(i=0;i<500;i+=50) { settextstyle(gothic_font,1,1); outtextxy(50,50+i,"a b c"); outtextxy(100,150+i,"h j"); outtextxy(150,250+i,"x y z"); outtextxy(300,50+i,"d e f"); outtextxy(350,350+i,"d e f"); outtextxy(400,350+i,"d e f"); outtextxy(450,350+i,"d e f"); outtextxy(500,50+i,"d e f"); outtextxy(550,350+i,"d e f"); outtextxy(600,350+i,"d e f"); delay(100); } don't have erase or over-write characters in old locations? might bottom-up rather

c++ - How to handle missing 'emplace_range' in C++0x STL? -

i have 2 containers, let's they're defined this: std::vector<std::unique_ptr<int>> a; std::vector<std::unique_ptr<int>> b; assume both a , b populated. want insert entire container a particular location in b , using move-semantics unique_ptr s move b . let's assume i valid iterator somewhere in b . following doesn't work: b.insert(i, a.begin(), a.end()); // error: tries copy, not move, unique_ptrs is there stl algorithm can achieve 'insert-range-by-moving'? guess need sort of emplace_range , there isn't 1 in vs2010's stl. don't want write loop inserts 1 one, since end nasty o(n^2) due shifting entire contents of vector every time inserts. other options? auto a_begin = std::make_move_iterator(a.begin()); auto a_end = std::make_move_iterator(a.end()); b.insert(i, a_begin, a_end);

cookies - How can I prove IP rotation is being used to cheat in public voting? -

i running anonymous voting contest. using cookies sole deterrant of multiple voting, tracking ip addresses , looking suspiciously high numbers of votes same ip. is there way prove cheating ip rotation? only statistically, not 100% proof can put statistical terms in contest terms - example (just example, don't know traffic exactly) - no more 1 vote per hour same class b network same candidate a way filter out based on cookies require cookie before contest starts. i.e. allow previous visitors of site vote. place cookie on computers before know contest. well, , of course require registration votes, that's little more involved.

<input type="search"> not working on iPhone Mobile Safari -

supposedly in html5 in safari, can define input type "search" , when user starts typing, x button show allow them clear, google search bar in safari. on website, works on desktop safari doesn't work in mobile safari. <input id="termsfield" type="search" autocorrect="off" placeholder="type here"> //this code x button have use since html5 doesn't work <input type="image" name="clear" alt="clear" src="clearx.png" height="22" width="22" onclick="cleartext(this)"> at first thought it's because have jquery autocomplete function on #termsfield again if works in desktop safari wouldn't case. have idea why might happening? also, doesn't work either on iphone or in iphone simulator in xcode it's not issue iphone. that works in (desktop) safari, not on iphone (mobile safari). can mimic functionality via cleve

Is there any reason to keep the WCF interface in a separate file? -

just personal style, guess, hate having 2 files wcf services. tend copy/paste interface .cs file have deal single file. any dangers in doing this? not dangers per se - there times when useful have separate assembly service, operation , data contracts (just contracts, interfaces, basically) - when need share between server , client side. there's no point in sharing whole service implementation code (the actual service class, implements service interface), client. plus: if have interfaces in separate file (and possibly assembly), makes easier write unit tests, if want mock service. gets bit messy if mix interface , class single file. so consider useful , helpful best practice have separate files interfaces , implementations (actually: 1 class per file only), , put service- , data contracts (and fault contracts) separate assembly.

io - Prioritizing I/O for a specific query request in SQL server -

sorry long introduction before can ask question, think giving background understanding our problem better. we using sql server 2008 our web services backend , time time takes time responding requests supposed run fast, taking more 20 seconds select request queries table has 22 rows. went through many potential areas cause issue indexes stored procedures, triggers etc, , tried optimize whatever can removing indexes not read write or adding nolock our select queries reduce locking of tables (we ok dirty reads). we had our dba's reviewed server , benchmarked components see bottlenecks in cpu, memory or disk subsystem, , found out hardware-wise ok well. , since pikes occurring occasionally, hard reproduce error on production or development because of time when rerun same query yields response times expecting, short, not 1 has been experienced earlier. having said that, have been suspicious i/o although not seem bottleneck. think able reproduce error after running index fragme

java - File Uploading with Servlets? -

note: before reading question , answer, please check input element has name attribute. i trying upload file using servlet. eclipse console shows no errors. file not getting uploaded. me, seems fine. making mistake somewhere. in console inside servlet //printed code items: [] // printed cdoe html code: <form action="imageuploadservlet" method="post" enctype="multipart/form-data"> <table> <tr> <td><label>select image: </label></td> <td><input type="file" id="sourceimage" /></td> <tr> <td colspan="3"> <input type="submit" value="upload"/><span id="result"></span> </td> </tr> </table> </form> servlet code: protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { b

SQL Server 2008: How to use SQL to output XML from Query? -

i declare variable 'xmloutput' , have produce contents of table in xml format. if provide simple example work off of appreciate it. tried using xmlelement() not work. sql server provides ability generate xml based on table structure via for xml clause . it's options are: raw auto path explicit there examples each in link.

java - How to setup administrators in Couchdb via Apache's HttpClient (given a curl example) -

so working on couchdb gui toolbox easier maintaining setting couchdb on android, futon quite uncomfortable on small mobile device. i wanted stick "org.apache.http.client.*" packages working out quite until wanted setup administrators.. with commandline tool "curl" works charm: curl -x put http://127.0.0.1:5984/_config/admins/username -d '"password"' but keep on having big problems translating "org.apache.http.client.methods.httpput()" method. any appreciated. defaulthttpclient client = new defaulthttpclient(); httpput put = new httpput("http://127.0.0.1:5984/_config/admins/username"); put.setentity(new stringentity("\"password\"")); client.execute(put);

c - Help deciphering simple Assembly Code -

i learning assembly using gdb & eclipse here simple c code. int absdiff(int x, int y) { if(x < y) return y-x; else return x-y; } int main(void) { int x = 10; int y = 15; absdiff(x,y); return exit_success; } here corresponding assembly instructions main() main: 080483bb: push %ebp #push old frame pointer onto stack 080483bc: mov %esp,%ebp #move frame pointer down, position of stack pointer 080483be: sub $0x18,%esp # ??? 25 int x = 10; 080483c1: movl $0xa,-0x4(%ebp) #move "x(10)" 4 address below frame pointer (why not push?) 26 int y = 15; 080483c8: movl $0xf,-0x8(%ebp) #move "y(15)" 8 address below frame pointer (why not push?) 28 absdiff(x,y); 080483cf: mov -0x8(%ebp),%eax # -0x8(%ebp) == 15 = y, , move %eax 080483d2: mov %eax,0x4(%esp) # point on, confused 080483d6: mov -0x4(%ebp),%eax 080483d9: mov %eax,(%esp) 080483dc: call 0x8048394 <absdiff> 31 return

sql - MYSQL/PHP: How do you Order By Starting point in a string? -

select sql_calc_found_rows posts.*, case when postmeta.meta_value regexp '$regex' 1 else 0 end keyword_in_title, match ( posts.post_content ) against ( '".addslashes( $s )."' ) mysql_score $wpdb->posts posts, $wpdb->postmeta postmeta posts.post_date_gmt <= now() , postmeta.post_id = posts.id , postmeta.meta_key='_headspace_page_title' , posts.post_password = '' , posts.post_status = 'publish' , posts.post_type != 'attachment' , ( postmeta.meta_value regexp '$regex' or posts.post_content regexp '$regex') group posts.id order charindex($s, 'keyword_in_title') desc limit $offset, $limit as order issue (apart escaping issue @gumbo pointed out in comment), charindex not valid mysql string function . locate function l

ruby on rails - Devise's validateable module doesn't respect custom defined email_required? method -

so far can tell, in order use validateable module, selectively disable email field's validations, must define protected method email_required? on model , have return false. i've done this, appears email validation still triggered. bug in devise, or missing crucial step? below relevant parts of user model: class user < activerecord::base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable protected def email_required? false end end in case still running this, has been added--but believe in 1.2 branch. download , install 1.2rc , can skip email validation done in question. https://github.com/plataformatec/devise

annotations - Need an automatic image tagging API, any suggestions? -

i'm building application needs take image , infer tags related it. tags can things, adjectives or emotions related picture. i've found alipr . tested it, some other people tested it , doesn't perform well. alipr makes many mistakes in set of 15 predicted tags. @ least application, better have few correct tags. preferably, api should web-based , free. suggestions? thanks in advance! i think if images labeled automatically, google have abandoned image labeler long time ago. unfortunately, computers have lot of trouble understanding images. edit: if interested in computer vision research have @ cvpapers , open source computer vision implementations . automatic image labeling far being solved (unless have specific/restricted set of topics). quote the google guide tuesday march 13, 2007 : the words “larry page” , “sergey brin” appear near images of eric schmidt, or in image captions, or in links images. google makes guess words related image. goo

php - why does apache/server die when i make a typo and cause a never ending loop? -

this more of fundamental question @ how apache/threading works. in hypothetical (read: suck , write terrible code), write code enters infinite-recursion phases of it's life. then, what's expected, happens. serve stalls. even if close tab, open new one, , hit site again (locally, of course), nothing. if hit different domain i'm hosting through vhost declaration, nothing. have wait number of seconds before apache can begin handling traffic again. of time tired , restart server manually. can explain process me? have php runtime setting 'ignore_user_abort' set true allow ajax calls initiated keep running if close browser, being set false affect it? any appreciated. didn't know search for. thanks. ignore_user_abort() allows script (and apache) ignore user disconnecting (closing browser/tab, moving away page, hitting esc, esc..) , continue processing. useful in cases - instance in shopping cart once user hits "yes, place order". don't

scripting - having a script autorun on a web server -

sorry if question bit ambiguous, i'll explain want do. i want run game on webserver. turn based game, of people might have come across it. game called mafia: http://mafiascum.net/wiki/index.php?title=newbie_guide . i know how needs work in terms of mysql database server side scripting language etc etc. what not sure whats best way script activate when game starts, , able run script every 3 minutes update game status: once 10 people join game starts people vote during 3 minute period. (votes stored in database) after 3 minutes script needs run calculate votes , remove player then 1 , half minutes later script needs run again. this cycle of 3 minutes, 1 , half minutes need repeat until condition met, i.e players 2 dead or something. when players refresh page need updated on games status. ive read sockets, , wonder if might path take. sockets able send json clients? jquery can update client game results. ideally the front end done in jquery , backend script

utf 8 - How to handle unicode issues in PHP? -

how handle unicode issues in php. set utf-8 parameter function needs or set locale somewhere in bootstrap file once? how affect mysql etc there's no way set global encoding in php. best can is, use mb_ family of functions, , try explicit encoding want use. as mysql, in particular, can make sure connects using utf-8, calling set encoding method/function right after connecting or in constructor if you're using pdo (see http://ar.php.net/manual/en/pdo.construct.php .) using utf-8 php requires discipline, but, it's definitly worth it. hope of helps.

scripting - Bourne Shell compare two strings -

i need compare 2 string in bourne shell of same fixed length. need compare each character against place holder in opposite string , find out how many differences there are. have suggestions on how go this? i after way of number of differences i.e. if compared aab & aac differences 1. this has 100% bourne. if don't mind creating temporary files, can use cmp method. bourne shell pretty limited can do. either use zsh/bash or if sh essential, write c program did want. if creating files every time out of question, create fifos, hackish , ugly, don't it! mkfifo cmp1 mkfifo cmp2 echo "abcd" > cmp1 & echo "abce" > cmp2 & diff_chars=`cmp -l cmp1 cmp2 | wc -l` process substitution in bash or modern shell makes trivial , try use that.

php - MySQL - count number of rows AFTER query -

i have query running on site looks rows don't have particular attribute. although have sequential numbers row numbers, actual result have gaps in primary keys. turns out difficult explain, i'll try , add code! here's part of statement, rest unimportant: ...where thought_deleted = 0 , thought_id <= (select max(thought_id) rmt_thoughts order thought_id) - $start order thought_date_created desc limit $number $number , $start values passed query using php. part want change , part. instead of looking thought_id values less particular id, want select if each thought_deleted = 0 row has sequential id. hope makes sense! i'm assuming need either a) make kind of alias counts number of rows, , sort or b) sort of limit thingy looks @ values want. either way, i've been googling while pretty exhausted , stuck. has seen before? thanks guys :) sparkles* apparently want kind of pagination. specify offset using limit <

sql server - How to loop through multiple login entries and calculate the Login Count and time in SQL 2005? -

i beginner in sql , hope people can me through ordeal. the below data should grouped client, date , user id (which have achieved). client user id date action module moha mother 01/10/2010 12:35:36 pm login pp moha voodoo 02/10/2010 05:15:28 pm login pp moha panther 04/10/2010 04:36:42 pm login pp moha mother 01/10/2010 12:42:35 pm action pp moha mother 01/10/2010 12:55:14 pm action pp moha voodoo 02/10/2010 06:35:46 pm login pp moha panther 04/10/2010 04:53:24 pm action pp moha deuce 05/10/2010 09:13:42 pm login pp moha deuce 05/10/2010 09:19:42 pm action pp moha panther 06/10/2010 08:11:22 pm login pp moha deuce 05/10/2010 09:27:49 pm action pp moha panther 06/10/2010 08:15:18 pm action pp moha panther 06/10/2010 08:44:53 pm action pp moha deuce 05/10/2010 09:27:49 pm login pp moha rabbit 05/20/2010 09:27:49 pm login pp moha voodoo 02/10/2010 06:57:35 pm action pp moha deuce 06/10/2010 08:30:59 login pp moha rabbit 05/21/2010 09:27:49 pm login pp moha mother 03/10/2010 01:04:5

iphone - How to get a UITableView's visible sections? -

uitableview provides methods indexpathsforvisiblerows , visiblecells , how can visible sections? or easy way take advantage of valueforkeypath , nsset class: nsset *visiblesections = [nsset setwitharray:[[self.tableview indexpathsforvisiblerows] valueforkey:@"section"]]; basically array of section values in visible rows , populate set remove duplicates.

objective c - MFMessageComposer iPhone,Auto Message Send -

any 1 know how implement auto send message using mfmessagecomposer....i mean no need of displaying message composer..we have sent pre-defined message given number..or other way without using mfmessagecomposer..??? you can't auto-send messages mfmessagecomposer. displays message user before sending (and rightly so). an alternative call webservice dispatches email you. or put enough smtp code in app emails sending. you'll need own email system though you'll not able users email settings.

How did C++ change with the different editions of TC++PL? -

(in case not know, "tc++pl" stands "the c++ programming language", book written inventor of c++, bjarne stroustrup.) i have third edition , wondering how c++ looked in first , second editions. third edition 1 cover iso standard c++, major features added c++ after first edition published , after second edition published? let bjarne stroustrup explain in own words: a history of c++: 1979−1991

android - How to use security permissions in combination with a shared user id? -

i got known security exception: java.lang.securityexception: sending sms message: user 1001 not have android.permission.send_sms i added following line android manifest file: <uses-permission android:name="android.permission.send_sms" /> but when got same exception. this has possibly shared user id use: android:shareduserid="android.uid.phone" , here question: when use shared user id (from system application), can add own permissions manifest file. additional information: used same certificate system, else couldn't use same user id system application. thanks in advance answers , remarks!

asp.net - How do I get the IP address of the current website in global.asax? -

i'd in application_start method, can write 'robots.txt' file if site running on test server. thanks i thought old school, using servervariables collection , following worked nicely in test app, running under built in vs web server: void application_start(object sender, eventargs e) { // code runs on application startup string localaddress = context.request.servervariables["local_addr"]; // returns "::1" when running under vs server, throws // exception under iis express, assume under iis. } the next best option can come like: void application_start(object sender, eventargs e) { // code runs on application startup string servername = server.machinename; } which works on both vs , iis express, if know name of test or live servers, check against instead?

Excel - Reading Merged Cells (rows) in .NET using C# -

greetings stackoverflow'lings, let me explain predicament: lets have 3 columns (9 in total merged in numbers of 3) in 1 row each of 3 columns has data in in row directly beneath have 9 columns each cell having data in it. the idea read first row 3 columns, , find out how long columns span can assign correct values when creating resulting xml. heres rough sketch of trying achieve: row 1 column 1 (range merged on 3 columns) = football teams row 2 columns 1, 2, 3 each hold different data football teams row 1 column 2 (range merged on 3 columns) = football players row 2 columns 4, 5, 6 each hold different data football players row 1 column 3 (range merged on 3 columns) = football finances row 2 columns 7, 8, 9 each hold different data football finances for reason when read first row getting values: [0] = "football teams" [1] = null [2] = null [4] = "football players" but when read row 2 full array (9) of columns! code using can seen below: range

jqGrid tree grid with pager -

how make tree grid pager using jqgrid? i have checked , try demos, didn't show pager, though there pager div in code how create pager ? tree grid has limitations documented : pager functionality disabled treegrid in other place of documentation can read same: since jqgrid not support paging, when have treegrid pager elements disabled automatically.

.net - How do I control MembershipProvider instance creation/lifetime? -

i have registered custom membershipprovider class in web.config file. i'm using inversion of control using castle windsor , have registered custom membershipprovider class transient (because it's using service that's transient well). this means want membership provider instance recreated on every web request. currently, created once per application domain when tries access service depends on, service instance reused while not supposed to. now need find way of having windsor control lifetime of custom membershipprovider don't know how. expected factory sitting around somewhere in .net framework, allowing me override instance creation , rerouting windsor can't find alike. by way, i'm using .net 4.0. update: here's of code can see i'm doing exactly: web.config: <membership defaultprovider="mymembershipprovider" > <providers> <clear/> <add name="applicationmembershipprovider" type=&

c++ - performance counter -

here code, bandwidth of system system, using counter . i'm getting "pdhcollectquerydata failed" ie.error code = "pdh_no_data" plz tell me i'm going wrong.????? #include <windows.h> #include <conio.h> #include <stdio.h> #include <pdh.h> #pragma comment(lib,"pdh.lib") why didn't include output enum calls, presumably worked since not commented out? i'd surprised if there space in counter_path after second opening parenthesis, have here. i'd expect name not have leading space. const lpcstr counter_path = text("\\network interface( nvidia nforce networking controller - packetscheduler miniport)\\current bandwidth");

c# - Enforce transactions for write operations in SQL Server -

how ensure , enforce write operations ms sql server db transactions-based? the reason want db contains financial account data , operations fail halfway through set of changes should not able mess database mistake or crashing. the application written in asp.net c#. thanks. edit: there dal not (yet) require transactions changes. wrote dal ourselves. did not use orm. i know how perform 1 transaction asp.net. i want ensure all changes made in transaction form if application throws exception in middle, there no change database. you might want @ setting sql server use implicit transactions: http://msdn.microsoft.com/en-us/library/ms188317.aspx

iphone - How to format double to money format? Eg: 3.234,12 -

i have string input user, string treated have numbers, such as: "3472042" . i convert string double value, want formatted money value, like: 3.472,042 just decimalformat in java if helps. i tried things nsnumberformatter no luck. can give me hand that? used @ first: nsstring *string = txtotherpower.text; nscharacterset *removecharset = [nscharacterset charactersetwithcharactersinstring:@"•€£¥./:;@#$%&*(){}[]!?\\-|_=+\"`'~^abcdefghijklmnopqrstvwxyz' '"]; string = [[string componentsseparatedbycharactersinset:removecharset] componentsjoinedbystring:@""]; so acceptable characters comma "," , numbers. problem if type "2,2,2,2,,,,,1,,2" won't anything. , messes string/number. i need formatted money values... ideas? create nsnumberformatter , set style nsnumberformattercurrencystyle or nsnumberformatterdecimalstyle (or, if styles don't work you, configure se

java - Suppressionfilter doesn't work in checkstyle config file -

can why suppression filter doesn't work? still generates javadoc errors candidate_ file. checkstyle.xml `... <module name="suppressionfilter"> <property name="file" value="c:/sts-projects/staffing4/trunk/config/suppressions.xml" /> </module> <!-- checks package-info.java file exists each package. --> <module name="javadocpackage" /> ...` suppressions.xml <suppressions> <suppress checks="javadocmethod" files="candidate_.java" /> </suppressions> could because checkstyle.xml above references suppressions.xml while file mentioned below suppression.xml ?

Creating and using a new Brush or color using sliders and dependency properties in C# -

i'm working on project basic wpf "paint" app. have 3 options, draw ellipse, draw line, or draw 'shape' (a line closed sections filled in). these 3 options represented radio buttons. have part working. here's example screenshot: http://i.stack.imgur.com/napyi.jpg basically need is, when user changes sliders r, g, b, , (opacity / alpha), small preview area showing new color should updated, , color should set line or fill color, depending on group of sliders changed. all of needs done data binding. i'm not sure to best approach problem. should have individual values each slider (rgba) , pass values color.fromargb(r,g,b,a)?? edit: here code using system; using system.collections.generic; using system.linq; using system.text; using system.windows; using system.windows.controls; using system.windows.data; using system.windows.documents; using system.windows.input; using system.windows.media; using system.windows.media.imaging; using system.windows.

animation - changing rgba alpha transparency with jquery -

possible duplicate: jquery + rgba color animations hey, i want change opacity of rgba value on hover, opacity stays @ .07.. maybe ou can me find mistake. css (ie hacks in seperate file - no need mention them here) .boxcaption{ float: left; position: absolute; height: 100px; width: 100%; background: rgb(255, 144, 11); background: rgba(255, 144, 11, 0.7); } js var thumbslide = $('.boxgrid.captionfull').click(function() { $('.boxgrid.captionfull.clicked').removeclass('clicked').children('.cover').stop().animate({top: 230, background: 'rgba(255, 144, 11, 0.7)'}, 350); $(this).toggleclass('clicked').children('.cover').stop().animate({top: 0, height:"230px", background: 'rgba(255, 144, 11, 1)'}, 350); }); the jquery color plugin doesn't support rgba. use instead: link text

scripting - Are there limitations to JSR223 implementation on Java 1.5 -

the java api scripting languages (jsr223) comes standard in java 1.6 , can downloaded separately java 1.5 here . my question is: there limitations or differences should aware of if using separate download 1.5 versus native support in 1.6? i had been facing same question earlier. one difference might quality of script engines. here's response got on jruby-user list: i guess 1 of reasons current jruby engine works on java5 not official release. put archive users' convenience. http://old.nabble.com/call-for-discussion-about-embed-api-tp24528478p24981076.html : also: i know class version problems reported java5+jsr223+jruby, works fine me. http://old.nabble.com/call-for-discussion-about-embed-api-tp24528478p25181920.html i think these relate scriptengines compiled under jdk5, see http://kenai.com/projects/jruby/pages/javaintegration#java_6_(using_jsr_223:_scripting ) that said, haven't run these or other real problems on java5 , jru

android adwhirl integration problem -

i have implemented adwhirl show adds in app. , working fine in portait mode. when change oreintation landscape mode add displaying width not fill parent(not showing on whole screen). showing in middle. i didn't found solution same..pls me in case.. some ad networks (admob example) serve fixed-size ads. can not stretched in order fill parent.

silverlight - How to set wrapping for HyperlinkButton with databound Content/Text? -

i binding collection (rss feed) list box such this: <listbox margin="0,0,-12,0" itemssource="{binding items}"> <listbox.itemtemplate> <datatemplate> <stackpanel margin="0,0,0,17" width="432"> <hyperlinkbutton content={binding title} navigateuri="{binding link}" /> <textblock text="{binding description}" /> </stackpanel> </datatemplate> </listbox.itemtemplate> </listbox> this works great - data displays correctly etc. when changed use text wrapping, title not displaying anymore. here problematic code. <listbox margin="0,0,-12,0" itemssource="{binding items}"> <listbox.itemtemplate> <datatemplate> <stackpanel margin="0,0,0,17" width="432"> <hyperlinkbutton navigateuri="

wpf - Dynamic complex Tooltip -

i want generate tool tip dynamically since tooltip has contain grid dynamic number of columns. how do ? you can create new popup , simulate tooltip popup. you have handle 2 events: mouseenter, mouseleave. on mouse enter can have timer open popup after x seconds: private void canvas_mouseenter(object sender, system.windows.input.mouseeventargs e) { timer = new timer(500); timer.elapsed += timer_elapsed; timer.enabled = true; } and on mouse leave cancel timer: private void canvas_mouseleave(object sender, system.windows.input.mouseeventargs e) { timer.elapsed -= timer_elapsed; timer = null; } when timer elapses, you'll use dispatcher open popup: void timer_elapsed(object sender, elapsedeventargs e) { dispatcher.begininvoke(dispatcherpriority.normal, new ooldelegate(opentooltip), true); } the open tooltip method open popup: public void opentooltip(bool isopen) { popup.isopen = isopen; popup.lostfocus += popup_lostfocus; }

iphone - UIWebView with server trust authentication challenge -

i'm working on web view needs work servers trust (based on ssl handshake), , not of apple approve. is there way intercept uiwebview connection control on request authentication? when use uiwebview method loadrequest: there's no way of getting ssl challenge (since it's not part of uiwebviewdelegate protocol). an alternative request uiwebview send (using delegate callback webview:shouldstartloadwithrequest:navigationtype:), telling uiwebview not load it, , sending request using nsurlconnection (using delegation methods ssl handshake logic). , when connection finishes, loading data receives uiwebview (using loading method loaddata:mimetype:textencodingname:baseurl:). workaround working simple sites, complicated sites (js, css...) might not work. thanks! i had similar problem of trying display web page certificate has expired. found this post , showed me how use protocol on nsurlrequest , override method allowsanyhttpscertificateforhost . he stresses mig

c# - remove items from cache which do not have a priority of NotRemovable -

i want remove items cache except set priority of cacheitempriority.notremovable when added. how can this? working asp.net , c#. why don't store date don't want removed httpapplication ? if need find place store few data need around application in different user session think httpapplicationstate best place that. bear in mind httpapplication use cache behind scene :-) you have problems if need deploy web application server farm httpapplicationstate not shared between servers: http://msdn.microsoft.com/en-us/library/system.web.httpapplicationstate.aspx but have same problem using cache :-)

How much is too much asp.net session size? -

i have application on corporate intranet makes use of session state store values between wizard (string of pages/ user controls). i'm measuring size of session , navigating around make sure things dotn out of hand. at worst, can size 900 bytes. is much? i know depends on other factors such number of users , amount of memory in server. lets set parameters around these... server allocated 1 gig of ram asp.net (the rest allocated os , other items). have @ 10 users on system concurrently. thanks help personally i'd 900 bytes nothing. lets it's 1kb -> means 1gig of ram should able store 1000k of sessions (not including else). personally think shouldn't @ raw numbers. what's important is: stuff in session meant in session. should put information in session that's useful when user browsing website , can discarded if user leaves website. as long don't store big data objects in session, should fine.

c - Allocating and free object of structures -

gcc 4.4.4 c89 i have following code in channel.h file typedef struct channel_tag channel_t; channel_t* open_channel(size_t channel_id); void close_channel(channel_t *channel); and in channel.c file #include "channel.h" struct channel_tag { size_t channel_id; }; channel_t* open_channel(size_t channel_id) { channel_t *channel = malloc(sizeof *channel); if(channel == null) { fprintf(stderr, "cannot allocate memory\n"); return null; } channel->channel_id = channel_id; printf("channel [ %zu ] has been created\n", channel->channel_id); return channel; } void close_channel(channel_t *channel) { printf("channel [ %zu ] resources has been released\n", channel->channel_id); free(channel); } the problem main.c file. here have loop create 5 channel objects , allocates memory them. however, if wanted free them later in program, not sure how can reference them. 5 testing with. la