Posts

Showing posts from July, 2012

ASP.NET: Create new CSS class programmatically from User Control? -

i have usercontrol contains, among other things, ajax modal popup extender: <ajax:modalpopupextender id="mpe" runat="server" targetcontrolid="btnchangepassword" popupcontrolid="pnlpasswordchanging" backgroundcssclass="modalbackground" dropshadow="true" cancelcontrolid="btncancel" oncancelscript="ulc_changepw_cancelbtnclick();" /> nothing special here. problem comes backgroundcssclass attribute—it requires css class called modalbackground . unfortunately cannot add css class user control in way survives postbacks. if add modalbackground class .ascx page: <style type="text/css"> .modalbackground { background-color: #a1a1a1; filter: alpha(opacity=70); opacity: 0.7px; } </style> ...it show property when first loaded, not after subsequent postbacks. of course define modalbackground within page itself, or within seperate, sta...

Strip parity bits in C -

say have stream of bits 8 bits of data followed 2 parity bits (pattern repeats). example (x parity bits): 0001 0001 xx00 0100 01xx 0001 0001 xx00 ... should become 0001 0001 0001 0001 0001 0001 ... i feel should easy , i'm on thinking it, how go stripping these parity bits? the tricky bit here c doesn't let work bits easily, bytes. going assume char holds 8 bits (check char_bit in limits.h ) -- case on modern systems. least common multiple of 8 , 10 40, want work in buffer of @ least 40 bits can integer arithmetic on whole -- in practice means 64-bit type. here's 1 way it, reading stdin , writing stdout. handling streams not multiple of 40 bits in length left exercise. #include <stdint.h> #include <stdio.h> int main(void) { int c; uint_least64_t buffer; (;;) { buffer = 0; /* read in 4 10-bit units = 5 8-bit units */ c = getchar(); if (c == eof) break; buffer = ((buffer <...

Compilation of Groovy Code in Grails application -

when build war file grails application via grails war still contains groovy files. after war-filed deployed on application server, when , how files compiled java bytecode? the templates there dynamic scaffolding. example if have controller this class personcontroller { static scaffold = person } then it'll use template create controller @ runtime. isn't used in real apps - it's more demos , getting started - it's option. dynamically generated controller , gsps created based on templates , compiled in-memory. the groovy-all jar have code can compile groovy source, that's because it's "-all" jar. because it's there doesn't mean it's used. in general compilation done when building war, including precompiling gsps. performance - want app fast possible in production.

Double buffering in Java on Android with canvas and surfaceview -

how 1 go doing this? give me outline? from i've found online, seems in run() function: create bitmap create canvas , attach bitmap lockcanvas() call draw(canvas) , draw bitmap buffer (how??) unlockcanvasandpost() is correct? if so, bit of explanation; these steps mean , how implement them? i've never programmed android before i'm real noob. , if isn't correct, how do this? it's double buffered, that's unlockcanvasandpost() call does. there no need create bitmap.

python - Loading modules at runtime from functions -

i load modules @ runtime. if works: a = __import__('datetime',globals(),locals(),[],-1) e in a.__dict__: if not e.startswith("__"): globals()[e] = a.__dict__[e] but if try doesn't work: def module_loader(modname,g,l): = __import__(modname,g(),l(),[],-1) e in a.__dict__: if not e.startswith("__"): g()[e] = a.__dict__[e] module_loader('datetime',globals,locals) any help? your snippet above works me if call as module_loader('datetime', globals, locals)

javascript - Problem with "initially_open" option with JStree -

Image
i'm working on first app using jstree , have doing need navigation tree. have javascript code working dynamically builds html list structure page using knockoutjs (somewhat of overkill here, use knockout elsewhere on page). after attach jstree html, dom looks likes - <div id="menutreelist" data-bind="template: "treemenutemplate"" class="navtree jstree jstree-0 jstree-focused jstree-default"> <ul class="jstree-no-dots jstree-no-icons"> <li id="menu_1" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><span> <a href="#" class=""><ins class="jstree-icon">&nbsp;</ins>cares home</a></span> </li> <li id="menu_2" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="#"...

android - EditText setError() with no message just the icon -

currently have simple code validates edittext fields , when user hits button @ end checks them. put errors in fields this: if (!emailmatcher.matches()) { email.seterror("invalid email"); } if (!zipmatcher.matches()) { zipcode.seterror("invalid zipcode"); } my problem keyboard popup , move error bubble random place. hoping not have error bubbles message keep error icons in invalid edittext fields. tried inputting seterror(null) doesn't work. ideas? your code perfect show icon only. as edittext show related when has focused. change code that... if (!emailmatcher.matches()) { email.requestfocus(); email.seterror("invalid email"); } if (!zipmatcher.matches()) { zipcode.requestfocus(); zipcode.seterror("invalid zipcode"); }

ruby - Savon: How to change header from being <env:Header> to <soap:Header> or something different -

in savon, there way change <env:header> to be <soap:header> or different? i've tried in request block putting additional header tag this: soap.header['soap:header'] but won't work. i've browsed savon docs , haven't found anywhere change tag, manually building xml. edited savon 1.0.0 the value can set in configure block can set logging , other parameters. put savon.configure |c| c.env_namespace = :soap end into code.

sql - Long Query Times -

i have table 23.5 million rows , 20 columns. updated table set 1 of columns null . query took hour complete. granted, don't have amazingly fast database server, update time normal? didn't have index on table when ran update. how have helped? thanks in advance! considering updated rows, index wouldn't have helped any. were there reads going on @ same time? updates cause row level locking, if brief, cause lot of traffic , waiting in transaction log.

html - jQuery link not fired -

i trying load ajax content, whenever click on link jquery not respond. heres html jquery <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title>title</title> <link rel="stylesheet" type="text/css" href="e3.css"> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> $.ajaxsetup ({ cache: false }); var ajax_load = "<img src='img/site/loader.gif' alt='loading...' />"; // load() functions $(document).ready(function() { $("#omta").click(function() { var loadurl = "fomt.php"; $("#usr") .html(ajax_load) .load(loadurl, "fid=<?php echo $fid;?>"); } ); ); </script> </head> <body> <div id=...

c# - Export/Import subset of data from SQL-Server -

as feature our application, looking find best way export subset of related data database sql-server 2008 express database out disk. exported content required imported keeping identities database , server. i have medium sized data model of 143 tables, on use entity framework 3.5 data access in our applications. model want extract rows tables based on given criteria. new c# , entity-framework, not new sql-server, i've taken on project developer began writing toxml() methods each entity extracted (20% done). maintenance nightmare. worse fromxml() entities, there complexities having unique keys etc... i experimented select ... xml auto, xmlschema combined microsoft sqlxml bulk loading. while @ first went plain vanilla tables, ran dead-end because appears not support xml data types without schemas or @ least without deal of manual intervention. have several tables xml data type columns. there yet unknown complexities bulk-loading in general having triggers, nulls, uniqu...

perl - Why is FastCGI fast? -

fastcgi provides way improve performance of thousands of perl applications have been written web. - source and how that? mark r. brown's whitepaper on subject claims 1 of primary benefits of fastcgi different requests can share single cache, making caching practical: today's deployed web server apis based on pool-of-processes server model. web server consists of parent process , pool of child processes. processes not share memory. incoming request assigned idle child @ random. child runs request completion before accepting new request. typical server has 32 child processes, large server has 100 or 200. in-memory caching works poorly in server model because processes not share memory , incoming requests assigned processes @ random. instance, keep frequently-used file available in memory server must keep file copy per child, wastes memory. when file modified children need notified, complex (the apis don't provide way it). fastcgi des...

architecture - Android Application Level Scope Variables -

i understand there no application level scope available able define shared logic/data, , each activity stand alone application tied manifest... but have group of user access permissions getting via web service call , not want make call in every activities oncreate() . i using sharedpreferences in application, since permissions not intended editable user, flat file exposure on android devices feels insecure way handle this. i need re-request info if application restarted, believe least expensive store in variable. i aware of intentextras talking settings "object", not primitive type. right way handle situation? you can create "application" class can used create application wide settings. just create new class , extend application, set class members , appropriate getter/setter methods , can access them throughout application. you need update manifest follows: <application android:icon="@drawable/logo" android:lab...

dxcore - How to get the classes that implement an interface in CodeRush? -

Image
i trying write method returns list of classes implements interface, not it. some method public list<class> getimplementedclasses(interface interface1) { . . . } i tried use interface1.allchildren , many other tries. non of them gave results. is possible write such method using dxcore apis? example: if pass interface1, should class1 , class2 method getimplementedclasses. thanks in advance. there's "getdescendants" method in intrerface class might useful task. code similar this: public list<class> getimplementedclasses(interface interface1) { list<class> result = new list<class>(); if (interface1 != null) { itypeelement[] descendants = interface1.getdescendants(); foreach (itypeelement descendant in descendants) { if (!descendant.inreferencedassembly) { class classdescendant = descendant.tolanguageelement() class; if (classdescendant != null) resul...

c# - ASP MVC 2 issue - trying to display images in a for-loop in a view -

i'm trying display ranking video game review. ranking displayed number of gold stars out of 5. so, if game has review score of 3, there should 3 gold stars, followed 2 gray/empty stars. i have following loops in view render images: <% (int = 0; < model.game.reviewscore; ++i) { %> <img src="~/content/images/review/goodscore.png" alt="" runat="server" /> <% } %> <% (int j = 0; j < (5 - model.game.reviewscore); ++j) { %> <img src="~/content/images/review/badscore.png" alt="" runat="server" /> <% } %> the problem 1 goodscore.png image being displayed in loop. similarly, if score allows empty stars, 1 badscore.png displayed. looking @ rendered html game score of 3, see: <img src="../content/images/review/goodscore.png" /> <img /> <img /> <img src="../content/images/review/badscore.png...

Forcing an argument in a Clojure macro to get namespace-captured -

i working on clojure macro build gridbaglayout-based jpanels. can java classes in defaults map inside macro namespace-qualify, not passed in arguments. magic combination of backquotes, quotes, tildas, or else need? (import [java.awt gridbagconstraints gridbaglayout insets] [javax.swing jbutton jpanel]) (defmacro make-constraints [gridx gridy & constraints] (let [defaults {:gridwidth 1 :gridheight 1 :weightx 0 :weighty 0 :anchor 'gridbagconstraints/west :fill 'gridbagconstraints/none :insets `(insets. 5 5 5 5) :ipadx 0 :ipady 0} values (assoc (merge defaults (apply hash-map constraints)) :gridx gridx :gridy gridy)] `(gridbagconstraints. ~@(map (fn [value] (if (or (number? value) (string? value) (char? value) ...

C# Formatting Long variable as String -

i'm trying take variable (long), , convert string, such that: 150 -> 150 1500 -> 1,500 1234567 -> 1,234,567 i know shouldn't difficult, far, i've been able find 2 different solutions, , they're not giving me output want: this: string.format("{0:n}", *long variable*.tostring()) gives me: 2000 -> 2000 and this: *long variable*.tostring("n" or "n0") gives me: 2000 -> 2000.00 someone commented correct syntax on answer deleted, sake of reading in future, here works: string.format("{0:#,##0}", *long variable*)

mysql - Rearrange Column Order in Navicat -

in navicat can arrange order of columns have yet find way sync changes database. saw similar question here -> rearrange column order in sqlyog haven't found similar in navicat. have many tables need fixed export excel , order important in readability/presentation. typing out sql code each move way tedious. in advance. you can't in navicat , have run sql query purpose

.net - trying to serialize and deserialize entity object in c# -

i using 2 methods below serialize/deserialize entity framework object (ver. 4.0). tried several ways accomplish this, , had no luck. serialization works fine. nice xml formatted string, when try deserialize error in xml. how possible? thanks. public static string serializeobject(object obj) { xmlserializer ser = new xmlserializer(obj.gettype()); system.text.stringbuilder sb = new system.text.stringbuilder(); system.io.stringwriter writer = new system.io.stringwriter(sb); ser.serialize(writer, obj); xmldocument doc = new xmldocument(); doc.loadxml(sb.tostring()); string xml = doc.innerxml; return xml; } public static object deserializeanobject(string xml, type objtype) { xmldocument doc = new xmldocument(); doc.loadxml(xml); xmlnodereader reader = new xmlnodereader(doc.documentelement); xmlserializer ser = new xmlserializer(objtype); object obj = ser.deseri...

ios - CVImageBuffer comes back with extra column padding. How do I crop it? -

Image
i have cvimagebuffer comes recorded height of 640px , width of 852px. bytes per row 3456. you'll notice 3456/852px != 4 (it's 4.05). after inspection, 864 width makes bytesperrow/width = 4.0. so, seems there 12px on each row (padded on right). i'm assuming because these buffers optimized multiple image not have. when render out buffer in opengl looks terrible (see below). noticed pattern repeats every 71px, makes sense because if there 12px (852/12px = 71). so, 12 pixels seem causing problem. how rid of these pixels , use data read opengl es? or rather, how read opengl es skipping these pixels on each row? it's pretty common images used high speed image processing algorithms have padding @ end of each line image has pixel or byte size multiple of 4, 8, 16, 32, , on. makes easier optimize algorithms speed in combination simd instruction sets sse on x86 or neon on arm. in case padding 12 pixels, means apple seems optimize algorithms processing 32 pixels...

ruby - Rails 3 - request.request_uri in model -

exist way have in own function in model request.request_uri ? now have in model called func.rb this: class func def self.url_adr request.request_uri end end but getting error undefined local variable or method `request' func:class the request object available controllers. suppose pass in argument model if must, e.g. ##### in controller func.url_addr(request) ##### in model def self.url_adr(controller_request) controller_request.request_uri end however, ian has point, request data not associated models.

iphone - UISlider for scrubbing the AQPlayer like iPod -

can tell me how scrub aqplayer ( used in apple's speakhere example ) using uislider ipod does? i know how handle slider part, once have value slider, need set/change/update in aqplayer, or audioqueue, player moves part of queue , continues playing point? there easy way percentage of playing time or have make calculations packets?? thanks input. al for needs seek/scrubb in audio file, found solution question @ following link: audio queues have @ function -(void)seek:(uint64)packetoffset; it worked after initial fine tuning.

cakephp - PHP memory usage for fopen in append mode -

i have custom cakephp shopping cart application i’m trying create csv file contains row of data each transaction. i’m running memory problems when having php create csv file @ once compiling relevant data in mysql databse. csv file contains 200 rows of data. alternatively, i’ve considered creating csv in piecemeal process appending row of data file every time transaction made using: fopen($mfile.csv, 'a'); my developers saying still run memory issues approach when csv file gets large php read whole file memory. case? when using append mode php attempt read whole file memory? if so, can recommend better approach? thanks in advance, ben i ran following script few minutes, , generated 1.4gb file, on php memory limit. read file without issue. if running memory issues else causing problem. $fp = fopen("big_file.csv","a"); for($i = 0; $i < 100000000; $i++) { fputcsv($fp , array("val1","val2","val3",...

android - What's the purpose of startManagingCursor? -

ok, documentation states lets activity manage cursor's lifecycle. don't see point of since when activity destroyed, references newly created cursor should erased , cursor left perish in next garbage collecting cycle. why bother? you should not rely on cursors being destroyed garbage collector... cursor represents significant amount of resources: of data held cursor, plus connection content provider owns cursor means requiring process kept in memory. in more recent versions of android, log messages printed if cursor's finalizer runs without being explicitly closed, because important apps close cursors when done them. managed cursors take care of closing cursor when activity destroyed, more well: deactivated , requeried activities stopped , restarted. that said, @ point should consider managed cursors deprecated. new loader api lot better, , has many improvements user experience of app -- ensures cursor operations done off main thread (so there not glitch...

javascript - Anyone know how to get a browser status bar like the one in Digg.com? -

if have @ digg.com, there persistent status bar (i.e. digg version number etc). i have played few jquery plugins, don't anchor bottom 1 in digg.. have tried @ css, can't quite understand bits needed.. any ideas/pointers welcome? <--- edit: solution ---> thanks answer/comments below, have ended follow (just in case else wants basic working version going..): the css is: .footer-bar { background: -webkit-gradient(linear,left top,left bottom,from(#f3f3f3),to(white)); background: -moz-linear-gradient(top,#f3f3f3,white); background-color: white; border-top: 1px solid #aaa; bottom: 0; color: #333; font-size: .833333333333em; font-family: arial narrow; height: 12px; padding: 5px 0; position: fixed; right: 0; text-align: left; width: 100%; z-index: 5; } obviously can change rele...

How to view IOS documentation using Xcode? -

is there shortcut can use display or search obj-c api? say, i'd learn more ibaction does, wonder if can mouse on , view documentation. there way can enabled? side bar possibly? please advise option-click class name , window pop description. click book icon , window open class. command click view h file.

c# - How to validate a datagridview column with 3 database field combine together -

basically have datagridview retrieve database , 3 of database field column combine column in datagridview. but problem come, need update before need validate user have editing before click on update button, don't know how validate them when in same column in datagridview. i able validate column 1 database field p.s doing editing , updating in datagridview, need validate 3 database field column. this how call databasase datagridview ps. position int protected void bindstaff() { sqlconnection conn = new sqlconnection("data source=.\\sqlexpress;initial catalog=brandcom;integrated security=true"); sqldataadapter adapter = new sqldataadapter("select staffid, (staffname+','+ staffnric+','+ position + ';')as staffdetail, yearin, age, address, email, stayindicator staffbook", conn); dataset ds = new dataset(); adapter.fill(ds); dgvstaffbook.datasource = ds.tables[0]; } this column saying able validate (only 1 database ...

javascript - Unable to change the visibility of HTML elements -

i trying change visisbility of row of elements. supposed display elements if user selects button. html code : <tr style="display:none"> <td><input type="submit" value ="home" onclick="" id="home"/></td> <td><input name="home_phone" id="home_phone" type="text" value="phone" ></td> </tr> js code : document.getelementbyid("home").style.display = ''; document.getelementbyid("home_phone").style.display = ''; i trying achive using html , js . you javascript code correct. the problem setting display value element nested within hidden element. have change style of <tr> because hidden element. html code: <a href="javascript:togglerow('home_row');">toggle home row visibility</a> <table> <tr id="home_row"> <...

How to extract HTML styled text from an EditText in Android? -

i using html.fromhtml(...) style text of edittext in android. need pass styled text result activity. however, when use intent pass contents of edittext unable figure out how retain html style of original text. as example, suppose original text in edittext is: today 21 st when extract text of using edittext.gettext() , send result resulting text is: today 21st is there way extract html styled string edittext? you can send html text , call html.fromhtml in activity passing text. fromhtml meant used text has displayed on screen

import - Importing classes in NetBeans -

in eclipse once put library on class path, can use classes , right click on class name , eclipse gives suggestions of various classes matching names can imported. i wish similar thing in netbeans, mouseover or select classname , click alt+enter suggested. options creating class within application. library opencsv - have used without trouble in eclipse (but want try netbeans). this code (i want import classes csvreader , filereader) ... gives me option create own): csvreader reader = new csvreader(new filereader("yourfile.csv")); string [] nextline; while ((nextline = reader.readnext()) != null) { // nextline[] array of values line system.out.println(nextline[0] + nextline[1] + "etc..."); } i don't want have manually write import statements ... netbeans expects? you have use menu option "source -> fix imports" generate missing imports your

sql - CASE: WHEN column1 IS NULL THEN write column2 -

is possible show data column if checked column null? for example : columns : color , originalcolor table : tablecolors [color, originalcolor] [w, b] [ , g] [b, y] and select case when color null "extract data originalcolor" tablecolors should following list: w, g, b could looking coalesce ? function return first non- null value. select coalesce(`color`, `originalcolor`) `color` `tablecolors`;

input - GWT Celltable and TABbing -

so have gwt celltable various inputs, including selectboxes, edittextcells , links. tab go along each cell. however, can tab switching go between selectboxes(when keyboardselectionpolicy.disabled ). (ie here ). doesnt tab edittextcells or other cells. (potentially relatedly, edittext <input> s seem cannot have tabindex!=-1, or else see celltable throwing errors. (and seems warn in edittext shouldnt this). is there tabindex edittext or other generic cells i'm missing maybe? 1 guy here seemed couldnt work , opt'd out. but according issue @ googlecode , other people doing successfully. ok adding tabindex work. edittextcell added new template (normally safehtml-rendered) text this: interface templatebasic extends safehtmltemplates { @template("<label tabindex=\"{1}\">{0}</label>") safehtml input(string value, string index); } and later in render when sets ... else if (value != null) { safe...

sql - how to encode special character using php function -

my orginal text 1 1/2"w x 1/2"h , in database likes 1 1/2â€w x 1/2â€h . i using stripslashes(). but still can't convert encrypted string. thank i added html. <meta http-equiv="content-type" content="text/html; charset=utf-8" /> i don't know read have use stripslashes() escape database input or output information wrong. have use specific escaping mechanism provided database library. instance, if using pdo can use bindvalue() inject values sql code. as 1 1/2â€w x 1/2â€h , looks multi-byte utf-8 string misinterpreted single-byte encoding (possibly iso-8859-1). looks either trying fit utf-8 data latin1 database or providing wrong charset when connecting database. in first case, best solution changing db charset match application's charset (if dbms allows so). in second case, you'll find solution in php manual page whatever db library is : method specify charset or encoding of connection.

python - Proper way to deal with string which looks like json object but it is wrapped with single quote -

by definition json string wrapped double quote. in fact: json.loads('{"v":1}') #works json.loads("{'v':1}") #doesn't work but how deal second statements? i'm looking solution different eval or replace. thanks. not sure if got requirements right, looking this? def fix_json(string_): if string_[0] == string_[-1] == "'": return '"' + string_[1:-1] +'"' return string_ example usage: >>> fix_json("'{'key':'val\"'...cd'}'") "{'key':'val"'...cd'}" edit: seems humour tried have in making example above not self-explanatory. so, here's example: >>> fix_json("'this string has - i'm sure - single quotes delimiters.'") "this string has - i'm sure - single quotes delimiters." this examples show how "replacement" happen...

how to typdef an enum of one namespace inside another and use ist c++ -

possible duplicate: how import enum different namespace in c++? how can following enum namespace problem been solved? namespace { typedef enum abar { a, b }; void foo( abar xx ) {} } namespace b { typedef enum a::abar bbar; void foo( bbar xx ) { a::foo( xx ); } } int main() { b::foo( b::a ); // 'a' : not member of 'b' // 'a' : undeclared identifier } while typedef type, don't import symbols defined in namespace. while can write: int main() { b::bbar enumvariable=a::a; } you cannot access b::a symbol not exist. a partial walkaround and, in opinion, way make code more clean, although bit more longer write, pack every enum own struct, e.g.: struct abar { enum type {a, b}; }; typedef abar bbar; int main() { abar::type var=abar::a; bbar::type var2=bbar::a; } you able to, if still need it, pack abar namespace , typedef in namespace too.

video - Saving AV stream from IP Cam under Quicktime format in IPhone -

my current project modify 1 of our company's iphone app such can record video stream our wireless ip cam , save under format iphone able play, quicktime format. currently app can record video under uncompressed avi format writing necessary headers, video frames , audio datas files. thus, if want save stream in .mp4 or .mov format, have compress video. i'm pretty new field i'm still @ loss should use next. i've heard ffmpeg, i'm still trying use it, pretty difficult. question is, can use ffmpeg task? if yes, have port library objective c? of course, if there's other method achieve task, feel free suggest me. thank you. edit: should add app receiving images camera http request. this: http://192.168.2.1/?action=appletvastream

richtextbox - RichTextToolbar in GWT 2.3 -

i'm trying create richtextarea (following gwt showcase : link ) when code completion of richtexttoolbar, i'm not able find it. external library? and googled , found : google code link . same library in google showcase? or richtexttoolbar old implementation not being brought version 2.3? update:i tested , feel although implementation same, ui looks different though. it seems created own version of richtexttoolbar . this class part of gwt showcase .

workspace - RAD does not prompt for worksapce -

when open rad not prompt workspace. verified in preference=>general=>startup , shutdown=>prompt workspace check box checked. still not prompt while start up. ideas how rad prompt workspace? thanks uma i surprised setting preferences has not worked. it works me on eclipse , rad(and other eclipse based tools wid). the file(org.eclipse.ui.ide.prefs) these preferences persisited in teh file system. look under directory \configuration.settings\org.eclipse.ui.ide.prefs i not showing entire file here (as clutter). @ show_workspace_selection_dialog , ensure it's value true. max_recent_workspaces=5 show_workspace_selection_dialog=true eclipse.preferences.version=1 hth manglu

How to Search a File through all the SubDirectories in Delphi -

i implemented code again not able search through subdirectories . procedure tffilesearch.filesearch(const dirname:string); begin //we write our search code here if findfirst(dirname,faanyfile or fadirectory,searchresult)=0 begin try repeat showmessage(inttostr(searchresult.attr)); if (searchresult.attr , fadirectory)=0 //the result file //begin lbsearchresult.items.append(searchresult.name) else begin filesearch(includetrailingbackslash(dirname)+searchresult.name); // end; until findnext(searchresult)<>0 findclose(searchresult); end; end; end; procedure tffilesearch.btnsearchclick(sender: tobject); var filepath:string; begin lbsearchresult.clear; if trim(edtmask.text)='' messagedlg('empty input', mtwarning, [mbok], 0) else begin filepath:=cbdirname.text+ edtmask.text; showmessage(filepath); filesearch(filepa...

Order totals block on Magento order email and invoice email templates -

can point me templates/code blocks used order totals block on magento order mail , invoice e-mail templates? the tax issue solved need implement logic rid of shipping , subtotal. templates used emails? found frontend , changed needed, can't find template/block used e-mails sent system. can point me in right direction? thanks, bart niels answer of app/design/frontend/base/default/template/sales/order/totals.phtml correct thought further clarification in order because 1 doesn't merely make cosmetic changes file in order effect desired change. totals.phtml loops on "totals", each of produces total-related line-item (subtotal, shipping & handling, tax, grand total (excl. tax), , grand total (incl. tax)). best bet use mage::log output each of totals (which looped on via associative array $_code => $total ). if log each key ( $_code ), you'll see names such subtotal , shipping , grand_total , tax , , grand_total_incl . filtered out sales or...

java - Xerces Sax2 parser encoding problem -

i've got sax parser class used in swing application , in web project deployed glassfish. the class parses xml files. works in netbeans ide swing application(in ide) , web project. but when clean , build swing app 1 .jar doesn't recognize anymore symbols ī, ķ, ļ, ā xml file. the same problem happens if compile , run through cmd. had same problem in web project - sorted using glassfish configuration. the question how solve problem in swing app? here peace of code: public void parsedocument(string filepath) { try { xmlreader xr = xmlreaderfactory.createxmlreader(); xr.setcontenthandler(this); inputsource = new inputsource(new filereader(filepath)); is.setencoding("utf-8"); xr.parse(is); }catch(saxexception se) { se.printstacktrace(); }catch (ioexception ie) { ie.printstacktrace(); } } no setencoding() method. you have answered question, other ...

Add Loading Spinner to JQuery UI Tab Body -

is there simple way show loading spinner in body of jquery ui tab while loading via ajax? essentially looking spinner option, displaying graphic , loading message in tab body rather tab title. this should work jquery ui 1.9+ ajax loaded tabs (assuming tabs have id 'tabs'): $("#tabs").tabs({ // loading spinner beforeload: function(event, ui) { ui.panel.html('<img src="loading.gif" width="24" height="24" style="vertical-align:middle;"> loading...'); } }); you'll need put loading.gif in right place , adjust img tag src, width , height, think idea. can bunch of spinner images @ http://www.ajaxload.info/

javascript - Remove existing code side of div code -

goal: if there html syntax code or data inside of <div id="feedentries"></div> then should removed , contained empty only. problem: syntax need in order remove every code , data inside of <div id="feedentries"></div> please remember don't want add class or id inside of "feedentries" <h3>search</h3> <div class="content"> <form> <input type="text" width="15" value="searchword" id="searchtermtextfield"><input type="button" name="some_name" value="sök" id="searchbutton"> </form> <div id="feedentries"> </div> </div> function fetchsearchresults(json) { var feedentriesdivelement = document.getelementbyid('feedentries'); var ulelement = ...

directory - android Reading all the Directories in SDCARD which has images -

i trying read images in sdcard directory in present. e.g: if there file test.jpg in /mnt/sdcard/album1 , test2.jpg in /mnt/sdcard/album1/album2 should able directory name album1 , album2. have written code in recursive manner, works when no of folders less when number of directories increases loop come out of it. public void getimagefoldes(string filepath){ string albumpath; file file = new file(filepath); file[] files = file.listfiles(); (int fileinlist = 0; fileinlist < files.length; fileinlist++) { file filename; filename =files[fileinlist]; if(filename.ishidden()|| filename.tostring().startswith(".")) return; if (filename.isdirectory()){ albumpath = filename.tostring(); string[] split; string title; split= albumpath.split("/"); title=split[split.length-1]; result = new thumbnailresults(); ...

iphone - Logic of using UISlider Xcode -

i'm stuck @ moment controlling uislider in xcode. i've made horizontal slider in interface builder , manage code controls in xcode. right i'm not sure how code logic. if user slides nib left, i'd rotate image counter-clockwise , if user slides right, rotate image clockwise. minimum value of slider i've set 0 , max 100. initial value 50. for transformation i'm using cgaffinetransformmakerotation(myangle). i've set myangle float. condition, here's snippet of code: myslider.value = myangle; // cgaffine if(myangle < 50) { myangle -= 0.1; } if(myangle > 50) { myangle += 0.1; } when slide nib, rotates anti-clockwise. what's best logic can use? hope can help. thanks. -hakimo note doc says angle as, the angle, in radians, matrix rotates coordinate system axes. in ios, positive value specifies counterclockwise rotation , negative value specifies clockwise rotation. in mac os x, positive value specifies clockwise rot...

symfony1 - Symfony: on response ready event -

in project, i've implemented custom i18n class collects untranslated strings during page load. now, save them message source after response has been built (hence strings collected). right event hook into? the "response.filter_content" event gets fired right before sending response browser. hope helps.

c# - I am looking for a specific control panel -

i looking specific control panel contain 3 gridviews have. user should flip through gridviews (preferably no postback). controls of flipping should @ top of panel. "control panel" can use achieve aim? if understand correctly mean "flip", use asp.net ajax tabcontainer organize gridviews in different tabpanels. asp.net-ajax load tabpanels/gridviews asynchronously , if visible. here tips. lazy-load tabpanels tabcontainer: tips&tricks

java - How to add components to JFrame once it's visible without having to resize it? -

i have program have jframe jbutton in it. when user clicks jbutton , components of jframe removed, , jpanel red background added it. when click jbutton , red jpanel not become visible unless resize jframe (i using windows 7). there way achieve want without having manually resize jframe ? here part of code using: public class demo implements actionlistener{ public static void main(string args[]){ ............... button.addactionlistener(this); //'button' object of jbutton class. frame.setvisible(true); //'frame' object of jframe class. ............ } public void actionperformed(actionevent ae){ frame.removeallcomponents(); frame.add(panel1); //panel1 object of jpanel class red background. /* here problem lies. panel1 not visible me unless manually resize jframe. */ } } for removing (and then, example, add new jcomponents) jcomponents jpanel or top-level co...

How do I enable a user to share my URL to their stream in Google+ (Plus)? -

does know if there available enable sharing of url stream in google+ options in facebook or twitter? i have found documentation on how +1 , nothing on how share stream. there available yet has come across? the +1 button allows users share urls stream: http://googleblog.blogspot.com/2011/08/doing-more-with-1-button-more-than-4.html

linux kernel - Access IF_RA_MANAGED and IF_RA_OTHERCONF from userspace -

i need access if_ra_managed , if_ra_otherconf ( in6_dev->if_flags ) userspace. does know how can it? thanks i think can pf_netlink socket. the ip utility, part of iproute2 has monitor mode appears show information, example: ajw@rapunzel:/tmp/iproute-20100519/ip > ip -6 monitor 2: eth0 inet6 2001:xxxx:xxxx:0:xxxx:xxxx:xxxx:xxxx/64 scope global dynamic valid_lft 86400sec preferred_lft 14400sec prefix 2001:xxxx:xxxx::x/64 dev eth0 onlink autoconf valid 14400 preferred 131084 (some exact addresses removed paranoia's sake). don't have ras flags set on lan, i'm 99% sure show there too. poking around strace shows interesting calls seem be: socket(pf_netlink, sock_raw, 0) = 3 setsockopt(3, sol_socket, so_sndbuf, [32768], 4) = 0 setsockopt(3, sol_socket, so_rcvbuf, [1048576], 4) = 0 bind(3, {sa_family=af_netlink, pid=0, groups=fffffff7}, 12) = 0 getsockname(3, {sa_family=af_netlink, pid=7151, groups=fffffff7}, [12]) = 0 time...

How to fire raw MongoDB queries directly in Ruby -

is there way can fire raw mongo query directly in ruby instead of converting them native ruby objects? i went through ruby mongo tutorial, cannot find such method anywhere. if mysql, have fired query this. activerecord::base.connection.execute("select * foo") my mongo query bit large , executing in mongodb console. want directly execute same inside ruby code. here's (possibly) better mini-tutorial on how directly guts of mongodb. might not solve specific problem should far mongodb version of select * table . first of all, you'll want mongo::connection object. if you're using mongomapper can call connection class method on of mongomapper models connection or ask mongomapper directly: connection = yourmongomodel.connection connection = mongomapper.connection otherwise guess you'd use from_uri constructor build own connection. then need hands on database, can using array access notation , db method, or current 1 straight mongom...

java - Is this the right way to add 2 arrays into SimpleAdapter -

i use simpleadapter display 2 strings, 1 on left , other on right, listview, the strings in 2 different arrays. , 1st array 1st in array b in 1st line, , on.. here part of code use: string[] array= getresources().getstringarray(r.array.names_list); int lengthtmp= array.length; for(int i=0;i<lengthtmp;i++) { counter++; addtolist(array[i]); } adapter = new simpleadapter(this,list,r.layout.start_row,new string[] {"number","suraname"},new int[] {r.id.start_numbering,r.id.start_name}); private void addtolist(string name) { hashmap<string,string> temp = new hashmap<string,string>(); temp.put("number", integer.tostring(sortingpictures[counter-1])); temp.put("suraname", name); list.add(temp); } i'm sure there better way make want. can suggest correct way? thanks. no not proper way implementing here given link read id , idea implementin...

webpage as a screensaver windows 7 and XP? -

is there way specify webpage/url screensaver in both windows 7 , xp? i found web screen saver 2010se , shareware program ($19.95), doesn't work in windows 7. any other ideas? update: although accept solutions 1 above, answers in .net good! actually, e-motional.com has screensaver called auto web view screensaver lets enter url (or list of urls) , screensaver shows pages.

asp.net - Using databound controls to obtain sum from column in related entity in Databound Gridview -

i have gridview bound datasoure on page load. datasource connected various other database tables, ie. datasourceitem.relatedentity there column in gridview value dependent upon sum of field in related relatedentities . so datasourceitem has 1 many relationship relatedentity , , need sum value specific column in related relatedentities . want possible, , know syntax wrong, kind of wanted do: markup: <asp:templatefield headertext="sum"> <itemtemplate> <asp:label id="lblsum" runat="server" text='<%# bind("relatedentity.columnname").sum() %>' /> </itemtemplate> </asp:templatefield> code-behind (databinding): mygridview.datasource = ds in datacontext.datasource ds.id == selectid select ds; mygridview.databind(); i want keep amount of code minimum, if @ possible, please me figure out how. clear, line of code want make work t...

c# - Unit Testing - Session object? -

i have implemented unit of work pattern, , environment using more unit testing. implementation writes session helper writes session. how unit test these aspects in regard session? should make repository pattern? (repository interface concrete session implementation , concrete mock implementation) how done? i know there more 1 way of approaching this, looking advice. there 2 ways of doing this. assuming using .net 3.5 or up. change implementation take httpsessionstatebase object constructor parameter, can mock implementation - there's few tutorials online on how this. can use ioc container wire @ app start or (poor man's dependency injection): public class myobjectthatusessession { httpsessionstatebase _session; public myobjectthatusessession(httpsessionstatebase sesssion) { _session = session ?? new httpsessionstatewrapper(httpcontext.current.session); } public myobjectthatusessession() : this(null) {} } alternatively, , b...

c# - how to pass baseclass/inheritedClass as web-service parameter? -

i'd in c# : public bool method(baseclass ) { ... } with classes: abstract baseclass ; inheritedclass1 , inherited class2. i'm trying pass object inhertited classes <baseclass xsi:type="inheritedclass1" > .... </baseclass> but while executing soapui got no answer @ not error. i tried xmlinclude without success. how can done?

php - Kohana 3.1 equivalent of Request::instance()->directory? -

have bit of code in app... request::instance()->directory after upgrading 3.1 stopped working... wondering 3.1 equivalent of be...? thanks request::initial()->directory()

iphone - In app purchase - How Subscription works? -

i'm working on magazine app ipad , i've been asked build system allow users subscribe for, say, year. have say... didn't quite concept of subscription... anyway, there's point: should implement real subscrition model of payment or can go standard consumable one? mean, if 20euros allow app download secret code, boolean, enable download of future issues of year, why should prefer subscription model? thanks all, marcello there's no need "build system allow users subscribe" since there subscription billing service offered apple: apple launches subscriptions on app store cupertino, california—february 15, 2011—apple® today announced new subscription service available publishers of content-based apps on app store℠, including magazines, newspapers, video, music, etc. same innovative digital subscription billing service apple launched news corp.’s “the daily” app.

javascript - Adobe Air works with hardcoded filePath, but fails when specifying filePath via command line -

i don't know why is. i'm using backbone adobe air. if hard code filepath url attribute backbone in adobe air, works, specifying via command line doesn't work. alerted filepath , same full file path. clue? fixed it, arguments passed array, wrongly thought of string.

tfs2010 - Visual Studio / TFS 2010 / Get Latest / Compile Fails for some not for others with Reference Error -

setup: all development being done on virtual servers (win server 2003) all compiles being done in vs 2010 all code checked tfs 2010 we migrating our solutions vs 2008 vs 2010. created main branch folder containing our converted vs 2010 projects. branched on , worked through getting projects migrated 2008. compiles (eventually) successful. developer working through other projects on same branch. we got of these projects compiling through tfs build 2010. this our main branch. developer created dev branch folder , branched of solutions main branch dev branch ongoing development. much our surprise, found though compile code if did latest on main branch, when did latest on dev branch (supposedly same code), some of (we'll call them unlucky developers) got slew of errors having reference project contained in solution. 2 developers (lucky) had compile fine. when 2 unlucky ones compile individual project (the 1 causing reference error) bui...

php - Blog with heavy load of pictures-Speed up page -

i'm building travel blog (php) might loading dozens of pictures (size 500x375 weight 150-200kb) page weights more 4-5mb. way go apart caching/gzip decrease waiting time , make better user experience? i'm on shared server budget low thanks some options: split images across multiple pages use 'lazy load' script request images come viewport use ajax request images needed via user action leverage external hosting of images (flickr, etc) split server requests amongst different servers.

call a function in vim when opening a file with a specific name ignoring directories (regex as a variable) -

i'm trying make vim check filename of file it's open if @%== .\+"notes.tex" highlight done ctermbg=blue ctermfg=white guibg=#292960 guifg=#aaaaaa match done /.\+itemize.\+/ endif i'd script work on file notes.tex regardless of directory. reason pu .+ before notes because want match preceeding characterrs in filename in other words want if match "notes.tex" , "../notes.tex" i think you'd better of using expand("%") function read filename, , using matchstr() check it: if matchstr(expand("%"),"notes\.tex$") != "" highlight done ctermbg=blue ctermfg=white guibg=#292960 guifg=#aaaaaa match done /.\+itemize.\+/ endif note $ in matchstr statement: matches "notes.tex" if @ end of string. the nice approach doesn't care slash direction ( \ or / ) , therefore should platform independent. hope helps.

javascript - Do something once jQuery plugin has loaded -

i'm dynamically loading jquery , jquery ui page, , need know when jquery ui has extended jquery . at moment i'm using readystate of script element loads jquery ui trigger running of code, think @ point, script has loaded, jquery ui hasn't been initialised. is choice poll until $.ui defined? here's code i'm wrestling with: (load_ui = (callback) -> script2 = document.createelement("script") script2.type = "text/javascript" script2.src = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.js" script2.onload = script2.onreadystatechange = -> console.log 'readystate:', @readystate if @readystate == "loaded" or @readystate == "complete" console.log "jquery ui loaded" callback ($ = window.jquery).noconflict(1), done = 1 $(script,script2).remove() document.documentelement.childnodes[0].appendchild script2 console...