Posts

Showing posts from March, 2014

mysql - Can triggers call PHP Scripts? -

i have written trigger, mysql doesn't it: code : create trigger triggers_on_comand_line after update on test1 each row begin if total_volume >= used_volume \! echo "php -f /home/test.php" end; i got error : ** mysql said: documentation 1064 - 064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near '! echo "php -f /home/test.php" @ line 6 ** thanks yes, can call php scripts if install mysql_udf_sys

C# ASP.NET Detect Download -

i maintaining website written in c# asp.net. @ bottom of page iframe. when user clicks button, source iframe set javascript page on server. showloadwidget(); document.getelementbyid("downloadframe").src='sdrtrenddownload.aspx'; return false; that page generates file , allows user download it. once download file box pops up, want call hideloadwidget() 'loading data...' overlay goes away. how detect when download file box pops up? you can't detect in addition more complicated depending on security setting zone detected site i suggest wrap call inside updatepanel , use partial postback trigger download prompt , progress template displaying loading widget. let .net , browser deal it.

sql - Find the difference between two date fields that are within a certain time parameter -

i have tried few ways here pseudo-code sql: select count(*) counter startdate , enddate 30 minutes , archived = 1. the datatypes mssql fields datetime the other idea had bring select statement , add dateadd datdiff not sure how account 2 seperate fields ( startdate , enddate )... i hope can straighten me out. select count(*) yourtable datediff(minute,startdate,enddate) <= 30 , archived = 1

ruby - Logging Google SketchUp timestamp events -

i'd ideas have problem we're looking solve via sketchup ( university research project). for usability study, want create timestamped log sketchup tool changing events .xml, csv, or txt file during modeling task given user. e.g. while drawing cylinder, events like- 1. selecting circle, 2. selecting push/pull etc. need logged text based file. please pingback neat ideas have doing such plugin. thanks tonne! you need add observer class project, utilize time.now , ruby's built-in file io create and/or write text/log file. ruby file class toolsobserver appobserver

c# - How to propagate changes done outside my View in a WPF app -

i have property called isvisible : public new bool isvisible { { return base.isvisible; } set { base.isvisible = value; this.raisepropertychanged ( "isvisible" ); } } so property set true when left mouse button down selected item in the treeview . works fine, have checkbox trying bind same property, 2 way. whenever change property via left mouse button down, checkbox shows isvisible state if it's true. works partially. but problem is, each time when set property true instance, other layers' isvisible property set false, checkbox es don't show changes. still checked. so whenever say: layer.isvisible = true; all other layers set false base class don't have access source code (shown above). how can make app recognize change? so hiding isvisible property of base class, doesn't implement inotifypropertychanged? checkboxes binding class (not base)? can mimic behavior of base class iterating throug...

c - Errors in header file with function taking structs -

what's wrong header? gcc throws out: libmmbox.h:7:29: error: expected ‘)’ before ‘*’ token libmmbox.h:8:27: error: expected ‘)’ before ‘*’ token here's code: #ifndef __libmmbox_h__ #define __libmmbox_h__ int mmbox_connect(char *username); int mmbox_login(int token, char *password); int mmbox_quit(); int mmbox_stat(mmbox_stat_t *result); int mmbox_list(mmbox_mail **l, int *num_msg); int mmbox_send(char *dest, char *obj, void *buf, size_t size); int mmbox_rcv(int id, void *buf, size_t size); int mmbox_delete(int id); int mmbox_resume(int id); typedef struct { char *user; int used_space; int free_space; int num_msg; } mmbox_stat_t; typedef struct { char *sender, *recipient; / char *obj, *date; char flags; size_t size; } mmbox_mail; #endif mmbox_stat_t struct declared after used function signature. compiler doesn't still know type when declare: int mmbox_stat(mmbo...

Matlab Imread resizes tif file -

so i'm using imread function in matlab , when save tiff file , open in photoshop, has white border , can't understand why. want maintain resolution 512 512 image. ideas why? , how can fix that? here's sample code: b = imread('w_noise1.tif'); n = 1:5, b = medfilt2(b); end b = filter2(fspecial('average',3),b)/255; imshow(b) are sure it's issue imread? i'd surprised if is. see this link medfilt2 explains "medfilt2 pads image 0s on edges, median values points within [m n]/2 of edges might appear distorted." edit: tried replicate problem. issue print puts white frame around image after save it. functionality, print made printing plots. if want save image, should use imwrite .

android - How to get back spinner data -

i filled spinner query. how can retrieve information selected? i'm having trouble getselecteditem(position) .. i have cursor save query, fill spinner that's no problem. don't know how assign string variable selected in spinner. for example spinnername.setonitemselectedlistener( new adapterview.onitemselectedlistener() { public void onitemselected(adapterview<?> parent, android.view.view v, int position, long id) { selentidad = ??; } public void onnothingselected(adapterview<?> parent) { selentidad ="nodata"; } }); how can put in selentidad value of selected in spinner, filled query? if pass strings spinner should able corresponding string with (string) parent. getitematposition(position) . getitematposition return object adapter uses construct views. in case of simplecursoradapter cursor @ position. can...

