Posts

Showing posts from August, 2014

flash - Error #2025 AS3 -

i'm trying build game chicken invaders , eror : argumenterror: error #2025: supplied displayobject must child of caller. @ flash.display::displayobjectcontainer/removechild() @ superstudent7_fla::maintimeline/movebullet() this problem occurs when space ship shoots. to solve , need know 2 things: my bullets defined movieclip s ,and not on stage.. brought them stage this: function shooting(e:event):void { var bullet:bullets = new bullets(); // bullets class name of movieclip ... ... ... addchild(bullet); bullet.addeventlistener(event.enter_frame,movebullet); }//end of shooting i need know if ok add bullet stage this? or there way? here code makes bullet move: function movebullet(e:event):void { e.target.y -=10; for(var i=0;i<enemy.numchildren;i++) { if(e.target.hittestobject(enemy.getchildat(i))) { counthits[i]=counthits[i]+1; e.target.removeeventlistener(event.enter_frame,movebullet);

c# - TotalSummary of GroupSummaries in Devexpress -

Image
i have aspxgridview this: is there way calculate total of groupsummary totalsummary without grouping . groupsummary's summerytype="average" for example: mus_k_isim groupsummary[risk_eur] 2m lojÄ°stÄ°k 123.456 aba lojÄ°stik 234.567 then want totalsummary of risk_eur column 123.456 + 234.567 = 358023 . note : want calculation normal gridview. not doing grouping. another example: customer_no customer_name price 123 aaa 50 123 aaa 100 123 aaa 60 124 bbb 60 125 ccc 20 125 ccc 40 i want grid: what avarage of 123 number customer = 50 + 100 + 60 = 210/3= 70 avarage of 124 number customer = 60/1=60 avarage of 125 number customer = 20 + 40 = 60/2= 30 and totalsummary of price = 70 + 60 + 30 = 160 how can that? or code about? function should use? i see 2 different solutions: 1) implement data management manually: a) sort dat

Facebook: Get when user clicks like button on fan page -

i have created app used tab on company facebook fan page. have new requirement capture when user clicks button on facebook fan page , hide portion of app page (within iframe) when event fires. although button on facebook's page, there way capture click event of button (ie: javascript sdk) within app iframe can hide appropriate elements? like .... http://www.facebook.com/redbull thanks , advice, b i found answer... how detect facebook button pressed , trigger event? i checked incoming request fb_sig_is_fan.

c++ - Why is it a compile error to assign the address of an array to a pointer "my_pointer = &my_array"? -

int my_array[5] = {0}; int *my_pointer = 0; my_pointer = &my_array // compiler error my_pointer = my_array // ok if my_array address of array &my_array gives me? my_array name of array of 5 integers. compiler happily convert pointer single integer. &my_array pointer array of 5 integers. compiler not treat array of integers single integer, refuses make conversion.

Entity Framework code first: update SetInitializer throws exception -

i've been looking strange error hours haven't found anything. have simple entity: public class company { public guid id { get; set; } public string name { get; set; } } and here context: public class mydbcontext : dbcontext { public dbset<company> companies { get; set; } } when running first time, works fine. but, when change entity (for example, put [key] attribute id), expected "model has changed" or error. so, enter in global.asax application_start: database.setinitializer<mydbcontext> (new dropcreatedatabaseifmodelchanges< mydbcontext >()); this stuck. there no compile error, compiles without errors / warnings. but, when run project, following error: description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.typeloadexception: genericarguments[0], 'mydb.data.mydbcontext', on 'system

Working WIth Color options in Magento -

