Posts

Showing posts from January, 2013

webforms - asp.net listview with two rows in grouptemplate -

first question on s.o. i have search result page in asp.net , have problems - have (for each "box") image of book cover , title of book knowing images aren't same height, want able vertically align them bottom. searched hard on web , found solution using display table/table-row/table-cell. everything works fine, using listview 's grouptemplate (as row) , itemtemplate (as cell) if want display images - - want images vertically aligned bottom , book's title below (with link "learn more" below title). knowing couldn't put book title in same cell image (because sometime title take 2 lines, break design again...), think need row (like in code below). tought putting 2 rows in grouptemplate work listview doesn't seem give me hability call 2 different itemtemplates (one image , 1 text placed in row, below image). any appreciated , if have other alternatives, i'm opened suggestions. bear in mind need datapager listview - think - way go. h...

ruby on rails 3 - ActiveRecord where method -

i have model sample attribute car car csv different car names x.car = "bmw,ferrari,audi" sample.where(:car => "bmw") returns []. how can use operator in sql returns x use condition in method (works prepared queries). sample.where("car ?", "bmw%") more examples can found in rails guide .

Google AdWords and google_conversion_value -

i have online shop application, , integrated google adwords, adding proper script web application. problem have, value on google's analysis control panel page 0, despite thing have conversions (many-per-click) value of 12. code integrated looks this: var google_conversion_id = <number here>; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "<label here>"; var google_conversion_value = <?php echo $charge; ?>; i added lines (with several more js lines required google adwords) last page, when payment has been made on webshop. php variable $charge have value of sold order. despite of those, value still 0. can me waht i'm doing wrong, , how can proper value it? try wrapping php output double quotes so: var google_conversion_value = "<?php echo $charge; ?>"; so rendered output looks like: var google_con...

c# - How can I reduce the garbage generation in this situation -

my game has gotten point generating garbage , resulting in long gc times. i've been going around , reducing lot of garbage generated there's 1 spot that's allocating large amount of memory , i'm stuck on how can resolve this. my game minecraft-type world generates new regions walk. have large, variable size array allocated on creation of new region used store vertex data terrain. after array filled data, it's passed slimdx datastream can used rendering. the problem fact variable-size array , needs passed slimdx, calls gchandle.alloc on it. since variable size, may have resized in order reuse it. can't allocate max sized array each region because require impossibly large amounts of memory. can't use list because of gchandle business slimdx. so far, resizing array when needs made bigger seems plausible option me, may not work out , pain implement. i'd need keep track of actual size of array separately , use unsafe code pointer array , pass slimdx. may ...

Ant: How to use apply task with identical source and target file -

i trying run apply task following command: jpegtran.exe -copy none -optimize -perfect ./images/file.jpg ./images/file.jpg i apply recursively images. have tried following ant code jpegtran says invalid arguments. <target name="optimize.images.jpg"> <apply executable="jpegtran.exe" dir="${src_dir}/public/assets/" parallel="false" verbose="true" resolveexecutable="true" force="true" vmlauncher="true"> <arg value="-copy none"/> <arg value="-optimize"/> <arg value="-perfect"/> <srcfile/> <targetfile/> <fileset dir="${src_dir}/public/assets/images" casesensitive="yes"> <include name="**/*.jpg"/> </fileset> <mapper type="identity"/> </apply> </target> what wrong ant code? one item needs changed nested <arg> element -copy none . since there space in ar...

synchronization - Multi-user Dropbox sync via API in Web app -

i have web app want provide users ability authorize dropbox accounts file sharing & sync. basically, if there 3 users: user a, user b , user c, should able hookup dropbox accounts (simple enough using oauth) app, after there new shared folder (say myapp) created under dropbox folder. web app should able list files (under shared myapp folder) shared between 3 users. if of 3 users adds, edits or deletes file in shared myapp folder, change should reflect in web app 3 users. just trying figure out best possible , simple way in app. the dropbox api isn't built automatically enable cross-account syncing this, rather enable users access own accounts/files. however, there useful call "/copy_ref" can use copy files between accounts easily: /copy_ref documentation beyond that, you'll need handle rest of logic yourself.

parallel processing - Does Clojure (or JCE, or JVM, or...?) introduce parallelism automatically? -

