Posts

Showing posts from May, 2014

.net - System.Runtime.Caching.MemoryCache strange behavior? -

have question on msdn forums ( http://social.msdn.microsoft.com/forums/en-us/netfxbcl/thread/0a666d5e-9bda-47bd-8dd3-98d32eb5fe60/?prof=required ), thought i'd opinion of folks here : here's output of immediate window : (employeecache memorycache).add("test", new object(),datetimeoffset.now.addminutes(10)); true (employeecache memorycache).getcount() 0 (employeecache memorycache) {<namespace>.customcache} [<namespace>.customcache]: {[<namespace>.customcache} base {system.runtime.caching.objectcache}: {<namespace>.customcache} cachememorylimit: 1887436800 defaultcachecapabilities: inmemoryprovider | cacheentrychangemonitors | absoluteexpirations | slidingexpirations | cacheentryupdatecallback | cacheentryremovedcallback name: "keyname" physicalmemorylimit: 99 pollinginterval: {00:02:00} under conditions adding memorycache return true, object not cached? (the call getcount , 1 following made immediatley after adding cache)

Pass a data structure to a function and access the fields of the data structure like an array in C# -

i have set of fields of different types, must group them data structure. have pass function , modify fields data structure indexes, array. how this? everyone. mytype{ int a; ushort b; string c; } and pass data structure groups these fields, can class or struct. , pass function , modify fields of instance indexes, this: void function(ref mytype g) { g[1] = 1; <= here g.a should set 1 } you use list of objects: var list = new list<object>(); list.add("strings cool!"); list.add(42); // ... var objbyindex = list[1]; // 42 you lose advantages of c#'s strong-typing if this, though. suggest using class well-defined, typed properties instead, unless need generic (where don't know properties' types before-hand).

c# - Linq to sql between List and Comma separated string -

i have 1 list , 1 comma separated column value. lst.add("beauty"); lst.add("services"); lst.add("others"); and column value beauty,services service,others beauty,others other,services other beauty, food food now want rows contains list item. output result is beauty,services service,others beauty,others other,services other beauty, food first edit these comma separated values 1 of table's 1 column value. need check against column. assuming can figure out how rowcollection rowcollection.where(row => row.split(",").tolist().where(x => list.contains(x)).any()).tolist(); will evaluate true if row contains value list.

Python - Printing Hex from a file -

i have following code: code1 = ("\xd9\xf6\xd9\x74\x24\xf4\x5f\x29\xc9\xbd\x69\xd1\xbb\x18\xb1") print code1 code2 = open("code.txt", 'rb').read() print code2 code1 output: �צ�t$פ_)�½i�»± code2 output: "\xd9\xf6\xd9\x74\x24\xf4\x5f\x29\xc9\xbd\x69\xd1\xbb\x18\xb1" i need code2 (which read file) have same output code1. how can solve ? to interpret sequence of characters such as in [125]: list(code2[:8]) out[125]: ['\\', 'x', 'd', '9', '\\', 'x', 'f', '6'] as python string escaped characters, such as in [132]: list('\xd9\xf6') out[132]: ['\xd9', '\xf6'] use .decode('string_escape') : in [122]: code2.decode('string_escape') out[122]: '\xd9\xf6\xd9t$\xf4_)\xc9\xbdi\xd1\xbb\x18\xb1' in python3, string_escape codec has been removed, equivalent becomes import codecs codecs.escape_decode(code2)[0]

jquery - Programmatically change focus in blackberry webworks application -

i working on developing webworks app uses jquery's "show" , "hide" methods dynamically change page contents. the application loads page few text inputs jquery styled hyperlink button. focus on start page defined x-blackberry-initialfocus attribute. when 1 of hyperlink buttons selected jquery hides displayed text inputs , buttons, , shows different set of text inputs , hyperlink buttons. @ point, focus navigation breaks , appears no element has focus. i have tried adding permissions use blackberry.focus config.xml , executing " blackberry.focus.setfocus('my_text_input_id'), " did not have effect. i guaranteed call setfocus executed after desired html element added dom putting call setfocus in jquery show method's callback function. used jquery select desired text input before calling setfocus ensure element existant. additionally, called blackberry.focus.getfocus() before , after calling setfocus() , getfocus() method returned

plsql - Oracle Scalar function in select vs table valued function join -

