Posts

Showing posts from July, 2015

c - Why does this code work to convert hexadecimal to decimal -

this code convert 1 hexadecimal digit decimal value. int value; // ch char variable holding hexadecimal digit if (isxdigit(ch)) if (isdigit(ch)) value = ch - '0'; else value = tolower(ch) - 'a' + 10; else fprintf(stderr, "%c not valid hex digit", ch); i don't understand how works though. can see different things subtracted char variable depending on whether number or letter. can understand part number gets converted, don't understand why 10 has added value when character letter. the subtraction of tolower(ch) - 'a' map character number in range 0..5 letters a..f. however, (decimal) value of hexadecimal digit a 16 10 10 , move range 10..15 needs be, 10 added. perhaps helps: +---------+------------+-----------------+-------------+ character | subtracted | resulting value | digit value | +---------+------------+-----------------+-------------+ | '0' | '0' | 0

Font-face with Internet Explorer -

does know there issues using more 1 or 2 @font-face declarations ie? i'm getting 1 typeface display, other won't @ all. cheers have generated right fonts work internet explorer (eot)? tutorial: generating custom fonts @font-face describes generating correct syntax support browsers. no reason why multiple wouldn't work. if you're still having issues perhaps can post code or example link?

java - NoInitialContextException when deploying MDB on custom resource adapter -

i developed resource adapter use within application ear, deployed in jboss 5.1. after playing around annotations , xml files, came following setup. ejb-jar.xml <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0"> <enterprise-beans> <message-driven> <display-name>myupdateservice</display-name> <ejb-name>myupdateservice</ejb-name> <ejb-class>com.my.package.myupdateservice</ejb-class> <messaging-type>com.my.other.package.adapterlistener</messaging-type> <transaction-type>bean</transaction-type> </message-driven> </enterprise-beans> </ejb-jar> jboss.xml <?xml version="1.0" en

Android Video Upload to Php server? -

how upload video or image file php server.anyone provide sample app or source upload file in php server please. i'd suggest creating asynctask handle upload , use apache libs post server. have system in place posts images linux server , php accepts post , saves image data. try this, you'll need commons-io jar , httpmime jar apache if remember correctly. import org.apache.http.httpresponse; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httppost; import org.apache.http.entity.mime.multipartentity; import org.apache.http.entity.mime.content.inputstreambody; import org.apache.http.entity.mime.content.stringbody; import org.apache.http.impl.client.defaulthttpclient; httpclient httpclient = new defaulthttpclient(); httppost postrequest = new httppost("http://www.mywebserver.com/upload"); multipartentity multipart = new multipartentity(); multipart.addpart("photo",bitmapdata); postrequest.setentity(multipart); h

objective c - iphone custom photo album view in inside of the appication(thumbnail) -

