Posts

Showing posts from March, 2015

makefile - Setting CFLAGS for pr_debug and printk -

i trying understand linux kernel module , see output of pr_debug , printk . using gnu make. understand pr_debug messages, have use ddebug . so, how enable printk statements ? lets filename kvm.c . difference between these two: cflags_kvm.o := -ddebug cflags_kvm.o += -ddebug what statement do: cflags_kvm.o := -i. [edit]: looks usage of square brackets has caused confusion. [filename], meant file, kvm.c. i don't know how activate printk() - did search google? amongst other things, found this seems imply printk() available (but have mark messages appropriate level, , there control on levels displayed on console). the square brackets in macro name unorthodox - , therefore extension specific system. reading between lines, talking linux kernel , therefore gnu make, you'd if stated such things. the := notation immediate assignment variable. rhs evaluated when line read , processed, not when macro used case. means if th...

iphone - How to get the view that is currently being displayed as an NSString? -

i need name of view user viewing nsstring, in order save can return user view if exit app. of now, if user exits app on "view4" instance app return them "view1" if launch afterwards. p.s. know possible because many apps, such tap tap revenge , angry birds this. can quit @ time , return, , view , @ saved. save view name using nsuserdefaults . then, when app launches, try retrieve name user defaults.

user-defined operators in C++ -

what think imaginary possibility specify user-defined operators in c++. such user-defined operator defined operator name (arbitrary sequence of allowed chars?), precedence, associativity , arity (something else?). they used many purposes: build "tiny" dsls on c++, list comprehension etc. wouldn't feature extend language possible usage? other languages allow user-defined operators? lisp comes mind, else? links topic? well, haskell has custom operators settable precedence , left-right binding. so, can work. then, haskell cutting edge , barely readable is, though it's used rather clever people. (haskell scares off newbies, think..) for c++, think there are: parsing issues (consider std::vector<std::list<int>> bug, >> parsed right-shift operator) .. c++'s syntax hard enough is. backwards-compability issues (introducing new operators combinations of old, !-- cause problems) clarity issues (people doing enough wierd thing ...

Rails Route - specific URL -

i want implement tracking pixel inside email. the tracking pixel url should this: http://example.com/__track.gif?id=xxxxxxx&u=xxxxx questions: how create route that? while says it's .gif, don't want gif file, want rails controller called , able run few methods when called, using url params. thoughts? put following in routes.rb file: match "/_track.gif" => "controller_name#action_name" replacing controller_name & action_name appropriate. i recommend read on rails guide routing , match noted in first section.

sql server - How to change column datatype in SQL database without losing data -

i have sql server database , realized can change type of 1 of columns int bool . how can without losing data entered table? you can using following command. value of 0 turned 0 (bit = false), else turned 1 (bit = true). alter table dbo.yourtable alter column yourcolumnname bit the other option create new column of type bit , fill old column, , once you're done, drop old column , rename new 1 old name. way, if during conversion goes wrong, can go since still have data..

java - Remove attributes from XMLBean -