i have have query performing poorly. 1 aspect of query use of cross join on table-valued function, in mimicking tsql behaviors of using cross apply on function avoid using scalar function call. bad behavior in oracle? the main issue i'm running oracle tuning advisor not parse query i'm unable research index optimizations yet. wouldn't post code suspect query more table optimization may causing issue. the statistics se table table volumn more 4,000,000 records. can recommend removal of blatant bad oracle behaviors? or if looks tool index tuning advisory? oracle enterprise manager won't parse query provide recommendations. additional performance information captured trace , formatted through tkprof parse: count(1) | cpu(0.04) | elapsed(0.04) | disk(0) | query(852) | current(0) | rows(0) execute: count(1) | cpu(0.00) | elapsed(0.00) | disk(0) | query(0) | current(0) | rows(0) fetch: count(1) | cpu(9.64) | elapsed(14.50) | disk(34578) | query(356

wordpress group by post type on search page -

i display search results grouped post type. have regular posts, pages, , custom post type of product. how accomplish editing below code. code below shows posts , pages right now. <?php while (have_posts()) : the_post(); echo "<h1>"; echo $post->post_type; echo $post->post_title; echo "</h1>"; endwhile; ?> this code alters original search query order results post-type in order select. there other solutions, 1 found doesn't break pagination or requires multiple queries. add_filter('posts_orderby', 'my_custom_orderby', 10, 2); function my_custom_orderby($orderby_statement, $object) { global $wpdb; if (!is_search()) return $orderby_statement; // disable filter future queries (only use filter main query in search page) remove_filter(current_filter(), __function__); $orderby_statement = "field(".$wpdb - > prefix. "posts.post_type, 'post-type-c', 'post-ty

ruby on rails - validates_uniqueness_of field scoped to a has_one relationship -

i have following models: class section < activerecord::base belongs_to :course has_one :term, :through => :course end class course < activerecord::base belongs_to :term has_many :sections end class term < activerecord::base has_many :courses has_many :sections, :through => :courses end i able following in section model ( call_number field in section ): validates_uniqueness_of :call_number, :scope => :term_id this doesn't work because section doesn't have term_id , so how can limit scope relationship's model? i tried creating custom validator section no avail (doesn't work when create new section error "undefined method 'sections' nil:nilclass" ): def validate_call_number if self.term.sections.all(:conditions => ["call_number = ? , sections.id <> ?", self.call_number, self.id]).count > 0 self.errors[:base] << &

ruby - can't install gem on managed server 1und1 -

gem install net-http-digest_auth /kunden/homepages/44/d374119480/htdocs/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/syck.rb:82:in <module:syck>': uninitialized constant syck::defaultresolver (nameerror) /kunden/homepages/44/d374119480/htdocs/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/syck.rb:80:in ' :29:in require' <internal:lib/rubygems/custom_require>:29:in require' /usr/lib/ruby/1.8/yaml/syck.rb:5:in <top (required)>' <internal:lib/rubygems/custom_require>:29:in require' :29:in require' /usr/lib/ruby/1.8/yaml.rb:11:in ' :29:in require' <internal:lib/rubygems/custom_require>:29:in require' /kunden/homepages/44/d374119480/htdocs/executable/ruby/lib/rubygems/config_file.rb:7:in <top (required)>' <internal:lib/rubygems/custom_require>:29:in require' :29:in require' /kunden/homepages/44/d374119480/htdocs/execut

javascript - what are advantages of mootools over jquery? -

in short notice can stupid question. still know advantages/disadvantages of using mootools js compared jquery? personally find jquery uses way shorter syntaxes mootools can handle heavy loads. win/loose situation. can 1 provided info 1 of library's better high ajax end web app? here comparison: http://jqueryvsmootools.com/ (found doing simple google search :) )

iphone - removed nib issues and calling init -

i have deleted nib file uiviewcontroller , want make calls init instead of initwithnibname. however, after deleted uiviewcontroller, still calling initwithnibname. need change calls init? i initialized rest of uiviewcontroller via code, in uitabbarcontroller have following: - (void)viewdidload { [self settaburls:[nsarray arraywithobjects:@"tt://mygroup", @"tt://all", @"tt://search", nil]]; } three20 framework calls initwithnib, if ttviewcontroller created without nib file. just move initialization code - (void)loadview function need to.

web services - Spring WS tutorial: no declarationcan be found for element 'context:component-scan' error -

i'm following step-by-step (basically copying , pasting stuff) spring-ws tutorial , hit wall when configuring spring-ws-servlet.xml below: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:sws="http://www.springframework.org/schema/web-services" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd"> <context:component-scan base-package="com.mycompany.hr"/> <sws:annotation-driven/> </beans> adding following line: <context:component-scan base-package="com.myco

datetime - php "countdown til" and "since time" GMT UTC time function -

i'm working function found this, i'm trying make work gmt utc timestamp: edit: maybe issue how i'm "converting" user input time gmt... i doing $the_user_input_date = strtotime('2011-07-20t01:13:00'); $utctime = gmdate('y-m-d h:i:s',$the_user_input_date); does gmdate('y-m-d h:i:s',$the_user_input_date); not "convert" gmt? format it? maybe thats issue. here's times can supply like: //local time in gmt 2011-07-20t01:13:00 //future time in gmt 2011-07-20t19:49:39 i'm trying work like: started 36 mins ago start in 33 mins start in 6 hrs 21 mins start in 4 days 4 hrs 33 mins here's im working far: edit: new php code im working with, seems add 10 hours on date. ideas? updated here: function ago($from) { $to = time(); $to = (($to === null) ? (time()) : ($to)); $to = ((is_int($to)) ? ($to) : (strtotime($to))); $from = ((is_int($from)) ? ($from) : (strtotime($from))); $uni