i running cpu-intensive clojure code within intellij idea (i don't think that's important - seems spawn process). according both htop , top, using 4 cores (well, 2 + hyperthreading) on laptop. despite me not having explicit parallelism in code. a little more detail: top shows single process ~380% cpu use, while htop shows "parent" process , 4 "children", each 1/4 time , ~100% cpu. is normal? or mean have got wrong somewhere? code involves many lazy sequences, @ core modifies mutable data structure (a mutable - not clojure data structure - hash accumulates results). i not using explicit parallelism. a significant amount of time (i haven't profiled) spent in jca/jce (crypto lib) - using multiple aes ciphers in ctr mode, each stream of secure random bytes ( code here ), implemented lazy seqs. perhaps parallelized? more random ideas: related io? i'm running on encrypted ssd , program processing data disk, lot of reading. htop shows system time red, ...

iphone - Error when passing data between views -

possible duplicate: how pass data detail view after being selected in table view? i'm using plist (array of dictionaries) populate tableview. now, when cell pressed, want pass reprecented dictionary detail view segue. it's working fill tableview, how send same value detail view? try: #import "winesviewcontroller.h" #import "wineobject.h" #import "winecell.h" #import "winesdetailviewcontroller.h" @interface winesviewcontroller () @end @implementation winesviewcontroller - (id)initwithstyle:(uitableviewstyle)style { self = [super initwithstyle:style]; if (self) { // custom initialization } return self; } - (void)viewdidload { [super viewdidload]; } - (void)viewdidunload { [super viewdidunload]; } - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { return (interfaceorientation == uiinterfaceorientationportrait); } #pragma mark - table view data source - (void)viewwillappear:(bool)animated { win...

ios - why is memory usage changing when no code is being executed? (as3) -

Image
hi there, can see graph profiler on space of 1 minute memory rises 2mb , drops down rise again same spot. on blank screen , no code running. no new objects being created. i've noticed on ios cpu usage rising , falling in similar pattern-from 20% 70%. reading. there many reasons. had similar situation cpu strangely high. my debugging methodology comment out code other boiler plate document class constructor , introduce variables, classes , methods (in blocks rather 1 @ time!) until issue reappeared. in particular case network monitor class had incorrectly set up.

NSLog shows the error "expression result unused" and not working. iphone? -

i trying nslog on xcode , gives error "expression result unused" , cant print using nslog. changed build configuration in edit scheme debug. dont know error? need help i had similar status. reason next code. #define nslog please check there redefinition of nslog.

ruby - Rails put validation in a module mixin? -

some validations repetitive in models: validates :name, :length => { :minimum => 2 }, :presence => true, :uniqueness => true validates :name_seo, :length => { :minimum => 2 }, :presence => true, :uniqueness => true how put in mixin? error if put 'em in mixin app/models/validations.rb:5: undefined method `validates' validations:module (nomethoderror) module validations extend activesupport::concern included validates :name, :length => { :minimum => 2 }, :presence => true, :uniqueness => true validates :name_seo, :length => { :minimum => 2 }, :presence => true, :uniqueness => true end end the validates macro must evaluated in context of includer, not of module (like doing).

Jasper report exported to excel format is not displaying the background colour -

i using jasper reports-4.5.0 . using generating reports , exporting different formats pdf,csv,xls,html. working fine except .xls format. when export report .xls not displaying background colour pageheader band. code using below. inside page header band <image> <reportelement mode="opaque" x="0" y="0" width="236" height="57" backcolor="#e6e6e6"/> <imageexpression><![cdata[new file($p{image}, "images/flower-logo.png")]]></imageexpression> </image> to flower image applying background colour. coming in other formats except .xls format. problem excel format. jasperreports xls exporters support standard excel color palette. think can see color list here. http://dmcritchie.mvps.org/excel/colors.htm

I need help escaping string parameters for a javascript function using PHP -

i dynamically creating anchor calls javascript function. works 1 string parameter not two. believe not escaping quotes around parameters correctly. in search answer came across following onclick="alert('<?echo $row['username']?>')" and next 1 found left me baffled echo('<button type="button" id="button'.$ctr.'"onclick="showmapsinfo(\''.str_replace("'", "\\'", $maps_name).'\', \''.str_replace("'", "\\'", $ctr).'\');"><img src="img/maps_logo.gif"></button><br/>'); if please explain why single quotes around username not have escaped? where there "dummies" write on escaping characters try decipher second example. let's examine first example onclick="alert('<?echo $row['username']?>')" the important part here is, outside of <? … ...

creating custom UITableView in iPhone -

Image
can create uitableview uitableview cell in horizontal vertically aligned please advise. well, possible modify uitableview , add cell rows contain multiple views set in horizontal order, require lot of custom work, in opinion, lose benefit of using uitableview, what suggest here create custom view, has custom datasource , delegate, , create own view drawing logic, since complex view, require more work customize table view, creating ne uiview subclass

Offline Google Maps in an Android app -

recently google released new version of google maps lets save offline version of particular chunk of map. @ same time i've been playing around making android app uses google maps api, , wondering... possible in way offline map , application use it? application doesn't need internet connection either? i'm aware openstreetmap alternative don't think it'll work project have in mind. cheers that may violation of google's terms of service. have @ this: how cache google map tiles offline usage?

openid - Is it possible to change partitionkey on azure table entities? -

on website user log in using open id , i'll store claimed identifier entity in azure tables using hash of claimed identifier partition key. the work items user creates on site stored in azure tables using same hash partition key. seemed useful performance point since 1 user query own partition key. but before paint myself corner, how can make possible user change open id provider , claimed identifier? because if claimed id changes, hash partition key has change. , can't change can i? no, not possible change partition key table, how entities identified. you need add new entity , delete old one. you try using partition key.

How to refer to Cocoa controls located in in the same NSWindow? -

i have nswindow nsview , nstextfield inside. i'm using interface builder right now. have dropped 2 controls on default nswindow , subclassed nsview. i'm implementing -drawrect method nsview , need access content of nstextfield. how refer instance of nstextfield method inside nsview ? your nswindow (or should be) controlled window controller. in ib create outlet nstextfield in window controller. using outlet, can refer nstextfield: in window controller .h file: @property (strong) iboutlet nstextfield *mytextfield; in window controller .m file: @synthesize mytextfield; from there can in controller: [[self mytextfield] seteditable: no]; a point note not access controls in window directly window windows (and cocoa controls matter) statically stored in xib/nib file. access controls (ui elements) channelled through controllers ( nswindowcontroller , nsviewcontroller ) in turn capable of loading xib/nib files. apple provides various samples in docs on how this.

regex - Java Regexp capturing group includes space, why? -

i trying parse string, "斬釘æˆÂªÃ©Âµ 斩钉æˆÂªÃ©“ [zhan3 ding1 jie2 tie3] /to chop nail , slice iron (idiom)/resolute , decisive/unhesitating/definitely/without doubt/"; with code private static final pattern traditional = pattern.compile("(.*?) "); private string extractsinglepattern(string row, pattern pattern) { matcher matcher = pattern.matcher(row); if (matcher.find()) { return matcher.group(); } return null; } however, reason string returned contains space @ end org.junit.comparisonfailure: expected:<斬釘æˆÂªÃ©Âµ[]> was:<斬釘æˆÂªÃ©Âµ[ ]> is there wrong pattern? have tried private static final pattern traditional = pattern.compile("(.*?)\\s"); but no avail i have tried matching 2 spaces @ end of pattern, doesn't match (there 1 space). you're using matcher.group() documented as: returns input subsequence matched previous match. the match includes space. capturing group within match doesn't, haven't asked...

AutoCompleteTextView for RTL in Android -

i have autocomplete textview working perfect english want to use farsi/persian language. does android support it?. data in autocomplete got db. can please me make work? please help cheers zolf see post , this , how support persi / arabic , other language in different versions in android ,

objective c - how to solve run time error of [__NSCFString _isResizable]: unrecognized selector sent to instance? -

i beginner of iphone, in code getting run time error of terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfstring _isresizable]: unrecognized selector sent instance 0x6e6e300' my code is - (void)viewdidload { [super viewdidload]; nsstring *path=[[nsbundle mainbundle] pathforresource:@"animalfile" oftype:@"plist"]; nsdictionary *dict=[nsdictionary dictionarywithcontentsoffile:path]; nsarray *animal=[dict valueforkey:@"image"]; nslog(@"print:%@",dict); nslog(@"hello:%@",animal); uiimage *img=[animal objectatindex:currentimage]; [animalphoto setimage:img]; } give suggestion , source code apply in code.... the problem happens when attempt treating string image: uiimage *img = [animal objectatindex:currentimage]; the value inside animal array cannot image, because array comes dictionary dict read file using dictionarywithcontentsoffile: method. this method create objects of type...

