Posts

Showing posts from July, 2014

c# - padding in asp.net -

is there function append padding digits left of digit.i want form 3 digit number, when value '3' need make '003' e.g in php have $m_ccode=str_pad($m_casecode,3,"0",str_pad_left); same want convert in asp.net c#. how can it, have numeric value stored in string 's' string s = dropdownlist3.selecteditem.value; string variant1 = "3".padleft(3, '0'); // if have string string variant2 = 3.tostring("000"); // if have number in case need unbox int if numeric value int string s = ((int)dropdownlist3.selecteditem.value).tostring("000");

How do I detect the supported framework architecture (x86 or x86-64) in Mono and .NET? -

in .net/windows there processor_architecture environment variable identifies whether running process x32, x64 or ia64. there's getnativesysteminfo api method can tell whether windows os supports x86-64. is true there x64 version of .net framework long x86 version available on windows x64? or there means detect platforms supported .net installation on machine? what mono/linux or other non-microsoft implementations? can x86 version of mono run on x86-64 linux? how detect (programmatically) platforms supported mono installation? added 16.11.2010 i’m developing kind of plugin system (ok, know there addins system flooded pipeline assemblies). want find out kinds of assemblies can loaded in running process (represented platform neutral assembly) , assembly architectures can executed system in isolated process. solution create test assemblies every architecture in system , try launch not elegant. is true there x64 version of .net framework long x86 version av...

overlapping widgets gtk -

Image
how can make widgets overlap 1 another. lower should image, rest above can other widgets buttons. subclass larger(parent) widget. in create() method or in constructor, add layout ( or container ) widget parent widget, inset others container. threat new subclass if single, specialized, version of super class. a window example of parent widget, while fixed example container. child eventbox enclosing image . composite of these new window object has pictures can clicked. for case of window's titlebar pixmap background, , buttons, try window image , fixed container hold buttons. fixed , image should able overlap fixed transparent, , image has no window . if buttons what's needed, have @ button boxes , toolbars in list of gtk containers . may possible add image background 1 of those. a different approach involves alignment widget (from same list). specifies smaller widgets positioned , sized in proportioned manner. i assumed, oop, if...

jquery shortcuts not working on IE -

hi using jquery.hotkeys.js plug in key board shortcut. other shortcuts working fine f1 not working expected in ie. on 'f1' keypress binds shortcut being called more 1 time , opens window well. the code this: $(document).bind('keydown', 'f1', function (evt) { evt.preventdefault(); evt.stoppropagation(); alert('some message'); window.event.keycode = 0; return false; }); please give me idea this. thanks munish in internet explorer, f1 key cannot cancelled keydown handler. can attach onhelp event instead: window.onhelp = function () { return false; } the firing twice issue possibly bug in plugin code, if it's occurring in internet explorer can work around using onhelp event exclusively: if ("onhelp" in window) // ie window.onhelp = function() { alert("some message"); return false; } else // others $(document).bind('keydow...

security - How can windows users who only log in through a browser change their password? -

i helping run reporting services installation protected , gains permission structure windows usernames , passwords. our password policy dictates passwords change once month. 3 of 5 users of installation log in report manager site windows logins using browsers. at present every month have remote desktop box , change passwords administrator's account , tell users new passwords myself. inevitably end writing new passwords down , far ideal scenario. microsoft claim "change password" dialog should able change windows login windows box can reached. problem have these boxes can reached remote desktop or via internet. have tried entering report server url domain , external ip of serving box domain password dialog not recognise these valid domains. is there way can provide users method changing password via local windows boxes? assuming website hosted on server users log into, run net user {usernamehere} {password} replace password. you on network more compli...

visual c++ - how to use Win32_PerfRawData_Tcpip_NetworkInterface class to get the current bandwidth in C++ -

i wanted how use win32_perfrawdata_tcpip_networkinterface class current bandwidth. want know begining. i'm using xp,microsoft visual c++ 2005 express edition.i'm not getting how to. you may find easier required data using performance counters api directly instead of going through wmi. step step instructions here . after creating query , adding counters it, call pdhcollectquerydata function retrieve current raw data counters in query. many counters, such rate counters, require 2 data samples calculate formatted data value. pdh maintains data current sample , collected sample. following procedure describes how collect counter values require 2 samples calculate displayable value. both apis complex, there no easy way here.

Java NullPointerException during read from keyboard -