hadoop - File I/O on NoSQL - especially HBase - is it recommended? or not? -

i'm new @ nosql , i'm trying use hbase file storage. i'll store files in hbase binary. i don't need statistics, file storage. is recommended? worry i/o speed. the reason why use hbase storage have use hdfs , can't build hadoop on client computer. because of it, tring find libraries helps client connect hdfs files. couldn't find it, , choose hbase instead of connection library. in situation, should do? i don't know hadoop, mongodb has gridfs designed distributed file storage enables scale horizontally, replication "free" , on. http://www.mongodb.org/display/docs/gridfs there overhead storing files in chunks in mongodb, if load low medium, , need low response times, better off using file system directly. performance vary between different driver implementations.

Python/Tkinter: Why is my cascade menu not working? -

i'm trying learn tkinter though right i'm stuck @ 1 part. i'd have cascade menu added main menu. problem don't know i'm doing wrong. help. from tkinter import * import tkfiledialog class application(frame): def __init__(self, master=none): frame.__init__(self, master) self.master = master self.create_wgts() def create_wgts(self): self.mainmenu=menu(self.master) self.wgt_confirm = button(text='confirm', command=self.traceback).pack(side=right) self.wgt_entry = entry() self.wgt_entry.pack(side=right, fill=x, expand=1, ipadx=200) self.wgt_entry.bind('<key-return>', self.hit_enter) self.casmenu_file = menu(self.mainmenu) self.casmenu_file.add_command(label="open file", command=self.file_select) self.casmenu_file.add_command(label="write file", command=self.file_write) self.casmenu_file.add_separator() self.c

javascript - ruby gem to support drawing -

is there ruby gem has pens/paint brush , stuff 1 can draw on site? if not, how can start developing that? i want create simple app lets people draw sketches , stuff online. i'm open using other frameworks other rails. no, there not. ruby server side stuff, while drawing client side. you need search javascript libraries.

crystal reports - PrintToPrinter in web based application -

if call printtoprinter method web-based application, printing done on server's printer or client's printer? it print server printer you can't print directly client printer in web application... need call javascript function window.print() in web page browser shows printer dialog user...

mobile - Android development - test for SD card or assume it's there? -

my app require external storage (sd card) in order save user's data. i've searched high , low, can't find best practices this. do i... simply assume external storage present , skip adding checks , alerts? (assumption here external storage goes missing in rare cases, , it's not worth spending ton of time coding solution this. typical users don't ever remove sd cards, etc.) check external storage mounted only when reading or writing it? (users may remove sd card @ time, app still work until comes time access data.) add listener @ application level waits external storage notifications , displays modal alert app-wide? (this sounds ideal, overkill know.) any insight appreciated. you should check before using it. suggest #2; you're right, #3 seem overkill (i don't know if there listener that). google docs has say: before work external storage, should call getexternalstoragestate() check whether media available. media might mount

drupal - Multiple sites in the same directory but separate database -

in linux based shared hosting account hostgator, going dozen of sites. there files count limitation cpanel backups in account. to reduce total number of files need suggestion continue add new bunch of sites using drupal-6. i don't want share same database keep maintenance simple. know drupal allows multiple sites in same db. want avoid it. can reuse same drupal files in old site , use them create symbolic link new site? except root/sites directory because may contain temporary files or files used/uploaded specific each site. so if drupal 6 site site1.com there can reuse files new site site2.com creating symbolic links in site2.com pointing sit1.com except sites directory: site2.com/includes->site1.com/includes site2.com/modules-> site1.com/modules site2.com/sites ( not shared) site2.com/misc -> site1.com/misc .... i've gone through related thread: combining databases in drupal don't want go per suggestions in it. any suggestions id

c# - define database schema name universally in entity framework 4.1 -

i know can define entity's schema name per class using totable("tablename", "schemaname") there way set can set schema name tables in configuration getting weird results when using types of relationship mapping , split entity mapping reverting default dbo.tablename in internal sql queries see this earlier post sql output example since final efv4.1 version doesn't have public api custom conventions cannot change schema globally api.

c# - Why Visual Studio Controls Event functions written, but it still gives error? -

i working in asp.net, found that, buttons , controls lost code behind, if place button , click on it, , automatically writes functions still gives error 'asp.meeting_schedular_aspx' not contain definition 'button1_click1' , no extension method 'button1_click1' accepting first argument of type 'asp.meeting_schedular_aspx' found (are missing using directive or assembly reference?) even there definition of function available in csharp file. this error occurs when hide contents of master pages manual css code, styling display:none default master pages content.

when I run query on view I get 2 record for unique id in sql server -