is possible implement photolibrary view custom thumbnail view default 1 grid list..(ie.,for example listing in uitableview)can u please me out..i strucked 1 past 1 week.... read alassetslibrary here code: -(void)viewdidload{ void (^assetenumerator)(struct alasset *, nsuinteger, bool *) = ^(alasset *result, nsuinteger index, bool *stop) { if(result != null) { //add result array uitableview } }; void (^assetgroupenumerator)(struct alassetsgroup *, bool *) = ^(alassetsgroup *group, bool *stop) { if(group != nil) { [group enumerateassetsusingblock:assetenumerator]; } }; alassetslibrary *library = [[alassetslibrary alloc] init]; [library enumerategroupswithtypes: alassetsgroupsavedphotos usingblock: assetgroupenumerator failureblock: ^(nserror *error) {

windows - convert the encoding of many files? -

i have 2000 files encoded in windows-1256. want convert encoding utf-8 (all in once) can notepad++ this? i encountered same problem. in case of needs it: #!/bin/bash mkdir ../converted x in `ls *` iconv -f windows-1256 -t utf-8 $x > ../converted/$x done note: unix systems, in case of windows can use cygwin.

.net - Is it possible to use Selenium with C# windows Form that contains a WebBrowser object? -

i'm wondering if it's possible use selenium c# windows form contains webbrowser object. i'm using selenium , i'm able create test cases selenium script record; i'm trying pinpoint whether or not can export c# code , have run within c# environment. appreciate thoughts or explanations. update got point have selenium open winform contains webbrowser component. there test won't execute. looks doesn't understand selenium command. don't see error messages being thrown though. hmmm the thing winformwithwebbrowsertest .exe opens winform webbrowser opened. nothing happens. below code 1 fires .exe test code (selenium command) namespace classlibrary1 { class class2 { private iselenium selenium; private stringbuilder verificationerrors; [setup] public void setuptest() { selenium = new defaultselenium ("localhost", 4444, "*custom c:\\users\\m-tak\\documen

java - how to detect new line in this type of string -

string quote = "now time "+ "men come aid of country."; i want detect break line in run time when click on button want know new line comes.. because in textview want output same string nothing change.. tell me idea or logic or source code of this.... the '\n' character specifies line break. "now time good\nmen come aid of country." if gui breaking line before point need disable word wrapping somehow.

jsf 2 - How to pass the node value as the attribute in Composite Component in JSF 2.0 -

i developing jsf 2.0 composite component. trying create box component required html set attribute. some thing like.. <composite:interface> <composite:attribute name="value" /> </composite:interface> <composite:implementation> <table cellpadding="0" cellspacing="0" border="1" width="100%"> <tr> <td></td> <td>#{cc.attrs.value}</td> <td></td> </tr> </table> </composite:implementation> when want use component , pass required html attribute "value", so: <somedir:boxcomp>hello</somedir:boxcomp> the "hello" not taken attribute value. how can make node value attribute value.? you aren't passing tag attribute. passing child in tag body. in case need use <composite:insertchildren /> insert it. so, instead of <td>#{cc.attrs

iphone - writing a text into xml file on click of a button -

can 1 tell me procedure write text on xml file text box ,on click of button.as im new iphone applications,please me out check out following answers. for "light-weight", plain text writing: writing , reading text files on iphone a more elaborate approach: writing files on iphone good luck!

Number TextBox in C# -

possible duplicate: how make textbox accepts numbers? hi all i want create numeric textbox accept numeric keys , separate number comma . please me ... you're looking numericupdown control , thousandsseparator property.

c++ - Can I create a for loop containing multiple type declarations? -

for example: is there can do, might allow me this: for(tixmlelement * pchild = elem->first(), int i=0; // note multiple type declarations pchild; pchild=pchild->nextsiblingelement(), i++) // note multiple types { //do stuff } perhaps there boost header? nope. if want limit scope of variables loop add scope: { tixmlelement * pchild = elem->first(); int = 0; for(; pchild; pchild=pchild->nextsiblingelement(), i++) { //do stuff } }

iphone - Not able to use componentsSeparatedByString on a string stored inNSMutableArray -

i'm parsing xml contains string needs displayed on screen. here code doing that. [gtutorialtextlist addobject:[attributedict objectforkey:@"value"]]; here value attribute contains text in xml , gtutorialtextlist nsmutablearray. what need need break line when ever \n comes in string. here code performs that. [[gtutorialtextlist objectatindex:0] componentsseparatedbystring:@"\n"]; but right i'm not able that. i'm not getting array of strings separated \n . when put nsstring directly, working fine. please help. think conveyed doubt properly. thanks in advance. can log value of object @ index 0 like: nsstring *logstring = [gtutorialtextlist objectatindex:0] nslog(@"-->%@<--", logstring); nsarray *stringarray = [logstring componentsseparatedbystring:@"\n"]; nslog(@"%@", stringarray); this should give clear picture of going on.

Algorithm to share array data in smaller array (s) in php -

i have array x ( 1,2,3,...700) i put datas in 5 arrays in order, like x1 ( 1,2...200) x2 (200...400) . . .x5(...,700) what fastest way gys? tx $xs = array_chunk($x, 200); http://php.net/manual/en/function.array-chunk.php

python - How do I register custom filter in Google App Engine template system? -

according django documentation i've registered filter: from google.appengine.ext.webapp import template # ... register = template.create_template_register() @register.filter(name='wld') def wld(result): if result == 1 : return "win" if result == 0 : return "loss" if result == 0.5 : return "draw" return "unknown" self.response.out.write(template.render("player.html", template_values)) somewhere in template have code: {{result|wld}} and when try render template, error: templatesyntaxerror: invalid filter: 'wld' what doing wrong? once have created custom tag library, need register django template engine: from google.appengine.ext.webapp import template template.register_template_library('path.to.lib') note call template.register_template_library wrapper provided part of appengine sdk. once have put in main.py , new tags or filters should available in of templates with

c# - windows mobile 6.5 CAB signing - what is the added value? -

i'm developing windows mobile 6.5 application in .net cf 3.5 dedicated customer. app has implemented functionality of autoupdate. application asks webservice @ startup newer version, if 1 exists, downloads cab installer via http , calls cab installation shellexecute. cab file not signed. wonder, add cab signing in case of application? current problem when cab installed requires user ack installation (by choosing install , ack newer version installed). wonder whether cab signing eliminate steps? , question - generate updates (1-2 per week). every cab signing require participation of microsoft? can sign cab manually? regards signing cab can done you, though need certificate valid cert provider (or custoemr has able reach cert server). however, buy absolutely nothing. signing cab allows installed on device has security prevents unsigned cabs being installed. the user interaction cab standard. can prevent ui in many cases shipping cab in package has installer ex

objective c - How to detect space, and special characters like :, ?,`,~, etc in text of a textfield in iPhone SDK? -

how detect space, , special characters :, ?,`,~, etc in text of textfield in iphone sdk? try this.. nscharacterset* symbols = [nscharacterset symbolcharacterset]; if([symbols characterismember: yourcharacter]) { //check condition here } if want include many characters use combined nscharacterset nsmutablecharacterset.. nsmutablecharacterset *space = [nsmutablecharacterset charactersetwithcharactersinstring:@" "]; [space formunionwithcharacterset:[nscharacterset symbolcharacterset]]; use space characterset check character

javascript - Get text's tags under this -

i have code javascript: var j = jquery.noconflict(); j('#example tr').click( function() { //here code want } ); html: <table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> <thead> <tr> <th>immat</th> <th>marque</th> <th>modèle</th> <th>contrat</th> <th>début contrat</th> <th>fin contrat</th> <th>coûtht/mois</th> </tr> <tr class="odd gradea"> <td>2257yy64</td> <td>citroen</td> <td>c3</td> <td>star lease</td> <td>27/04/2009</td> <td>27/04/2010</td> <td>

Good introduction to OpenGL? -

i'm interested in learning rendering , "the whole 2d/3d stuff", in opengl/c#. there thousands of search results on google, wondering if have recommendations pick, , how approach issue - possible become proficient without teacher? - there great books on topic? my background: have been programming in c++/java/c# years. got basic math skills lack knowledge once comes basic university level. reason digging topic company project personal interest. if you're going use opengl in c#, go opentk amazing c# library let's use opengl, openal , opencl have offer typesafe .net environment. website has tutorials well. once done, can choose opengl tutorials , translate them opentk syntax without trouble. nehe has opengl tutorials. luck!

c# - Set that a program has to run at startup from an installer -

i've c# .net 4 application, i'm starting create installer. the installed program works fine, customer want application start window(it's "always of top" toolbar them manage call). i thought create "class installer", , in insert key in registry. i've 2 problems: first: how can find executable path? can change between installation. found somewhere application.executablepath, seems located application.window.forms think not compatible wpf second: need insert key in registry of local machine. there way in windows installer specify user must have admin rights? here code started: registrykey rkapp = registry.localmachine.opensubkey("software\\microsoft\\windows\\currentversion\\run", true); rkapp.setvalue("cststart", ???); thank help! edit: found can pass custom action data, : /dir="[targetdir]\" in customactiondata. normally it's said can retrieve through this.context.parameters["dir

Flex PHP Login System Not Working Correctly -

i wrote login system using flex , php, odd reason php echos both "true" , "false". ideas why happening? <?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; //include("connect.php"); // used connection database. $username = strip_tags($_post['username']); $password = strip_tags($_post['password']); // temp username , password until hooked database. $strdetails[0] = "dennis"; $strdetails[1] = "test"; // database work here (grab user) /*<!-- $query = "select username,password users username='$username' , password='$password'"; while ($row = mysql_fetch_array($query)) { // have not tested yet. if ($row['username'] == $username && $row['password'] == md5($password)) // if don't want encryption take off md5 echo "<login>true</login>"; else echo "<login>fal

cocoa touch - UIImagePickerControllerSourceTypeCamera crashes in IPHONE Simulator? -

is known issue if try test uiimagepickercontroller using camera source type simulator crash? i have following code: self.imgpicker = [[uiimagepickercontroller alloc] init]; self.imgpicker.allowsediting = no; self.imgpicker.delegate = self; [self.imgpicker setsourcetype:uiimagepickercontrollersourcetypecamera]; [self presentmodalviewcontroller:self.imgpicker animated:yes]; [imgpicker release]; running in simulator, objc-exception-throw error on stack @ -[uiimagepickercontroller setsourcetype:]. now if set source type photo library though, runs smoothly , fine? what's deal? simulator doesn't have camera , can't simulate take picture (it have been nice use isight apple has not been kindly). code not safe because, example, old ipod touch doesn't have camera , in case app crash on device. as apple suggest in uiimagepickercontroller documentation : to use image picker controller containing default controls, perform these steps: 1.verify

java - coordinates based search -

i developing web page users can create activities , others find them via search function. when create activity must specify exact location take place, assisted google maps retrieve latitude , longitude. now, when doing search want have functionality find activities close specified location(also assisted google maps). so have set of activities coordinates, coordinates of point want find activities nearby, , want return activities no more than, lets say, 5 km(or miles or whatever prefer) away point. i having idea in head can solved calculating max/min latitude , longitude, , use these parameters in sql-query use clause filtering...the problem i'm facing here firstly calculating these max/min values, secondly in circular area(with radius 5km), , not rectangular would appreciate input here! thanks!:) coordinates not x , y latitude , longitude; need spherical distance unless points within rather small radius, e.g. few hundred miles. if have many points, direct exha

html - Class being over written by other class -

here simple css issue. have site has following problem: #main-content ol { list-style-type: decimal; padding-left: 25px;} /* abc.css (line 140) */ #contentwrapper p, #contentwrapper ul, #contentwrapper ol, #lmblurbsarchive { color: #666666; font-size: 1.1em; margin-bottom: 12px; margin-left: 0; margin-right: 0; margin-top: 0;} /* abc.css (line 69) */ /* code below being striped out/ on written other class above */ ol.upper-roman { list-style-type: upper-roman; #main-content ol.upper-roman should specific enough "win". so, in css, change ol.upper-roman above selector. give these read: http://css-tricks.com/specifics-on-css-specificity/ http://www.w3.org/tr/css2/cascade.html#specificity

c# : Loading typed data from file without casting -

is there way avoid casting non-string type when reading data text file containing exclusively integer values separated integer markers ('0000' example) ? (real-life example : genetic dna sequences, each dna marker being digit sequence.) edit : sample data : 581684531650000651651561156843000021484865321200001987984948978465156115684300002148486532120000198798400009489786515611568430000214848653212000019879849480006516515611684531650000651651561156843000021 etc... unless use binary writer , read bytes, rather text (because how data written @ first), i think funky idea, "no" straight answer this. wanted definitive confirmation here, sure. i welcome intermediate solution write/read kind of data efficiently without having code custom reader gui display outside app, intelligibly (in generic reader/viewer). rather casting, should use .tryparse(...) method(s) of types trying read. more type-safe solution. and answer question, other using binary fil

sql server - Calculating value using previous value of a row in T-SQL -

i got following table , want calculate value of column2 on each row using value of same column (column2) previous row in sql without using cursor or while loop. id date column1 column2 1 01/01/2011 5 5 => same column1 2 02/01/2011 2 18 => (1 + (value of column2 previous row)) * (1 + (value of column1 current row)) i.e. (1+5)*(1+2) 3 03/01/2011 3 76 => (1+18)*(1+3) = 19*4 , on any thoughts? assuming @ least sql server 2005 recursive cte : ;with ctecalculation ( select t.id, t.date, t.column1, t.column1 column2 yourtable t t.id = 1 union select t.id, t.date, t.column1, (1+t.column1)*(1+c.column2) column2 yourtable t inner join ctecalculation c on t.id-1 = c.id ) select c.id, c.date, c.column1, c.column2 ctecalculation c

html - CSS Dynamic Left/Right column Static Width -

the problem is, have background in 2 parts. background image #1 background image repeats (endlessly) #1 background image #2 background image repeats (endlessly) #2 in css cant create background sticking elements on so: #leftcolumn { background-image:url('http://i53.tinypic.com/2ezlb7n.png'); background-repeat:no-repeat; background-position:right top; background-z-index:1; background-image:url('repeat.png'); background-repeat:repeat-x; background-z-index:0; } what want result be: [ background left ] [ content ] [ background right ] the content should 768px. background on both sides should show as possible. i can't believe it, able solve myself. code made possible: <style type="text/css"> * { padding:0px; margin:0px; } html, body { width:100%; height:100%; background-color:#333333; } #leftcolumn { background-image:url('http://i54.tinypic.com/aa83lw.png');

Sharepoint Excel Services NLB -

can throw light on nlb in sharepoint excel services. here question. when open workbook using sharepoint excel web services call openworkbook method returns sessionid. lets have web farm , session server a. now call getrange method using sessionid. if request routed server b, blow because server b did not issue sessionid. if not, how managed. excel's services load balancer works similar other sticky sessions load balancer - whenever request gets load balancer picks server session belongs based on session id. note session id unrelated other session ids asp.net session id (also serving similar purpose). load balancing excel services happens betweeh servers run excel services, not front end ones (which talk server , server b). front end services load balanced whatever load balancing have setup external ip of farm - simple round robin, front end servers stateless.

jquery ui - Multiple jQgrids in jQueryui Tabs -

i having issue need with. have 3 jqueryui tabs. first holds grid of items. second holds grid of work orders. third fires alert verify show function working. problem have no grid on second tab. first 1 loads fine. if comment out code first tab, second grid shows fine. third tab fires alert every time. have lightbox use edit items on select works fine. here's relevant code: jquery(document).ready(function () { $('#tabs').tabs({ show: function(event, ui) { if(ui.index == 0) { jquery("#list1").jqgrid({ ... pager: '#pager1', ... jquery("#list1").jqgrid('navgrid','#pager1',{edit:false,add:false,del:false}); } else if(ui.index == 1) { $("#list").jqgrid({ ... pager: '#pager', .... onselectrow: function(id){ if(id){ alert(id); onclick=openbox('edit work order', 1); ... else if(ui.index == 2) { alert('tab2'); } }

c# 4.0 - Where predicate and Expression<Func<T, bool>> -

i have line of code returns index of particular object in ilist<t> int index = list.indexof(list.where(x => x.code == searchvalue).firstordefault()); and have similar construction on many places, searches collections on different properties. goal automate this, can have generic method myclass<t> int index = myclass.find<t>(x=> x.code == searchvalue); or int index = myclass.find<t>(x => x.name.toupper().startswith(searchvalue.toupper())); is possible lambda expressions? edit: for asking same, here code working: public int find(func<t, bool> whereclause) { return _list.indexof(_list.where<t>(whereclause).firstordefault<t>()); } i'm not sure why think need use expression tree. assuming list list<t> , should able use findindex : int index = list.findindex(x => x.code == searchvalue); if that's not need, please give more information types involved are.

flex - styleManager: problem using setStyleDeclaration -

hey folks..!! m using stylemanager.setstyledeclaration set cssstyledeclaration object more 1 instance of same component, being used in different canvases. want set different properties of component in various canvases, wont happen setstyledeclaration takes name of component , set styles globally, suppose. following first cssstyledeclaration : this.datatickeroddstyle = new cssstyledeclaration(); this.datatickeroddstyle.setstyle("fillcolors", stringutilex.extractcolorpair(o.dataticker.item[0].background_fill_colors)); this.datatickeroddstyle.setstyle("fillalphas", stringutilex.extractnumberpair(o.dataticker.item[0].background_fill_alphas)); this.datatickeroddstyle.setstyle("gradientratio", stringutilex.extractnumberpair(o.dataticker.item[0].background_gradient_ratios)); this.datatickeroddstyle.setstyle("cornerradius", int(o.dataticker.item[0].background_corner_radius)); this.datatickeroddstyle.setst

ms access 2007 - Inno-Setup update HKCU of original user in Win7/Vista -

i'm trying add application path trusted location ms access install using inno setup. have following lines in script: [registry] ; add application folder trusted location access 2007 root: hkcu; subkey: software\microsoft\office\12.0\access\security\trusted locations\{#dirname}; valuetype: string; valuename: path; valuedata: {app}; check: accessversion('2007'); root: hkcu; subkey: software\microsoft\office\12.0\access\security\trusted locations\{#dirname}; valuetype: string; valuename: description; valuedata: grandjean , braverman applications; check: accessversion('2007'); root: hkcu; subkey: software\microsoft\office\12.0\access\security\trusted locations\{#dirname}; valuetype: dword; valuename: allowsubfolders; valuedata: 1; check: accessversion('2007'); this works fine in windows xp , earlier, fails under user account control in vista/win7 because (elevated) user running install may different logged in user. the workaround can think of have .re

java - Problems with ElementCollection / MappedSuperclass / AssociationOverride -

i have troubles override association. reading javadoc http://download.oracle.com/javaee/6/api/javax/persistence/collectiontable.html can read "see also: elementcollection, attributeoverride, associationoverride, column" wich gives assume can use it.. don't know how doesn't works @mappedsuperclass public class abstractuser { [...] public string getlastname() { ...} @elementcollection @collectiontable(joincolumns=@joincolumn(name="user_id")) @column(name="nickname") public set<string> getnicknames() { ... } implements @entity @table(name="users") @table(name="user_rfcs") @associationoverride(name = "nicknames", jointable = @jointable(name = "user_nicknames", joincolumns = @joincolumn(name = "user_id")) ) public class user extends abstractuser { [...] } @entity @table(name="user_rfcs") @associationoverride(name = "nicknames", j

objective c - Calling a method on self while in dealloc -

i have dictionary of objects need cleaned before released. have method entire dictionary. before release dictionary in -dealloc method, want same thing. however, not sure of state of object during deallocation. in c# or java, instance, never call method on object being finalized, not sure applies objective c , deallocation. acceptable call clean method on self during deallocation, or should duplicate functionality in -dealloc ? yes, may invoke methods inside dealloc method, though you're wise cautious. pretty only methods should invoke should "tear down" methods, or methods in cleaning object before resources reclaimed. of these cleanup methods include: unregistering notifications via notification center removing key-value observer other general cleanup methods note, however, in each of these methods, object in inconsistent state. may partially deallocated (some ivars may/will invalid), , should never rely on specific object state. these

drop and re-create MySQL database using a ruby script -

is there way drop , re-create database within ruby script? gem (dbi, mysql2) should use? with dbi have problem cannot connect mysql server when database has not yet been created. thank you mysql2 work, have @ rake tasks come rails db:create etc edit : rails rake tasks create / drop dbs https://github.com/rails/rails/blob/master/activerecord/lib/active_record/railties/databases.rake

java - Testing validation constraints -

the hibernate validator documentation has simple getting started guide outlines testing validation rules . the relevant chunk is @test public void manufacturerisnull() { car car = new car(null, "dd-ab-123", 4); set<constraintviolation<car>> constraintviolations = validator.validate(car); assertequals(1, constraintviolations.size()); assertequals("may not null", constraintviolations.iterator().next().getmessage()); } it seems me vague route test if notnull constraint has been violated. my simple solution like public static <t> boolean containsconstraintviolation( set<constraintviolation<t>> violations, class<?> constraint) { (constraintviolation<?> violation : violations) { constraintdescriptor<?> descriptor = violation.getconstraintdescriptor(); if (constraint.isassignablefrom(descriptor.getannotation().getclass())) return true;

jquery slidetoggle issue -

i'm having problems toggling next div. heres code: jsfiddle of code what need is: after clicking next button, close current box_content , open next 1 in order. simple can't it... please help. $(".box_next").click(function() { $(".box_content").slideup(); $(this).parents(".box").next().find(".box_content").slidedown("fast"); });

objective c - Does an ArrayController's Selection Persist Across Tabs? -

i have 2 arraycontrollers in interface builder bound 2 sets of core data entities. 2 entities have parent/child relationship. have nstableview bound parent entities' arraycontroller on first tab of nstabview. second tab of nstabview has nstableview bound child entities' arraycontroller. child arraycontroller's content set bound parent arraycontroller controller key: selection , model key path: <name of child relationship> what i'm trying allow user select entity list of parents, switch tabs , work list of children. what's happening if start app empty storedata file, can add parents, cannot add children. if add parents, restart app, can add children. list of children, however, doesn't seem filtered parent selected on first tab. the way can explain behavior if arraycontroller's selection not persisting across tabs, case? there else i'm missing? it's possible. i've never done myself, sounds need experiment , see. if nothing

ajax redirect issue -

i want redirect form after ( success ) page. use code $(document).ready(function(){ $("#ajax-form").submit(function(){ $.post( "ajaxcontact/ajax-register.php", $("#ajax-form").serialize(), function(data){ if (data.success) $("span#ajax-message").css({'color':'green'}); window.location("index.html"); else $("span#ajax-message").css({'color':'red'}); $("span#ajax-message").html(data.message); }, "json" ); return false; }); }); how redirect. regards if want redirect page there, should work: if(data.success) window.location = "url"; updated: $(document).ready(function() { $("#ajax-form").submit(function() { $.post("ajaxcontact/ajax-register.php", $("#ajax-f

database design - How to implement reference data Java/DB -

Image
i've got table factors need incorporate java program. @ first thinking of hardcoding number seems pain trying create data structure fit factors. wanted ask around , see if better implement reference data in database, flat file or in java. number change every 6 months , used mathematical computations. thoughts? you have create data structure contain data regardless of how store them. data structure kind of data not have complex. list of values attributes. don't have store them in complex table-like structure. loading data flat text file quite easy when representing data single list. public class datatable { private list<entry> table = new arraylist<entry>(); public double getvalue(sex sex, maritalstatus maritalstatus, ageinterval ageinterval, type type) { (entry entry : table) { if (entry.sex == sex && entry.maritalstatus == maritalstatus && entry.ageinterval == ageinterval && entry.type == ty

java - Sequence Files in Hadoop -

how these sequence files generated ? saw link sequence file here, http://wiki.apache.org/hadoop/sequencefile are these written using default java serializer ? , how read sequence file ? sequence files generated mapreduce tasks , and can used common format transfer data between mapreduce jobs. you can read them in following manner: configuration config = new configuration(); path path = new path(path_to_your_file); sequencefile.reader reader = new sequencefile.reader(filesystem.get(config), path, config); writablecomparable key = (writablecomparable) reader.getkeyclass().newinstance(); writable value = (writable) reader.getvalueclass().newinstance(); while (reader.next(key, value)) // perform operating reader.close(); also can generate sequence files using sequencefile.writer. the classes used in example following: import org.apache.hadoop.conf.configuration; import org.apache.hadoop.fs.filesystem; import org.apache.hadoop.fs.path; import org.apache.hadoop.

c# - WPF: Remove control's explicit foreground color -

two sample textboxes in standard color scheme , following constructor yield box1 gray foreground , box2 black foreground, since box2's foreground color has been explicitly set. public partial class mainwindow : window { public mainwindow() { initializecomponent(); box2.foreground = brushes.black; box1.isenabled = false; box2.isenabled = false; } } i "unset" foreground color box2 "falls back" default disabled color , has gray foreground when isenabled set false. possible? if so, how done? setting foreground property null not have desired effect. want avoid explicitly setting foreground color gray if possible, since not compatible customized color schemes. i not sure if that's mean, try following code: public partial class mainwindow : window { public mainwindow() { initializecomponent(); box2.foreground = brushes.black; box1.isenabled = false; box2.isena

C#: Appending *contents* of one text file to another text file -

there no other way this, there way append contents of 1 text file text file, while clearing first after move? the way know use reader , writer, seems inefficient large files... thanks! no, don't think there's this. if 2 files use same encoding , don't need verify they're valid, can treat them binary files, e.g. using (stream input = file.openread("file1.txt")) using (stream output = new filestream("file2.txt", filemode.append, fileaccess.write, fileshare.none)) { input.copyto(output); // using .net 4 } file.delete("file1.txt"); note if file1.txt contains byte order mark, should skip past first avoid having in middle of file2.txt . if you're not using .net 4 can write own equivalent of stream.copyto ... extension method make hand-over seamless: public static class streamextensions { public static void copyto(this stream input, stream output) { if (input

jboss - Jboss4 inside OSGI -

is possible run jboss 4.2.3 bundle inside osgi container? challenges associated it? for cares, looking @ running dcm4chee inside osgi. while not impossible incredibly hard, simpler alternative embed osgi inside jboss, see: http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html , programmatically start osgi (equinox)? , http://njbartlett.name/2011/03/07/embedding-osgi.html http://www.dcm4che.org/jira/browse/dcm-308 looks they're adding support make jars valid bundles - couldn't work out dependencies , deploy these osgi framework? osgi has support jmx , jndi. unless there huge dependencies on jboss' internals, i'd suggest second option, beware of class.forname usage , other non-osgi-friendly code.

actionscript 3 - Sending vars from a classic ASP page to Flash using AS3? -

i having bit of trouble retrieving variables asp page. returns entire page whereas need variable stranswer page. please help? here code: var loader:urlloader = new urlloader(); loader.addeventlistener(event.complete, ondatasaved); loader.dataformat = urlloaderdataformat.variables; var request:urlrequest = new urlrequest("http://" + host + urlpath + "setxml.asp"); request.method = urlrequestmethod.post; var variables:urlvariables = new urlvariables(); variables.xmlstring = str; variables.eltguid = eltguid; request.data = variables; loader.load(request); private function ondatasaved(e:event):void { var loader2:urlloader = urlloader(e.target); loader2.dataformat = urlloaderdataformat.variables; trace(loader2.data.stranswer); } asp page: <%@language="vbscript" codepage="65001"%> <% response.cachecontrol = &

iphone - I am making a calendar app, how can I get each event to show up in different sizes depending on the length of the event? -

so every calendar app out there have ever used lets add events schedule, , see color rectangle shows event title, , sized depending on length. if event runs 1:00-1:45, rectangle takes 3/4 of hour slot. using eventkit, , eventkitui, have realized making events going quite easy, wondering next step, graphically making events visible user. i plan on using simple uitableview day view, when add event, how go representing graphically? looking ideas on implementation here. don't know how this. matter of making custom label , adding top of selected cell? i realizing programming partly problem of knowing how something, , other knowing do. @ point, struggling part, because think if had direction, in code no problem. any ideas? check out. https://github.com/klazuka/kal i played sample code , threw watch on on github because liked did. calendar functions, maybe can ideas flowing.

Cannot register activity to open email attachments on Android -

i've been working on update shopping assistant , shopping list management application , trying create functionality email shopping lists nothing json encoded text files contain shopping list created application different user has application installed. when email received, , 1 tries preview/open attachment, shopping assistant app should presented option open attachment. however, no matter intent filers have tried, doesn't work. can't app called when attachment previewed. true created custom mime type called application/sal (sal extension give file attachment) , added intent filter manifest file looks this: <intent-filter> <action android:name="android.intent.action.action_view" /> <category android:name="android.intent.category.default" /> <data android:mimetype="application/sal" /> </intent-filter> but no success. i've tried use text/xml mime type in

php - How to integrate AJAX into a MVC-style web application? -

i'm developing web application using simple (maybe not mvc-compliant) mvc framework, coded myself while developing application keep code clean. application, though, has many ajax components , i'm stuck trying integrate them within general mvc structure. how should integrated? i have in javascript files: $('#pagelist').load(base_site_url + 'ajax/pagelist.php'); and pagelist.php used have structure following one: <?php require '../includes/config.inc.php'; require base_path . 'includes/init.inc.php'; // whole load of controller logic here , then... echo "<table>"; //display user data echo "</table>"; i'm confused this, advice appreciated few pointers - website should functional without javascript. example, if have pagination page urls /list/?page=1 ... /list/?page=n should make sure of pages clickable without needing javascript. javascript should extension website. in above example,

rJava classpath in an R package... works on some systems... not others -

i have built package r wraps r around java classes. on development laptop (ubuntu) package loads , works great. on 2 other machines (one ubuntu, 1 debian) have tried use package , classpath not being set .jpackage() call. all 3 machines running r 2.12.1 , rjava .8-8 believe recent. the entire package up @ google code here's contents of zzz.r file works set class path on 1 machine not others: ##' @import rjava .onload <- function(lib, pkg) { pathtosdk <- paste(system.file(package = "gsradr") , "/gsrad_sample/lib/", sep="") jarpaths <- c(paste(pathtosdk, "clima_core-1.0.0.jar", sep=""), paste(pathtosdk, "clima_gsrad-1.0.0.jar", sep=""), paste(pathtosdk, "colt-1.0.jar", sep=""), paste(pathtosdk, "commons-lang-2.0.jar", sep=""), paste(pathtosdk, "junit-3.8.1.jar",

Are empty constructors always called in C++? -

i have general question, may little compiler-specific. i'm interested in conditions under constructor called. specifically, in release mode/builds optimised speed , compiler-generated or empty constructor called when instantiate object? class noconstructor { int member; }; class emptyconstructor { int member; }; class initconstructor { initconstructor() : member(3) {} int member; }; int main(int argc, _tchar* argv[]) { noconstructor* nc = new noconstructor(); //will call generated constructor? emptyconstructor* ec = new emptyconstructor(); //will call empty constructor? initconstructor* ic = new initconstructor(); //this call defined constructor emptyconstructor* ecarray = new emptyconstructor[100]; //is different? } i've done lot of searching, , spent time looking through generated assembly code in visual studio. can difficult follow in release builds though. in summary: constructor

concurrency - concurrent kernel execution -

is possible launch kernels different threads of (host) application , have them run concurrently on same gpgpu device? if not, know of plans (of nvidia) provide capability in future? the programming guide http://developer.download.nvidia.com/compute/cuda/3_1/toolkit/docs/nvidia_cuda_c_programmingguide_3.1.pdf says: 3.2.7.3 concurrent kernel execution devices of compute capability 2.0 can execute multiple kernels concurrently. applications may query capability calling cudagetdeviceproperties() , checking concurrentkernels property. maximum number of kernel launches device can execute concurrently sixteen. so answer is: depends. depends on device. host threads won't make difference in way. concurrent kernel launches serialized if device doesn't support concurrent kernel execution , if device does, serial kernel launches on different streams executed concurrently.

uisplitviewcontroller - iPad UISplitView Detail Toolbar NULL on Startup -

i've been racking brain trying figure out little bug in ipad half of app i'm working on. it's related problem in post: ipad splitviewcontroller strange behaviour actually, should it's same problem. however, solution given there won't work me, since app has main menu swaps on uisplitviewcontroller's view when proper button pressed. controller , contained view controllers aren't created until button press. thus, can't set controller's delegate before calling [window makekeyandvisible], since that's done way when main menu loads. now, i've added nslog calls delegate's willhideviewcontroller function follows: nslog(@"will hide popover view controller!"); nslog(@"self=%p",self); nslog(@"%@",detailpad.tbtoolbar); when start app on ipad in portrait mode, , click switch on split view controller, delegate's willhideviewcontroller indeed called, when finishes, i'm left empty toolbar in detail vi