php - Symfony 1.4 installation and security issues -

i have shared hosting account in want install symfony 1.4 , deploy , application. bumped issues because of inability change apache config on production server. the structure of web server is: hosting_account_name html <--- public folder i moved files in symfony local app folder hosting_account_name , put web folder content in html so got following structure: hosting_account_name apps cache config data html css js index.php .htaccess frontend_dev.php lib log plugins test and added line bellow config/projectconfiguration.class.php $this->setwebdir($this->getrootdir().'/www'); i have couple of issues though: 1. when access frontend_dev.php no images due fact symfony expects files under sf/ folder. should move files there? 2. index.php gives error. display errors set yes , 500 internal server error presented. a...

nsfetchedresultscontroller - Enhance my Core Data design. Experts only! -

Image
in acaniusers , i'm downloading closest 20 users me , displaying profile pictures thumbnails in table view. user & photo both resources because each have id (mongodb bson objectid) on server. each user has unique_id. each photo has 4 different sizes (images) on server: square: 75x75, square@2x: 150x150, large: 320x480, large@2x: 640x960. but, each device have 2 of these sizes, depending on whether it's iphone 3 or 4 (retina display). each of these sizes has own mongodb collection. and, 4 images each photo have same bson objectid's across these 4 collections. in future, may give user relationship called photos allow user have more 1 photo. also, although don't foresee this, may add more image sizes (types). the fresh attribute on image tells me whether i've downloaded latest image. set no whenever photo 's id has changed, , yes after i've finished downloading image. should store 4 different images in core data or on file system , store u...

objective c - How to send POST and GET request? -

i want send json url ( post , get ). nsmutabledictionary *jsondict = [[nsmutabledictionary alloc] init]; [jsondict setvalue:"myvalue" forkey:"mykey"]; nsdata *jsondata = [nsjsonserialization datawithjsonobject:self options:kniloptions error:nil]; my current request code isn't working. nsmutableurlrequest *requestdata = [[nsmutableurlrequest alloc] init]; [requestdata seturl:[nsurl urlwithstring:@"http://fake.url/"];]; [requestdata sethttpmethod:@"post"]; [requestdata setvalue:postlength forhttpheaderfield:@"content-length"]; [requestdata setvalue:@"application/json" forhttpheaderfield:@"content-type"]; [requestdata setvalue:@"application/json" forhttpheaderfield:@"accept"]; [requestdata sethttpbody:postdata]; using asihttprequest not liable answer. sending post , get requests in ios quite easy; , there's no need additional framework. post request: w...

.net - Linking a precompiled MSIL file into an assembly? -

is there way precompile msil file , have .net linker link .net assembly @ compile time? so, example. have project. compile it, decompile msil, , tweak msil. now then, i'd compile , link tweaked msil file project. yes, +could+ recompile seperate assembly , reference it, in particular case, can't that. contents of msil needs in target assembly. any ideas if possible? far, i've had no luck finding anything. -- edit-- 1 suggestion ilmerge, might work. i'll grabbing latest copy , see how fairs. issue have in past, i've found debugging difficult after merge (or @ least, more difficult if didn't use ilmerge). hoping possibly tweak proj file include compiled msil directly part of build process, continue debugged in ide. -- edit -- well, doesn't ilmerge work scenario first, got message: exception occurred during merging: (taskid:32) ilmerge.merge: assembly 'blah' not marked containing managed code. (taskid:32) (consider using /zeropekind...

iphone - In Google Analytics report, Visits are coming but no data for PageViews are coming -