i developing site appliance retailer on magento, , wondering if can suggest how should implement following: there multiple colors each appliance. each related color has it's own sku, , price variations. i'd have following happen: when users browse catalog should see 1 product, have list -- related skus, color , prices in list , , should able navigate indivual item i don't want of related colors show individual items, because users see same products number of times. i'd create link within product page show related colors, , prices. any ideas? (i thinking of creating attribute contain comma-separated list of related skus, , loop through them, deal 1 , 3, i'm still not sure how deal 2) look 'simple configurable products'. cool extension want achieve including image , price options. free.

sql server - Dropping tables using dynamic SQL -

i having trouble sql stored procedure, passing in varchar() table name using it. my code (not working) is: create procedure deleteuser @username varchar(50) begin --drop surf table if exists (select 1 sysobjects xtype='u' , name=@username + '_table') drop table @username + '_table' end go however, on execution errors @ drop table @username + '_table' line. what doing incorrectly? i using ms sql server 2008 if matters, called c#. the drop table statement can't parametrised trying. need dynamic sql. declare @dynsql nvarchar(max) = 'drop table ' + quotename(@username + '_table'); exec(@dynsql);

jQuery: How to bind the same action on two different events? -

i find myself writing code looks this: $(document).ready(function(){ updatestuff(); $('select').change(function(){ updatestuff(); }); }); function updatestuff(){ //do simple } the same function updatestuff() called twice (once each event), nothing different between 2 events. wondering if there better way write same code called on both events, , can dry code more. way, won't need create function in first place. maybe (if such syntax exists)? $('select').bind(['document.ready', 'change'], function(){ //do simple }); you need have change event binding inside of ready handler, dom guaranteed ready manipulation when binding. doing in simplest possible way can think of. change code bind change event so: $('select').change(updatestuff); unless need pass in parameters, there's no need wrap call updatestuff() in anonymous function. as jandy points out, can invoke function you've bou

jms - Post to WebLogic Queue from .NET -

i need post weblogic queue .net/c# web application. any on how appreciated. thanks in advance. have gone through documentation / tutorials? here information on that: http://download.oracle.com/docs/cd/e12840_01/wls/docs103/jms/intro.html#wp1058350 otherwise, if you've made attempts , run trouble, please post tried, , trouble was. good luck.

java - How to setup Eclipse Plugin Profiler -

i want use eclipse plugin profiler profile applications. however, facing problems while installing it. copied unzipped folder of profiler plugins folder in root eclipse folder. when open eclipse, run->run configurations-> , click on profiler, receive following error: "an error has occurred. see error log more details. ru/nlmk/eclipse/plugins/profiler/launch/profilertab" i think there problem in location of profiler dll, don't know put it. how make plugin work? thank in advance the right steps installation defined @ http://eclipsecolorer.sourceforge.net/index_profiler.html , , dll should in bin folder of jre installation.

Does MySQL Workbench automatically create indexes for foreign keys? -

when create foreign key in mysql workbench, new entry appears on "indexes" tab exact same same foreign key created. is foreign key, showing on "indexes" tab reason? or mysql workbench try helpful , create index me, knowing i'm selecting against column, , give (confusingly) same name foreign key? it's mysql doing that, not workbench. , yes, being helpful create index when create foreign key constraint.

objective c - UIActionSheet not rotating in landscape mode? -

i have uiactionsheet , set it's view this: [popup showinview:[[uiapplication sharedapplication] keywindow]]; this works fine in portrait mode, when switch landscape, stays portrait. doing wrong? thanks. you're showing in window (which not rotated), rather in view controller's view (which is). pass main view of currently-visible view controller instead, or use showfromtabbar: or showfromtoolbar: on iphone or showfrombarbuttonitem:animated: or showfromrect:inview:animated: on ipad.

flash - How to use a parabola formula in AS3 for firing an arrow that will always intercept a given point -

Image
first note: mathematically, i'm not skilled @ all. i played game on iphone while press point, , arrow fires castle intersect point pressed. wanted make similar game, thinking easy quick make; ran realization mathematics beyond skill level. i'm assuming they're using parabola formula or determine velocity , angle needed when arrow launched arrow intersect clicked point. i vaguely remember how parabolas work school , have no chance of working out formulas. any mathematical or ideas might easier implement great. i want end function in castle so: package { import avian.framework.objects.avelement; public class castle extends avelement { /** * fires arrow * @param ix x intersection point * @param iy y intersection point */ public function fire(ix:number, iy:number):void { var ar:arrow = new arrow(); ar.x = x; ar.y = y; // define angle , veloc

c# - Implementing an interface whereby generics are based on the interface -

i refactoring code important classes implement interface (for unit testability). came across class implements icomparable (non-templated); like: public myclass : icomparable { public int compareto(object obj) { myclass cobj = obj myclass; if (cobj == null) { throw new argumentexception(); } // etc. } } i'm wanting interface out, , use generics while i'm @ it; this: public imyclass : icomparable<imyclass> { // other methods here } public myclass : imyclass { public compareto<imyclass>(imyclass other) { ... } // other methods here } but then, ideally, myclass should implement icomparable<myclass> (and subclasses of myclass should implement icomparable<mysubclass> ). all of ask several questions: what think of approach described? there better way of doing refactoring? there point in making myclass implement icomparable<myclass> , or pointless since implement icomparab

iphone - Can I detect the delete key even if the UITextField is empty? -

when uitextfield contains nothing, pressing delete key of keyboard won't call of uitextfielddelegate's methods. how can detect it? edit: there seems no trivial way it. useful links can find are: uitextfield : way detect delete key event when field empty ? how actual key pressed in uitextfield in short, solution put permanent space @ start of text field. , make other nesessary changes(textfieldshouldreturn:, textfield:shouldchangecharactersinrange:replacementstring:, etc.). its possible put button on it, that's bit fragile since keyboard layout change different ios versions , there different keyboard layouts different languages. look @ "managing text fields , text views" apple doc. im sure there way this. uitextfield implements protocol keyevents. 1 of key events delete key, override whatever method receives these , way.

sql server - SSIS 2008 - How to add date and time fields together -

in ssis 2008, how add date , time in derived column? they different datatypes want end datetime field. you should able concatenate them strings, , cast string dt_date: http://msdn.microsoft.com/en-us/library/ms141036.aspx for example: (dt_date)((dt_str, 30, 1252)@mydate + " " + (dt_str, 30, 1252)@mytime)

Still untracked files even after using git add -

guys, after using "git add ." still have untracked files can't commit. there question same problem, in case related case-sensitive folder. didn't change name of folders here. the . in git add . command refers "current directory". so, running git add . add files in current directory , subdirectories. should ensure in correct directory before running git add . . if you're 1 level down in subdirectory, git add .. equivalent cd ..; git add . .

c# - panel clear everything -

i reset panel initial state. e.g., set image background, drew graphics on part of panel. have clear everything. how? you have clear panel first panel1.controls.clear(); then call initial form. panel1.controls.add(orig_form);

iphone - MultiMarkdown to HTML parser in Javascript -

i have seen javascript parsers convert markdown html. not able find same multimarkdown. are there available. thanks try this: https://github.com/evilstreak/markdown-js my bad, didn't realise multimarkdown new variation. no js implementation exists, i'm sure when you'll find on http://search.npmjs.org/

android ListView ItemClick get the Child Text -

i have made custom listview which extends listactivity , each row contains 2 textview , button. adapter = new simpleadapter(this, arraylist, r.layout.simplelistcustom, new string[] { "count","title"}, new int[] {r.id.invisible, r.id.textview11 }); setlistadapter(adapter); when clicking on list view row ,i selected row index , using index row child protected void onlistitemclick(listview listview, view view, int position, long id) { super.onlistitemclick(listview, view, position, id); string selection = listview.getitematposition(position).tostring(); } the output when displayed in "selection" in logcat {count=6, title=etywewetr} problem want seperate content....how can possible....plz help thanx in advance the getitematposition method returning element arraylist parameter; need cast correct type. assuming arraylist list<map<string, string>> (which suspect is): prot

mkdir - Creating folder using perl -

i want create folder using perl same folder perl script exists. created foldercreator.pl requires input parameter folder name. unless(chdir($argv[0]){ # if dir available change current , unless mkdir($argv[0], 0700); # create directory chdir($argv[0]) or die "can't chdir $argv[0]\n"; # change or stop } this worked fine if call scipt, in same folder resides. if call in other folder if doesn't work. eg. .../scripts/scriptcontainfolder> perl foldercreator.pl new .../scripts> perl ./scriptcontainfolder/foldercreator.pl new first 1 working fine second doesn't. there way create these folders??? you can use findbin module, give $bin variable. locates full path script bin directory allow use of paths relative bin directory. use findbin qw($bin); $folder = "$bin/$argv[0]"; mkdir($folder, 0700) unless(-d $folder ); chdir($folder) or die "can't chdir $folder\n";

javascript - <script></script> or <script />? -

possible duplicate: why don't self-closing script tags work? i found weired behavior script tag in html. i web server nginx, , used fast cgi , php5. have page.html, looks this: <html> <body> <!-- <?php echo 'i going add php code here'; ?> --> <script type="text/javascript" src="./my/javascript1.js" /> <script type="text/javascript" src="./my/javascript2.js" /> </body> </html> if page served directly web server, java script works well. if passed php5, seems first java script tag executed. if change script block into: <script type="text/javascript" src="./my/javascript1.js"></script> <script type="text/javascript" src="./my/javascript2.js"></script> everything works again. noticed how tags closed? yeah, why asking here. difference? supposed have same function/meaning. beside

php - how to make New lines in a cell using phpexcel -

i have problem php excel, i want make new line in 1 cell can't, have tried using \n or <br /> itsn't work. code: $objphpexcel->getactivesheet()->setcellvalue('h5', 'hello\nworld'); // need show in 2 line $objphpexcel->getactivesheet()->getstyle('h5')->getalignment()->setwraptext(true); fyi: format excel xls not xlsx. many :) $objphpexcel->getactivesheet()->setcellvalue('h5', "hello\nworld"); $objphpexcel->getactivesheet()->getstyle('h5')->getalignment()->setwraptext(true); works me... you should use double quotes when add escape sequences in php string.

How to create abstract properties in python abstract classes -

in following code, create base abstract class base . want classes inherit base provide name property, made property @abstractmethod . then created subclass of base , called base_1 , meant supply functionality, still remain abstract. there no name property in base_1 , nevertheless python instatinates object of class without error. how 1 create abstract properties? from abc import abcmeta, abstractmethod class base(object): __metaclass__ = abcmeta def __init__(self, strdirconfig): self.strdirconfig = strdirconfig @abstractmethod def _dostuff(self, signals): pass @property @abstractmethod def name(self): #this property supplied inheriting classes #individually pass class base_1(base): __metaclass__ = abcmeta # class not provide name property, should raise error def __init__(self, strdirconfig): super(base_1, self).__init__(strdirconfig) def _dostuff(self, signals): print

Search in sqlite3 Database in iPhone -

i want search employeename in data base query ok give nscfstring error when bind. please help. code is: sqlite3 *database; self.array_employeesearch = nil; [self.array_employeesearch release]; self.array_employeesearch = [[nsmutablearray alloc]init]; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentdirectory = [paths objectatindex:0]; nsstring *path = [documentdirectory stringbyappendingpathcomponent:@"employee.sqlite"]; if(sqlite3_open([path utf8string], &database) == sqlite_ok){ nsstring *str_query = [nsstring stringwithformat:@"select empname employee empname '%@%@%@'",@"%",str_emp,@"%"]; const char *sql = [str_query utf8string]; sqlite3_stmt *statement; if(sqlite3_prepare_v2(database, sql, -1, &statement, null) == sqlite_ok){

javascript - prevent default action for tab key in chrome? -

i want prevent default action when tab key pressed , wanna in chrome, can't find solution that, can please ? i using jquery here's article on how detect chrome: http://javascriptly.com/2008/09/javascript-to-detect-google-chrome/ and question: disable tab key on specific div might on disabling tab key. if able combine both yourself, you've got working. the disable function become like: $('.textarea').on('keyup mouseup', function(e) { if(e.which == 9) { e.preventdefault(); } }); e.which = 9 tab key according last link given. if able wrap browser detection around yourself, guess you've got working example.

c# - Why does sortedDictionary need so much overhead? -

long b = gc.gettotalmemory(true); sorteddictionary<int, int> sd = new sorteddictionary<int, int>(); (int = 0; < 10000; i++) { sd.add(i, i+1); } long = gc.gettotalmemory(true); console.writeline((a - b)); int reference = sd[10]; output (32 bit): 280108 output (64 bit): 480248 storing ints alone (in array) require 80000. internally sorteddictionary<tkey, tvalue> uses treeset<keyvaluepair<tkey, tvalue>> . tree uses node<t> , uses references between nodes, in addition each key , value have references left , right nodes additional properties. node<t> class each instance has traditional overhead of reference type. furthermore, each node stores boolean called isred . according windbg/sos size of single node on 64 bits in 48 bytes 10000 of them take @ least 480000 bytes. 0:000> !do 0000000002a51d90 name: system.collections.generic.sortedset`1+node[[system.collections.generic.keyvaluep

php - Commenting/skipping markup with Smarty -

is there smarty tag allows skipping content in template without enclosed code showing in rendered html page? do mean comment tag? {* comment *} your question bit difficult understand or mean minifying?

vb.net - .NET Gridview Paging shows different content on following pages -

i have gridview in page paging enabled (sorting not enabled, not used). onrowdatabound , onpageindexchanged events assigned. <asp:gridview showheader="false" id="gv1" runat="server" autogeneratecolumns="false" onrowdatabound="gridview_rowdatabound" datasourceid="sqldatasource1" gridlines="none" cellpadding="0" pagesize="25" allowpaging="true" onpageindexchanging="gv1_pageindexchanging"> datasource assigned below gridview as: <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:my_connectionstring %>"></asp:sqldatasource> onrowdatabound used display content in formatted way. don't think causes problem: protected sub gridview_rowdatabound(byval sender object, byval e gridviewroweventargs)..... pageindexchanging defined follows: protected sub gv1_pageindexchang

ezpublish - Ez Publish 4.5 is free or is only Enterprise Edition? -

i'm new ez publish. need know if ez publish joomla , free or commercial open source application. possible use ez publish without paying fees? ps: don't know if place ask question. best regards, short answer : 4.5 enterprise edition of ez publish, called matterhorn , not free. long answer : 2011.x community project version , has same development base because ez systems engineers works , commits work on same master branch : https://github.com/ezsystems/ezpublish versions of community project able download snapshots taken master branch, , packaged using same continuous integration tools used ez systems enterprise edition. the short story : ez systems used provide consulting , support services aside ez publish make more clear decision takers, package (software code source & services) called enterprise edition. nothing has changed, naming convention, , last not least, innovation , contribution more easy before.

c multithreading process -

i want write multi threaded program in c language. use posix thread library. i write following code: #include<stdio.h> #include<pthread.h> void *put (int *arg) { int i; //int * p; // p=(int*)arg; for(i=0;i<5;i++) { printf("\n%d",arg[i]); } pthread_exit(null); } int main() { int a[5]={10,20,30,40,50}; pthread_t s; pthread_create(&s,null,put,a); printf("what this\n"); return 0; } i want thread show items in array. program compiled following warning: tm.c:19: warning: passing argument 3 of ‘pthread_create’ incompatible pointer type /usr/include/pthread.h:227: note: expected ‘void * (*)(void *)’ argument of type ‘void * (*)(int *)’ when run program got out put of main thread not value stored in array. now can tell me i'm doing wrong? how send array argument in thread function? if changed code little bit compile time warning resolved changed code following: #include<s

java - IPv6 validation -

i used ipaddressutil.isipv6literaladdress (ipaddress) method validate ipv6, method fails ipv6-address/prefix-length format (format mentioned in rfc 4291 section 2.3) of ipv6. could know validators validate " ipv6-address/prefix-length " format? legal representations of ipv6 abcd:ef01:2345:6789:abcd:ef01:2345:6789 2001:db8:0:0:8:800:200c:417a ff01:0:0:0:0:0:0:101 0:0:0:0:0:0:0:1 0:0:0:0:0:0:0:0 2001:db8::8:800:200c:417a ff01::101 ::1 :: 0:0:0:0:0:0:13.1.68.3 0:0:0:0:0:ffff:129.144.52.38 ::13.1.68.3 ffff:129.144.52.38 2001:0db8:0000:cd30:0000:0000:0000:0000/60 2001:0db8::cd30:0:0:0:0/60 2001:0db8:0:cd30::/60 not legal representations of ipv6 2001:0db8:0:cd3/60 2001:0db8::cd30/60 2001:0db8::cd3/60 see if works: try { if (subjectstring.matches( "(?ix)\\a(?: # anchor address\n" + " (?: # mixed\n" + " (?:[a-f0-9]{1,4}:){6}

javascript - Polling a Collection with Backbone.js -

i’m trying keep backbone.js collection up-to-date what’s happening on server. my code similar following: var comment = backbone.model.extend({}); var commentcollection = backbone.collection.extend({ model: comment }); var commentview = backbone.view.extend({ /* ... */ }); var commentlistview = backbone.view.extend({ initialize: function () { _.bindall(this, 'addone', 'addall'); this.collection.bind('add', this.addone); this.collection.bind('refresh', this.addall); }, addone: function (item) { var view = new commentview({model: item}); $(this.el).append(view.render().el); }, addall: function () { this.collection.each(this.addone); } }); var comments = new commentcollection; setinterval(function () { comments.fetch(); }, 5000); what happens when comments fetched, refresh called, same comments bottom of commentlistview —which i’d expect code above. what i’d know

python - Check if a function is a method of some object -

how check if function method of object? for example: def check_method(f): ... check_method(lambda x: x + 1) # >>> false check_method(someclass().some_method) # >>> true there special attributes in methods in 'helloworld' example (e.g. 'im_self', '__self__' etc). can rely on them or there nicer way? use inspect.ismethod() . the documentation states: return true if object bound method written in python. this means work intend classes define in python. however, methods of built-in classes list or classes implemented in extension modules return false .

interrupt - Python: Stop the socket-receiving-process -

i receive data device via socket-module. after time device stops sending packages. want interupt for-loop. while true doesn't work, because receives more 100 packages. how can stop process? s stands socket. ... in range(packages100): data = s.recv(4) f.write(data) ... edit: think socket.settimeout() part of solution. see also: how set timeout on python's socket recv method? if peer stops sending data, opposed closing connection, tricky , you'll forced resort asynchronous reading socket. put in asynchronous mode (the docs , google friends), , try read each time, instead of blocking read. can stop "trying" anytime wish. note nature of async io code bit different - no longer able assume once recv returns, read data.

Preserving Mathematica expressions in a textual form -

what proper way convert mathematica expressions losslessly string (a string kept in memory, not exported file)? i looking textual representation that will preserve information, including keeping special (and possibly atomic) objects, such sparsearray , graph , dispatch , compiledfunction , etc. intact. e.g. cycling sparsearray through representation should keep sparse (and not convert normal list). is relatively fast cycle through (convert , forth). is tostring[expr, fullform] sufficient this? tostring[expr, inputform] ? note 1: came while trying work around bugs in graph internal representation gets corrupted occasionally. i'm interested in answer general question above. note 2: save surely this, writes files (probably possible solve using streams), , write definitions associated symbols. if not going perform string manipulations on resulting string, may consider compress , uncompress alternative tostring . while don't know cases tostring[

c# - How to find out if a computer is connected to novell eDirectory or Microsoft ActiveDirectory? -

i implemented novell edirectory in application. since our application supports microsoft activedirectory prevent additional configuration parameter "novell yes/no". so, there way find out if computer connected microsoft activedirectory or novell network? i want know if computer part of windows domain can win32_ntdomain wmi information. in powershell gives : get-wmiobject win32_ntdomain clientsitename : default-first-site-name dcsitename : default-first-site-name description : dom dnsforestname : dom.fr domaincontrolleraddress : \\192.168.183.100 domaincontrollername : \\wm2008r2ent domainname : dom roles : status : ok edition according @scotttx comment can use win32_computersystem wmi class ps> (get-wmiobject win32_computersystem).partofdomain false according win32_ntdomain class documentation in c# can : using system; using system.collections.g

Matlab: renaming workspace elements from command window? -

the gui of matlab allows me rename element in workspace right-clicking on element , selecting 'rename' option. possible command window well? these things can test yourself, , should so. best way learn, discover. regardless, answer no, cannot change variable name in way command window. command window keyboard input only. edit: question apparently doing change command in command window, not done via mouse. (why not tell front?) there no explicit command such rename. however, nothing stops writing yourself. example... function renamevar(oldname,newname) % renames variable in base workspace % usage: renamevar oldname newname % usage: renamevar('oldname','newname') % % renamevar written used command, renaming single % variable have designated new name % % arguments: (input) % oldname - character string - must name of existing % variable in base matlab workspace. % % newname - character string - new name of variable % % example: % % cha

c++ - why UChar* is not working with this ICU conversion? -

when converting utf-8 iso-8859-6 code didn't work: unicodestring ustr = unicodestring::fromutf8(stringpiece(input)); const uchar* source = ustr.getbuffer(); char target[1000]; uerrorcode status = u_zero_error; uconverter *conv; int32_t len; // set converter conv = ucnv_open("iso-8859-6", &status); assert(u_success(status)); // convert len = ucnv_fromuchars(conv, target, 100, source, -1, &status); assert(u_success(status)); // close converter ucnv_close(conv); string s(target); return s; images: ( 1 , 2 ) however when replacing uchar* hard-coded uchar[] works well!! image : ( 3 ) it looks you're taking difficult approach. how this: static char const* const cp = "iso-8859-6"; unicodestring ustr = unicodestring::fromutf8(stringpiece(input)); std::vector<char> buf(ustr.length() + 1); std::vector<char>::size_type len = ustr.extract(0, ustr.length(), &buf[0], buf.size(), cp); if (len >= buf.size()) {

c# - piece of code works in console application, but does not works inside nunit test -

simple console application open connection without problems: static void main(string[] args) { string connectionstring = string.format( @"provider=oraoledb.oracle;plsqlrset=1;password={0};persist security info=true;user id={1};data source={2};oledb.net=true;fetchsize=5000", "pwd", "schema", "server"); using (idbconnection con = new oledbconnection(connectionstring)) { con.open(); console.writeline("opened"); } console.readkey(); } but if try same in nunit test method: public class unittest1 { [test] public void testmethod1() { string connectionstring = string.format( @"provider=oraoledb.oracle;plsqlrset=1;password={0};persist security info=true;user id={1};data source={2};oledb.net=true;fetchsize=5000", "pwd", "schema", "server"); using (

javascript - error :id is already registered -

i have error in code error: tried register widget id==legend1 id registered the code legend is: <div id="legend1"></div> var stackedarealegend = new dojox.charting.widget.selectablelegend({ chart: chart1 }, "legend1"); stackedarealegend.refresh(); how can solve error? try destroy widget before creating new: var stackedarealegend = dijit.byid('legend1'); if (stackedarealegend) { stackedarealegend.destroyrecursive(true); } stackedarealegend = new dojox.charting.widget.selectablelegend({ chart: chart1 }, "legend1"); stackedarealegend.refresh();

cocoa touch - Move view when so that keyboard does not hide text field -

in app, when click on text field, keyboard hides it. please me -- how can move view when click on text field. i'm using code in textfielddidbeginediting: self.tableview.scrollindicatorinsets = uiedgeinsetsmake(0, 0, 216, 0); self.tableview.contentinset = uiedgeinsetsmake(0, 0, 216, 0); but doesn't work. you can following, first make sure you've set uitextfield delegate self and #define koffset_for_keyboard 350; at top. how far want view shifted //method move view up/down whenever keyboard shown/dismissed -(void)setviewmovedup:(bool)movedup { [uiview beginanimations:nil context:null]; [uiview setanimationduration:0.3]; // if want slide view [uiview setanimationbeginsfromcurrentstate:yes]; cgrect rect = self.view.frame; if (movedup) { // 1. move view's origin text field hidden come above keyboard // 2. increase size of view area behind keyboard covered up. if (rect.origin.y == 0 ) { rec

tortoisesvn - Why did my tortoise svn merge a file and not conflict it? -

i changed file locally , updated repository , else had updated file. instead of conflict coming , me having go in , diff file , select portions file use looks tortoise svn merged file instead... merge http://img850.imageshack.us/img850/9733/merged.jpg that means went well. conflict when versioning tool (svn) can't merge 2 versions of file properly.

sql - VB -- How to test for value not in dropdown -

i have large vb/sql application have created problem in. have table of procedures have active flag on them. flag can toggled through user screen. other screens access same table populate dropdowns. values stored in table id field (pk). problem have selecting dropdown values based on active flag. if select record has procedure stored in has been made inactive, old object not set instance.... error. what want able check value in record when populating dropdown , allow record displayed bypassing sql error , showing dropdown value blank while not altering record itself. hope i'm making sense. code below -- pretty vanilla stuff, i'm in app programming after being sysadmin 20 years , i'm still rusty. library code public function getdropdownlist(byval strdropdownlist string, _ byref objsession system.web.sessionstate.httpsessionstate) string dim strsql string = "" select case strdropdownlist case "surgical

plsql - How to define a pl sql function with dynamic return types in Oracle? -

i have set of tables different data type columns , need consolidate way retrieving data. thought using function idea, don't know how define 1 function having different return types. for example, how define function able use different definitions tabletype. create or replace function retrieve_info(field_id in integer) return pintegertypetable -- <-- how change return more generic record built dynamically in code below? r pintegertypetable := pintegertypetable (); begin r.extend; r(i) := pintegertypetable (someinteger); return r; end; is possible?. there better way handle problem: different columns stored in lot of legacy tables, , given every column has different data types, in way can retrieve recent information conserving original data types without hardcoding views neither storing in varchar2 , casting again in client code? you can implement using weakly-typed ref cursor return type. easy implement client interface using jdbc, returned cursor type ca

c# - Dealing with an incrementing SNMP OID? -

Image
i'm trying use snmp data printer. if turn printer off , on, oid need get .1.3.6.1.2.1.43.18.1.1.8.1.1 . each time printer has "event", such getting paused, running out of paper or having paper jam, oidfor data want increments. for example, turn printer on , query .1.3.6.1.2.1.43.18.1.1.8.1.1. , "paused" value. unpause printer , remove of paper printer, , "add paper" message have query .1.3.6.1.2.1.43.18.1.1.8.1.2 . i don't know if normal snmp behavior wonder people suggest in these cases able programatically printer state? yes it's normal retreiving rows alert table : just have mib : the corresponding text part of mib ( from rfc 1759 ): prtalerttable object-type syntax sequence of prtalertentry max-access not-accessible status current description "" ::= { prtalert 1 } prtalertentry object-type syntax prtalertentry max-access not-accessible status curr

ruby - Why can't I modify values of an array in a method? -

in code fragment below, array deck should equal [6,9,5,6,5,1,2] since ruby passes arrays reference. after method call, values of deck not change. why that? def count_cut!(deck) s1, s2 = deck[0, deck.last], deck[deck.last..-2] deck = s2 + s1 + [deck.last] end deck = [5, 1, 6, 9, 5, 6, 2] count_cut!(deck) p deck i using ruby 1.9.2-p180. assigning deck not mutate array passed in. treated local variable in scope of function definition. can call deck.replace if want mutate it.

flash - Is there an away3D hitTestObject equivalent? -

i working away3d , find myself in dire need of hittestobject-method. far have found out, there no such method present in library. have tried distanceto, calculates distance centerpoints, using method not option since need detect collisions. does have way of detecting hits on object in away3d? in advance. away3d renderer, not physics engine. have 'collisions', need kind of physics engine involved jiglib .

xml - Can an XSLT 2.0 function return arbitrary types? -

i trying write xslt 2.0 function returns result of specific type--let's 1 or more elements. here's i've tried, no avail: <xsl:function name="util:find-parents2" as="element(parent)*"> <xsl:variable name="output" as="element(parent)*"> <xsl:for-each select="('one','two')"> <parent> <xsl:sequence select="."/> </parent> </xsl:for-each> </xsl:variable> <xsl:value-of select="$output"/> </xsl:function> here's error saxon processor: error @ xsl:function on line 192 column 65 of file:/e:/mlsh/recursive.xsl: xtte0780: required item type of result of function util:find-parents2() element(parent, xs:anytype); supplied value has item type text() failed compile stylesheet. 1 error detected. but expected this: <parent>one</parent> <parent>two</pare

jquery - How does the triggering of mousemove work in Javascript? -

i have object prints mouse's x , y positions on every mousemove. it's this: $('#canvas').mousemove(function(e){ $('#output').prepend(e.pagex + ',' + e.pagey); }); i've noticed when move on object fast prints out few positions. i'm not unhappy (because quite exhaustive have hundreds of pixels you've crossed) wondering how works. is mousemove event limited amount of triggers per second or what? (btw: tested on chromium in ubuntu linux) "mice report position operating system n times per second, , think n less 100"

php - GD Library image creation problem -

i having problem gd library issue. when use following code <script type="text/javascript"> $.fn.infinitecarousel = function () { function repeat(str, num) { return new array( num + 1 ).join( str ); } return this.each(function () { var $wrapper = $('> div', this).css('overflow', 'hidden'), $slider = $wrapper.find('> ul'), $items = $slider.find('> li'), $single = $items.filter(':first'), singlewidth = $single.outerwidth(), visible = math.ceil($wrapper.innerwidth() / singlewidth), // note: doesn't include padding or border currentpage = 1, pages = math.ceil($items.length / visible); // 1. pad 'visible' number seen, otherwise create empty items if (($items.length % visible) != 0) { $slider.append(repeat('<li class="empty" />

c# - Calling a self-hosted WCF service in windows svc without blocking the UI -

i have wcf service hosted in windows svc. execute in normal way winforms app, making channel etc, , calling method. there's no .svc file on server side. however, when call method in windows service gui, blocks ui. there way without blocking ui? thanks look @ either backgroundworker class, or newer task parallel library stuff. want fire off call service, , describe when answer received, not block ui while waiting answer. in cases, there may nothing ui do while waits answer, such in case of search dialog. until answer comes back, there's nothing else ui can doing. executing search in background means ui thread has been freed. means should still able move , resize window, or possibly switch form in same application while wait. enough reason execute calls in background.

cocoa/iPad How do I keep a UIButton clickable when its alpha == 0? -

when set uibutton's alpha 0, behaves if isn't enabled. i've checked and, though button remain enabled (though invisible (but not hidden, checked well)), ceases work. is there way keep clickable when alpha 0? try put uibutton on top of it's uibuttonstyle set "custom" , leave is, except of adding ibaction it.

html lists - Li not showing right in Internet Explorer -

i'm having yet problem internet explorer. have list got php database , want show in div. there's no problem browser, except internet explorer. li's squashed under eachother. have no idea why. here's screenshot of how looks in ie: http://img16.imageshack.us/img16/3435/fkngie.jpg edit: added zip file related files: http://www.mediafire.com/?pgx1yg79c80a8sd anyone has idea how solve this? you might need specify div's size 100% in style. unless send generated html code, there nothing more 1 can do. can save , upload html file, , css files related? edit: checked file, after replacing database parts static text, working fine in ie 6. however, think problem raises divs. may try debugging divs assigning different bg colors them. check database if contains text can break markup.

Is there a way to pass a property from an HTML page to a Flash application created with Flex? -

i want specify string value in html containing flash created using flex 3. value url used flex code , want dev able update it. how do this? i'm using flex builder 3. you try javascript , externalinterface or use flashvars if have 1 parameter you'd pass in, it's easier use flashvars.

objective c - drawRect gets called on UIView subclass but not on UIViewController -

my code working far had create class uiview . bit inconvenient because need interact viewcontroller too. btw, did try [self setneedsdisplay] on viewdidload of uiviewcontroller subclass file didn't work. here's code, works on uiview subclass doesn't called on uiviewcontroller one: - (void)drawrect:(cgrect)rect { uicolor *currentcolor = [uicolor redcolor]; cgcontextref context = uigraphicsgetcurrentcontext(); somenum = 1; cgcontextbeginpath(context); cgcontextmovetopoint(context, 30, 40); [self adddotimagex:30 andy:40]; cgcontextsetlinewidth(context, 2); cgcontextsetstrokecolorwithcolor(context, currentcolor.cgcolor); cgcontextstrokepath(context); } any ideas on try? btw, tabbar app. know can somehow block calls drawrect . the tabs created programatically, not through nib. eg: nsmutablearray *listofviewcontrollers = [[nsmutablearray alloc] init]; uiviewcontroller *vc; vc = [[education alloc] init]; vc.title = @"

tortoisehg - Mercurial Missing Revlog -

i'm receiving "missing revlog" error when using mercurial (via tortoisehg). know how fix repo? % hg --repository c:\source\project verify --verbose repository uses revlog format 1 checking changesets checking manifests crosschecking files in changesets , manifests checking files data/myproject.class.library.tests/part/filename.cs.orig.i@1: missing revlog! 1: empty or missing myproject.class.library.tests/part/filename.cs.orig myproject.class.library.tests/part/filename.cs.orig@1: fb25dd9d5f41 in manifests not found 4384 files, 1354 changesets, 12803 total revisions 3 integrity errors encountered! (first damaged changeset appears 1) [command returned code 1 wed may 11 13:31:14 2011] you can try use convert extension convert.hg.ignoreerrors set true, described on wiki . keep in mind modify hashes, , damaged files lost completely.

wordpress - PHP executes phpinfo function but not other php code -

i have installed lastest version of wordpress today. i able run php files once tried creating wp-config.php file none of files seem execute php longer. if go index.php , run (as per wordpress) see if php code in browser. however, if put following @ top of file: phpinfo(); die(); i can see php information , server running normal. commenting line, again shows php code in browser. i can create php file in root folder such test , echo out statement , works no problem either. wordpress code seems not work. php version: 5.3.2 (ubuntu 10.4 , apache2) wp version: 3.1.2 sample >ll permissions: -rw-r--r-- 1 myname myname 398 may 11 10:59 index.php -rw-r--r-- 1 myname myname 24 may 11 10:59 phptest.php ... -rw-r--r-- 1 myname myname 2454 may 11 10:59 wp-load.php

java - Setting connection timezone with Spring and DBCP and MySQL -

my enviroment java 5 spring 2.5.5 dbcp datasource (org.apache.commons.dbcp.basicdatasource) mysql similar posts setting session timezone spring jdbc oracle links http://www.mysqlfaqs.net/mysql-faqs/general-questions/how-to-manage-time-zone-in-mysql my problem i need set on connection timezone, aiming prevent conversions when dealing timestamp columns. my idea/research dbcp connection pool did not mention around timezone. link what investigate , thought ok described on this post, exemplifying is: <bean id="datasource" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close"> <property name="url" value="${database.url}" /> <property name="user" value="${database.username}" /> <property name="password" value="${database.passwd}" /> <property name="connectioncachingenabled" value="true