Is there colour schemes tools to integrate with Twitter Bootstrap Less files? -

i know can include file bootstrap_and_overrides.css.less can use override colors in twitter bootstrap css files. but, isn't there way set less variables using online colour schemes generator on fly ? such tool great start customizing theme twitter bootstrap! any known tool there ? for css , less outputs know 1 tool : http://www.boottheme.com/#generatetheme css : http://stylebootstrap.info

objective c - Core Data match a to many relationship to a list -

related this question , occured new 1 : say have these attributes : [red, green, blue] how can fetch objects or attributes in list, but in list only ? * object_1 (red, green, blue) * object_2 (red, green) * object_3 (red) this means not fetch object_4 (red, green, blue, yellow) because has yellow not in list you can make compound predicate can add 3 predicates : nspredicate *predone = [nspredicate predicatewithformat:@"color == %@",@"red"]; nspredicate *predtwo = [nspredicate predicatewithformat:@"color == %@",@"blue"]; nspredicate *predthree = [nspredicate predicatewithformat:@"color == %@",@"green"]; nsarray *allpredicates = [[nsarray alloc] initwithobjects:predone,predtwo,predthree, nil]; nspredicate finalpredicate = [nscompoundpredicate andpredicatewithsubpredicates:allpredicates];

uiview - How to remove SubView with slide in iOS? -