i have 2 table in sqlserver member , memberadress , generating view vw_member executing following query select m.memberid, m.membername, m.endcustomer, m.expirationdate, ma.dea, ma.hin, ma.address1, ma.address2, ma.city, ma.state, ma.officecontact, ma.officecontacttitle, ma.officecontactemail dbo.member m inner join dbo.memberaddress ma on (m.memberid = ma.memberid) but problem generating 2 record unique memberid can tell me doing wrong ? wild guess - there 2 rows in memberaddress same memberid . maybe there's concept modelled in there of address type? if so, need decide of address types should including in view, or if need an address, decision on how prioritise address types. for second, clause might like: from dbo.member m inner join dbo.memberaddress ma on m.memberid = ma.memberid left join dbo.memberaddress ma_anti on

php - View rendering as blank in Zend Framework action -

<?php class signupcontroller extends zend_controller_action { function indexaction() { if ($this->_request->ispost()) { echo "your email address is: " . $this->_request->getpost('email'); } $this->render("signup"); } } this controller this view <html> <body> <form action="/signup" method="post"> email: <input name="email" type="text" /> <input name="btnsubmit" value="click me" type="submit" /> </form> </body> </html> when tried run view getting result blank/signup why happens please rectify error, , tell me reason error if using signup view replace render code :- $this->_helper->viewrenderer('signup');

asp.net - Application developed in vs 2008 and Hosting is godaddy .net 4.0 creating problem -

i have developed application in vs 2008 , trying host on godaddy server having .net 4.0 framework , iis7. i getting internal server error 500. i hosting files under sub directory.i have set subdirectory application folder.tried upload files , have error.when delete web.config , upload test aspx file runs proper.but again put web.config test files stops running , showing same error. please kindly me resolve issue. regards, sunny make sure that: .net 3.5 deployed on hosting machine (should be) applicationpool application using configured .net 2.0 (not 4.0) 3.5 application still using 2.0 runtime, apppool have configured 2.0.

Regex: match, but not if in a comment -

i have file of data fields, may contain comments, below: id, data, data, data 101 a, b, c 102 d, e, f 103 g, h, // has 101 a, b, c 104 j, k, l //105 m, n, o // 106 p, q, r as can see in first comment above, there direct references matching pattern. now, want capture 103 , it's 3 data fields, don't want capture what's in comments. i've tried negative lookbehind exclude 105 , 106, can't come regex capture both. (?<!//)(\b\d+\b),\s(data),\s(data),\s(data) this capture exclude capture of 105, specify (?<!//\s*) or (?<!//.*) as attempt exclude comment whitespace or characters invalidates entire regex. i have feeling need crafty use of anchor, or need wrap want in capture group , make reference (like $1 ) in lookbehind. if case of "regular expressions don't support recursion" because it's regular language (a la automata theory), please point out. is possible exclude comments in 103, , lines 105 , 106, using regular ex

c# - Accessing derived class properties when implementing an interface method with abstract base class as parameter -

i tried hard find answer question, if has been asked already, perhaps i'm wording wrong. have abstract base class , derived class. abstract class foo { protected int property1 protected int property2 // etc.. } my dervied class contains properties not found in base class: class fum : foo { public int uniqueproperty { get; set; } } now have interface method takes abstract base class: interface idosomethingwithfoos { void dosomethingwithfoo(foo fooey); } a class implements interface class fumlover : idosomethingwithfoos { void dosomethingwithfoo(foo fooey) { // in here know going passed objects of fum // , want access unique properties fooey.uniqueproperty = 1; // doesn't work ((fum)fooey).uniqueproperty = 1; // seems work // does.. fum reftofum = fooey fum; reftofum.uniqueproperty = 1; } } so question is: going in right way? although compiles, don't have enough code in place make sure

c# - i have problem in uploading files to specific folder it is permession not enough -

i'm having aproblem uploading files specific folder on web server. how can give permession folder , vital user in case ? please me, in advance. it depends on identity application pool running as. seeing haven't mentioned version of iis using, i'll assume iis7 :-) right click on application pool , select "advanced settings..." , take @ identity of pool. make sure identity has correct file system permissions.

php - News content blocks and custom Regular Expression -

i need create little facility create news article editors php software. have created way use custom block , module editors include static or dynamic blocks , modules including in text: example: lorem ipsum dolor sit amet, consectetur adipiscing elit. etiam in mollis libero. phasellus sollicitudin ligula pharetra magna egestas mattis. {block name="ads1"} aenean lacinia lacinia sapien nec fermentum. {module name="thename" class="thelist" method="show" parameter1="first parameter" parameter2="second parameter" parameter3="third parameter"} donec ligula lectus, egestas et molestie ac, tristique id mi. donec sed scelerisque leo. i using 2 regex: $ex = preg_match_all("/{((?:module|block).*?)}/sm", $text, $matches); preg_match_all ( '/^{module\s+|\g(name|class|method)=("[^"]+"|\'[^\']+\'|\s+)(?:\s+|(?=}$))/i', $module, $matches ); the first 1 items in news arti