i have incorporated google analytics in iphn application. when checking reports, data visits coming no data pageviews , pages/visit coming. in appdelegate file inside application didfinishlaunchingwithoptions method have pasted code well- [[gantracker sharedtracker] starttrackerwithaccountid:@"ua-20206851-1" dispatchperiod:10 delegate:nil]; i using code pageview tracking in viewdidload method- nserror *error; if (![[gantracker sharedtracker] trackpageview:@"buildsviewcontroller.xib" witherror:&error]) { // handle error here } even event tracking no data coming. using code that- nserror *error; if (![[gantracker sharedtracker] trackevent:@"buttonclicked" action:@"production1" label:@"environment1" value:-1 witherror:&error]) { // handle error here } here "trackevent" method name , have used string in "action" , "label". please tell why pageviews not coming ...

vb.net - currentCell to remain the same if validation fail. - CellEndEdit Event -

i have datagridview user's input. for example, columns "name", "date of birth"... for "date of birth" part, have implemented validaion... i want make user have enter valid "date of birth" before allowed leave cell. meaning once them entered cell, have provide valid "date of birth" can move on. would find out how can done, have tried setting dgv.currentcell intended cell inside "cellendedit" event. gives me following error: "operation not valid because results in reentrant call setcurrentcelladdresscore function" i believe can achieve using cellvalidating void datagridview1_cellvalidating(object sender, datagridviewcellvalidatingeventargs e) { if(e.columnindex == 3) { e.formattedvalue // check date validation against value e.cancel = true; // set true if validation fails } } this in retaining focus in same cell in case of incorrect entry user.

html - Making a td contract to only it's padding and content -

i've got table arranged this: <table style="width:100%" class="ui-widget-content"> <tr> <td rowspan="2" style="width:100px;padding:10px"> </td> <td style="padding:5px"> </td> </tr> <tr> <td> </td> </tr> </table> i want when filled content (sorry bad ascii art): ----------------------- | | | | |---------------| | | | | | | | | | ----------------------- however looks this: ----------------------- | | | | | | | | --------------| | | | | | | ----------------------- i did height:1% in top 1 doesn't work in ie, i'm looking less haxxy approach. any advice? edit: here's actual code i'm using php left in: <table styl...

android - Show ProgressDialog while uithread sleeps? -

i want show progressdialog while uithread sleeps until data server retrived activity not shown. how can this? you can use thread , asynctask , or service load data in background, , handler implementation control progressdialog . the example in post shows how use thread login request, , in meantime show progress dialog. using asynctask lot easier , clearer: private static final int wait = 11; private final class mytask extends asynctask<void, void, void> { @override protected void onpreexecute() { super.onpreexecute(); // show dialog id=wait [11] showdialog(wait); // other actions must performed in ui thread // before background works starts } @override protected void doinbackground(void... params) { // perform background work return null; } @override protected void onpostexecute(void result) { super.onpostexecute(result); // remove dialog id...

vbscript - VB Script Error - Worked before but now not confusingly -

Image
i getting error the vb file reads col1 , finds matching image name in directory , renames file col2 produces report show images haven't been renamed , placed ones have in folder called rename i have attached code can see strdocmap = "c:\img\docmap.xlsx" strinputfolder = "c:\img\" stroutputfolder = "c:\img\renamed\" strlogfile = "c:\img\renaminglog.txt" strpattern = "\d{5}" set regexpression = new regexp regexpression .global = true .ignorecase = true .pattern = strpattern end set objexcel = createobject("excel.application") objexcel.visible = true const xlup = -4162 const xlformulas = -4123 const xlpart = 2 const xlbyrows = 1 const xlnext = 1 set objwb = objexcel.workbooks.open(strdocmap, false, true) set objsheet = objwb.sheets(1) set objfso = createobject("scripting.filesystemobject") if right(strinputfolder, 1) <> "\" strinputfolder = strinputfolder & "\" if right(st...

objective c - ios write geotag into image -

i need read jpg image (not imagelibrary) , write them exif geotag data taken iphone gps how can this? thanks in advance. paolo the uiimagepickercontroller doesn't give camera's location. have add cllocationmanager in app. initiate/delegate self. , call "startupdatinglocation". in "-(void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation", able location "newlocation". now if want save image photo library, can use https://github.com/gpambrozio/gusutils more explanations can found: http://blog.codecropper.com/2011/05/adding-metadata-to-ios-images-the-easy-way/

android - How to get around setting a unique ID for AlarmManager? -

i using code launch alarm. the alarm set in activity user can launch. //setting alarm fire off new_game intent every 24 hours. string alarm = context.alarm_service; calendar calendar = calendar.getinstance(); calendar.set(calendar.hour_of_day, 8); calendar.set(calendar.minute, 0); calendar.set(calendar.second,0); calendar.set(calendar.millisecond, 0); log.i("test", "current time: " + system.currenttimemillis() ); log.i("test", "calendar time: " + calendar.gettimeinmillis() ); int currentdate = calendar.get(calendar.date); calendar.set(calendar.date, currentdate+1); log.i("test", "calendar time day added: " + calendar.gettimeinmillis() ); alarmmanager = (alarmmanager)getactivity().getsystemservice(alarm); intent intent = new intent("ne...

objective c - Using BLAS or LAPACK with Xcode -

i'm looking guide on how incorporate blas or lapack functions objective c program developed through xcode. sources can find online of programs in blas/lapack written in fortran - confusing. how 1 make use of blas/lapack , still code in objective c? there online examples/guides? want able perform matrix operations elements of matrix have complex values. cheers, shaddy the headers c interfaces cblas.h , clapack.h . part of veclib framework, part of accelerate framework.

ubercart - Adding .htaccess to disallow sites/default/files directory from any access -

customers @ site upload private files using node checkout module land in sites/default/files directory part of order. unfortunately never find way till restrict files owners only. i've used user file module, module stopped site. customer can upload files product order anonymous checkout need login. so if add .htaccess in directory disallowing in world read access, idea work? i thinking write hook product checked out, it's associated uploaded file can moved private location, or have it's read permission removed( hosting on linux). any ideas? i'm using drupal-6

javascript - jQuery tweet plugin does not fetch tweets -

i using jquery tweet plugin. unable figure out why plugin not fetching tweets. see there no js errors when @ firebug console. http://www.montereytravelguide.com the twitter widget in footer uses jquery tweet plugin. i appreciate help thanks it seems query twitter returns empty result : http://twitter.com/status/user_timeline/montereytravel.json?count=3&callback=jquery151031489942711777985_1304067889969&_=1304067890328 returns : jquery151031489942711777985_1304067889969([]); first, seems correct url should : http://api.twitter.com/1/statuses/user_timeline.json?screen_name=montereytravel but requires authenticated user. guess plugin outdated or misconfigured

oop - Class vs. static method in JavaScript -

i know work: function foo() {}; foo.prototype.talk = function () { alert('hello~\n'); }; var = new foo; a.talk(); // 'hello~\n' but if want call foo.talk() // not work foo.prototype.talk() // works correctly i find methods make foo.talk work, foo.__proto__ = foo.prototype foo.talk = foo.prototype.talk is there other ways this? don’t know whether right so. use class methods or static methods in javascript code? first off, remember javascript prototypal language , rather class-based language 1 . foo isn't class, it's function, object. can instantiate object from function using new keyword allow create similar class in standard oop language. i'd suggest ignoring __proto__ of time because has poor cross browser support, , instead focus on learning how prototype works. if have instance of object created function 2 , access 1 of members (methods, attributes, properties, constants etc) in way, access flow down prototype h...

Overloading + operator in F# -

so have this: open system open system.linq open microsoft.fsharp.collections type microsoft.fsharp.collections.list<'a> static member (+) (first : list<'a>) (second : list<'a>) = first.concat(second) let = [1; 2; 3; 4; 54; 9] let b = [3; 5; 6; 4; 54] x in list.(+) b console.writeline(x) and want convert last line into for x in + b console.writeline(x) but doing gives me the type 'int list' not support operands named '+' the documentation , examples on web flakey, , despite google-fu have been unable work. basically, coming python background, want list manipulation syntax terse used to: should not need more 1 character in infix notation. first, overriding operators should declared in tuple form, not in carried form. in case: type microsoft.fsharp.collections.list<'a> static member (+) (first: list<'a>, second: list<'a>) = first.concat(second) second...

Python running out of memory parsing XML using cElementTree.iterparse -

Image
a simplified version of xml parsing function here: import xml.etree.celementtree et def analyze(xml): = et.iterparse(file(xml)) count = 0 (ev, el) in it: count += 1 print('count: {0}'.format(count)) this causes python run out of memory, doesn't make whole lot of sense. thing storing count, integer. why doing this: see sudden drop in memory , cpu usage @ end? that's python crashing spectacularly. @ least gives me memoryerror (depending on else doing in loop, gives me more random errors, indexerror ) , stack trace instead of segfault. why crashing? the documentation tell "parses xml section into element tree [my emphasis] incrementally" doesn't cover how avoid retaining uninteresting elements (which may of them). covered this article effbot . i recommend using .iterparse() should read this article liza daly . covers both lxml , [c]elementtree. previous coverage on so: using python iterparse large xml...

android - Setting a theme/style when using startActivity() -

simple question: i using pick_contact in android 3.0 application. issue contact app has light theme while app uses dark one. so question is: is there way set style/theme when using startactivity() ? if creating own library , want user able use customize styles, need receive in intent ? there better way solve this? is there way set style/theme when using startactivity()? no. have no right mess other apps' user interfaces, more have right mess yours. in case of pick_contact , if willing have read_contacts permission, there nothing stopping writing own contact picker activity, themed wish. if creating own library , want user able use customize styles, need receive in intent? since there no setstyle() method, dynamically changing activity's style seems troublesome. if library shipped android library project, can provide theme resources , guidance developers who, when adding activities manifest, can choose theme use @ compile time.

javascript - Titanium.Media.showCamera with overlay, pass through events -

i writing ios application utilizes camera. want image (and control element or two) overlayed on camera picture. this works. overlay prevents default control elements flash, hdr , camera selection receiving touch events. below code. there way make myoverlay pass through or ignore events? var overlayimage = titanium.ui.createimageview({ width: 100, height: 100, backgroundimage: 'img/picture.png' }); var myoverlay = titanium.ui.createview(); myoverlay.add(overlayimage); titanium.media.showcamera({ success: successmethod, error: errormethod, cancel: function(e) {}, overlay: myoverlay, savetophotogallery: true, allowediting: false, mediatypes: ['public.image'] }); you can try var myoverlay = titanium.ui.createview({touchenabled: false}); , should pass events according appcelerator docs.

Ruby Soap datetime parsing error -

i trying convert datetime returning soap service looks this: "2011-09-30t11:25:56-05:00". i want parse format "2011-09-30 11:25:56" when hard code datestring in ruby code, works: def parse_date(datestring) formatteddatetime = datetime.strptime("2011-09-30t11:25:56-05:00", "%y-%m-%dt%i:%m:%s%z") dt = formatteddatetime.strftime("%y-%m-%d %h:%m:%s") return dt end this example works when hard code datestring in. however, below example not work. datestring using "2011-09-30t11:25:56-05:00", exact same hardcoding in above example. def parse_date(datestring) formatteddatetime = datetime.strptime(datestring, "%y-%m-%dt%i:%m:%s%z") dt = formatteddatetime.strftime("%y-%m-%d %h:%m:%s") return dt end this way throws error: [01:29:06 pm 2011-10-09] sourceadapter raised query exception: private method `sub!' called # can please let me know going on? i can't r...

javascript - backbone.js - how and when to show a spinner -

is there sort of hooks in backbone can "whenever of collections fetching data, show spinner, hide when they're done"? i have feeling more complicated , require overwriting specific functions. when should show spinner? on fetch() or refresh() or else? backbone doesn't trigger event when collection::fetch() starts ( see source code ), have override fetch method. maybe this: var oldcollectionfetch = backbone.collection.prototype.fetch; backbone.collection.prototype.fetch = function(options) { this.trigger("fetch:started"); oldcollectionfetch.call(this, options); } this override fetch method give event when fetch starts. however, triggers event on specific collection instance if have bunch of different collections you'll have listen event on each collection.

php html display hierarchical data -

i have array ($title, $depth) $title($depth) //////////////////////////////////// electronics(0) televisions(1) tube(2) lcd(2) plasma(2) portable electronics(1) mp3 players(2) flash(3) cd players(2) 2 way radios(2) ////////////////////// how display structure <ul><li> the basics of it...keep track of depth, , print out <ul> , </ul> tags nudge depth toward current depth. keep in mind html not require </li> tags, , makes life easier. can print out <li> before each item, , let elements close needed. now, specifics of going on list, depends on structure (which, @ time of edit, haven't cared share). there 2 sensible ways can think of structure such list, though. $depth = -1; // may foreach($arr $title => $itemdepth), depending on structure foreach ($arr $item) { // if did 'other' foreach, rid of list($title, $itemdepth) = $item; // n...

cruisecontrol.net - How to make ccnet update multiple projects independently in a single mercurial repo? -

i have central hg repository multiple subprojects in it. this: /hg_central /subproject-a /subproject-b /... i trying set cc.net server builds subproject if directory has been updated. my current problem once 1 of subprojects has been updated , built, server not find modifications other subprojects, since mercurial has updated whole repository. cc.net not build other subprojects, unless update has been done. i've tried using inclusionfilters without success. can't afford have seperate workingdirectory each subproject. missing make possible? my ccnet config file this: <cruisecontrol xmlns:cb="urn:ccnet.config.builder"> <project name="subproject-a"> <workingdirectory>g:\hg-clone\</workingdirectory> <triggers> <intervaltrigger name="continuous" seconds="60" buildcondition="ifmodificationexists" initialseconds="20" /> </triggers> ...

javascript - How to get BGCOLOR of a TD? -

how value of bgcolor? (my alert wrong). <table id="mytable1" onclick="setcolor()" width="25" border-color:black border="1" cellspacing="1" cellpading="0" align="left"> <tr> <td id='colorid' bgcolor=yellow>&nbsp;</td> </tr> </table> <script type="text/javascript"> alert(document.getelementbyid("colorid").getattribute('bgcolor')); </script> javascript case-sensitive. getattribute() should written lowercase g (like getelementbyid , others). called camel-case (or camelcase , name says is), javascript functions follow naming convention. document.getelementbyid("colorid").getattribute('bgcolor') also can't write css directly html element, have use style attribute: style="border-color: black;" one more thing, if let me. try consistent in markup style. in html4...

ruby on rails - Factory Girl not destroying objects properly -

i creating object several has_many associations. regards tob building object works fine, when try test deletion of 1 of children or parent, not reflect in test. for example: base_article = factory(:base_article, :articles => [factory(:article)]) p base_article.articles.size base_article.articles.first.destroy p base_article.articles.size base_article.destroyed?.should == true this prints out: 1 1 i testing callback after destroy on article deletes base when there no more children. why size of articles association not being reduced one? thanks! you need reload articles collection rails' database caching stale: base_article = factory(:base_article, :articles => [factory(:article)]) base_article.articles.size # => 1 base_article.articles.first.destroy base_article.articles.size # => 1 base_article.articles.reload.size # => 0 base_article.destroyed?.should == true

How do sites like tabsite automatically hook up with Facebook Developer to register new apps on the fly? -

have developed quite basic facebook app development experience, can hook apps databases, have different info installed , displayed on different tabs no probs. however, ive been doing far date revolves around me manually going developer account , setting each apps settings individually, 1 @ time. curious figure out how people tabsite have created interface captures users input data , displays on tabs (that part understand) registers new apps each time on fly (this part curious how done), allowing them add individual app logos, tabnames etc without user ever having go anywhere near developer set up. , how tabsite getting data developer such app_id or app_secret?? insight appreciated. regards tony as recall there isn't way register app using api. use 1 app, , check signed_request variable facebook page id, link data in database. https://developers.facebook.com/docs/authentication/signed_request/

java - How to implement a binary to ascii conversion? (and vice versa) -

i want write 2 simple utilities: receives binary file, , converts text file (ascii format). receives text file in format of above file , restores original binary file. the reason need stupid, still reason. have 2 computers - 1 internet access , 1 without. write software on 1 without internet. emails on 2nd one. need transfer binary files 1 (e.g. jars) communication between them clipboard (text only). might localized problem - assume has solution in worlds of data encryption/compression/network transfer. the thing come go on binary file , convert each byte it's hex representation - every byte i'll 2 ascii characters (i.e. 2 bytes). there better? (this solution doubles amount of info , might not possible transfer via clipboard) one limitation - need java based solution (i want write myself) google base64, , use apache commons codec have ready use implementation.

grep - Conditional Merge in R Data Frame using a String as a search -

i prepping database plotting in ggplot plot large geom_point() plot. 1 set of point stand out , thinking of making dummy column use column color variable in: p <- ggplot(data, aes(x-x,y-y,color=color) colors=c("yes"="orange2", "no"="grey") scale_color_manual(values=colors) to make dummy column wanted follows: df$color <- "no" to set default color, , use grep substitute make highlight color. df$color[grep("string", df$v1, ignore.case=t),] < "yes" where v1 column contains string substitute. although love suggestions on how substitution interested in learning more direct coloring method involve highlighting data of particular value. thanks here 1 way using grepl . using mtcars data set illustrative purposes. want merc stand out. can call ggplot(mtcars, aes(mpg, hp)) + geom_point(aes(colour = grepl('merc', rownames(mtcars)))) + scale_colour_manual("merc", v...

How to resize multiple WPF controls when the text size changes? -

what's correct pattern resize controls when font size changes? for example, used wpf designer make form, , placed ui elements toolbox. late in game got requirement font size of every ui element needs configurable, i'm thinking there has better way resize controls when font size changes. right i'm doing alot of code behind calculations on margin properties. for such cases place control inside grids , stackpanels, way font size won't affect layout, stretchable. never place controls on window using absolute coordinates.

c# - MDI Parent Child -

i have created 1 mdi form & want inherit made child form. have access controls on mdi in child form. (i dont want create new inherited form, have one) your question rather unclear appears asking how show form mdi child. assume have set ismdicontainer true main form. in order show mdi child need set mdiparent property child form. this: childform mychild = new childform(); mychild.mdiparent = this;//this main form, mdi parent mychild.show();

Android: Removing "The" from listview items -

i have received several requests adjust way list items displayed on media player application. currently entry beginning "the" sorted t's expect. many users sort item using second word in title. can shed light on done? adjusted while getting cursor or when applying listview? any appreciated. thank you, josh update: thank answers, still struggling find apply solutions suggested in instance. i using simple cursor acquire dataset. snippet of code below: audiocursor = getcontentresolver().query(mediastore.audio.artists.external_content_uri, cols, null, null,audiocolumns.artist + " collate localized asc"); startmanagingcursor(audiocursor); setlistadapter(new myabcadapter(this, r.layout.list_item, audiocursor, new string[]{audiocolumns.artist,mediastore.audio.artists.number_of_tracks}, new int[]{android.r.id.text1, android.r.id.text2})); i have utility adjusts entry text,...

php - MySQL Query for " Where SUM(Price) Bigger Than Equal " ? -

this query : select user,name,sum(price) $tablename faktor='1' group user order sum(price) asc this query work , want show have sum(price) bigger 100 $ . test where sum(price) < '100' not work , , result wrong. thanks ;) you need use having , not where . select user,name,sum(price) $tablename faktor='1' group user having sum(price) < 100 order sum(price) asc where applies before doing group-by. having applies afterwords.

javascript - Doing assignment in VBscript now.. Need to give positions of each "e" in a string -

i've done in javascript needless can't swap over. in jscript used this: var estr = tx_val index = 0 positions = [] while((index = estr.indexof("e", index + 1)) != -1) { positions.push(index); } document.getelementbyid('ans6').innerhtml = "locations of 'e' in string are: " + positions; i tried using same logic vbs terms, ie join, tried using instr. i'm not sure how yank out 'e'... maybe i'll try replacing character. here tried vbscript. tried using instr , replace yank out first occurance of 'e' in each loop , replace 'x'. thought maybe make next loop through give location of next 'e'. -- when don't subscript out of range 'i' error, 1 location script , 0. (6) show location of each occurence of character "e" in string "tx_val" in span block id="ans6" countarr = array() countarr = split(tx_val) estr = tx_val outhtml = "" posi...

Android sqlite Cursor value to a textbox -

text = (textview)findviewbyid(r.id.textview123); cursor sum = dbobject.rawquery("select sum(volume) share _id2 ?", new string[] { "%" + val1 + "%" }); how sum value textview? thank in advance, this.startmanagingcursor(sum); //or (activity) .startmanagingcursor sum.movetofirst(); text.settext(sum.getstring(0));

Find the Hardy–Ramanujan number using R5RS scheme. Please suggest improvements in idiom and calculations. -

i remember once going see [srinivasa ramanujan] when ill @ putney. had ridden in taxi cab number 1729 , remarked number seemed me rather dull one, , hoped not unfavorable omen. "no," replied, "it interesting number; smallest number expressible sum of 2 cubes in 2 different ways." [g. h. hardy told in "1729 (number)" ] in "math wrath" joseph tartakovsky says feat, "so what? give me 2 minutes , calculator watch, , i'll same without exerting little gray cells." don't know how mr. tartakovsky accomplish proof on calculator watch, following scheme function enumerates numbers starting @ 1 , stops when finds number expressable in 2 seperate ways summing cubes of 2 positive numbers. , indeeds returns 1729. there 2 areas appreciate suggestions improvement. 1 area is, being new scheme, style , idiom. other area around calculations. sisc not return exact numbers roots, when be. example (expt 27 1/3) yiel...

search - Pass multiple parameters in batch file -

i have winform app prompts user input 2 search parameters. when executed these parameters passed run.bat file i.e. call search.bat %1 %2 where %1 %2 parameters input user in winform. this should put parameters search.bat part of search url is- "http://www.foo.com/search=%*" i thought %* take both parameters added , search reason brings results both parameters %1 + %2 , results %2 . is possible edit brings results parameters entered user? its turns out not clearing cache folder after every search, therefore old search terms being submitted.

objective c - UIScrollView - transparent PNG sliding over an image background -

trying png transparency appear in uiscrollview. instead of transparent black now. tried set view.opaque = no, , view.backgroundcolor = [uicolor clearcolor] no avail. rootviewcontroller has image background set self.view.opaque = no; self.view.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@"appbackground.png"]]; rootviewcontroller has uiscrollview load other 2 uiviewcontroller views (leftscreen, centralscreen) into: cgrect frame = scrollview.frame; frame.origin.x = 0; frame.origin.y = 0; leftscreen.view.frame = frame; [scrollview addsubview:leftscreen.view]; frame.origin.x = frame.size.width; frame.origin.y = 0; centralscreen.view.frame = frame; [scrollview addsubview:centralscreen.view]; the centralscreen.view has 24bit transparent png background set in uiviewcontroller with self.view.opaque = no; self.view.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@"homepagetext.png"]]; in end centralscr...

html - make checkbox behave like radio buttons with javascript -

i need manipulate behavior of check boxes javascript. should behave radio buttons (only 1 selectable @ time, plus unselect previous selections). the problem can't use plain radio buttons in first place, because name attribute each radio button different. i know not ultimate , shiniest solutions make apple pear, , w3c wouldn't give me thumbs it, better solution right change core php logic of entire cms structure ;-) any appreciated! html : <label><input type="checkbox" name="cb1" class="chb" /> checkbox1</label> <label><input type="checkbox" name="cb2" class="chb" /> checkbox2</label> <label><input type="checkbox" name="cb3" class="chb" /> checkbox3</label> <label><input type="checkbox" name="cb4" class="chb" /> checkbox4</label> jquery : $(".chb").change...

ant - jsUnit and build.xml -

so want build.xml file can invoke hudson run jsunit tests. however, build.xml file has few things needs ... guess run unit tests. 1 of things needs these browser files such ie.exe or firefox.exe. on ubuntu have no clue these browser files are. if can me, appreciate perhaps - sample build.xml file can run multiple tests (through hudson). - or way reference "browser files" - or description of simpler/better alternative of jsunit thanks in advance! from question sounds looking firefox executable. on ubuntu, believe located at: /usr/bin/firefox there no ".exe" extension.

need a simple linq -

i have table called products. want products have productid 2 or 6 or 9 sql : select * products productid=2 or productid=6 or productid=9 . how can sql linq? productids in array from p in products new int [] { 2,6,9 }.contains(p.productid) select p;

objective c - Will Apple reject this code? -

please tell me if think code rejected apple. catransition *animation = [catransition animation]; animation.delegate = self; animation.duration = 0.3f; animation.timingfunction = uiviewanimationcurveeaseinout; animation.removedoncompletion = no; if (curlup) { animation.type = @"pagecurl"; animation.fillmode = kcafillmodeforwards; animation.endprogress = 0.7; } else { animation.type = @"pageuncurl"; animation.fillmode = kcafillmodebackwards; animation.startprogress = 0.3; } // perform animation uiview *whitebg = [self.view viewwithtag:10]; nsinteger purple = [[whitebg subviews] indexofobject:[whitebg viewwithtag:99]]; nsinteger white = [[whitebg subviews] indexofobject:[whitebg viewwithtag:100]]; [whitebg exchangesubviewatindex:purple withsubviewatindex:white]; [[whitebg layer] addanimation:animation forkey:@"page curl"]; if yes, how can same result way? the page curl effects ( animation.type = @"pagecurl";...

file compare in perl -

i new perl . i have 2 text files: file1 contain 2 lines: mahesh bharti file2 contain 2 lines: mahesh orange as can see difference between 2 files bharti , orange . somehow able print difference. requirement should print below. difference of file below: file1 contain: bharti file2 contain: orange my current code written in perl below use text::diff module.

multi instance of workflow wcf in memory -

i designed 2 wcf long running workflow (long life) names 'wcf a' , 'wcf b'. i have loop in 'wcf a' , i'm sending message 'wcf b' in per execution of loop. might exist instances of 'wcf b' in memory until 'wcf b' got stop message. both wcf , b hosted in windows service. @ first executing windows service ok after time not work , monitored in task manager don't using cpu usage. where problem from? it depends, monitoring cpu usage not tell anything. be: deadlock happened somewhere in loop, i.e. maybe each instance use shared objects? channel gets faulted (because time outs, exceptions etc) execution cannot go through. depends on object of each instance of wcf b holds, might reached os limit, (for example: number of opened file) from question guess may find debugging services difficult, try following: enable wcf logging , there plenty entries on or google attach debugger service, if find gives random entry...

Javascript Date Plus 2 Weeks (14 days) -

i use date: var currenttime = new date() var month = currenttime.getmonth() + 1 var day = currenttime.getdate() var year = currenttime.getfullyear() alert(month + "/" + day + "/" + year); how can add 2 weeks ? instead of showing 10/13/2011, show 10/27/2011 etc here fiddle: http://jsfiddle.net/25wna/ i want 1 input have +14 days , other +21 note: i'd format > 10/13/2011 <. 12096e5 magic number 14 days in milliseconds. var fortnightaway = new date(+new date + 12096e5); jsfiddle .

iphone - Core data with to-many relationship/ -

i using core data. having 2 entities music , lyrics .i created relationship musictolyrics inverse , to-many. have save number of timestamps , lyrics 1 song. m using code lyrics *lyrics = [nsentitydescription insertnewobjectforentityforname:@"lyrics" inmanagedobjectcontext:context]; lyrics.lyrics = albumtitlefield.text; lyrics.starttime = 0.0; lyrics.lyricstomusic = music; this saving in coredata. want save number of records 1 song..just foreign key.. how can ? please help. thanks in advance it looks inverse wrong way. rather "music" quite ambiguous, let's call "song". so, song has "lyrics". other songs use same lyrics . so far then, have many-to-one relationship in many songs can use same lyrics. what i'd recommend map out in core data modeller. then, generate class files automatically. you'll see in to-many relationship, can add object set, you'll have example: song *mysong = [nsentitydescription...

.net - How to add small window into Form -

possible duplicate: dockable autohiding panel control windows forms i have problem. don't know how make "small window" in form. mark them on picture. panels or what? how add close, minimize etc. buttons them , allow move them? picture http://img651.imageshack.us/img651/9791/beztytuurke.jpg check out third party docking panel control. ( http://sourceforge.net/projects/dockpanelsuite/ ) you use create dockingwindow type forms can automatically dock/fill/float on main form has docking container. layout of docked windows within docking container serialise nicely xml can stored need, in order reload form later.

asp.net - web.config location element settings -

i have question on sample of location element inside web.config: <configuration> <location path="uploadpage.aspx"> <system.web> <httpruntime maxrequestlength="128"/> </system.web> </location> </configuration> the uploadpage.aspx refer www.mysite.com/uploadpage.aspx or file called uploadpage.aspx inside site? can write path="~/uploadtool/uploadpage.aspx" ? if want rule refer file named uploadpage.aspx well, "/path" doesnt work need put ~/ @ beginning /* @ end works here example <location path="~/upload-cs/upload.aspx"> <system.web> <httpruntime maxrequestlength="5378" executiontimeout="300" /> </system.web> </location>

data annotations - Visual Editor for DataAnnotations ASP.NET MVC? -

i writing dataannotations models in mvc program. after doing pretty same thing third model, can't wonder there easier way this? [metadatatype(typeof(articlemd))] public partial class article { public class articlemd { [displayname("created by:")] public string createdby { get; set; } [displayname("additional information:")] [datatype(datatype.multilinetext)] public string additionalinformation { get; set; } [displayname("title:")] [required] public string title { get; set; } //... does know of addons or plugins visual studio allow select model or viewmodel , use gui define of stuff (in separate metadata class)? i don't know of gui editors, use t4 template generate starter each metadata class. got idea post dan wahlin . here's template use: <# // created dan wahlin - http://www.thewahlingroup.com // title: t4 metadata , data annotations t...