i tried add subview animation following codes.it's okay. [self.view addsubview:pickerview]; pickerview.frame = cgrectmake(0, 0, 320, 50); [uiview animatewithduration:1.0 animations:^{ pickerview.frame = cgrectmake(0, 152, 320, 260); }]; and want remove subview slide animation above animation. how can that? thanks in advance. you use animatewithduration completion block remove view [uiview animatewithduration:1.0 animations:^{ pickerview.frame = //move out of screen } completion:^(bool finished) { [pickerview removefromsuperview]; }];

Listing and previewing images in a directory using PHP -

i'm trying improve administrator panel of website. need preview images in thumbnails folder when i'm using thumbnails news dont have upload image second time. found great script, failed read directory error. here script: <?php // filetypes display $imagetypes = array("image/jpeg", "image/gif", "image/png"); // original php code chirp internet: www.chirp.com.au // please acknowledge use of code including header. function getimages($dir) { global $imagetypes; // array hold return value $retval = array(); // add trailing slash if missing if(substr($dir, -1) != "/") $dir .= "/"; // full server path directory $fulldir = "{$_server['document_root']}/$dir"; $d = @dir($fulldir) or die("getimages: failed opening directory $dir reading"); while(false !== ($entry = $d->read())) { // skip hidden files if($entry[0] == ".") continue; // check image files $f = escapeshellarg("$fulldir$entry...

c# - how can i find a list item with a list item's given parameter? -

how can find list item list item's given parameter? my list defined as; public list<column0a> list0a = new list<column0a>(); and has items as; list0a.add(new column0a(header.type, message.receievetime, message.importance, message.data)); i have listed message.receivetime's on gui depending on list. want is; when user click on receivetime label, want show tooltip shows list item's (same receive time) data this: header: header.type receive time: receivetime importance: message.importance data: message.data how can find same receievetime list instance? should use linq? give me code sample? thanks. i'd recommend use id lookup instead of time stamp. if info comes database, primary key field. makes intent clearer, , allows select right info if 2 happen have same time. select item: int theidimlookingfor = //the 1 clicked on column0a myitem = list0a.single(x => x.id == theidimlookingfor); //display myitem's info in tooltip ( single linq e...

java - unable to invoke applet from jsp -

Image
applet tag in jsp : <%--<applet code ="applets/applet_1" height="500" width="500"/>--%> <jsp:plugin type="applet" code="applet_1.class" codebase="web/web-inf/classes/applets"/> <%--this tag inside jsp page index.jsp--%> why don't see applet ? have used netbeans ide. i tried ! and changed tag : <jsp:plugin type="applet" code="applet_1.class" codebase="applets" height="300" width="300"/> but nothing changed . try this <applet name="applet1" code="applet_1.class" codebase="/web/web-inf/classes/applets" width="300" height="300" </applet>