i need read values keyboard table, , guess it's going out of range, can't figure out how fix it. exception in thread "main" java.lang.nullpointerexception @ b12.app.main(app.java:36) this line tab.matrix[ai][aj]=parser; whole code: import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; class matrix{ public matrix() { } int rozmiar; double matrix[][]; } public class app { public static void main(string[] args){ matrix tab = new matrix(); int parser; bufferedreader br = new bufferedreader(new inputstreamreader(system.in) ); system.out.println("podaj rozmiar macierzy: "); try { parser = integer.parseint(br.readline()); tab.rozmiar = parser; } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } system.out.pr...

iphone - Temporarily change a UIButtons image -

i have uibutton assign image in ib. i change image in code, want temporary. how 1 return button image set in ib or there way revert after doing temporary switch? thanks if want revert previous image have store reference somewhere: // previmage ivar uiimage * previmage = [[mybutton imageforstate:uicontrolstatenormal] retain]; // change new image ... // later: revert previmage [mybutton setimage:previmage forstate:uicontrolstatenormal]; [previmage release]; previmage = nil;

SVN: Dealing with svn object of the same name is already scheduled for addition -

everytime svn update following error failed add file path/to/file: object of same name scheduled addition i tried rename file, delete it...but error still there. i've read article , reverting...but still can't understand how it... http://thrustlabs.com/blog/2007/04/04/dealing-with-svn-object-of-the-same-name-is-already-scheduled-for-addition-errors-on-windows/ thanks. what client using? "plain" svn client, see if of these solve problems: cd /path/to/directory/with/suspected/duplicate svn revert . svn cleanup svn update if use tortoisesvn, rightclick on folder issues, then: tortoisesvn->revert, tortoisesvn->clean , svn update.

java - XMLStreamReader Problem -

i'm using xmlstreamreader interface javax.xml parse xml file. file contains huge data amounts , single text nodes of several kb. the validating , reading works good, i'm having trouble text nodes larger 15k characters. problem occurs in function string foo = ""; if (xsr.geteventtype() == xmlstreamconstants.characters) { foo = xsr.gettext(); xsr.next(); // read next tag } return foo; xsr being stream reader. text in text node 53'337 characters long in particular case (but varies), xsr.gettext() method returns first 15'537 of them. of course loop on function , concatenate strings, somehow don't think that's idea... i did not find in documentation or anywhere else this. intended behavior or can confirm/deny it? using wrong way somehow? thanks of course loop on function , concatenate strings, somehow don't think that's idea... actually, is idea :) the parser permitted break event stream wishes, long it...

iphone - I have to retain a NSMutableArray although it's a property -

i'm new, read lot memory management, , tried find answer myself. sounds basic , yet apparently don't it. have nsmutablearray property in .h: @property (nonatomic, retain) nsmutablearray *documentlistarray; i synthesize , release in (void) dealloc. populate array, have method - (void)updaterecordlist , in there: self.documentlistarray=[documentdatabase getdocumentlistsortedbydate]; edit:next line: [[self recordlisttableview] reloaddata]; where documentdatabase different class class methods getdocumentlistsortedbydate , getdocumentlist. here happening in getdocumentlistsortedbydate: nsmutablearray *returnarray = [documentdatabase getdocumentlist]; //sorting... nslog("array count:%i",[returnarray count]); //returns correct numbers first , second time return returnarray; and in getdocumentlist nsmutablearray *returnarray = [nsmutablearray arraywithcapacity:files.count]; //add file data array... return returnarray; this works first time call updater...

cocoa touch - Using gradient as background in UITableViewCell -

possible duplicate: uitableviewcell custom gradient background, gradient highlight color hey, want put slight gradient background tableview cells make them more interesting. should make image , put on background or use code draw it? if if should use code explain how? ps. got custom cell make image first, gradient.jpeg instance. then following done inside -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath method configure cells. uiimage *image = [uiimage imagenamed:@"gradient.jpeg"]; uiimageview *imageview = [[uiimageview alloc] initwithimage:image]; imageview.contentmode = uiviewcontentmodescaletofill; cell.backgroundview = imageview; [imageview release]; and yes make image, meant done on capable image editor.

web services - How do I recognize that I am using REST? -

rest looks me simple got question rest. looks urls use. how recognize using rest? difference between simple url like: "http://en.wikipedia.org/wiki/representational_state_transfer" , rest service url. url (hhttp://en.wikipedia.org/wiki/representational_state_transfer) if return json/xml rest, otherwise webpage! in other words: given url, how recognize accessing rest service url or webpage. return type different. if return type xml/json rest otherwise simple webpage! there no way tell url accessing rest service vs. else. given rest architectural style, instead of specific technology, there no specific bit-pattern or given marker should for. from example, cannot tell if returns json vs. html or such, in case server responding accept: string instead of randomly picking 1 or other based on url (although given specific server can respond specific url how likes, there servers determine in way).

php - Embed Movie | want to set autoplay function dependent on whether they have visited site before -

i have embedded movie , trying set php function let me see if user has been here before. if have autoplay set false the followig code not work <?php function autoplay(){ if ($remote_addr == "") { $ip = "no ip"; echo "true"; } else{ $ip = gethostbyaddr($remote_addr); echo "false"; } } ?> any suggestions please you use cookie stored in user's browser. session_start(); before else in page, setcookie('visited','yes',$time+2592000); after before loading movie check if $_cookie['visited'] == "yes"; , thats it. 2592000 seconds in month. paste @ first line of page: <? session_start(); $loopif=($_cookie['visited']=="yes")?false:true;setcookie('visited','yes',$time+2592000); ?> then $loopif false when user has visited before , true when hasnt, echo needed.

c# - ASP.NET MVC change default route on login/logout -

i have pretty simple requirement. if user goes http://www.somedomain.com/ , not logged, want mvc route user homecontroller. if user goes http://www.somedomain.com/ , logged in, want mvc route user clientcontroller. is there easy solution problem? thank much! in homecontroller, index action, redirect clientcontroller if httpcontext.user not null: public class homecontroller : controller { public actionresult index() { if (httpcontext.user != null) { redirecttoaction("index", "client"); } } } edit: or use request.isauthenticated public class homecontroller : controller { public actionresult index() { if (request.isauthenticated) { redirecttoaction("index", "client"); } } }

django plural for templates -

how django realize singular form of countries country , not countrie from docs , if have template variable called num_countries, write like: countr{{ num_countries|pluralize:"y,ies" }}

jsf - JSF2.0: ManagedProperty Lifecycle? -

i have problem don't understand: behind view have controller managedbean requestscoped , data managedbean, holds data view , sessionscoped. so there 2 views, login logindata , logincontroller , overview overviewdata , overviewcontroller. the functionality should that: the user logs application (logincontroller method) if authentication successfull, there redirect overview.xhtml (again in logincontroller method) then overviewdata gets data overviewcontroller, retrieves them business logic layer the overview.xhtml shows retireved data so, point want fill overviewdata out of logincontroller, right after login! (???or if possible right befor overview view constructed, if possible???). i tried managedproperties, 1 initiate in logincontroller different object managedproperty in overviewcontroller, although have same name! how possible. oh boy, doubt guys understand mean, need post code: logincontroller.java ... @managedbean @requestscoped public c...

c - Which string manipulation functions should I use? -

on windows/visual c environment there's wide number of alternatives doing same basic string manipulation tasks. for example, doing string copy use: strcpy , ansi c standard library function (crt) lstrcpy , version included in kernel32.dll strcpy , shell lightweight utility library stringcchcopy / stringcbcopy , "safe string" library strcpy_s , security enhanced version of crt while understand these alternatives have historical reason, can choose consistent set of functions new code? , one? or should choose appropriate function case case? first of all, let's review pros , cons of each function set: ansi c standard library function (crt) functions strcpy 1 , choice if developing portable c code. in windows-only project, may wise thing have separation of portable vs. os-dependent code. these functions have assembly level optimization , therefore fast. there drawbacks: they have many limitations , therefore still have call functions othe...

ActionScript - Get Instance Name From Constructor Without Passing Parameters? -

is possible obtain instance name of class class without having manually pass instance name string parameter class constructor? //create new sizeclass var big:sizeclass = new sizeclass(); //------------- package { public class sizeclass { public function sizeclass() { trace( //-- instance name "big" --// ); } } } no, not possible know containing code block during constructor, save can learn stack trace (though that's not available except in debugger version of flash). if had global access point containing class, still not allow access. think of constructor method call. in line of as, called before assignment. eg: var a:foo = new foo() foo created (the constructor completes), , a populated whatever happened. after point a remain agnostic of context (because of encapsulation) unless told (this true on displayobject -- try this( var mc:movieclip = new movieclip(); trace( mc.root ) //this null ). i...

sql server - Send Data Via Email in T-SQL -

i writing stored procedure collects changes happend in table given date , send recordset administrator via email sql batch job. now untill now, couldn't figure out how send recordset in email body. possible construct email body based on recordset obtained tsql logic. any appriciated thanks theitguy look sp_send_dbmail procedure, allows execute query , send results in e-mail body or file attachment.

iphone - How do I register a custom filetype in iOS -

i creating app in want let user backup files (plist + m4a). zip files , change extension custom 1 (specifically app, "*.mybackup"). user can either export via email or itunes file sharing. i have read cfbundledocumenttypes didn't had them. the part stuck @ how associate extension app. if user sends himself email "custom"-zip file he's supposed able open app. how do , "utexportedtypedeclarations"? i hope it's okay if dump in part of projects info.plist without further explanation. think it's pretty self-explanatory. <key>cfbundledocumenttypes</key> <array> <dict> <key>cfbundletypeiconfiles</key> <array> <string>icon-ipad-doc320.png</string> <string>icon-ipad-doc.png</string> </array> <key>cfbundletypename</key> <string>myappname file</string> <key...

winforms - Separate code in single Form [C#] -

Image
i've got winform application separate groupboxes , objects, code isn't sorted groupbox , pretty messed up. can code split in 2 files or objects on same place? edit: this code: how should split it? (i need news , dir changed) you may find easier , less problematic use regions trying split out files: #region - textbox events - private void txtnews_textchanged() {...} private void txtdir_textchanged() {...} #endregion #region - combobox events - private void cmbnews_selectedindexchanged() {...} private void cmbdir_selectedindexchanged() {...} #endregion which, when collapsed, looks like - textbox events - - combobox events - you consider tool ora navigate large files: http://ora.codeplex.com/ jetbrains' resharper has excellent file-structure viewer.

perl - A method for changing INCLUDE_PATH in Template::Toolkit on the FLY -

if have preloaded template::toolkit object, in mod_perl enviroment example, there way change include_path array without recreating object? i use template::provider this my $template_config = { include_path => "/path/to/templates", encoding => 'utf8', }; # create template_provider manually can manipulate template path # later. $template_provider = template::provider->new($template_config); $tt = template->new({ load_templates => [$template_provider ], pre_chomp => 2, post_chomp => 3, trim => 1, encoding => 'utf8', }) || die $template::error; # somewhere else later $template_provider->include_path([ "$dir/templates/$language", "$dir/templates"]);

c# - Spring.net SQL select a single value -

hey, there way using spring.net run select query , have return single value. if there way, how go doing it? as far know spring .net manipulates data using both nhibernate , it's own dao. sooo... if you're using spring .net dao should use executescalar method of dbcommand. more details. if you're looking nhibernate example, should use uniqueresult method of iquery it should this: long veryimportantid = (long) session.getnamedquery("somequeryname").setstring("someparam", "somevalue").uniqueresult(); i hope helps you. if not, please write more details issue.

javascript - SWFObject / load smil file -

why not working? <div class="videocontainer" id='mediaspace-55'></div> <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js?ver=3.0.1'></script> <script type='text/javascript'><!-- var flashvars = { provider: "highwinds", file: "http://hwcdn.net/xxxxx/fms/pathtofile.smil", image: "test.jpg" }; var params = { allowfullscreen: "true", allowscriptaccess: "always" }; var attributes = { id: "mediaspace-55", name: "mediaspace-55" }; swfobject.embedswf("player.swf", "mpl55", "710", "420", "9.0.0","expressinstall.swf", flashvars, params, attributes); // ...

php - Redirect Users Based on Server Traffic -

i have php script finds out number of users on each of servers , inputs mysql database. want user redirected page least users on it, defined mysql database. how can done? thanks in advance, callum you use query on db sorts on number of users. select servercolumn table order numberofuserscolumn asc; that retrieve servers ordered serverload (as defined in db). as redirection part can take @ http://php.net/manual/en/function.header.php and use "location" header.

Always visible jQuery UI DatePicker -

how can use jquery ui display always-visible datepicker widget? it's simple. keep jquery code, assign <div> instead of input box. date: <div id="datepicker"></div> <script> $(function() { $("#datepicker").datepicker(); }); </script> a functional example lives @ jquery ui webpage datepicker widget , , i've included 1 below. $(function() { $("#datepicker").datepicker(); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <div id="datepicker"></div>

asp.net - to display username on all aspx pages -

how dispaly username on aspx pages....? can 1 me in context..... am thinking using "session object" can able this...bt not sure can send code or links assuming have mechanism can use obtain current user's username, fetch , add code master page(s) display name. there's not more can said question. (ask vague question, vague answer.) and also, if aren't using master pages, should using master pages.

android - Accessing style items by style ID -

any view have constructor public view (context context, attributeset attrs, int defstyle) called when view declared style attribute. so, if have class inherited view class, can access declared attributes (like android:layout_width or android:background ) via attributeset attrs in constructor. when move attributes style cannot see attributes , values exists in style. want read items declared in style have style id in defstyle parameter. there way read style items using style id? changing style after creating view not supported .. can : 1 - create new android xml file of type values 2 - add new theme 3 - add elements theme , values , save file now when dynamically creating new view call constructor allow define defstyle .. point style id have created pointing r."the xml file name"."your style id"

types - What's a good alternative to uint8_t when it is not provided by the compiler? -

i'm using nvcc compile cuda kernel. unfortunately, nvcc doesn't seem support uint8_t , although support int8_t (!). i'd not use unsigned char , portability, readability, , sanity reasons. there alternative? just forestall possible misunderstanding, here details. $ nvcc --version nvcc: nvidia (r) cuda compiler driver copyright (c) 2005-2010 nvidia corporation built on mon_jun__7_18:56:31_pdt_2010 cuda compilation tools, release 3.1, v0.2.1221 code containing int8_t test = 0; is fine, code containing uint8_t test = 0; throws error message like test.cu(8): error: identifier "uint8_t" undefined c99 integer types not "defined compiler" - defined in <stdint.h> . try: #include <stdint.h>

dotnetnuke file manager replace a file -

i'm using dotnetnuke's file manager , files have these hard links dnn generates. when delete file , upload file of same name, hard link changes. can file use old url of deleted file? you need upload file , let dnn replace existing file. if delete file removed database, , when re-added assigned new id value, links broken.

transparency - Depth test inverted by default in OpenGL, or did I get it wrong? -

i've been playing around opengl full week or equivalent. after 2d i'm trying 3d. want reproduce 3d scene can see in third video on http://johnnylee.net/projects/wii/ . i've had hard time making work textures , depth. i've had 2 problems have visually same impact : one textures not blend in 3d using techniques i've found 2d. one objects appearing bottom above top. problem exposed here: depth buffer in opengl i've solved both problem, know if things right , especially second point . for first one , think i've got it. have image of round target, alpha outside disc. it's loaded fine inside opengl. (due z-ordering problem) other targets behind suffered being hidden transparent regions of naturally square quad used paint it. the reason every part of texture assumed full opaque regard depth buffer. using glenable(gl_alpha_test) test glalphafunc(gl_greater, 0.5f) makes alpha layer of texture act per pixel (boolean) opacity indicator, , make...

struct member character by character in c -

how can assign values struct member character character . like #include <stdio.h> #include <stdlib.h> #include <string.h> struct s { char *z; }; int main () { struct s *ss; ss = malloc(2 * sizeof *ss); char *str = "hello world-bye foo bar"; char *a = str; int = 0; while (*a != '\0') { if (*a == '-') i++; else ss[i].z = *a; // can this? a++; } for(i = 0; i<2; i++) printf("%s\n",ss[i].z); } so can as: ss[0].z = "hello world" ss[1].z = "-bye foo bar" edit: forgot mention, number of "-" in str might vary. if const char *str wasn't const insert '\0' split string two. you'd need shift other chars "right" in doing so. the cleaner solution use strdup make 2 copies of string, 1 of terminate early, other of start copy partway through: e.g. ss[0].z = strdup(str); ss[1].z = strdup(...

php - Rich edit in place -

what best solution support: rich editor edit in place placeholder save html , strip out malicious etc. i have nice , usable interface change data on profile. must support bold, italic , multi-line text , being sure no malicious code can injected. i looking javascript side if come php code backend, nice. fck editor ckeditor it free.

android - How can I update the all the views inside a TabHost when pressing on a ContextMenu item from within one of the views? -

i implementing music player application in android. play list selection screen implemented tab selector widget contains listactivity inside each of tabs: artist, albums, songs. want update listview in each of listactivity when delete item of lists. i.e. when long press item in artists list context menu drawn "delete artist" , should delete songs artist in songs listview, delete albums artist in albums listview, , delete entry artist in artist listview. each of listactivity has own filldata() method, updates listview when button in context menu pressed. how can call filldata() method of albums listactivity after update listview inside of artists listactivity? the solution have delete action broadcast update message public static final string refresh_data = "package.music.refresh_data"; intent myintent = new intent(refresh_data); myintent.putextra("type","refresh_data"); sendbroadcast(myintent); and in activi...

java - Change element name of a JAXB annotated subclass -

i trying create jaxb class hierarchy web services domain. find inconvenient subclass overrides getter method in super class can change element name jaxb outputs, super class's 1 being written output. wondering if there way suppress getter in super class. code: @xmltype class superclass { @xmlelement(name = "name") public string getname(){} } @xmltype class subclass extends superclass { @override @xmlelement(name = "coolname") public string getname(){} } when add subclass element xmlrootelement, output xml contains 2 elements, <name> , <coolname>. there way suppress <name> being marshaled ? do need have name property on superclass mapped? if not mark property @xmltransient. class superclass { @xmltransient public string getname(){} }

python - Where is the entry-point of the C code generating by pypy -

i'm using pypy translate python code c code. wrote simple script below: def main(): print "hello world!" def entry_point(argv): main() return 0 def target(*args): return entry_point, none then used translate.py --source test.py . did generate c code successful. when make code, generated executable file test-c . cannot find main function in code using grep , i'm wondering entry-point of code generating pypy. thank reading. that's incorrect. grep pypy_g_entry_point. main() function inlined in example, won't it. if want rendered use --inline-threshold=0 translation parameter.

OSError: [Errno 24] Too many open files with Google App Engine Task Queues in Dev Environment -

i'm testing google app engine application i've started using task queues process batch job. have local job seem number of tasks in task queue seems create number of objects in file system. clear: i'm not creating files, app server seems doing so. i've noticed when creating large numbers of tasks (2000+) in development environment @ point jobs start failing following error: <body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> <body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> --> </font> </font> </font> </script> </object> </blockquote> </pre> </table> </table> </table> </table> </table> </font> </font> </font><pre>traceback (most recent call last): file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/conten...

multithreading - Which is the correct way to wait for a Thread.finalization and keep my application responsive -

actually using code , works ok, 'am wondering if correct way. while waitforsingleobject(mythread.handle, 0) = wait_timeout application.processmessages; showmessage('i done'); calling application.processmessages considered code smell. let main thread idle if it's got nothing do. if ran company , needed 1 of workers run store , grab much-needed supplies, pace door until got back, or prefer sit in office , rest , wait him, , find out supplies here because hear him walk through door? either way, he'll take same amount of time, first way's gonna wear legs out. similarly, instead of having ui watch thread, have thread report ui. 1 way have thread use postmessage send custom message form launched once it's finished, , put message handler on form respond it.

c# - Merge Merger header columns in gridview? -

Image
how can create below type of gridview merge merged header columns? if have example share me. thanks in advance. code gridview <asp:gridview id="grvmergeheader" runat="server" backcolor="lightgoldenrodyellow" bordercolor="tan" borderwidth="5px" cellpadding="3" forecolor="black" gridlines="none" borderstyle="none" cellspacing="2" autogeneratecolumns="false" datasourceid="sqldatasource1" onrowcreated="grvmergeheader_rowcreated"> <footerstyle backcolor="tan" /> <selectedrowstyle backcolor="darkslateblue" forecolor="ghostwhite" /> <pagerstyle backcolor="palegoldenrod" forecolor="darkslateblue" horizo...

iphone - warning: format not a string literal and no format arguments -

when run below code nslog([nsstring stringwithformat:@"response count %d",response.products.count]); i warning message below warning: format not string literal , no format arguments what problem in syntax.. you don't need create autoreleased string, pass straight nslog : nslog(@"response count %d",response.products.count); the reason why warning popping because didn't supply format string first argument nslog .

asp.net - How to Insert checkbox checked text to textbox as 1,2,3 using vb.net? -

possible duplicate: i have 4 checkboxes , 1 textbox in webform if type in textbox 1,2 checkbox1 & 2 checked ! how insert checkbox checked text textbox 1,2,3 using vb.net ? i have 3 checkboxes , 1 textbox when check checkbox 1 , 3 in textbox appear 1,3 ? i want asp.net (vb) coding !! check if works in vb. private sub check1_checkedchanged(byval sender system.object, byval e system.eventargs) handles check1.checkedchanged if (check1.checked) then textbox1.text = textbox1.text + "1" end if end sub private sub check2_checkedchanged(byval sender system.object, byval e system.eventargs) handles check2.checkedchanged if (check2.checked) textbox1.text = textbox1.text + "2" end if ...

wpf - Error in adding assembly from dll in C# codedom compiler parameter -

i working on c# codedom project provides users dynamically compile c# code. getting error when adding assembly dll of wpf (it working fine winforms). saying "can not find #### in assembly. missing reference" when try add reference "system.windows.media". when adding reference dll path "c:\program files\reference assemblies\microsoft\framework\v3.0\system.printing.dll" saying "file c:\program files\reference assemblies\microsoft\framework\v3.0\system.printing.dll not found" when place system.printing.dll application executable folder, working fine. following code using add reference compiler option: compilerparameters oparameters; : : : string lcassemblydll="c:\program files\reference assemblies\microsoft\framework\v3.0\system.printing.dll"; oparameters.referencedassemblies.add(lcassemblydll); i not able understand problem. there other approach add wpf assemblies? thanks well, can't provide thorough answer off to...

postgresql - I want to restore the database with a different schema -

dear , have taken dump of database named temp1 using follwing command $ pg_dump -i -h localhost -u postgres -f c -b -v -f pub.backup temp1 now want restore dump in different database called "db_temp" , in want tables should created in "temp_schema" ( not default schema in fms temp1 database ) in "db_temp" database. is there way using pg_restore command other method appreciated ! in advance! there's no way in pg_restore itself. can use pg_restore generate sql output, , send through example sed script change it. need careful how write sed script though, doesn't match , change things inside data.

java - Sorting a List<Number> -

how sort list<number> ? example: list<number> li = new arraylist<number>(); //list of numbers li.add(new integer(20)); li.add(new double(12.2)); li.add(new float(1.2)); collections.sort(li,new comparator<number>() { @override public int compare(number o1, number o2) { double d1 = (o1 == null) ? double.positive_infinity : o1.doublevalue(); double d2 = (o2 == null) ? double.positive_infinity : o2.doublevalue(); return d1.compareto(d2); } }); have @ andreas_d's answer explanation.in above code null values , +infinity values handled such move end. update 1: as jarnbjo , aioobe points out flaw in above implementation.so thought it's better restrict implementation's of number. collections.sort(li, new comparator<number>() { hashset<class<? extends number>> allowedtypes; { allowedtypes = new hashset<class<? extends number>>(); allowedtyp...

query optimization - Index not getting used + sql server 2005 -

here query declare @startdatetime datetime, @enddatetime datetime select @startdatetime = '2010-11-15', @enddatetime = '2010-11-16' select practicecode, accountno, proccd, modifier , chargedos, paid amt, createddate, case when paid > 0 'p' when paid = 0 , writtenoff = dueamt 'a' else 'o' end status trn_postings createddate >= @startdatetime , createddate <= @enddatetime --and manualoverride in ('s','f','x','g','o') , manualoverride in ('n','u') edit : created date datetime column contains date & time of record created i have individual indexes on both createddate , manualoverride. execution plan shows clustered index scan. table has million record , can grow 4 5 times in near future. the surprising part if change clause below, uses both indexes. dont know why. createddate >= @startdatetim...

html - Bought joomla template no text after flash content -

i have bought joomla template template monster. looks template isn't ie8 compatible. can't count on support, because when entering online chat, fague chat bot. the problem template doesn't show text after flash banner. in ff works great, in ie7,8 andabove not. top menu , flash header. this header <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr" > <head> <base href="http://www.friesecomputerservice.nl/" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="robots" content="index, follow" /> <meta name="keywords" content="joomla, joomla" /> <meta name="description" content="joomla! - dynamic port...

android - Please help solve this listview problem -

i have 3 lines of code use hold state of items in listview wjen scrolling, problem is, last line of code gets executed. please me solve this. code block: holder.viewname.settextcolor((priority.equals("low")? color.blue: color.gray ) ); holder.viewname.settextcolor((priority.equals("medium")? color.green: color.gray ) ); holder.viewname.settextcolor((priority.equals("high")? color.red: color.gray ) ); // items in state condition gets executed in listview, rest ignored , set gray. is there way can join code logic together, 3 conditions can called?.. thank all 3 lines executed, you're overriding text color next line. use condition instead: if (priority.equals("low")) { holder.viewname.settextcolor(color.blue); } else if (priority.equals("medium")) { holder.viename.settextcolor(color.green); } else if (priority.equals("high")) { holder.viewname.settextcolor(color.red); } else { holder.viewname.se...

java - How to I define and get locale-based messages in Spring MVC? -

i want define set of error messages when validation errors generate codes, codes pick corresponding error message , print them. for sake of learning, , develop extendable web app, i'd follow proper i18n path, though need define 1 (english) set of messages now. so locales should default english when don't find own resources (which i'm yet define). i've never used of i18n functionality of java. , spring docs assume have knowledge. could give me gental nudge in right direction? i've defined messagesource in dispatcher-servlet.xml webapp context. have validator produces bindingresult object rejected field "username" , code "username.taken" . can generate default message. now need error message errormessages.properties file in view. how resolve error code message? <bean id="messagesource" class="org.springframework.context.support.resourcebundlemessagesource"> <property name="basename...

c# - WaitAll for multiple handles on a STA thread is not supported -

why error message? "waitall multiple handles on sta thread not supported." should use [mtathreadattribute] attribut? update: dosn't work wpf applications! note: error @ line waithandle.waitall(doneevents); i'm using standard wpf project . private void search() { const int cpus = 2; var doneevents = new manualresetevent[cpus]; // configure , launch threads using threadpool: (int = 0; < cpus; i++) { doneevents[i] = new manualresetevent(false); var f = new indexer(paths[i], doneevents[i]); threadpool.queueuserworkitem(f.waitcallback, i); } // wait threads in pool waithandle.waitall(doneevents); debug.writeline("search completed!"); } update: following solution doesn’t work wpf applications! not possible change main application attribute mtathreadattribute. result in following error: error: "waitall multiple handles on sta thread not supported." what using ta...

android - screen with top banner, webview and bottom banner -

i'm trying create simple android screen following content: top banner, webview , bottom banner. reason, can't it. xml like: <?xml version="1.0" encoding="utf-8"?> <linearlayout android:id="@+id/framelayout02" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:fitssystemwindows="true" android:isscrollcontainer="false"> <imageview android:layout_width="wrap_content" android:layout_above="@+id/web" android:layout_height="fill_parent" android:layout_gravity="top" android:src="@drawable/logo"></imageview> <webview android:layout_gravity="center" android:id="@+id/web" android:layout_height="fill_parent" android:la...

java - Getting column names from an AbstractTableModel -

i can't figure out using constructor jtable(tablemodel dm) . i'm using linkedlist manage data so, display it, extended abstracttablemodel : public class volumelisttablemodel extends abstracttablemodel { private static final long serialversionuid = 1l; private linkedlist<directory> datalist; private object[] columnnames= {"id", "directory", "wildcard"}; public volumelisttablemodel(){ } public void setdatalist(linkedlist<directory> temp){ this.datalist = temp; } public linkedlist<directory> getdatalist(){ return (linkedlist<directory>) this.datalist.clone(); } public object[] getcolumnnames() { return this.columnnames; } @override public int getcolumncount() { return directory.numcols; } @override public int getrowcount() { return this.datalist.size(); } @override public object getvalueat(int...

java - Log4j hanging my application -

im trying console output external application in application. when call externall app code hangs message: configuring logging... configuring log4j from: c:\gpat\log4j.cfg and nothing happens. searched through internet , seems might thread issue. cant modify external application , must go through log4j. read external app this: stringbuffer output = new stringbuffer(); try { runtime rt = runtime.getruntime(); process proc = rt.exec(gsatcommand); bufferedreader input = new bufferedreader(new inputstreamreader(proc.getinputstream())); system.out.println("test running..."); string line = null; while ((line = input.readline()) != null) { system.out.println(line); // writes test output console output.append(line); output.append("\n"); } int exitval = proc.waitfor(); system.out.println("process exitvalue: " + exitval); system.out.println(...

captcha - question about generating the image in php -

i write script generate image , write text on image. doubt if send header image displaying ... without sending header can't display images? i want display 20 dynamically generated images different text in 1 page. when create first image , display second not display because first image sent header. how can solve problem. thanks on advance. madan sapkota either make 1 big image , send or send html file contains 20 images, these fetched 1 one browser , can send header everytime :-d

java - Bytecode enhancement for fields in a class -

is possible add "hooks" class via bytecode enhancement execute code whenever class field read or written? example, i'd automatically set "dirty" flag whenever new value assigned field. if so, libraries best suited implement functionality? here how generate getters , setters using asm framework. should started. http://asm.ow2.org/doc/faq.html#q9 you can let bytecode-rewriter hook class-loader , rewriting on fly.

How to make parametrizable properties in WPF user controls? -

i want refactor many similar controls differ in value of single property (besides positioning properties). imagine have user control (let's call uc1) have label . label.content should value + ":" value passed through property user control. i implement hand using initialized event, happens in case isn't label custom control (let's call uc2) needs property on own initialized event. somehow uc2 initialized runs before uc1's, , throws exception because property value not set yet. how solve this? maybe problem cause calling initializecomponent() inside user control when shouldn't. it may cause initialized event fired twice.

iphone - Table of contents from PDF Document using CGPDFDocumentGetCatalog -

can provide sample code table of contents pdf document? have googled more 2 days couldn't find proper example. m having voyuer example suggested many blogs not able understand it. there simple way??? looks closest thing seen on create table of contents pdf file

width - jQuery outerWidth on a parent element which has child elements with padding -

i have slight issue, trying outer width of table cell. table cell has inputs child elements, in case textbox , image. the width of image 16px , width on textbox 115px. textbox has padding left , right, both 2px (equals 4px). i assume td.outerwidth() gives me 119 + 16 = 135px (115 + 4 padding + 16) instead gives me 115 + 16 = 131px. outer width return correct width on child elements separatly there seems problems when calculating outer width on parent element has child elements padding. if remove padding, works fine. does else have problem or solution it?

javascript - Why this script is not running? -

i'm trying add script beggin of xbl file, following test not running, idea why? <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script language="javascript" type="text/javascript"><![cdata[ while(true) { dump("ok"); } ]]></script> </bindings> --update this infinite loop becouse want piece of code keep running. it's communication embedded system. there no script element in xbl, documentation false: https://bugzilla.mozilla.org/show_bug.cgi?id=58757

c# - Asterisk click to call -

maybe of may know how achieve this. want this: click on link/button my phone rings, pick asterisk dials number me recipient phone rings i'm using asterisk 1.2 . i tried dial out . can make call 1 side. thanks in advance. you can use call files . read: asterisk auto-dial out . i have made simple cgi script called via web server creates call file (remember use temp directory) , moves /var/spool/asterisk/outgoing , asterisk rest of work. user perspective works described. remember normalize phone numbers (on web pages can have spaces, hyphens etc, while in call file must dialable numbers).

Jquery chechboxTree and Cookie plugin - Problem with getting children -

i'm using checkboxtree plugin in relation cookie plugin jquery. problem is, i'd set/unset cookies of children (from header) when checkbox class "header" clicked. how can that? here's .js code: // when page has loaded, check each checkbox if it's checked (set cookie) or not (unset cookie) $(".tree input:checkbox").each(function(){ var elementid = this.id; // check if cookie of element exists if($.cookie(elementid)){ // if so, change attribute checked $(this).attr("checked", "checked"); }else{ // if not, change attribute not checked $(this).attr("checked", ""); } }); $(".tree input:checkbox").change(function(){ if($(this).attr("class") == "header"){ if($(this).is(":checked")){ setcookie(this.id); // set cookie children }else{ unsetcookie(this.id); // unset cookie children } }else{ if($(this).is(":checke...