Posts

Showing posts from January, 2014

.net - update table with c# and mysql -

i apologize in advance elementary questions i using: command.commandtext = "select * some_table;" to retrieve data can use same thing update data? i assume command instance of sqlcommand. in case, yes can. here code fragment detailing should update data: command.connection = (insert connection string here); command.commandtext = (insert update statement); int numrowsupdated = command.executenonquery(); as type 3 answers came in. no need apologize; we're happy help!

Find all Chinese text in a string using Python and Regex -

i needed strip chinese out of bunch of strings today , looking simple python regex. suggestions? the short, relatively comprehensive answer narrow unicode builds of python (excluding ordinals > 65535 can represented in narrow unicode builds via surrogate pairs): re = re.compile(u'[⺀-⺙⺛-⻳⼀-⿕々〇〡-〩〸-〺〻㐀-䶵一-鿃豈-鶴侮-頻並-龎]', re.unicode) nochinese = re.sub('', mystring) the code building re, , if need detect chinese characters in supplementary plane wide builds: # -*- coding: utf-8 -*- import re lhan = [[0x2e80, 0x2e99], # han # [26] cjk radical repeat, cjk radical rap [0x2e9b, 0x2ef3], # han # [89] cjk radical choke, cjk radical c-simplified turtle [0x2f00, 0x2fd5], # han # [214] kangxi radical one, kangxi radical flute 0x3005, # han # lm ideographic iteration mark 0x3007, # han # nl ideographic number 0 [0x3021, 0x3029], # han # nl [9] hangzhou numeral one, ha...

database theory - candidate keys from functional dependencies -