assume there's xmlbeans xmlobject attributes, how can selected attributes in single step? i'm expecting .... removeattributes(xmlobject obj, string[] selectableattributes){}; now above method should return me xmlobject attributes. assumption: attributes want remove xmlobject must optional in corresponding xml schema. under assumption, xmlbeans provides couple of useful methods: unsetx , issetx (where x attribute name. so, can implement removeattributes method in way: public void removeattributes(xmlobject obj, string[] removeattributenames) throws illegalargumentexception, illegalaccessexception, invocationtargetexception, securityexception, nosuchmethodexception { class<?> clazz = obj.getclass(); (int = 0; < removeattributenames.length; i++) { string attrname = removeattributenames[i].substring(0, 1).touppercase() + removeattributenames[i].substring(1); ...

java - JSR-303 @Valid annotation (nested object) not working -

[spring 3.0.5][jboss 5.1] my main classes public class useraddressesform { @notempty private string firstname; @notempty private string lastname; private list<addressform> addresses; ... setters , getters public class addressform { @notempty private string customname; @notempty private string city; @notempty private string streetan; @notempty private string streethn; @notempty private string addresscountry; @notempty private string postcode; ... setters , getters a controller @requestmapping(value = "/up", method = requestmethod.post) public string completeform(@valid @modelattribute("useraddressesform") useraddressesform useraddressesform, bindingresult result, httpservletrequest req) ... a jsp page <form:form commandname="useraddressesform" action="registered"> <table> <tr> <td class=...

Concatenating a variable and a string literal without a space in PowerShell -

how can write variable console without space after it? there problems when try: $myvariable = "some text" write-host "$myvariablenospaces" i'd following output: some textnospaces another option , possibly more canonical way use curly braces delineate name: $myvariable = "some text" write-host "${myvariable}nospaces" this particular handy paths e.g. ${projectdir}bin\$config\images . however, if there \ after variable name, enough powershell consider not part of variable name.

iphone - cocos2d wheel spinning like wheel of fortune -

i'm developing spinning wheel app cocos2d. wheel seen top view. can spin wheel (only 1 sprite) & stop spinning wheel. wheel = [ccsprite spritewithfile:@"wheel500.png" rect:cgrectmake(0, 0, 500, 500)]; id spin = [ccrotateby actionwithduration:.5 angle: 360]; id spins = [ccrepeat actionwithaction:spin times:8]; [wheel runaction:spins]; the wheel has 6 or 8 segments. want add text in segment (dynamically). hints... add text wheel.. means text child of wheel.. den done.. ever parent(wheel) does, child(text) follow..

c# - Is it possible to hook up a anonymous Delegate using reflection? -

from msdn article , there's quite few ways hook delegate using reflection. it seems best way createdelegate method: delegate d = delegate.createdelegate(delegatetype, targetobject, handlermethodname); under normal circumstances, i'd pointing handler method within targetobject class. if delegate created anonymously? example: public delegate void selectedvehiclescollectiondelegate(string query, list<vehicles> list); ... myobject.selectedvehiclescollection = (query, list) => { //assign list of vehicles list matching query }; there's not method within class definition delegate referencing. need invoke delegate unknown @ runtime, obtaining list of items result. ok, looks terminology got best of me. wasnt aiming @ creating handler invoke what's there (tomas petricek's answer still gives me insight though). given comment, sounds calling delegate rather creating one, in ...

uibuilder - How do you launch a second MainWindow.xib in an iPad application? -

how launch second mainwindow.xib in ipad application? you load nib, using nsbundle, , call makekeyandvisible on window in nib. best way window use outlet in object loading nib. [[nsbundle mainbundle] loadnibnamed:@"secondwindow" owner:self options:nil]; [self.secondwindow makekeyandvisible]; //assuming window connected property named secondwindow

objective c - does anyone know how to catch NSInvalidArgumentException? -

is there way catch it? or bug? thanks. it bug. specifically, bug in code. nsinvalidargumentexception means you've passed bad data method. means you've passed nil argument doesn't allow nil . exception description should provide more information method/argument bad.

winapi - How Screensaver works while windows locked -

can tell me how screensaver works while windows locked. win32 api methods used. do want implement screen saver or know how screen saver can run while machine locked? on xp there separate desktop this, gets activated gina (a dll running in winlogon process) when machine locked. to implement screen saver, implement screensaverconfiguredialog , screensaverproc according specifications on @ msdn, export functions under these names (i.e. use .def file have names without decoration) , name created dll .scr afterwards.

python - Trouble with Tornado and JavaScript Libraries -

i'm trying write simple python web application using tornado web server , having trouble using javascript libraries need. wanted use protovis javascript plotting library, added following 'hello world' code snippet template.html: <script type="text/javascript" src="/protovis-d3.2.js"></script> <script type="text/javascript+protovis"> new pv.panel() .width(150) .height(150) .anchor("center") .add(pv.label) .text("hello, world!") .root.render(); </script> whenever run webserver, however, , try accessing page, following error @ console: warning:root:404 /protovis-d3.2.js (127.0.0.1) 0.46ms the protovis.js file in same directory server.py file, , permissions set correctly. same error when trying src , javascript file know there isn't problem protovis.js file, tornado server's routing. does know how can src javascript code, thanks. you should re...

File's modification date in C# -

i have write application, compare modification date of 2 files. these files excel workbooks. first file located on local drive , second on lan network. any hints, how write app? there's no need open these files, check date file attributes. system.io.fileinfo file1 = new system.io.fileinfo(file1name); system.io.fileinfo file2 = new system.io.fileinfo(file2name); if(file1.lastwritetime != file2.lastwritetime) //do stuff.

ruby - Does ActiveScaffold work with Rails 3? -

does activescaffold work rails 3? the activescaffold github page readme lists rails 3.0 - 3.2 support, based on further development of vhochstein's fork.

database - Maximum length for MySQL type text -

i'm creating form sending private messages , want set maxlength value of textarea appropriate max length of text field in mysql database table. how many characters can type text field store? if lot, able specify length in database text type field varchar? see maximum numbers: http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html tinyblob, tinytext l + 1 bytes, l < 2^8 (255 bytes) blob, text l + 2 bytes, l < 2^16 (64 kibibytes) mediumblob, mediumtext l + 3 bytes, l < 2^24 (16 mebibytes) longblob, longtext l + 4 bytes, l < 2^32 (4 gibibytes) l number of bytes in text field. maximmum number of chars text 2 16 -1 (using single-byte characters). means 65 535 chars(using single-byte characters). utf-8/multibyte encoding : using multibyte encoding each character might consume more 1 byte of space. utf-8 space consumption between 1 4 bytes per char.

.net - Control query is not correct in DotNet -

Image
please help, receive error "cannot invoke because object nothing". i've added query ask if object nothing. visual studio still goes routine. private withevents frm frmfullscreen private sub updateimageinguiasync(byval bm system.drawing.bitmap) if me.frm.invokerequired = true dim dl new bitmapdelegate(addressof updateimageinguiguithread) if me.frm isnot nothing me.frm.invoke(dl, bm) else call me.updateimageinguiguithread(bm) end if end sub any idea how fix this? regards is possible form disposing? if so, i'd wrap entire if block in try/catch.

windows - Problem with quoted filenames in Batch -

let have batch program: set foo=c:\temp\%1 bar.exe %foo% when call double quoted file name argument these quotes in middle; , fact prevents other programs working correctly: > fail.bat "aa bb.jpg" set foo=c:\temp\"aa bb.jpg" > bar.exe c:\temp\"aa bb.jpg" cannot find file how variable containing correct value "c:\temp\aa bb.jpg"? you can use %~1 instead, removes quotes parameter. code should like set foo="c:\temp\%~1" bar.exe %foo%

Algorithm for "neon glow" graphics programming -

i searching article or tutorial explains how 1 can draw primitive shapes (mainly simple lines) (neon) glow effect on them in graphical output of computer program. not want sophisticated stuff example in modern first pirson shooters or alike. more in search simple solution, lines in picture: http://tjl.co/blog/wp-content/uploads/2009/05/neonstripes.jpg -- of course drawn computer program in case. the whole thing should run on modern smart phone, hardware bit limited. i know bit opengl, not much, unfortunately bit lost here. did research on google ("glow effect algoritm" , similar), found either highly complex stuff 3d games, or tutorials photoshop & co. so need in-depth article on subject, not on advanced level. hope thats possible... have started opengl, did minor graphics programming in past, long-year programmer now, understand technical papers in general. does of know of such article/paper/tutorial/anything? thanks in advance advices! cheers! matthias ...

How can I store data in sql database using asp.net c# -

does have code write/store data asp.net c# sql database? http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executenonquery.aspx

java - Extract specific field from multiple PDF files and write to text file -

i have directory filled subdirectories, pdfs files and/or subdirectories filled pdf files. essentially, unorganized group of pdfs. i'd parse each file, pulling contents of 1 specific field, , dumping output text file. end result large text file containing contents of field within each individual pdf. surely possible. question whether can done easily, without programming. in opinion, best option pay little money 3rd party component provide api. http://www.aspose.com/categories/java-components/aspose.pdf-for-java/default.aspx http://www.pdfcomponent.com/java-pdf/ if doesn't have in java, believe php has open source library.

android - Restoring state of TextView after screen rotation? -

in app have textview , edittext . both have data in it. when screen orientation changes data in edittext remains, textview data cleared. can 1 me out find way retain data in textview too? if want force textview save state must add freezestext attribute: <textview ... android:freezestext="true" /> from documentation on freezestext : if set, text view include current complete text inside of frozen icicle in addition meta-data such current cursor position. default disabled; can useful when contents of text view not stored in persistent place such content provider

django - ImportError: No module named models? -

i using django , keep receiving error group app, have checked import settings , fine. registration , profile apps run smoothly why app giving me importerror models? traceback (most recent call last): file "manage.py", line 14, in <module> execute_manager(settings) file "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 438, in execute_manager utility.execute() file "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 191, in run_from_argv self.execute(*args, **options.__dict__) file "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 219, in execute self.validate() file "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line ...

javascript - A relative rotation in an animation -

i have problem raphael.js. want rotate "compassscale" - set in following code - in relative manner. this works paths, texts "animate" absolute rotation of 30 degree. want them rotate 30 degrees relative actual positions. var compassscale = paper.set(); var centerx = 200; var centery = 200; var radius = 195; var compascircle = paper.circle(centerx, centery, radius); for(var = 0; < 360; i++) { var winkelrad = * (math.pi/180) var xstart = centerx + math.sin(winkelrad) * radius; var ystart = centery + math.cos(winkelrad) * radius; var diff = 6; if(i % 10 === 0){ compassscale.push(paper.text(centerx, centery - radius + 18, i).rotate(i, centerx, centery, true)); diff = 12; } else if(i % 5 === 0) { diff = 8; } var xend = centerx + math.sin(winkelrad) * (radius - diff); var yend = centery + math.cos(winkelrad) * (radius - diff); compassscale.push(paper.path("m" + xstart + " ...

windows 7 - Proper way to debug SVN+SSH checkout over VPN failure? How to compare with a working setup? -

Image
in brief given setup svn+ssh checkout on vpn not working, , working, correct procedure find out difference between 2 systems? details i using 64-bit system running windows 7. have open vpn , tortoise svn 64-bit installed. the repository in remote system, , connect using vpn. continuing earlier question svn+ssh checkout on vpn using tortoise svn, smartsvn failing one new teammate (working on system, 64-bit running windows 7, same me) has checked out remote server (connected via open vpn). both of have followed same steps - added project specific open vpn config files inside config folder of open vpn installation path. took these files working setup of other team members. initiated open vpn connection using user. ran putty's pageant.exe, selected .ppk file , entered pass phrase. after checkout successful, did fresh installation of softwares (openvpn, tortoisesvn) using same ones has used still getting following error when trying checkout or using reposit...

CodeIgniter 2 - captcha helper? -

i cant seem ci2's captcha helper work... can point out doing wrong? i think i've followed steps on doc's im not getting event print_r(get_defined_vars()) isnt showing anything... :( my controller function index() { $this->load->helper('form'); $this->load->helper('captcha'); $this->load->model('captcha'); $vals = array( 'word' => 'random word', 'img_path' => '../images/captcha/', 'img_url' => 'http://mysite/images/captcha/', 'font' => '../../system/fonts/texb.ttf', 'img_width' => '150', 'img_height' => 30, 'expiration' => 7200, "time" => time() ); $data['cap'] = create_captcha($vals); $cap = array( 'captcha_time' => $vals['time'], 'ip_address' => $this->input->ip_address()...

How can I sort div elements based on inner div element content / values using javascript / jQuery? -

i have x amount of divs in page, each div item represents single product , looks this: <div class="productcontainer"> <li> <img src="my-product-image.jpg"></a> <div class="productinfo"> <h4> <!-- sort divs based on tag content --> <a class="producttitleforsorting" href="product-page-link">name</a><br> </h4> <div class="product-price"> <span id="lowestprice">price: <!-- or sort divs product price span content --> <span class="productpriceforsorting">$xx.xx</span></span> </div> </div> </li> </div> then have select list / dropdown list i'd sort divs price or alphabetically. for example, let's have 10 divs (10 products), 1 above on single...

How common usage are Page Methods in ASP.NET 4? -

how common usage page methods in asp.net 4? i example of how it's used (not code sample). i don't know how common, check out example: http://aspalliance.com/1922_pagemethods_in_aspnet_ajax.all use page methods if don't want publicly expose web service, , creating web method that's page, imho. instance, need web service features 1 page only, that's when create page method. if need reusable in 2 pages, don't want publically expose it, create helper , web method wraps helper. otherwise, if looking create dynamic web site , share information, go traditional asmx or wcf service. hth.

oracle - SQL -Grab unique column combination from table -

in oracle, have table called "mytable". table has columns 'a' , 'b'. want find every unique combination of 'a' , 'b'. how this? i'd prefer in sql rather pl/sql. example: column | column b dog cat cat dog horse cat dog cat a unique combination above should return 3 rows. thank you select distinct columna, columnb table or select columna, columnb table group columna, columnb

php - MYSQL get closest match with multiple WHERE -

in database, have table products , table has tags associated each of te products. when user looks @ product's page, want show "related" (or closest) product 1 he's looking at. so let's product tagged 5 different tags. prodcuts have same 5 tags , ones have 4 of same 5 tags, , ones have 3 of same 5 tags, etc... to this, i'm guessing have create 1 or more mysql query don't know start. matching same 5 tags easy, can use tag='?' , tag='?'... how can other (4/5, 3/5, 2/5, 1/5)? any appreciated! cheers steven edits @orbits: tags on different rows... if not text match the case. tag row consists of (id, tag, product_id) @cusimar9: different table, stated in post :p @vbence: believe it's simple possible.. here is... don't have connecting table products : create table `products` ( `id` int(11) unsigned not null auto_increment, ... primary key (`id`) ) engine=myisam default charset=utf8; tags : create ta...

jquery - How can I add an autocomplete value to the browser's store without refreshing the page? -

i thought might it, not: $.ajax({ type: "post", url: document.location, data: 'myautocompletename='+ myautocompletevalue }); i not sure step of typical form submission causing form values added autocomplete. the solution not have jquery-based, i'm fine if is.

asp.net - Making a secure login cookie -

i've read 1 of jeff's articles xss , got me thinking how better protect login cookies in home cooked authentication system. basically this(note, configurable , set true ): protected static string computeloginhash(string passwordhash){ stringbuilder sb=new stringbuilder(); sb.append(passwordhash); if(cookieuseip){ sb.append(httpcontext.current.request.userhostaddress); } if(cookieusebase){ sb.append(httpcontext.current.request.mappath("/")); } if(cookieusebrowserinfo){ sb.append(httpcontext.current.request.useragent); } sb.append(sitename); return computehash(sb.tostring()); } (note passwordhash made out of password, unique salt, , username). ok, 1 of questionable things use useragent string. there harm in doing this? or browsers change useragent string under normal operation(as in, without being updated)? goal if attacker gets logi...

Does Spring Expression Language support IN operator? -

does spring expression language support in operator? similar sql in clause. public class security { private sectyp1; public security (string asectyp1) { sectyp1 = asectyp1; } } security security = new security("bond"); standardevaluationcontext context = new standardevaluationcontext(security); expressionparser parser = new spelexpressionparser(); // should return true boolean result = parser.parseexpression("sectyp1 **in** {'bond','swpi'}").getvalue(context, boolean.class); // should return false result = parser.parseexpression("sectyp1 **in** {'fut','swpi'}").getvalue(context, boolean.class); i following exception org.springframework.expression.spel.spelparseexception: el1041e:(pos 8): after parsing valid expression, there still more data in expression: 'in' @ org.springframework.expression.spel.standard.internalspelexpressionparser.doparseexpression(internalspelexpressionparser.java:118) ...

maven - Project management/build tools for a Django project? -

coming java development build , project management tools abound, i'd know what's available django. i'd use maven building things, there preferred way of doing it? i'm looking following: command-line building: mvn install easy , cool. command-line test-runs. i'd integrate app hudson continuous integration, since i'm hardcore that. deployment of media local test server (js, css, images, etc.) is possible maven or tool? i'm embarking on pretty big project here , i'd have kicking-rad build/project management system maven project able grow on time. two tools come mind both generic python tools - need not work django specifically: fabric . use this; allows write remote commands if ssh'd in, upload code etc. these isn't can't , because bash script written in python, easy going. bash script written in python, means can import parts of django app, run tests or python can in process of running deployment. buildout . i've...

c# - WCF SQL insert GUID conversion error -

i unsure how go this, i want add unique identifiers users using wcf , when go add guid clients datacontext throws error error 2 argument 1: cannot convert 'system.guid' 'servicefairy.client' c:\users\john\documents\visual studio 2010\projects\premleague\servicefairy\service1.svc.cs any chance can help? using system; using system.collections.generic; using system.linq; using system.runtime.serialization; using system.servicemodel; using system.servicemodel.web; using system.text; using system.data.sqlclient; using system.diagnostics; namespace servicefairy { // note: can use "rename" command on "refactor" menu change class name "service1" in code, svc , config file together. public class service1 : iservice1 { public list<match> getallmatches() { matchtabledatacontext context = new matchtabledatacontext(); var matches = m in context.matches orderby m.date select m; return matc...

java - Importing SOAP Webservice into Android Project Causes Error -

i have working android project using intellij. i utilize intellij's menu option: 'generate java code wsdl' i see class being built, , intellij seems validate in ide, when invoke webservice methods generated get java.lang.noclassdeffounderror: com.mydomain.testapp.sms.sendsms what being doing wrong cause class not found? i've tried several publicly available web services rule out webservice same error. here 1 of test wsdl: http://www.aswinanand.com/sendsms.php?wsdl and specific code: sendsms s = new sendsms(); s.getsendsmsport().sendsmstomany("8135551212", "", "8135551212", "testing sms send"); edit tried webservice http://www.esendex.com/secure/messenger/soap/sendservice.asmx?wsdl with same basic usage: sendservice ss = new sendservice(); string s = ss.getsendservicesoap().sendmessage("8135165861", "testing sms", messagetype.text); with exact same results. i don...

c# - What is the best way to reincarnate an application that dies? -

how force application restart after user closes or process killed task manager? i tried using windows service timer limitation of windows service user can stop service. i tried using windows service timer limitation of windows service user can stop service. this not limitation of windows services. limitation of fact the user owns computer , can therefore whatever want or it. there no way create application cannot stopped or quit. if somehow managed figure out way hide app task manager, semi-computer-literate user find task manager-style program allow them quit application. windows (and other end-user operating systems) specifically designed , programmed prevent type of exceptionally user-hostile behavior, , reason. this not programming problem, , you'll never find solution through route. need solve through use of group policies in collaboration system administrator. group policy built-in feature windows has limiting amount of control individual users ha...

artificial intelligence - Extensible First Person Shooter in C++? -

i've become interested in study of ai programming , how relates games. i'm interested see it's create ai first person shooter-type game c++. so, leads me question. rather not spend time writing complete fps purpose of practicing ai design, know of existing projects/engines functional games extend (in c++) ai somehow? thanks. you might want start source or unreal engines, , use bot apis or scripting plugins experiment writing character code. for example, there lots of bots fps counterstrike . alien swarm shipped source code part of sdk, start ais there , modify them.

zend framework - Enable jQuery using with ZendX_JQuery in a view helper -

i trying activate jquery through view helper called within layout. the problem jquery called within layout , renders include files, before defined in view helper. here scripts : layout.phtml : <?php echo $this->doctype(); ?> <html> <head> <?php echo $this->headtitle() ?> <?php echo $this->headlink()->appendstylesheet('/css/base.css') ?> <?php echo $this->headmeta() ?> <?php echo $this->headstyle() ?> <?php echo $this->jquery() ?> </head> <body> [...] <div id="droite" class="column grid_4"> <!-- column 2 start --> <?php echo $this->render('partials/droite.phtml'); ?> <!-- column 2 end --> </div> </body> </html> partials/droite.phtml : <?=$this->rolelinks(); ?> my_view_helper_rolelinks : <?php class my_view_helper_rolelinks extends zend_view_h...

problems with ruby symbols in hash look-up -

i'm trying create simple hash corresponding strings symbols (:student_number, :first_name, ...). i'm having issue retrieving data function though. here's function snippet a def get_nice_column_name(col_symbol) column_names = { :first_name => "student's first name", :last_name => "student's last name", :email => "student's email", :given_name => "student's given name" } return column_names[col_symbol] end here's how use it, not working : snippet b col_titles = [] params = {:first_name => 'true', :last_name => 'true', :email => 'true', :given_name => 'true' } params.each |key, value| if ( value == 'true') col_titles << get_nice_column_name(key) end end when col_titles, expect ["student's first name", "student's last name"...

java - Want to get the start and end date of a month from a particular date -

i m having code gives date of particular event : string date=date1.substring(3,5)+"/"+date1.substring(0,2)+"/"+date1.substring(6,10); i want start date , end date of month of above date belongs to.. kindly help. use calendar.getactualmaximum() to max date of month cal.getactualmaximum(calendar.day_of_month) and minimum cal.getactualminimum(calendar.day_of_month) note : cal instance of calendar

vim - How to get a unique identifier for a window? -

i trying sort of unique identifier window, commands can run against window. ie, if need give window focus.. or if need see size of window.. etc. problem seems window number used identifier, number potentially changes time new window introduced.. seems index count left right , top bottom.. puzzles me why used identifier. seeing have no idea user may layout.. how can assure when assign window buffer, or information window, getting information window want? you can use window variables such identifier: " put unique window identifier w:id variable autocmd vimenter,winenter * if !exists('w:id') | let w:id={expr_that_will_return_an_unique_identifier} | endif : should mark windows. or, maybe better mark windows want use after window creation. find window id abc , switch it: function s:findwinid(id) tabnr in range(1, tabpagenr('$')) winnr in range(1, tabpagewinnr(tabnr, '$')) if gettabwinvar(tabnr, winnr, 'id')...

excel - VBA Cell address of Max() -

i have like sdmax = worksheetfunction.max(range("d2", cells(emptyrow, 4))) to find maximum number of column d how find location of maximum number? defined user defined function in vba, returning address string function addressofmax(rng range) string addressofmax = worksheetfunction.index(rng, worksheetfunction.match(worksheetfunction.max(rng), rng, 0)).address end function or returning range reference function addressofmax(rng range) range set addressofmax = rng.cells(worksheetfunction.match(worksheetfunction.max(rng), rng, 0)) end function these functions assume rng 1 column wide these functions can used in sheet eg =addressofmax(c:c) or in vba eg dim r range set r = addressofmax(range("d2", cells(emptyrow, 4)))

objective c - Cache a JSON string from a URL Request -

i have 3 different requests made url retrieve extensive json string. store in cache in event iphone not have internet connection @ next launch. what best method this? new objective-c , xcode. have researched nsurlcache , nscache, not sure should use. i know if there way preload json string in background. or @ least show preloader view. 2 separate questions, know. thanks pointing me in right direction.

GWT Communication strategies -

i newbie gwt. doing feasibility study on gwt decide whether include in our product or not. went through various docs , have open questions. whether can use rpc( java-servlets) data other server well- means cross site access. see can via json or jsonp, wanted confirm on that. may question sounds bad . not well-versed in web technologies well. web engines load balancing, case means browser gets reply , need not worry server gets result. how different cross-site access? why java-script not stopping accessing different servers in this? then communication strategy better implement? know tricky question , requirement specific. in general 1 can proceed with. i see many docs saying fine go gwt , no need have gxt in place. benefit when use gxt? have not worked on any. have worked on examples provided in gwt tutorial. needed know border-line between gxt , gwt ... it great if 1 can clarify above doubts. --priya. gwt primariy client-side technology. have server-side related ...

iostream - C++ input and output streams -

is possible c++' input stream read chatroom msn , yahoo , things , return sort of message? wondering search net , of require client , server. i new this no; 2 concepts have passing resemblance. c++ iostreams low-level construct reading bytes , operating system devices such file systems, fifos, sockets, etc. chat services implemented on high-level protocols such xmpp, operate on tcp via socket apis provided os. in short, chalk , cheese. there have been nominal efforts provide access sockets via iostream facility, designed extended in such ways. however, these libraries have never acquired significant traction in mainstream c++ programming. if had, still long way off implementing protocol complex xmpp.

flash media server - Problem with publishing rtmp stream to FMS with librtmp -

i'm trying video webcam , encoded , publish stream fms. , i'am having problem when try publish rtmp stream fms librtmp. code: char uri[]="rtmp://127.0.0.1/live/bolton"; r= rtmp_alloc(); rtmp_init(r); rtmp_setupurl(r, (char*)uri); r->link.lflags |= rtmp_lf_live; r->link.lflags |= rtmp_lf_bufx; rtmp_enablewrite(r); //rtmp_setbufferms(r, buffertime); rtmp_connect(r, null); rtmp_connectstream(r,0); and log: debug: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 debug: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 debug: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 debug: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 debug: handshake: handshaking finished.... debug: rtmp_connect1, handshaked debug2: rtmp_sendpacket: fd=768, size=85 debug2: 0000: 03 00 00 00 00 00 55 14 00 00 00 00 ......u..... debug2: 0000: 02 00 07 63 6f 6e 6e 65 63 74 00 3f f0 00 00 00 ...connect.?.... debug2: 0010: 00 00 00 03 00 03 61 70 ...

c# - Reflection: How to get a generic method? -

possible duplicates: how use reflection call generic method? select right generic method reflection hi there let's have 2 following 2 methods in class: public void mymethod(object val) {} public void mymethod<t>(t val) {} with reflection, first method this: type[] typearray = new type[1]; typearray.setvalue(typeof(object), 1); var mymethod = myinstance.gettype().getmethod("mymethod", typearray); but how can second, generic method? var mymethod = myinstance.gettype() .getmethods() .where(m => m.name == "mymethod") .select(m => new { method = m, params = m.getparameters(), args = m.getgenericarguments() }) .where(x => x.params.length ==...

javascript - jQuery form submission -

my form works should , receive emails if hit submit without entering data error box informing of required fields - submit button stays greyed out, if fill in fields cannot submit form without refresh. code: jquery(document).ready(function() { $('#success').hide(); $('#contactform').submit(function() { var action = $(this).attr('action'); $('#contactform #submit').attr('disabled', 'disabled').after('<img src="images/ajax-loader.gif" class="loader" />'); $("#message").slideup(750,function() { $('#message').hide(); $.post(action, { name: $('#name').val(), email: $('#email').val(), phone: $('#phone').val(), subject: $('#subject').val(), comments: $('#comments').val(), verify: $('#verify...

c# - How to increase the table height from the code behind file in ASP.Net while using StringWriter? -

i generating 1 pdf code behind file using stringwriter , htmltextwriter. coding given below: system.io.stringwriter sw = new system.io.stringwriter(); htmltextwriter hw = new htmltextwriter(sw); gridview gv = new gridview(); gv.borderstyle = borderstyle.none; gv.datasource = dt2; gv.databind(); gv.rendercontrol(hw); string str = sw.tostring(); string str1 = "<table width='100%' border='1'><tr><td><img src='" + server.mappath("app_themes/ribo/ribologo.bmp") + "' alt='' width=75px height=75px /></td><td align='center' colspan='8' font size='3'><h2><b>material receipt cum inspection report(mrir)</b></h2</td></tr>"; str1 += "<tr><td font size='3'>mrir no</td><td font size='3'>date</td><td align='center' font size='3'>job description</td><td font size...

java - how to use JdbcTemplate in a multithreaded environment? -

i'm trying use spring jdbctemplate spring's simpleasynctaskexecutor concurrent connections db can made , whole data can inserted related table in smaller amount of time when compared single threaded environment. i'm using following code, doesn't speed application. the clue find fact bean "campaignproductdbwriter" constructed once whereas i'm expecting 10 seperate instances created set "throttle-limit" 10 in tasklet. what doing wrong? or suggestions appreciated. regards, <bean id="datasourceproduct" class="org.springframework.jdbc.datasource.drivermanagerdatasource" p:driverclassname="${jdbc.driverclassname}" p:url="${jdbc.url.product}" p:username="${jdbc.username.product}" p:password="${jdbc.password.product}" /> <bean id="jdbctemplateproduct" class="org.springframework.jdbc.core.jdbctemplate"> <property name="datasource...

c# - Sending a bitmap from an Android to a laptop -

a friend @ work has gone on holiday , left me app sends bitmap (as byte array using bitmap.compressformat) android device laptop running application has written in c sharp. is there way i'm going able end picture sent, saved on laptop? or changing app him? sorry, quick edit. is there going conflict in between java , c sharp framework here? worry bitmap class in java differs off c sharp bitmap class. i think bitmap in byte bitmap (but wrong, if java serialize it's bitmap class instead of image thing it's not true). however, if have byte array can start trying use c# constructor http://msdn.microsoft.com/it-it/library/z7ha67kw.aspx bitmap(stream), memory stream on byte array hope helps bit

Having trouble calling Oracle stored procedure in java -

i'm having trouble calling oracle stored procedure in java. added stored procedure database this: string sql = "create or replace procedure liveresults() " + "is " + "begin" + " select pool_id, pool_mbr_id, bsln_cd, pge_typ_nm, serv_nm, cl_file_nm" + " lbmadm.tppo_mstr_map " + " order serv_nm" + " pge_typ_nm = 'live' ; " + "end"; stmtlive = con.createstatement(); stmtlive.executeupdate(sql); and i'm trying call : callablestatement cs; try { cs = con.preparecall("{call liveresults() }"); rs = cs.executequery(); while (rs.next()) { ..... however, i'm gettin...

java - Get all annotations in a project? -

is there way annotations in eclipse project in single annotation[] ? project mean, in of packages in source folder. take @ scannotation scannotation java library creates annotation database set of .class files.

Why/Should we implement BaseColumns when using a Content Provider in Android? -

i browsing source code google iosched app , noticed following code snippet part of content provider implementation: public static class blocks implements blockscolumns, basecolumns . as far know basecolumns interface 2 constants: _count , _id . i have 2 questions: what advantages/disadvantages of implementing basecolumns opposed having private field _id in class directly? what role of constant _count ? according android developer guide , note: provider isn't required have primary key, , isn't required use _id column name of primary key if 1 present. however, if want bind data provider listview, 1 of column names has _id. requirement explained in more detail in section displaying query results. the guide continues on explain basics of why need unique value provided primary key , table data should have "primary key" column provider maintains unique numeric value each row. can use value link row related rows in other ...

spring - Map of Maps Initialization in Application Context -

i want initialize map of maps in spring context file. i'm getting xsd error. cvc-complex-type.2.4.d: invalid content found starting element 'map'. no child element expected @ point. this bean defnition: <bean id="votodomapper" class="com.yyy.yyy.yyy.yyy.configuration.votodomapper" factory-method="getinstance"> <property name="channeltomapper"> <map key-type="java.lang.string" value-type="java.util.hashmap"> <entry key="yyy" > <value> <map> <entry key="com.yyy.yyy.yyy.asyncaddresschangeeventvo"> <value>com.yyy.yyy.yyy.vo.yyy.fakeacctaddressevent</value> </entry> </map> </value> </entry> </map> </property> </bean> any appreciated. one way <util:map...

python - Cartesian product of a dictionary of lists -

i'm trying write code test out cartesian product of bunch of input parameters. i've looked @ itertools , product function not want. there simple obvious way take dictionary arbitrary number of keys and arbitrary number of elements in each value, , yield dictionary next permutation? input: options = {"number": [1,2,3], "color": ["orange","blue"] } print list( my_product(options) ) example output: [ {"number": 1, "color": "orange"}, {"number": 1, "color": "blue"}, {"number": 2, "color": "orange"}, {"number": 2, "color": "blue"}, {"number": 3, "color": "orange"}, {"number": 3, "color": "blue"} ] ok, @dfan telling me looking in wrong place. i've got now: def my_product(dicts): return (dict(izip(dicts, x)) x in product(*di...