c++ - When should I use inline functions? -

possible duplicate: when should write keyword 'inline' function/method? i have question inline functions in c++. know inline functions used replace each apperance inline function body. not know when use it. said inline functions can improve performance, when should consider using inline function? inline functions best small stubs of code performance-critical , reused everywhere, mundane write. however, use them split code, rather having 1000-line long function, may end splitting couple of 100-line long methods. inline these have same effect 1000-line long method. modern compilers automatically inline of smaller methods, can manually inline ones bigger. there many resources this, example: http://msdn.microsoft.com/en-us/library/1w2887zk(v=vs.80).aspx http://www.cplusplus.com/forum/articles/20600/ http://www.glenmccl.com/bett_007.htm http://www.exforsys.com/tutorials/c-plus-plus/inline-functions.html

php - remove autocomplete from cache results -

i've following problem. used have input auto-completion, removed field (as no longer necassery). the field now: <input type="text" class="required text motivationname valid" maxlength="30" onblur="isdoublemotivation(this.value);" value="" id="title" name="title"> nothing special right? i've auto-completion field gets filled information cities. var elements = $('input.auto_plaatsnaam'); elements.each(function() { $(this).autocomplete( { datatype: "json", source: "/common/ajax/citysearch.php", minlength: 1, cache: false, delay: 100 }); }); the problem follows: users auto-complete on first (title) input field. i'm thinking it's cache problem removing cache solves problem. can force php or js flush cache before field loaded? removing caches not beneficial site i'm hoping r

google app engine - Why error "Joins are only supported when all filters are 'equals' filters." -

i not sure doning wrong here? complains "joins supported when filters 'equals' filters." when query executed. how can around that? query query = pm.newquery(iteminfo.class); if (lastsyncdate != null) { query.declarevariables("deviceinfo deviceinfo"); query.setfilter("this.todevices.contains(deviceinfo) && " + "deviceinfo.phonenumber == numberparam && createddate > lastsyncdateparam"); query.declareparameters("string numberparam, java.util.date lastsyncdateparam"); map.put("lastsyncdateparam", lastsyncdate); } else { query.declarevariables("deviceinfo deviceinfo"); query.setfilter("this.todevices.contains(deviceinfo) && deviceinfo.phonenumber == numberparam"); query.declareparameters("string numberparam"); } map.put("numberparam", "123456"); query.setordering("createddate desc"); @persistenc

javascript - When to close custom build jQuery dropdown -

i made simple dropdown using <div> (parent), <span> (current selection) , <ul> (options). works fine. want if user clicks anywhere on page, have close, "real" <select> element. what this: $(document).delegate('body','click',function(){ if(isexpanded){close();} }); and works. worried performance. wise listen click events on document node? there better way? thank you. you make use of blur event. while elements don't support default, adding tabindex=... makes them fire blur event: http://jsfiddle.net/ugsta/ . html: <div tabindex="1"> <ul> <li>1</li> <li>2</li> <li><span>3</span></li> </ul> </div> javascript: $('div').blur(function(){alert(1)})

iphone - Is there an SDK to draw lines on iOS with touch? -

is there framework can use draw lines touch. want add ability customer sign on ipad/iphone , capture image. any appreciated. thanks. you can meet requirement using core graphics available in uikit framework. i had similar requirement in application different use ,if needed can provide code. tnq .h file #import <uikit/uikit.h> typedef enum _drawingmode{ drawingmodepen =0, drawingmodeeraser=1, } drawingmode; @interface drawingview : uiview { cgpoint lastpoint; uiimageview *drawimage; bool mouseswiped; int mousemoved; drawingmode mode; uicolor *_drawingpencolor; } @property (nonatomic, retain) uicolor *drawingpencolor; @property (nonatomic) drawingmode mode; @property (nonatomic, retain) uiimageview *imageview; @property (nonatomic,retain)uiimageview *drawimage; @end .m #import "drawingview.h" @implementation drawingview @synthesize mode, drawingpencolor=_drawingpencolor, imageview=drawimage; -(void)initialize{ drawimage = [[uiimag

.net - Exception that gets caught for some reason bubbles up to another catch block -