jsf 2 - p:calender multiple date selection -

i trying achieve multiple selection of dates functionality p:calender(primefaces 3.3), in way. <p:calendar id="cal" showbuttonpanel="true" mode="inline" value="#{bean.dates}" selection="multiple"/> in backing bean have taken dates array in way: private date[] dates; public date[] getdates() { return dates; } public void setdates(date[] dates) { this.dates = dates; } but still didnt able select multiple dates. as per blog http://blog.primefaces.org/?p=391 works. i tried implement in same way .but did'nt worked. why so? the blog post have read outdated , in time calendar of primefaces relying in yui , while based on jquery ui datepicker (which not support multi selection) so can't achieve multiple date selection primefaces current calendar , can google bit , find other jquery based alternatives, for example jquery ui datepicker - multiple date selections

r - Error when changing axis format with scale_x_date -

Image
dear fellow homo sapiens, i've created this graph using code below (except without + scale_x_date ). the data-set i've used found here . looks this: gfc1cari<-read.csv("demo.csv") head(gfc1cari) x xx variable value var 1 1 2008-07-17 financials 0.001772705 financ 2 2 2008-07-18 financials 0.017306086 financ 3 3 2008-07-21 financials 0.010745136 financ 4 4 2008-07-22 financials 0.021152194 financ 5 5 2008-07-23 financials 0.031195805 financ 6 6 2008-07-24 financials 0.026534444 financ as you'll see in picture, x-axis displays dates such "aug", "sep" .... . however, want similar "08/2007", "09/2007" ... . so, attempt @ doing displayed below, doesn't work. p <- ggplot(data=gfc1cari,aes(x=xx, y=value, colour=var)) + geom_line() + opts(legend.position = "none") + xlab(" ") + ylab("cumulative abnormal return") + scale_x_date(labels = date_format("%m/%y"),breaks = "1 mon...

ios - Referencing containing UIView from a subview? -

Image
when add uiview subclass object uiview - example uiswitch inside prototype uitableviewcell , connect switch viewcontroller via ibaction, how can find out in action table row invoked uiswitch in? i attached image clear - when uiswitch invoked, want know row invoked uiswitch in. i think "cleanest" way have switch send action cell itself. you'll need subclass uitableviewcell implement action, , have pass along method on view controller (probably giving cell delegate view controller hooked to). fair amount of pomp; there more straight-forward less proper methods below. one way specify tag on uiswitch when configuring table view cell in first place (i.e. in tableview:cellforrowatindexpath: method). switch.tag = indexpath.row ; can retrieve row switch later asking tag. another way search upwards through uiswitch's superviews until find uitableviewcell , find row. like: uiview *view = switch.superview; while (view && ![view iskindofclass:[uitableviewcell ...

How to resize TextView with SeekBar's progress (Android) -

i'm triying change text size of textview using seekbar, , it's works fine when increase size, when decrease, "text size" changes well, "textview's layout" seems have biggest height put (the text appears in center of layout if has match_parent property instead of wrap_content). i tried many combinations of textview's layout properties (it's in relativelayout) (h:wrap_cont,w:wrap_cont / h:match_par,w:match_par,aling parent top true /.....) can me?? edit: textview should appear on top layout <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <relativelayout android:id="@+id/preview_preview" android:layout_width="match_parent" android:layout_height="match_parent" > <imageview android:id="@+id/preview_image" android:layout_width="match_parent" android:layout_height="match_parent...

c# - How to get one login page for multiple systems? -

i have 4 systems running on same server. want let users log in once systems. made 1 user-management system create users , edit them. i tried save in session didn't help. any suggestions? working on asp.net. there 2 approaches. most resolve around login happening @ central site, returns identity information field (login token) target site uses retreive user. when go site, site redirects shortly central site , if logged in (persistent cookie) identity of you. alternatively can lot referrers , playing around. you want research on internet - loo kfo "single sign on". http://www.codeproject.com/articles/27576/single-sign-on-in-asp-net-and-other-platforms has technical discussions. across complete separate websites (domains) can read on http://aspalliance.com/1513_cross_site_authentication_and_data_transfer howw - shared cookies not work there.