given relation r attributes abcde. given following dependencies: -> b, bc -> e, , ed -> a. have answer cde, acd, , bcd. need know how it. thanks. a candidate key minimal superkey. in other words, there no superflous attributes in key. first step finding candidate key, find superkeys. unfamiliar, super key set of attributes closure set of atributes. in other words, super key set of attributes can start from, , following functional dependencies, lead set containing each , every attribute. since have functional dependencies: -> b, bc -> e, , ed -> a, have following superkeys: abcde (all attributes super key) bced (we can attribute through ed -> a) acde (just add b through -> b) abcd (just add e through bc -> e) acd (we can b through -> b, , can e through bc -> e) bcd (we can e through bc -> e, , ed -> a) cde (we can through ed -> , b -> b) (one trick here realize, since c , d never appear on right side of function...

How i can get user email and name with Facebook connect new platform -

Image
i using facebook connect new platform in asp.net web site in 2.0. want user email , name. how can that. regards. email address , other information of user facebook, users permission before should have facebook app id , secret id , these values can created below link, when logged facebook https://developers.facebook.com/apps follow steps create apps , keys automatically step 0 make test.php , below contents <html> <head> <title>my facebook login page</title> </head> <body> <div id="fb-root"></div> <script> window.fbasyncinit = function() { fb.init({ appid : 'your_app_id', status : true, cookie : true, xfbml : true, oauth : true, }); }; (function(d){ var js, id = 'facebook-jssdk'; if (d.getelementbyid(id)) {return...

http - Should I allow sending complete structures when using PUT for updates in a REST API or not? -

i designing rest api , wonder recommended way handle updates resources be. more specifically, allow updates through put on resource, should allow in body of put request? always complete structure of resource? always subpart (that changed) of structure of resource? a combination of both? for example, take resource http://example.org/api/v1/dogs/packs/p1 . get on resource give following: request: http://example.org/api/v1/dogs/packs/p1 accept: application/xml response: <pack> <owner>david</owner> <dogs> <dog> <name>woofer</name> <breed>basset hound</breed> </dog> <dog> <name>mr. bones</name> <breed>basset hound</breed> </dog> </dogs> </pack> suppose want add dog (sniffers basset hound) pack, support either: request: put http://example.org/api/v1/dogs/packs/p1 <dog> <name>sniffers</name> <br...

How to get skin tone color pixel in iPhone? -

in application m using following way red pixel in image // // pixelsaccessappdelegate.h // pixelsaccess // // created fortune1 on 14/04/10. // copyright __mycompanyname__ 2010. rights reserved. // #import <uikit/uikit.h> @class clspixelaccess; nsuinteger numberofredpixels; nsuinteger numberofredpixels1; nsuinteger numberofredpixels2; nsuinteger numberofredpixels3; nsuinteger numberofredpixels4; nsuinteger numberofredpixels5; nsuinteger numberofredpixels6; nsuinteger numberofredpixels7; nsuinteger numberofredpixels8; nsuinteger numberofredpixels9; nsuinteger numberofredpixels10; nsuinteger numberofredpixels11; nsuinteger numberofredpixels12; nsuinteger numberofredpixels13; nsuinteger numberofredpixels14; nsuinteger numberofredpixels15; nsuinteger numberofredpixels16; nsuinteger numberofredpixels17; nsuinteger numberofredpixels18; nsuinteger numberofredpixels19; nsuinteger numberofredpixels20; nsuinteger numberofredpixels21; nsuinteger numberofredpixels22; nsuinteger num...

Getting Null value Of variable in sql server -

strange situation in trigger assign column value variable gives exception while inserting other table using variable. e.g select @srno=a.srno id=123; insert b (srno) values (@srno) // here gives null run above select query in query pane works fine in trigger gives me null suggestions alter procedure processdata @id decimal(38,0), @xmlstring varchar(1000), @phone varchar(20) as declare @idoc int, @ierror int, @serial varchar(15), @phonenumber varchar(15), begin commit tran exec sp_xml_preparedocument @idoc output,@xmlstring<br/> select @ierror = @@error<br/> if @ierror = 0<br/> begin<br/> select @serial = convert(text,[text]) openxml (@idoc,'',1) nodetype = 3 , parentid = 2 if @serial=valid <br/> begin<br/> begin tran invalid<br/> begin try <br/> declar...

c# - How can I map an array property to a delimited string db field using EF? -

i have object array property want persist in database delimited string. how map property field in database , vice versus? public class user() { public int id { get; set; } public string[] roles { get; set; } } incomplete config class: public class userconfig : entitytypeconfiguration<user> { public userconfig() { this.property(u => u.roles).__???__ this.map(u => u.properties<string[]>(r => r.roles).__???__)) .hascolumnname("roles"); } } for example "roles" property converted "rolea,roleb,rolec" when going database , transformed array when read database. there on data mapping event somewhere? you need additional property wraps , converts string string[] . public class user() { public int id { get; set; } public string roles { get; set; } public string[] rolesarray { { return roles.split(',').toarray(); } set { roles = string.join(',...

javascript - click .toggle add/remove class -

when click #tool want add class .spanner div #drill . however when #drill has class .spanner , #tool clicked want class removed? use toggleclass function: $("#tool").click(function() { $("#drill").toggleclass("spanner"); });

Problem with C# Decompression -

have data in sybase image type column want use in c# app. data has been compressed java using java.util.zip package. wanted test decompress data in c#. wrote test app pulls out of database: byte[] bytes = (byte[])reader.getvalue(0); this gives me compressed byte[] of 2479 length. pass seemingly standard c# decompression method: public static byte[] decompress(byte[] gzbuffer) { memorystream ms = new memorystream(); int msglength = bitconverter.toint32(gzbuffer, 0); ms.write(gzbuffer, 4, gzbuffer.length - 4); byte[] buffer = new byte[msglength]; ms.position = 0; gzipstream zip = new gzipstream(ms, compressionmode.decompress); zip.read(buffer, 0, buffer.length); return buffer; } the value msglength 1503501432 seems way out of range. original document should in range of 5k -50k. anyway when use value create "buffer" not surprisingly outofmemoryexception. happening? jim the java compress method follows: public byte[] comp...

blogs - Could someone give me an overview for a php 'anonymous confessions' script? -

i don't need know every minute detail, i'll own research, if wanted write script allowed anonymous visitors site post confessions on site see, no 'approval'.. process, comments, , captcha. it'd need have backend deletions of comments , 'confession' posts - overview of i'd need do/learn in php achieve that. have basic understanding of php, enough modify existing scripts. if there script out there base on, love know called. thanks. those basic crud actions virtually every dynamic website does. whether call them comments or blog posts or forum threads or confessions, it's creating, reading, updating , deleting objects represented rows in database. a beginners php book walk through building things (a blog, cms, etc)... recommend book build own database driven website php & mysql .

windows - why create CLSID_CaptureGraphBuilder2 instance always failed in a machine -

it's real strange issue, machine information below dxdiag. there no error reported, create clsid_capturegraphbuilder2 instance failed in machine. it's okay create clsid_filtergraph. before create clsid_capturegraphbuilder2, have called coinitialize , created clsid_filtergraph. machine has error, dll related interface or function needed call before make work? in advance. system information time of report: 4/24/2010, 09:46:58 machine name: turion operating system: windows xp home edition (5.1, build 2600) service pack 3 (2600.xpsp_sp3_qfe.100216-1510) language: japanese (regional setting: japanese) system manufacturer: filled o.e.m. system model: ms-7145 bios: default system bios processor: amd turion(tm) 64 mobile technology mt-30, mmx, 3dnow, ~1.6ghz memory: 768mb ram page file: 376mb used, 1401mb available windows dir: c:\windows directx version: directx 9.0c (4.09.0000.0904) dx...

Convert MS word file to Image in .Net C# -

i want convert microsoft word image file using .net c#. suggest open source. help virtual printer drivers common way this. you use modi virtual printer included office, print tiff. as pdf requirement there number of free virtual printers pdf. office 2010 has 'save pdf' feaure. may worth looking @ open office, can open ms office docs, , save pdf. i'm not 100% sure kind of api's has available open source

java - How to get ID of computer? -

is there code in vb.net or java id of computer >>?? want write program id of computer in order make license of software microsoft did ? thanks in advance makara first off, microsoft licensing doesn't work way. they have key generated on side of things. when sell copy of software, give key. once enter key, software sends encrypted tcp packets ms in order identify key in use , increase usage count. creates nicely hidden file on system contains authorization key. none of involves getting "id of computer". now, ms (under @ least 1 of licensing models) take snapshot of system includes processor type, hard drive, , motherboard make/model in order identify whether components have changed enough trigger potential check on whether computer license needs reverified. which leaves idea there isn't single "id" in computer system. last time attempted intel (i believe?) pii processors. however, public backlash enough stopped putting se...

linux - How can you determine installed versions of the glibc (etc.) libraries? -

i'm working embedded linux deployment , using cross compiler tool chain doesn't compile i2c library function calls. how determine precise versions of libraries on system may rebuild tool chain? i don't intend replace libraries deployed, know work (including i2c), believe need following: binutils version gcc version glibc kernel (for headers) i think can assume following binutils library version 2.2.5. kernel modded i've source. root@dev-box />ls /lib/ -al drwxrwxrwx 3 root root 1024 apr 27 09:44 . drwxrwxrwx 14 root root 1024 jan 1 1970 .. -rwxrwxrwx 1 root root 105379 jan 1 1970 ld-2.2.5.so lrwxrwxrwx 1 root root 16 jan 1 1970 ld-linux.so.2 -> /lib/ld-2.2.5.so lrwxrwxrwx 1 root root 16 jan 1 1970 ld.so.1 -> /lib/ld-2.2.5.so -rwxrwxrwx 1 root root 1288601 jan 1 1970 libc.so.6 -rwxrwxrwx 1 root root 25441 jan 1 1970 libcrypt.so.1 -rwxrwxrwx 1 root root 14303 jan 1 1970 libdl.so.2 -rwxrwxrwx 1...

sql - Can I set NHibernate's default "OrderBy" to be "CreatedDate" not "Id"? -

this oddball question figure. can nhibernate ask sql sort data createddate default unless set orderby in hql or criteria? i'm interested in knowing whether sort can accomplished @ db level avoid bringing in linq. the reason use guids ids , when this: sheet sheet = sheetrepository.get(_someguid); ilist<sheetlineitems> lineitems = sheet.lineitems; to fetch of lineitems, come in whatever arbitrary way sql sorts fetch, figure guid. @ point i'll add ordinals line items, now, want use createddate sort criteria. don't want forced do: ilist<sheetlineitem> lineitems = sheetlineitemrepository.getall(_sheetguid); and writing method sort createddate. figure if sorted on createddate default, fine, unless requested otherwise. no, can't. best solution (as mention in comment) set order-by attribute in collection mapping . note value should set database column name, not property name.

c# - VS2010 / Target Framework = 3.5 / Building on Continuous Integration Server -

i'm checking upgrading vs2010. our production servers have 3.5 framework , 6-9 months before updated. we have continuous integration server, running cruisecontrol.net (cc.net). has 3.5 framework on well. our implementation of cc.net calls msbuild.exe mysolution.msbuild. (we encapsulate of build logic .msbuild files fyi) inside .msbuild file, following "build" syntax: < target name="build" dependsontargets="checkout"> < msbuild projects="$(workingcheckout)\mysolution.sln" targets="build" properties="configuration=$(configuration)"> < output taskparameter="targetoutputs" itemname="targetoutputsitemname">< /output> < /msbuild> < /target> (a few spaces added make display here) =========== i know vs2010 can "target" 3.5 framework. my question happens when have vs2010 dev machine, , check vs2010 .sln , .csproj(s) files source c...

c++ - Caching XSD schema to reuse in several XML DOM parser tasks in Xerces -

how can cache xsd schema (residing on disk) reused when parsing xmls in xerces (c++)? i load xsd schema when starting process, then, whenever need parse xml, validate first using loaded schema. i think found need here .

How to use table component added to JasperReports 3.7.2 with grails jasper plugins? -

i use new table component added jasperreports 3.7.2 grails jasper plugins. find new component useful generate tables. i have define table dataset 1, , fields (ex : $f{name}), problem, fields values null. have define fields (not attached table), , values. here table code : <subdataset name="table dataset 1"> <field name="name" class="java.lang.string"/> <field name="signal" class="java.lang.double"/> ... </subdataset> <componentelement> <reportelement key="table" style="table" x="0" y="0" width="802" height="50"/> <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> <datasetrun subdataset="table dataset 1"> <d...

Rails not using Postgres user account -

i'm using rails 3.0 , postgresql 8.4 on ubuntu 10.10 , ruby 1.9.2p136 pg gem. when run rake db:migrate , error fatal: password authentication failed user "my_os_user_account" , when expected log in database my_db_username specified in database.yml. i have md5 authentication configured in pg_hba.conf both unix socket , ip connections , can log in using psql on command line. have tried setting authentication trust. psql allows me log in without entering password, rails gives fatal: role "my_os_user_account" not exist . here's database.yml: development: adapter: postgresql database: my_project_dev user: my_db_username password: my_password pool: 5 timeout: 5000 with additional near-identical entries test , production. the correct key username is, in fact, username , not user . easy mistake, easy fix.

Ruby on Rails Tutorial Test Not Passing -

i'm working through railstutorial.org book, chapter 9. when running test suite, can't rid of following failure. code has been attempted first typing in , copying , pasting book. ...............f............................................ failures: 1) sessionscontroller delete 'destroy' should sign user out failure/error: controller.should_not be_signed_in expected signed_in? return false, got true # ./spec/controllers/sessions_controller_spec.rb:69:in `block (3 levels) in <top (required)>' finished in 8.28 seconds 60 examples, 1 failure here's code test in sessions_controller_spec.rb: describe "delete 'destroy'" "should sign user out" test_sign_in(factory(:user)) delete :destroy controller.should_not be_signed_in response.should redirect_to(root_path) end end the (i think) relevant portions of sessions_controller.rb: def destroy sign_out redirect_to root_path end th...

asp.net mvc - How should I use ninject in a multiproject mvc app? -

my app set way web data services poco entities controllers use services (so should injected) services use repositories (which assume should injected) i have set controllers receive service need through ninject not sure how done services =>repositories any this? you use ninject.web.mvc extension. contains sample application illustrates how register container in global.asax .

xml - XSL ignores my whitespace even with the <xsl:text> tag -

i'm making header in xsl code includes multiple fields of information, i.e. "name: bob birthdate: january 1 1900," etc. enclosed them in tags such: <xsl:text> gender: male </xsl:text> but on page, whitespace around gender/male being ignored. there i'm missing? thanks in advance. if want output text file should specify <xsl:output method="text"/> child of <xsl:stylesheet> element. when treating output html parser might pack spaces, if html output non-breaking spaces want can use &#160; non-breaking space entity (note &nbsp; might not work since it's not xml entity, unless declare yourself).

How to generate a specific CPPDEFINE such as -DOEM="FOO BAR" using Scons -

my intention end compiler command line including -doem="foo bar" i have following in sconstruct file: opts = options( 'overrides.py', arguments ) opts.add( 'oem_name', 'any string can used here', 'undefined' ) . . . if (env.dictionary('oem_name') != 'undefined'): oem_define = 'oem=' + str(env.dictionary('oem_name')) env.append( cppdefines=[ oem_define ] ) then put following in "overrides.py" file: oem_name = "foo bar" i seem end "-doem=foo bar" in command line gets generated. can point me in right direction? thanks. cppdefines can dictionary (the scons user guide has an example ). couldn't figure out way rid of surrounding quotes, had double escape quotes around string: env = environment(cppdefines = {'oem': '\\"foo bar\\"'})

ASP.NET Self Update System -

the customer requires install our asp.net-based web system on intranet server. initial adjustments done, server made inaccessible (due security reasons might have guessed). on other hand, still responsible maintenance , ongoing development. so after kind of auto update system. deemed windows service working side side site , periodically polling central server updates. assuming central server under developers' control, such approach solve problem. the question whether such systems exist, either commercial or free/open source. have heard of them? bit limited in time , prefer accommodate ready made solution rather writing scratch. phil haack has library he's putting enable this, although agree dave's answer should not responsible if can't in control of it. see here more details.

Continuous Integration - with what to start: CruiseControl.NET vs TeamCity vs Visual Studio Team System -

i'm new continuous integration. want advice tool should start deal with. see biggest tools right now: cruisecontrol.net, teamcity , visual studio team system. i'm using tools: visual studio 2010, mercurial, nant, nunit. both teamcity , cruisecontrol.net work fine set of tools. can consider alternatives : hudson (free, ui-based setup) visual studio team system (expensive (about 6000$), ui-based setup) cruisecontrol.net (free, xml-based setup) teamcity (professional edition of teamcity free, ui-based setup) the difference : 1) pricing. cruisecontrol.net , hudson free , open source, while visual studio team system , teamcity cost money (however professional edition of teamcity free). 2) set process. systems have pretty simple ui continuous integration processes except cruise control .net - uses xml-based configuration files instead ( example ) essentially need integration system run nant script on commit event , show report. every continuous integra...

iphone - Swipe to change views -

is following easy code? i have tableview , when user selects cell detail view loaded. want allow user navigate throughout items/detail-view representing items in tableview left , right swipes, working in same way e.g. home-screen of iphone (e.g. while swiping, 1 page moving off screen , next appears). i have seen implemented in mobilerss-app, possible, have hard-time figuring out way properly. thanks million in advance! still trying find feet cocoa-touch... this not secret, apple provides sample code called pagecontrol demonstrates want achieve: this application demonstrates use of uiscrollview's paging functionality use horizontal scrolling mechanism navigating between different pages of content. i implemented in many of apps .

.net - C# - which programs have been opened since the user opened my program -

i need know programs have been opened since user opened program - program activity monitor.. how can that? you can use wmi notified when new process started: using wmi monitor process creation, deletion , modification in .net

usability - User name form validation message -

i have form validation message user name field says following name can contain alphabets, '.' , ' ' characters or should be name can contain alphabets, dot , space characters or should be name can contain alphabets, dot (".") , space (" ") characters which preferable usability perspective assuming end users has less exposure computers. use 'letters of alphabet' not 'alphabets' rather 'characters' ''.'' or ("."), why not show character on instance different background so like: name can contain letters of alphabet, . , spaces

How to make sure the value is reset in a 'foreach' loop in PHP? -

i writing simple php page , few foreach loops used. here scripts: $arrs = array("a", "b", "c"); foreach ($arrs $arr) { if(substr($arr,0,1)=="b") { echo "this b"; } } // end of first 'foreach' loop, , didn't use 'ifelse' here. and when foreach ends, wrote foreach loop in values in foreach loop same in previous foreach . foreach ($arrs $arr) { if(substr($arr,0,1)=="c") { echo "this c"; } } i not sure if practice have 2 foreach loops same values , keys. will values overwritten in first foreach loop? it's ok until start using references , can strange behaviour, example: <?php $array = array(1,2,3,4); //notice reference & foreach ($array & $item) { } $array2 = array(10, 11, 12, 13); foreach ($array2 $item) { } print_r($array); outputs this: array ( [0] => 1 [1] => 2 [2] => 3 [3]...

php - where to put business logic in a library? -

i'm going create library consists of lot of separate classes. i'm familiar mvc have never created pure library before. i wonder should put business logic? kind of logic resides in controller in mvc. should in class or in "bootstrap" file? and should 1 file include every class, or should 1 class include classes uses? to clarify: goal not create mvc, pure library eg. email or guestbook others can use. thanks! there difference in mixed terminology between framework , library: a library collection of classes offer functionality. user of library responsible providing information necessary , instanciating these classes (you can provide higher level abstraction classes interface simple possible). a framework collection of classes provides frame how application or part of application being built, e.g. forcing user of framework follow mvc pattern (where user has provide appropriate model, view , controller classes). leads called inversion of con...

.net - How to build solution using batchfile -

i want build .net solution using batch file. i aware need use following statement devenv /build release "d:\source code\source\test.sln" but not know how create batch file execute on vs command prompt. the visual studio command prompt loads variables , path settings. that's is, it's nothing specially, it's not different command prompt, it's same command prompt settings configured. can load same settings in own batch file including following line @ top: call "c:\program files\microsoft visual studio 9.0\vc\vcvarsall.bat" x86 (obviously, different versions of vs, path might change slightly) you can replace "x86" appropriate architecture machine. permitted values are: x86 amd64 x64 ia64 x86_amd64 x86_ia64 that said, don't think need load vars/paths need provide full path devenv.exe file. try instead: "c:\program files\microsoft visual studio 9.0\common7\ide\devenv.exe" /build release "d...

c# - Math.Asin problem -

i calculating value ( should reflect sin of angle between direction vector , xz plane ) angle_between_direction_and_xplane = (math.abs(enemyship_.orientation.forward.y) / math.sqrt(math.pow(enemyship_.orientation.forward.x, 2) + math.pow(enemyship_.orientation.forward.y, 2) + math.pow(enemyship_.orientation.forward.z, 2))); and seems work fine . when object perpendicular ground angle_between_direction_and_xplane near 1 , when paralel xz plane near 0 . when apply math.asin angle ( 70 or 20 degrees ) instead values around 1 . using wrong ? asin returns angle in radians. multiply 180/pi angle in degrees.

Grails 1.2.0 not finding plugins in the default repository -

i not know changed in environment, of sudden can not pull plugins default repository. went through _*.groovy scripts , nothing has changed in grails home directory , appears default repository url set correctly (default_plugin_dist = " http://plugins.grails.org "). i assuming environment setting changed on me, because if switch old version of grails have installed, 1.1.1 example, list-plugins returning full list of plugins. when run grails list-plugins in current 1.2.0 environment following output: welcome grails 1.2.0 - http://grails.org/ licensed under apache standard license 2.0 grails home set to: /opt/grails-1.2.0 base directory: /users/padraic/projects/testapplicationmachine resolving dependencies... dependencies resolved in 1633ms. running script /opt/grails-1.2.0/scripts/listplugins_.groovy environment set development reading remote plugin list ... plug-ins available in core repository listed below: hibernate <1.3.0.rc2> -- hib...

How should I access Active Directory from a C# application running on mono in Linux? -

my code run in windows (non-mono) , in linux (mono). currently, using system.directoryservices, works great in windows. in linux: system.nullreferenceexception: object reference not set instance of object @ system.directoryservices.directorysearcher.initblock () [0x00000] @ system.directoryservices.directorysearcher.dosearch () [0x00000] @ system.directoryservices.directorysearcher.get_srchcoll () [0x00000] @ system.directoryservices.directorysearcher.findone () [0x00000] @ (wrapper remoting-invoke-with-check) system.directoryservices.directorysearcher:findone () remobjects has ldap implementation in internet pack .net, http://blogs.remobjects.com/blogs/ck/2010/02/08/p1043

android - Setting number of columns programmatically in TableLayout -

i have xml layout contains tablelayout unknown number of tablerows... number of rows established durin runtime, know though want 2 columns... have couple of questions regarding : - there way set whole tablelayout have 2 columns ? - there way programmatically give id (during runtime) created tablerows placed within tablelayout, can reference them later on other parts of software ? you can build table rows via xml parts , layoutinflater. had table_cell.xml: <textview android:id="@+id/text" android:text="woot" /> and table_row.xml (unless you're doing fancy tablerow, may not need put in it's own xml file, , instead create programmatically. result same): <tablerow /> assuming tablelayout reference called "table", this: tablelayout table = (tablelayout)findviewbyid(r.id.table); layoutinflater inflater = getlayoutinflater(); for(int = 0; < 5; i++) { tablerow row = (tablerow)inflater.inflate(r.layout.tab...

jquery - Manipulating a copied attr -

i'm working on simple lightbox script website, wraps link (a) around image. link url should src of image, manipulated. the image url this: "pb028855_copy_147x110.jpg" , want delete " 147x110", after "copy " before ".jpg" is. my current script, copy src image link this: $(function(){ $('img.withcaption').each(function(){ var $imgsrc = $(this).attr("src"); $(this).wrap('<a rel="lightbox" />'); $(this).parent().attr("href", ""+$imgsrc); }); }); how can use parts of attr? thank in advance... if you're not numbers be, use replace() (docs) method regular expression. $(function(){ $('img.withcaption').each(function(){ var $imgsrc = this.src.replace(/_\d+x\d+\./,'.'); $(this).wrap('<a rel="lightbox" />') .parent().attr("href", ""+$img...

java - How to handle ordering of @Rule's when they are dependent on each other -

i use embedded servers run inside junit test cases. these servers require working directory (for example apache directory server). the new @rule in junit 4.7 can handle these cases. temporaryfolder-rule can create temporary directory. custom externalresource-rule can created server. how handle if want pass result 1 rule another: import static org.junit.assert.assertequals; import java.io.*; import org.junit.*; import org.junit.rules.*; public class folderruleorderingtest { @rule public temporaryfolder folder = new temporaryfolder(); @rule public mynumberserver server = new mynumberserver(folder); @test public void testmynumberserver() throws ioexception { server.storenumber(10); assertequals(10, server.getnumber()); } /** simple server can store 1 number */ private static class mynumberserver extends externalresource { private temporaryfolder folder; /** actual datafile number stored */ private f...

sql - How Can I Execute *.exe From Table Trigger? -

i start exe or dll once record updated. if field of interest updated call *.exe parameters. possible in mysql , oracle? a similar issue came in this question . while poster trying make web call within trigger, same general response ("this not idea") true here well.

servlets - Session timeout in Java EE -

in ways time session timeout can defined in java ee? looking beyond obvious ways, such setting session timeout in web.xml or httpsession.setmaxinactiveinterval(). i reviewing java ee application, can't find related session timeout definition. web app in weblogic. assuming since there no session timeout definition, session never expire. as you're looking how session can timed out in weblogic, can add timeoutsecs in weblogic.xml or check point in code session killed session.invalidate() on logout. by way, not infinite. on weblogic, default in web.xml (if no value specified) use timeoutsecs value in weblogic.xml, defaults 3600 secs i.e. 60 mins

diff - Comparison tool with option to check file names only? -

i'm looking folder comparison tool has option check file names only, not timestamps or content. i've tried araxis merge, beyond compare, , winmerge, none seem have option. beyond compare support that. use session->session settings... menu item , on comparison tab uncheck everything. if want check case changes check compare filename case option.

how to allow user manual entry in datagridview combobox in c# -

i trying enter values in datagridview combobox. not allows. do? private void gridstockitementry_editingcontrolshowing(object sender, datagridvieweditingcontrolshowingeventargs e) { datagridviewrow row = gridstockitementry.currentrow; datagridviewcell cell = gridstockitementry.currentcell; if (e.control.gettype() == typeof(datagridviewcomboboxeditingcontrol)) { if (cell == row.cells["itemname"] && convert.tostring(row.cells["type"].value) == "raw material") { datagridviewcomboboxeditingcontrol cbo = e.control datagridviewcomboboxeditingcontrol; cbo.dropdownstyle = comboboxstyle.dropdown; cbo.validating += new canceleventhandler(cbo_validating); } } } void cbo_validating(object sender, canceleventargs e) { datagridviewcomboboxeditingcontrol cbo = sender datagridviewcomboboxeditingcontr...

android - What if I want to release an update with higher minSDK than the one on the market? -

i have released an app on market minsdk set 4 (android 1.6) want release update features unavailable in 1.6 need higher minsdk . so, question is: users running 1.6 notified of update?...and if yes able download/install it? no shouldn't notified of update. market filter application out , no longer able see or receive updates. if want add features use higher api level not exclude user's of lower api level can use reflection enable this: public static method getexternalfilesdir; try { class<?> partypes[] = new class[1]; partypes[0] = string.class; getexternalfilesdir = context.class.getmethod("getexternalfilesdir", partypes); } catch (nosuchmethodexception e) { log.e(tag, "getexternalfilesdir isn't available in devices api"); } this piece of code saying: within context.class have got method getexte...

XPath and XMLs with namespaces -

i have following xml: <?xml version="1.0" encoding="utf-8"?> <arrayofagence xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns="http://www.artos.co.il/"> <agence> <codeaval>20008</codeaval> <codesource>artpo</codesource> <logicielsource>ntlis</logicielsource> </agence> </arrayofagence> i want codeaval value, tried: arrayofagence/agence/codeaval it didn't work since xml has namespace, so, how need approach this? thanks, you mentioned in comment use xpath in xslt. in case need add namespace definition prefix input documents default namespace http://www.artos.co.il/ , use prefix in xpath expression. example of namespace definition (it doesn't need in stylesheet element) <xsl:stylesheet version="1.0" xmlns:xsl="http://www...

Get Multiple Values in SQL Server Cursor -

i have cursor containing several columns row brings process @ once. notice of examples i've seeing on how use cursors show them assigning particular column cursor scalar value 1 @ time, moving next row, e.g. open db_cursor fetch next db_cursor @name while @@fetch_status = 0 begin --do stuff @name scalar value, next row cursor fetch next db_cursor @name end what want know if it's possible following: open db_cursor fetch next db_cursor; while @@fetch_status = 0 begin set @myname = db_cursor.name; set @myage = db_cursor.age; set @myfavoritecolor = db_cursor.favoritecolor; --do stuff scalar values fetch next db_cursor; end help appreciated. this should work: declare db_cursor cursor select name, age, color table; declare @myname varchar(256); declare @myage int; declare @myfavoritecolor varchar(40); open db_cursor; fetch next db_cursor @myname, @...

objective c - Cannot find protocol declaration in Xcode -

i've experienced today while i'm building app. i've declared protocol in myobject1 , add delegate property on it. i've assign myobject2 delegate of myobject1. i've added in way usual @interface myobject2 : uiviewcontroller <delegateofobject1> but xcode says protocol declaration cannot found. i've check code i've declared protocol. i've try assign myobject2 delegate of other object. i've edit code this @interface myobject2 : uiviewcontroller <uitableviewdelegate,delegateofobject1> but xcode again cannot found declaration of protocol of delegateofobject1. i've tried delete delegateofobject1 on code , add assign myobject delegate of other object , goes this. @interface myobject2 : uiviewcontroller <uitableviewdelegate,uitabbardelegate> no errors have been found. i've tried again add again delegateofobject1 in code @interface myobject2 : uiviewcontroller <uitableviewdelegate,uitabbardelegate,delegateofobje...

android - Drawable from mdpi loading instead of hdpi -

i have set project different drawable directories (ldpi, mdpi , hdpi). have background png 2 different resolutions: 320x480 in drawable-mdpi folder, , 480x800 in drawable-hdpi. both have same filename. when try load background style in manifest (using android:windowbackground in style) if use emulator 1.6 device, correct 1 loaded(mdpi). however, if try on nexus, see @ first correct background hdpi folder loaded, switches mdpi one. have tried set background in layout xml file (android:src=...) in case mdpi 1 loaded. if delete mdpi version, loaded ok. idea on problem? why loading mdpi drawable? in manifest file: <supports-screens android:anydensity="true"/> hope hepls

javascript - Using a variable as identifier in a json array -

i'm wondering if possible use assigned variables identifier in json array. when tried this, getting unexpected results: (code simplified, parameters passed in different way) var parameter = 'animal'; var value = 'pony'; util.urlappendparameters (url, {parameter : value}); util.urlappendparameters = function(url, parameters) { (var x in parameters) { alert(x); } } now alert popup says: 'parameter' instead of 'animal'. know use different method (creating array , assigning every parameter on new line), want keep code compact. so question is: possible use variable identifier in json array, , if so, please tell me how? thanks in advance! no, can't use variable identifier within object literal that. parser expecting name there can't else provide string. couldn't this: var parameter = 'animal'; var parameter = 'value'; //<- parser expects name, nothing more, original parameter not ...

Silverlight debug problem blank page -

i have visual studio 2010 , silverlight 4 on it. when i'm trying run simple application hello world in browser, shows blank page. the type 'deployment' not found. verify not missing assembly reference , referenced assemblies have been built. i think problem above how can solve it? did use silverlight web application? when create silverlight app have 1 web site associated. on default.aspx, have object. check parameters off object , verify if ok , have installed components support it.

javascript - jQuery $.param'ed string parsing in Python (app engine) -

i have javascript dictionary want pass python app on app engine, put datastore, retrieve datastore , return json. what's right way it? say looks that: dict = {'box': 'huge', 'crayons': [{ 'color': 'blue', 'l': 12 }, { 'color': 'red', 'l': 2 }, { 'color': 'yellow', 'l': 7 }]}; i serialize using jquery: data = $.param(dict); getting like: box=huge&crayons%5b0%5d%5bcolor%5d=blue&crayons%5b0%5d%5bl%5d=12&crayons%5b1%5d%5bcolor%5d=red&crayons%5b1%5d%5bl%5d=2&crayons%5b2%5d%5bcolor%5d=yellow&crayons%5b2%5d%5bl%5d=7 i send using $.ajax app engine (python, flask) , put datastore serialized string. later want deserialize python dictionary , translate json using simplejson. i have no idea how deserialize python dictionary though. edit: or maybe i'm doing wrong , need pass dictionary app engine differe...

swing - Progress bar in Java -

i have got form in java (swing) loading large amount of data database. want display progress bar while program gets loaded. how can it? the code follows: import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.sql.*; import java.applet.*; import java.util.*; import java.awt.color; public class bookshow extends jframe implements mouselistener, actionlistener { jpanel p1, p2, p3; jlabel l1, l2, l3, l4; imageicon image; jbutton b[] = new jbutton[84]; jbutton btnocc, btnbook, btnsel; resultset rs; private jmenubar menubar = new jmenubar(); private jmenuitem exit, home, save; private jmenu filemenu, gotomenu; public int cnt = 0, x = 150, y = 90, i, j, put = 0, k = 0, avail = 1, point, x1, y1, count = 0, quan; public static int prev_click = -1, xpos, ypos; public static int prev[] = new int[5]; public static int pos[][] = new int[5][2]; public string movname, movdate, movtime; public bookshow() { ...