we have unusual case, try-catch block inside try-catch block. both catch clauses catch exception type of exceptions. error occurs in inner try-catch block, gets caught byt first catch empty , instead of moving next line, gets caught time other catch. have never seen before. 1 of our colleagues claims setting not remember kind of setting. know why happening , how "turn off"? please find code below: try { //some code try { //code throws exception } catch (exception) { } //some other code, never reached } catch (exception ex) { logger.write(ex.tostring()); return null; } one thing causing first catch block throwing exception. cause second 1 triggered. your colleague may referring exception catching functionality of visual studio allows break on exceptions including ones have

Menu wrapping - Chrome CSS Issue -

have @ following page: http://berrisford.gumpshen.com/ the last item in top nav menu wraps in chrome can't pin down can please? change width of last li 255px , you'll see mean. the last item large :)

html5 - I am looking to save a canvas as a blob in mySql blob field -

the toblob method of canvas doesn't seem work me, have used todataurl , sent data produces controller ajax, i've put data in2 byte [] convert 2 blob data changes data:image/png;base64,ivborw0kggoaaaansuheu.... array of numbers [100, 97, 116, 97, 58, 105, 109, 97, 103, 101, 47, 112, 110... so, when calling blob change byte [] of numbers original data. possible , if please give me advise on how it, thanks please see wrote here on matter. i'll paste below convenience. short answer toblob new use, , because in spec doesn't mean ready. toblob() really new , not recommend using in consumer app unless can explicitly ask them use particular browser (or else control environment). toblob() added on may 12th , of limited functionality as-defined. not exist in chrome nightly, firefox nightly, nor ie9. it worth noting firefox have functional mozgetasfile there yet discussion adding chrome . the discussion firefox. have decided wait until spec more clear

sql - MS Access query -

i using ms access. have table named changes having columns ( cno (int) , tno (int), date_c). i want write sql query displays recent date , group cno. want display tno. select tno, cno, max(date_c) changes [date_c] in (select [date_c] changes [date_c]<=[enter date]) group cno; there 7 ways in sql (because there :) , oft asked question on stackoverflow. here's one: (i've omitted date_c <= [enter date] parameter clarity , because can't test -- i'm not using access interface!): select distinct c1.tno, c1.cno, dt1.c_most_recent_date changes c1 inner join ( select c2.cno, max(c2.c_date) c_most_recent_date changes c2 group c2.cno ) dt1 on c1.cno = dt1.cno; , c1.c_date = dt1.c_most_recent_date; and here's another: select distinct c1.tno, c1.cno, c1.c_date c_most_recent_da

HTML textfield whose values cannot be 0 using Javascript -

i trying make javascript function check if user entered value inside text field cannot less 9 digits & cannot 0s. this made function checkfield(field) { if (field.value.length <9 || field.value=="000000000") { alert("fail"); field.focus(); return false; } else { return true; } } <input type ="text" id="number1" onblur='return checkfield(this)'> but doesnt check condition user enters more 9 values , 0's. checks 1 condition exact 9 zeros 000000000 so, if understand right want user able enter number more 9 digits, cannot zeros, right? this can done regexp: var value; // obtain somehow if (/^\d{9,}$/.test(value) && !/^0+$/.test(value)) { // ok } what checks whether value @ lest 9 digits (it not allow digits) , not 0s.

iphone - How to hold for a moment in program? -

i fetching data facebook , during time of fetching data, taking few milliseconds or second. want on hold untill fetched data perfectly. how write code this? - (void)viewdidload { [self performselectorinbackground:@selector(startfatching) withobject:nil]; [super viewdidload]; } - (void) startfatching { [self performselectoronmainthread:@selector(startindicator) withobject:nil waituntildone:no]; nsautoreleasepool *pool = [[nsautoreleasepool alloc] init]; // code [self performselectoronmainthread:@selector(stopindicator) withobject:nil waituntildone:no]; [pool release]; } - (void) startindicator { av.hideswhenstopped = yes; [av startanimating]; } - (void) stoprindicator { [av stopanimating]; } hope give idea

Converting Java program to Spring Framework -

i have short program takes string console prompt, in format: 1=harry_2=male_3=54_4=blonde_5=french_6=teacher and prints so: 1 name harry 2 gender male 3 age 54 4 hair blonde 5 nationality french 6 occupation teacher however, next aim take , recreate program operates web browser. i've read documentation spring framework , got demo program running, i'm @ loss how begin taking script , fitting framework. ideally, i'd have single page input box prints results underneath. any advice on how begin process great. oh, code: import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.util.hashmap; import java.util.map; public class maptest { public static void main(string args[]) throws ioexception { map<string, string> tagmap = new hashmap<string, string>(); tagmap.put("1","name"); tagmap.put("2","gende

How to use Classes As List Collection in Azure AppFabric Caching -

h, using windows azure appfabri caching. have 2 project in asp.ne t . 1 put data in cache , 2nd read cache. these 2 project running on 2 different systems. have 4 dll included in these projects. microsoft.windowsfabric.common.dll microsoft.windowsfabric.data.common.dll microsoft.applicationserver.caching.client.dll microsoft.applicationserver.caching.core.dll poject 1: insert data in cache using following code:data saving cache successfully default.aspx.cs: using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using microsoft.applicationserver.caching; public partial class default2 : system.web.ui.page { public class employee { public string name { get; set; } public decimal salary { get; set; } } protected static datacachefactory _factory = null; protected static datacache _cache = null; protected void page_load(object sender, eventargs e) {

c# - ajax with datalist giving error -

i have data list control placed inside content place holder. <asp:content id="content3" contentplaceholderid="maincontent" runat="server"> <asp:scriptmanager id="mainscriptmanager" runat="server" /> <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <asp:datalist id="dlprodocut" runat="server" repeatcolumns="3" edititemindex="-1" repeatdirection="horizontal" onitemdatabound="dlprodocut_itemdatabound"> <itemtemplate> <asp:table id="table1" runat="server" border="0" cellspacing="0" cellpadding="0"> <asp:tablerow> <asp:tablecell height="10" horizontalalign="center" verticalalign="top&

c# - Searchstrings with Linq? -

hi, i need let enduser type search strings : volvo s70 or s60 > posts contins volvo or s70 or s60 volvo s70 not s60 > posts contains volvo , s70 not s60 "volvo s70" > posts includes "volvo s70" 1 string volvo s* > posts contains volvo , word starting s "volvo s70" "volvo s60" v* > posts contains "volvo s70" or "volvo s60" or word starting on v vo*l* s* > * treated wildcards in case posts contains vo*l* or s* this small part off possible combinations. how handle linq object? i know can use startswith, endswith, contains mean have split incoming search string, way? , how handle strings vo*l*? bestregards edit1: data have been fetched database entityframework, means data in application (list) if want unleash full power of text search can use lucene.net . it's not easy set gives lot of power full text searches , indexing. can set work linqtoentities. http://linqt

objective c - UITextView's background like that of the Notes app in ipad/iphone -

i uitextview background repeat vertically (except top-margin), notes app in iphone/ipad, using repeat-y option in css.... possible? how? thank you! you can find technique can use implement notes-like ui described in blog post .

jquery - Trigger function on Enter keypress -

i've simple search function want trigger on enter key press, though function executes form posted. <script> function search() { ... } $(document).ready(function() { $("#text").keypress(function (e) { if (e.which==13) search(); }); }); <body> <form id="searchform" name="searchform"> <input size="40" id="text" type="text" name="text" class="input" /> </form> </body> bind function submit event , prevent default: $('form').submit(function(ev){ ev.preventdefault(); /* code here */ });

how to save activity's state in android? -

i want know how can save state of page(activity) when come page should in state in left it. eg if checked checkbox in page after leaving page when come checkbox should checked left. in advance http://mobile.tutsplus.com/tutorials/android/android-application-preferences/ take @ tutorial sharedpreferences or http://developer.android.com/reference/android/content/sharedpreferences.html

Dynamically creating a columns in asp.net gridview -

Image
i doing project on hotels. in booking page room types , availability, , rates have populate on gridview given dates. below roomtypes in hotel admin page. image below binding room rates given date. currently binding data using sql query each cell.so taking time load page. i need find faster method bind data. code have using given below. dim dtx new datatable /// sql command load roomtypes. while dr.read dtr = dtx.newrow() dim datearray() string = lbl_checkindate.text.split("/") dim xdt1 new date(cint(datearray(2)), cint(datearray(0)), cint(datearray(1))) dtr("room type") = dr("r_type").tostring dtr("book") = dr("r_id").tostring x = 1 15 tmpdt = left(weekdayname(weekday(xdt1)), 3) & vbnewline & day(xdt1) & " " & left(monthname(month(xdt1)), 3) price = cls_function.gettabledata("select isnull(rent_a,0) rent_a tbl_hotelroom h_id = " & val(request.querystring(&qu

url - How can a GET form be submitted with variables in a specific order? -

i building form submitted different website (which have no control on or ability change). oddly enough, other site seems require queries in specific order work correctly. there way specify how submitted query ordered? i've tried ordering fields in form, doesn't seem work consistently. as example, 1. works fine, while .2 throws error. http://minerva.maine.edu/search/?searchtype=t&searcharg=caterpillar http://minerva.maine.edu/search/?searcharg=caterpillar&searchtype=t not aware of, however, ugly solution build url in javascript , use window.location send get?

android - Changing a textview text dynamically when it is displayed in a tabhost -

firstly, im new android have years of various other programming experience on unix, windows,but not java or android. im wanting display tab 3 tabs, each having different layout file (which works). im working on displaying "blank" template , data retrieved xml file once user points setting 1 (i.e. via shared preferences). my problem function populatexmlcharacter never called (using breakpoints). tab activity displays "", strig string.xml. putting breakpoint in oncreate function never gets called either. ive tried using call populatexmlcharacter in onresume, never gets called. im thinking because of call tab: resources res = getresources(); // resource object drawables tabhost tabhost = gettabhost(); // activity tabhost tabhost.tabspec spec; // resusable tabspec each tab // , same tabs spec = tabhost.newtabspec("description").setindicator("description", res.getdrawable(r.drawable.android)).setcontent(r.layout.t

Paypal Sandbox payment problem -

i have following post button use paypal transactions: <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="my@email.com"> <input type="hidden" name="item_name" value="item description"> <input type="hidden" name="item_number" value="1"> <input type="hidden" name="amount" value="00.30"> <input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="usd"> <input type="hidden" name="lc&

.net - Selecting a specific part of a string C# -

i trying create new string, removes characters existing string e.g. string path = "c:\test.txt" so string "pathminus" take out "c:\" e.g. string pathminus = "test.txt" the string class offers sorts of ways this. if want change "c:\test.txt" "test.txt" removing first 3 characters: path.substring(3); if want remove "c:\" anywhere in string: path.replace("c:\", ""); or if want filename, regardless of how long path is: path.getfilename(path); depending on intentions, there many ways it. prefer using static class path .

asp.net mvc - What's the best practice .net Architecture for a single simple json web service? -

so know of 3 .net architecture's can provide json data in form of web service: 1) classic asmx web service 2) asp.net mvc action returns json result. 3) wcf (also there way use asp.net web forms ajax, i'm not going there) i've worked 3 before, , seems classic asmx web service right pick job. i'm not sure if web services preferred way of providing json data in .net environment anymore. the project have 1 web service , nothing else, @ point. what's microsoft (tm) preferred architecture of creating simple json web service these days? if application asp.net mvc application, don't need else. create controller returns jsonresult class also, give wcf web api try : http://wcf.codeplex.com/releases/view/64449 watch of videos of glenn block here; http://channel9.msdn.com/events/mix/mix11/frm14 http://channel9.msdn.com/events/devdays/devdays-2011-netherlands/devdays103

cookies - Share authentication between two websites -

what best/proper technique share login between 2 sites. i have website a, , websites b. both types belong same company, b running on customer premises. like, users login in b, , when redirected reason, don't need login again, , can work account in a. of course, company make logins each 'b' user. problem user initiate login in or b. would oauth do? or openid more suitable? another option pass guid token in string, sort time live , valid ip address of requester, not sure user access web sites through same gateway. thanks oauth need. openid offers discovery useful when user gets choose authenticate (not use case). also, openid more complicated , dying protocol. in scenario, server oauth server (or authorization server in oauth 2.0) , server b client. there many ways implement this, suggest start looking (and trying) how facebook oauth 2.0 implementation works. give idea of involved , of extension (e.g. display) make more user-friendly.

passing subreport value to mainreport crystal -

i have report contains subreport. trying value subreport field on main report. issue is not displaying on correct report, report after , subsequent reports. maybe not reset var correctly. subreport header whileprintingrecords; shared numbervar amount := 0; subreport footer whileprintingrecords; shared numbervar amount := {ap1.amount}; mainreport formula field shared numbervar amount; amount; i have subreport in details section ( tried put in report header - suppressing report anyway ). in details section have formula field displaying 0.00 on main report, if cycle through report pages desired value shows on report right after. linking subreport , main report contract no. any appreciated. not declaring right or need set shared amount 0 somewhere? thanks on main report formula: shared numbervar amount; amount := amount;

javascript - Click handler fired only once -

i have set of links iterate on , add click handlers. each link when clicked, fires ajax request upon success creates div containing response data, , appends dom. newly appended div (a floating div similar small lightbox) however, removed when user clicks close(on div) or clicks anywhere else on screen. have simple script below monitor change, click handler fires once , not work until after page refresh. doing incorrectly? var monitorchange = function () { //check if div has been appended dom , if continue monitor if ( $('div.justappended').length > 0 ) { settimeout(monitorchange,100); } else { //div has been removed dom alert('div removed'); //...do additional stuff here } }; $( 'span.someelements' ).each( function () { var = $(this); $(that).click( monitorchange ); }); from understand, looking have on click event still work ajax generated code. need use live command i

reporting services - SSRS 2008 - Line Chart - How to shade an area of the chart? -

i have line chart. line represents average thickness of material apply glass. y axis represents thickness , x axis represents time. range of values on y axis between 1 , 10. average thickness typically between 3 , 5, must fall within range, on low side of 2 , on high side of 7. shade area of graph between 2 , 7, indicate acceptable range of values. can done? add second value series, , change "range" chart type. allow set high / low y values discretely. rather choosing field these values, edit expression , set static values (in case, 2 , 7). from there, edit series "fill" properties - select pattern, , find 1 works ya. there set of % fills (5 percent, 10 percent, etc.) midway down list. hope helps.

java - Image storage and retrieval using sqlite db -

i have few questions database storage , retrieval of images. have activity prompts user either take picture using camera or selecting existing gallery. when picture has been taken/selected, shown in activity , should saved in sqlite database (i use own content provider). should store images blob or store them seperately , store uri pointing requested image? how show image , save it? it depends on size of images. saving images disk , databasing uri's is sensible suggestion photographs, if storing small thumbnails (like avatars), these safely stored blobs without great performance hit. as application description suggests taking photographs, should use uri's.