Posts

Showing posts from July, 2013

objective c - Perform Action while Button is pressed down? -

how can call method (in case same message on , on again), long user presses , holds down button, , stop performing action releases button again. nsbutton type momentarychangedbutton? im starter, if knew button type use carry on getting more informations. thanks. way make uibutton continuously fire during press-and-hold situation?

regex - Find text between string -

how extract text using perl string this: get text 1 ... --------------------------------------------------------------------------------------------- text 2 ... --------------------------------------------------------------------------------------------- text 3 --------------------------------------------------------------------------------------------- the result should this: %texts = ( 'text1' => 'get text 1 ...', 'text2' => 'get text 2 ...', 'text3' => 'get text 3 ...' ) something php preg_match_all . many thanks if preg_macth_all looks preg_match_all('/(foo)/', $text, $matches) , perl equivalent @matches = $text=~/(foo)/g .

c# - Nlog Callsite is wrong when wrapper is used -

i'm using nlog logging, use wrapper call log methods, problem is: if try print information call site ( ${callsite} ), prints wrapper method , not original method caused logger log. is there way original method called wrapper method instead? see answer question: problem matching specific nlog logger name i have copied example code (for abbreviated nlog wrapper) answer here save trouble: class nloglogger : ilogger { private nlog.logger logger; //the type passed in type of current object //ninject creating. in case of example, class1 , class1 //dependent on ilogger. public nloglogger(type t) { logger = nlog.logmanager.getlogger(t.fullname); } //trace, warn, error, fatal eliminated brevity public bool isinfoenabled { { return logger.isinfoenabled; } } public bool isdebugenabled { { return logger.isdebugenabled; } } public void info(string format, params object [] args) { ...

php - How to create a ticket with attachment in RT using REST -

does know how create ticket attachment in rt (request tracker) using rest service php script? remove "attachment_1: /tmp/img2.png" add post variable using addpostfile() name "attachment_1" contains raw attachment.

Drupal , developing custom module, it is correct way am doing -

below drupal custom modules, can u please confirm it, is correct way of developing custom module, else please advise, <?php /** * implementation of hook_form_alter(). */ function register_form_alter(&$form, $form_state, $form_id) { switch($form_id) { case 'user_register': // value stole rendered form // customizations go here // drupal_set_message('hey, we\'ve tapped form!'); $form['account']['bharani'] = array( '#title' => 'bharani', '#type' => 'textfield', '#description' => t(' bharanikumar custom field '), ); $form['#submit'][] = 'register_submit_handler'; // add break; } } function register_submit_handler($form, &$form_state) { $value = $form_state['values']['bharani']; $mail = $_post['mail']; $query = "update users se...

javascript - Why aren't framework-like functions built in natively? -

i wondering why trivial functions string.contains() aren't part of javascript core itself. mean, although javascript core contains of functions necessary create new functions based on core ones, obvious functions aren't available default. there are great frameworks out there extend javascript core, don't why aren't built in natively. also, instance, jquery ajax() function more developer-friendly native xmlhttprequest object. essential use frameworks things this. so why functions these not available in javascript core itself? there great frameworks out there extend javascript core, don't why aren't built in natively. i don't think had foresight think 10-15 years in advance , see how implementations of technologies play out, in terms of browsers support parts of specifications standardized @ time create these utility functions find useful in 2011. javascript created in 1995 eich , landscape far different. "ajax" ...

spring - Hibernate annotations-Question on one to many relationship with composite primary key -

first of all, kindly @ design, i have 2 tables t1(a,b,c,d)- primary key t2(a,e) (a,e) composite primary key foreign key referencing t1(a) t1 - t2 relationship 1 many. so created 3 classes c1 t1 has 5 fields - a,b,c,d, c2set setters & getters c2 t2 has 2 fields- c1,c3 of type c1, c3 respectively- setters & getters c3 defining c3 represent composite primary key of t2 has 2 fields (a,e) setters & getters i using following annotations define hibernate mappings in classes c1,c2,c3 respectively 1. @entity @table(name = "t1", schema = "dbo", uniqueconstraints = { @uniqueconstraint(columnnames = "a") }) @id @column(name = "a", unique = true, nullable = false) @transient private set<c2> c2set = new hashset<c2>(); @onetomany(fetch = fetchtype.eager, mappedby = "c1") public set<c2> getc2set() { return c2set; } 2. @entity @table(name="t2", schema...

jQuery $.ajax request of dataType json will not retrieve data from PHP script -

i've been looking on solution cannot find works. trying bunch of data database , via ajax autocomplete input fields in form. i've decided use json, because why not, right? alternatively i've been thinking send delimited string , tokenise it, in hind-sight would've been easier , spared me headache... since i've decided use json though, guess should stick , find out went wrong! happens when get_member_function() executed, error pops in alert dialogue , reads "[object object]". i've tried using request, , setting contenttype ”application/json; charset=utf-8″. alas, no dice. can please suggest doing wrong? take care, piotr. my javascript/jquery function follows: function get_member_info() { var url = "contents/php_scripts/admin_scripts.php"; var id = $( "select[ name = member ] option:selected" ).val(); $.ajax( { type: "post", datatype: "json", url: url, data: { get...

assembly - Implementing rotate left using AND, NOT, and ADD operations -

i'm implementing 16-bit bit shifter rotate bits left r . have access and , not , add operations. there 3 condition codes: negative , zero , positive , set when use of these operations. this approach: and number 1000 0000 0000 0000 set condition codes positive if significant bit 1 . add number itself. shifts bits left one. if msb 1 , add 1 result. loop through steps (1)-(3) r times. are there other efficient ways can this? since homework, i'll think it. 2 * 2 = 4 4 * 2 = 8 8 * 2 = 16 0010 * 0010 = 00100 0100 * 0010 = 01000 1000 * 0010 = 10000 a left shift [some unknown] operation. [some unknown] operation can implemented using and, not , add doing...

.net - Userdefined margins in WPF printing -

most printing samples wpf go this: printdialog dialog = new printdialog(); if (dialog.showdialog() == true) { stackpanel mypanel = new stackpanel(); mypanel.margin = new thickness(15); image myimage = new image(); myimage.width = dialog.printableareawidth; myimage.stretch = stretch.uniform; myimage.source = new bitmapimage(new uri("pack://application:,,,/images/picture.bmp")); mypanel.children.add(myimage); mypanel.measure(new size(dialog.printableareawidth, dialog.printableareaheight)); mypanel.arrange(new rect(new point(0, 0), mypanel.desiredsize)); dialog.printvisual(mypanel, "a great image."); } what don't is, set margin fixed value. in printdialog user has option choose individual margin no sample cares about. if user selects margin larger fixed margin set program, printout truncated. there way user selected m...

jQuery .live function problem -

i have element gets attribute added jquery when page loads. attribute called jcarouselindex. need value of attribute when document loads. ive got selector , if wasn't added dynamically do: id = jquery('#gallery-carousel li.selected').attr("jcarouselindex"); but since been added dynamically value of id undefined. think need use .live() know how value of attribute please? your code above should work. .live() used different purpose. think may trying access attr before being dynamically added. try calling function using settimeout, ensure existing code gets executed. settimeout(function(){ id = jquery('#gallery-carousel li.selected').attr("jcarouselindex"); }, 0); i'm assuming code within $(function(){}); block.

How to make Vim auto-complete with / for path instead of \ -

currently vim pop-ups path completion, shows ..\css\style.css but, backslashes doesn't work in firefox reason, so, want vim auto-complete ../css/style.css (notice, difference in slashes). how achieve this? thanks. set shellslash ? even on windows, never use noshellslash .

How to select a different theme/style for CodeRay syntax highlighting Ruby code? -

i'm having difficulty figuring out how select different theme/style syntax highlighting of ruby code using coderay gem, default ok wonder if there's else on offer? can't seem find them. thanks it understanding generate own coderay.css file. coderay doesn't have "themes".

r - Should I use a data.frame or a matrix? -

when should 1 use data.frame , , when better use matrix ? both keep data in rectangular format, it's unclear. are there general rules of thumb when use data type? part of answer contained in question: use data frames if columns (variables) can expected of different types (numeric/character/logical etc.). matrices data of same type. consequently, choice matrix/data.frame problematic if have data of same type. the answer depends on going data in data.frame/matrix. if going passed other functions expected type of arguments of these functions determine choice. also: matrices more memory efficient: m = matrix(1:4, 2, 2) d = as.data.frame(m) object.size(m) # 216 bytes object.size(d) # 792 bytes matrices necessity if plan linear algebra-type of operations. data frames more convenient if refer columns name (via compact $ operator). data frames imho better reporting (printing) tabular information can apply formatting each column separately.

.net - Out of Memory Exception at System.Drawing.Graphics.FromHdcInternal but no memory leak -

am getting occasional crash following trace: system.outofmemoryexception: out of memory. @ system.drawing.graphics.fromhdcinternal(intptr hdc) @ system.windows.forms.painteventargs.get_graphics() @ system.windows.forms.control.paintbackcolor(painteventargs e, rectangle rectangle, color backcolor) @ system.windows.forms.control.paintbackground(painteventargs e, rectangle rectangle, color backcolor, point scrolloffset) @ system.windows.forms.control.paintbackground(painteventargs e, rectangle rectangle) @ system.windows.forms.control.onpaintbackground(painteventargs pevent) @ system.windows.forms.scrollablecontrol.onpaintbackground(painteventargs e) @ system.windows.forms.control.paintwitherrorhandling(painteventargs e, int16 layer, boolean disposeeventargs) @ system.windows.forms.control.wmerasebkgnd(message& m) @ system.windows.forms.control.wndproc(message& m) @ system.windows.forms.scrollablecontrol.wndproc(message& m) @ system.wi...

concurrency - Active Object Pattern in Concurrent Java 1.5+ -

i trying develop active object pattern in concurrent java using java.util.concurrent classes. i describe using client , server . sample server as: class server implements runnable { public final linkedblockingqueue que = new linkedblockingqueue(); private final executorservice es = executors.newcachedthreadpool(); private message currentmessage; private boolean state = false; public init() { es.submit(this); } public void requestforserver() { if (state) { this.currentmessage.await(); } state = true; } public void run() { for(;;) { message m = que.take(); this.currentmessage = m; this.es.submit(m); } } } and sample client : class client { private server server; public client(server s) { this.server = s; } public void dosomething() { message m = new message(new callable() { public object call() { server.requestforserver(); } }); this.serv...

c# - WCF client forgets XML declaration -

i have written wcf client sharepoint queryservice. in word, writes correctly-formed soap query. when executed, http request "forgets" xml declaration before soap envelope. queryservice not that . how can force wcf client start request with: <?xml version="1.0"> this duplicate (although other web service) wcf client not include xml declaration in http post message . it seems need implement custom encoder. see link above more information.

How can I show a ManyToManyField value filtered on the basis of ForeignKey while editing an django model object? -

i have 4 models in models.py are: models.py class course(models.model): course_code = models.charfield(max_length=100,unique=true) title = models.charfield(max_length=200) short = models.charfield(max_length=50) elective_group = models.charfield(max_length=100) class unit(models.model): title = models.charfield(max_length=100) short = models.charfield(max_length=50) course = models.foreignkey(course) class pattern(models.model): pattern_name = models.charfield(max_length=200) class examschedule(models.model): exam_date = models.datetimefield() course = models.foreignkey(course) pattern = models.foreignkey(pattern) **units = models.manytomanyfield(units)** i have these models register admin site, can use admin functionality these models. my problem when user creates or edits examschedule object, want units(field) multivalue widget should contains values associated course every course can have multiple units. if user creates...

java - A function that generates a boolean that differs between computers, but not within the same computer. Possible? -

this kind of weird question. i'd write java function either return true or false. return either true or false same computer, if program has been purged computer , reinstalled (that is, no state allowed.) return same value no matter in program called, time is, if it's tuesday, etc. my second requirement of computers in world there should anywhere 50/50 30/70 split in function returns. is, @ least 30% of computers need generate less-likely result of function. my third requirement (the tricky one) causes true/false split won't obvious users. splitting along operating system lines isn't okay, since that's obvious. any thoughts? update: true, "same computer" doesn't have meaning since computers made of changeable parts. it's fine value change if piece of hardware replaced. well, simple solution use last digit of mac address return true or false based on if or odd. ensure on same machine returns same machine , return true on half m...

twitter - Scribe OAuthException No Response returned for Service.getRequestToken() after ServiceBuilder.build() -

i trying authorization url allow users authorize app twitter api calls. i have registered app @ twitter , gotten consumer key , secret. scribe-1.1.3.jar , commons-code-1.5.jar in classpath. i running behind proxy , added system.setproperty("java.net.usesystemproxies", "true"); the code follows: servicebuilder lbuilder = new servicebuilder(); lbuilder.provider(twitterapi.class); lbuilder.apikey("----"); lbuilder.apisecret("----"); oauthservice lservice = lbuilder.build(); token laccesstoken = lservice.getrequesttoken(); the last line throws exception: org.scribe.exceptions.oauthexception: response body incorrect. can't extract token , secret this: 'failed validate oauth signature , token' @ org.scribe.extractors.tokenextractorimpl.extract(tokenextractorimpl.java:41) @ org.scribe.extractors.tokenextractorimpl.extract(tokenextractorimpl.java:27) @ org.scribe.oauth.oauth10aserviceimpl.getrequesttoken(oauth10...

flex - Clarifying web development tools and languages (Java) -

with java background, having never developed web client side (i.e. scripts run browser), java applets (which suspect being, mmm, old-fashioned (right?) or otherwise use them of following) then consider following scenarios: only client side application (with no server interaction). recommend learn javascript or better use google web toolkit (gwt) (which understand translates java code javascript+html) other choices? bis: client side application interacting client side app (i.e. both within -different- browser) or server (standalone). same choices before? know gwt allows remote-procedure-calls. more? a rich internet app. flex seems usual choice (right?) think there no java-based language (javafx, despite name not java, , read around "it fatally wounded") other choices? a business application. then, choice javaee (which includes javafaces client-side). clear? other choices? please correct me if i'm wrong. only client side application (with no se...

terminology - What is voluntary preemption? -

what voluntary preemption? know it's concept in scheduling. it depends little bit on os. in rtos, voluntary preemption means running process declares points can preempted (where otherwise run until completion). way think of variant of yield in coroutine . in contrast desktop os kernel determines preemption. keep in mind rtos not have concept of "user mode". in linux (at least), "voluntary preemption" bit of misnomer: traditionally (no forced preemption), when user process making system call (in kernel mode), block until completion. user mode code preempted. the preemptive kernel such kernel code can preempted. sounds redundant it's worth noting mean kernel preemptible , not "the kernel supports preemption". forced/involuntary preemption means while servicing system call, interrupt high priority user process can "force" kernel context switch run (technically it's not context switch, has same effect). decrea...

sql - Oracle SQLPlus question - writing strings to txt file -

i attempting write sql command sql file output can used script. using script create output formatted runnable script. maybe it's redundant haven't been able think of better way. use set of eyes (or ideas) if possible. thanks here's script: connect &&master_user/&&master_pwd.@&&tns_alias set linesize 132 pagesize 0 echo off feedback off set verify off head off term off trimspool on spo syns_list.sql --grant create synonym &&syn_user;//how line formed? select 'create or replace synonym ' || table_name || ' ' || '&&master_user..' || table_name || ';' user_tables order table_name asc; --revoke create synonym &&syn_user;//how line formed? spo off; set echo on feedback on verify on head on term on; exit this output: //need "grant" line here create or replace synonym agents webdemo_admin.agents; create or replace synonym construction_company webdemo_admin.construction_company...

spring mvc - Using Jaxb2Marshaller with multiple classes having same @XmlRootElement name -

i working on web service using spring-mvc , jaxb2marshaller. i have 2 classes, both annotated same @xmlrootelement name @xmlrootelement(name="request") class foo extends astractrequest { } @xmlrootelement(name="request") class bar extends abstractrequest { } all 3 classes (abstractrequest, foo, bar) included in classestobebound list in same order now request uses bar works fine. 1 uses foo throws classcastexception exception during unmarshalling message bar cannot cast foo the controller code this, source source = new streamsource(new stringreader(body)); foo request = (foo) this.jaxb2marshaller.unmarshal(source); i guess happening because bar kind of overriding foo since it's written after foo in list of classes bound in spring-servlet.xml file however having multiple classes annotated @xmlrootelement(name="response") , marshalling response doesn't give problem. is there way specify class used jaxb2marshaller unmarshal...

array combine by array key in php? -

is there function can combine array key ? ( in example pid ) array 0 => array 'product' => string 'a product pid 3' (length=9) 'name' => string 'adamramadhan' (length=12) 'pid' => string '3' (length=1) 'timecreate' => string '2011-02-26 13:30:07' (length=19) 1 => array 'product' => string 'a product pid 4' (length=8) 'name' => string 'adamramadhan' (length=12) 'pid' => string '4' (length=1) 'timecreate' => string '2011-02-26 13:30:54' (length=19) and array 0 => array 'pid' => string '3' (length=1) 'comment' => string 'a comment on pid 3' (length=8) 1 => array 'pid' => string '4' (length=1) 'comment' => string 'a comment on pid 4' (length=8) ...

delphi - Focus next control on enter - in overridden KeyUp -

i have custom class extends tedit: tmytextedit = class (tedit) private ffocusnextonenter: boolean; public procedure keyup(var key: word; shift :tshiftstate); override; published property focusnextonexnter: boolean read ffocusnextonenter write ffocusnextonenter default false; end; in keyup procedure do: procedure tmytextedit.keyup(var key: word; shift: tshiftstate); begin inherited; if focusnextonexnter if key = vk_return selectnext(self twincontrol, true, false); end; but isn't moving focus next control. tried if key = vk_return key := vk_tab; but isn't working either. missing? selectnext selects next sibling child control, ie. need call on edit's parent: type thackwincontrol = class(twincontrol); if key = vk_return if assigned(parent) thackwincontrol(parent).selectnext(self, true, false);

TypeArray in Android - How to store custom objects in xml and retrieve them? -

i have class like public class countryvo { private string countrycode; private string countryname; private drawable countryflag; public string getcountrycode() { return countrycode; } public void setcountrycode(string countrycode) { this.countrycode = countrycode; } public string getcountryname() { return countryname; } public void setcountryname(string countryname) { this.countryname = countryname; } public drawable getcountryflag() { return countryflag; } public void setcountryflag(drawable countryflag) { this.countryflag = countryflag; } } and want store objects of class in typearray xml of android like <resources> <array name="custom_arr"> <item> <countryname>albania</countryname> <countrycode>al</countrycode> <countryflag>@drawable/al</countryflag> ...

.net - Implement short urls (tinyurls) for twitter in c#? -

how convert full(long) urls short urls(like tinyurls) in c# twitter? imagine simple right api. know of api doing this? i published an article doing bit.ly in c# application. note bit.ly requires free login key need in order code work.

css - csslint - broken box model -

i've used csslint stylesheets , 1 warning don't understand. consider css code: div { width: 50px; height: 50px; border: 1px solid; } csslint says following: "broken box model: using height border." "broken box model: using width border." why shouldn't use width / height border? i suppose csslint trying enforce set of practices around reader not having understand implications of box model. @ end of day, understand box model entirely , understand css produces "actual" width / height of 52px perhaps trying guard against misunderstanding. personally i'd ignore it. "warning" rather error , therefore subjective.

Rails 3 MySQL query question -

my job model has id , percentage fields (among others). percentage may nil . i set default percentage here: class jobscontroller def new ... @job.percentage = <what should here?> ... end end it should calculated this: take percentage of latest job (a job max id ), percentage isn't nil . if there no jobs, or jobs percentage nil , should 23. what easiest method calculate ? you should in job model: [update] added test new_record? in callback, since percentage can legitimately nil ; don't want override if it's been set such. class job < activerecord::base after_initialize :calculate_default_percent # other stuff private def calculate_default_percent if self.new_record? conditions = { :conditions => "percentage not null" } self.percentage = job.last(conditions).nil? ? 23 : job.last(conditions).percentage end end end

silverlight 4.0 - Does Caliburn.Micro support design time data? -

does caliburn.micro support design time data? tried out following steps; created simple hello world program. shellviewmodel derived off of ishell. running sample program show hello word @ run time. since view model derived off of ishell created dummy class derived off of ishell , used design time instance. public class sampleshellviewmodel:ishell { #region ishell members public string helloworld { { return "hello world"; } } #endregion } in view added design time context follows <usercontrol x:class="helloworld.shellview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" xmlns:sampledata="clr-namesp...

python sqlalchemy + postgresql program freezes -

i've ran strange situation. i'm writing test cases program. program written work on sqllite or postgresqul depending on preferences. i'm writing test code using unittest. i'm doing: def setup(self): """ reset database before each test. """ if os.path.exists(root_storage): shutil.rmtree(root_storage) reset_database() initialize_startup() self.project_service = projectservice() self.structure_helper = fileshelper() user = model.user("test_user", "test_pass", "test_mail@tvb.org", true, "user") self.test_user = dao.store_entity(user) in setup remove folders exist(created tests) reset database (drop tables cascade basically) initialize database again , create services used testing. def teardown(self): """ remove project folders , clean database. """ created_projects = dao...

AJAX and using javascript history() -

i have page, loads in data using ajax (a form filter) using jquery. gives me list of items click on. when page of item loads, have button, using: <script type="text/javascript"> function navigateback(){ if (document.referrer.indexof("press")> -1){ history.go(-1); return false; } return true; } </script> <a href="" onclick="navigateback()"> but i'd happen, returns ajax filtered results. is possible? thanks this requirement has implemented such have key appended url http://abc.com/xyz.html#search-key=keyword in java script should have global (like static) variable map of objects search results various keys. if map contains key in url return form map else fire ajax request , fetch value server. be sure append url key whenever there server call made , result stored in map. frameworks dwr make simple handle.

c# - Got hit by an OverflowException -

in method below on last line i'm getting exception: system.overflowexception: value either large or small int32. i can't explain why because i'm checking explicitly that: private int32 convertvalue(double value) { if (value > int32.maxvalue) { console.writeline("couldn't convert value " + value + " int32"); return int32.maxvalue; } else if (value < int32.minvalue) { console.writeline("couldn't convert value " + value + " int32"); return int32.minvalue; } else { return convert.toint32(value); } } also check double.isnan(value) . compares nan yield false.

gSoap, c++, how to pass a soapStub declared argument in client application -

the project containing following excerpts client application using gsoap generated c bindings ( gsoap - www.cs.fsu.edu/~engelen/soap.html ) project builds fine, breaks on line in main function indicated below. defined in project header file: class soap_cmac _ns7__accounts { public: std::vector<std::string>accountnumber; /* required element of type xsd:string */ std::string *requestidtrackingforesb; /* optional attribute */ struct soap *soap; /* transient */ public: virtual int soap_type() const { return 23; } /* = unique id soap_type__ns7__accounts */ virtual void soap_default(struct soap*); virtual void soap_serialize(struct soap*) const; virtual int soap_put(struct soap*, const char*, const char*) const; virtual int soap_out(struct soap*, const char*, int, const char*) const; virtual void *soap_get(struct soap*, const char*, const char*); virtual void *soap_in(struct soap*, const char*, const char*); _ns7__accounts(): requestidtrackingforesb(null), soa...

numpy - Python: Using Tensordot for tensor x matrix multiplication -

hi im tying multiply tensor matrix in following fashion: dimensions w: a x b x c v: a x c i want z such that z[i]=dot(w[i],v[i]) z of dimension a x ( (b x c) . (c x 1)) , (a x b) ive tried numpy.tensordot havent been able to. can want? if not how can without loops. basically equivalent of def f(w,v): z=[] in range(len(w)): z.append(dot(w[i],v[i])) return z thanks edit: achievable tensordot? np.einsum("abc,ac -> ab", w, v) : import numpy np def z_loop(w,v): # define check `einsum()` gives necessary result z = np.empty(w.shape[:-1], dtype=w.dtype) in range(z.shape[0]): z[i,:] = np.dot(w[i,:], v[i,:]) return z w = np.random.uniform(size=(3,4,5)) v = np.random.uniform(size=w.shape[::2]) assert np.allclose(z_loop(w, v), np.einsum('abc,ac -> ab', w, v)) there might simpler variants (via dot() , .reshape() ) einsum() obvious task description. def z_dot(w, v): z = np...

c# - Custom ItemsControl Child Control Namespace Issue -

i'm having trouble adding controls x:name custom control. adding x:name="startdate" causes break. otherwise works perfectly. i have custom control inheriting itemscontrol. using system; using system.windows; using system.windows.controls; using system.windows.documents; using system.windows.ink; using system.windows.input; using system.windows.media; using system.windows.media.animation; using system.windows.shapes; namespace controlcsi { public partial class slidemenu : itemscontrol { public slidemenu() { // required initialize variables initializecomponent(); } } } here markup definition of class <itemscontrol xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006...

objective c - Naming conventions for Universal Applications -

i'm writing universal ios application (ipad , iphone) , find myself massively long names classes can't shared between 2 apps: familyviewcontroller_iphone.h/m familyviewcontrollera_ipad.h/m detailviewcontrollerb_iphone.h/m detailviewcontrollerb_ipad.h/m and likewise, classes inside of these guys have complete name (device included) interface builder can use them. i considered acontrollera.h , bcontrollera.h a=iphone , b=ipad not excited option either. what standing convention classes in ios universal application - or (hopefully) missing obviates necessity? i think you're heading down bad path separating functionality this. while ipad apps can have different ui structures , design iphone apps, it's best if can try remain abstract possible. i avoid using platform names in view controllers. i'd have: familyviewcontroller.h familyviewcontroller.m familyviewcontroller.xib (which used ipad ui) familyviewcontroller~iphone.xib you're going hav...

iphone - Anything wrong with leaving timer on and using a flag to control execution on/off? -

i'm polling router iphone. timer fires every 60 seconds. i'm starting timer in viewdidload , leaving on. there's flag pollingon set false. when timer fires, calls mytimerfiredmethod, checks, if (self.pollingon) { self.pollingon = false ; // run polling code self.pollingon = true ; } aside wasting nanosecond or 2 of cpu time, wrong practice? a timer running although not in use, waste of battery life. it's strange design pattern, running timer without cause. also if turn on polling, @ worst have wait 60 seconds before update. i not recommend implementing way. instead, invalidate timer when polling turned off , create new timer when polling turned on.

android respond to contact > send? -

i'm looking magic incantation make app respond contact > send. want able receive contact's uri in order retrieve contact. have manifest filter / code snippet this? thanks. i have not testes, try intent filter based on action_send , mime type vcard. once again, not tested: <intent-filter> <action android:name="android.intent.action.send"/> <category android:name="android.intent.category.default"/> <data android:mimetype="text/x-vcard"/> </intent-filter>

php - Zend_Auth_Adapter_DbTable for two tables? -

usually, keep username , password fields in 1 table (for example users). in case easy use zend_auth_adapter_dbtable . however, if have password in separate passwords table. how uses zend_auth_adapter_dbtable have identitycolumn in 1 table (users) , credentialcolumn in other table (passwords)? thanks. i recommend creating table view users , passwords tables. specify view tablename zend_auth_adapter_dbtable.

c# - How to configure DB connection at run time with EF 4.1 Code First -

i'm trying use ef 4.1 code first poco objects against legacy database. have many similar databases same schema, , need decide 1 connect @ runtime. all examples i've seen show put connection string in app.config or web.config. won't work me since need dynamic behaviour. what object/properties can manipulate control db settings dbcontext? dbcontext has constructor accepts dbconnection instance, can spin using appropriate factory class. i sort of thing in 1 of apps: _context = new mydbcontext( new sqlconnectionfactory(properties.settings.default.myconnectionstring) .createconnection("databasename")); so can read connection string @ runtime , pass sqlconnectionfactory class, give me new connection using that. i'm not sure "databasename" parameter used in case, since it's in connection string anyway. sure, i've made sure they're same.

javascript - object literal and Sys.WebForms.PageRequestManager.getInstance().add_endRequest issue -

what i've got asp.net masterpage/contentpage, contentpage utilizes updatepanel updatemode set "conditional". contentpage multiview has 3 views: setup, confirm, , complete. i've got navigation buttons when clicked, go server, need , update updatepanel can come back. problem lies in javascript. i have following global object literal named page : page = { panel : undefined, currentview: undefined, buttons : { : undefined, cont : undefined }, views : { setup : {}, confirm : {}, complete : {} } }; page.init() function looks this: page.init = function() { console.log("page.init() fired"); this.panel = $('div[id$="panel_page"]'); this.currentview = this.panel.find('input[id$="hidden_currentview"]').val(); this.buttons.all = this.panel.find('input[type="submit"]'); this.buttons.cont = this.pa...

osx - How to reserve the original variants while upgrading a port in MacPorts? -

when upgrade ports, notice upgraded port might change variants. normal or mis-observation? let's original variants git-core +bash_completion +doc +python26 +svn, if sudo port upgrade git-core , change +bash_completion +doc +python27! , force installation of python27! how prevent issue happening? yes correct, variants can change. as git-core has default variants +python27 (among others) have 3 options: live upgrade hand set default variants in ${prefix}/etc/macports/variants.conf things like. hope helps :)

web - Use a HTML page as Live Wallpaper in Android -

can use html page live wallpaper? or possible capture web page image , set wallpaper? any appreciated. there app on market called weblivewallpaper this. there option in how refresh view of web page, leads me believe taking snapsnot of page , presenting image how. unfortunately wouldn't know how go setting up. think you're going want go image route. edit here links may out: open source java library produce webpage thumbnails server-side http://www.acasystems.com/en/web-thumb-activex/ http://www.fileguru.com/apps/convert_html_to_image_in_java i have not used of these components before i'm not positive them seem can looking .

Ruby Class and Object singleton - get access -

i learning ruby singletons , have misunderstanding such code: class myclass def self.class_singleton_mymethod end end class_singleton = class << myclass self end puts class_singleton.methods.grep(/mymethod/) # => [] obj = myclass.new def obj.object_singleton_mymethod end object_singleton = class << obj self end puts object_singleton.methods.grep(/mymethod/) # => class_singleton_mymethod why class_singleton not contains class's class method , object_singleton instead of object's singleton method contains class's class method? i think have notion of methods , instance_methods mixed up. if replace instances of methods instance_methods , see results expect. instance_methods used enumerate methods class's instances have. methods used enumerate methods object has. (class objects objects too, , have own methods new not instance methods. for example, string#slice instance method; can call slice on string instanc...

asp.net - change an individual image in a gridview depending on a value -

Image
i have 2 tables assignment , feedback, in gridview displays assignments, assignments feedback. im wanting change view feedback button in gridview depending on if there new feedback example: the feedback table has state field in when 1 want image button change 1 + thanks in advance houlahan on itemdatabound event can can change image's url image img = (image)e.item.findcontrol("imgid"); img.navigateurl = "~/images/othersource.png";

javascript - Debug Resource Scripts with Chrome Developer Tool -

i found script file inside resources tab , not inside script tab , hence, when search particular function inside script's tab, doesn't return result shown @ how search loaded scripts in chrome developer tools? i want debug resource script file chrome developer tool, how able that. unfortunately, can't debug script in resources tab, have locate script name in scripts tab.

Learning javascript, can't figure out hide and show elements -

edit- see written in javascript, not jquery or framework please. i know accomplished jquery, i'd learn javascript behind magic, , have been reading dom scripting jeremy keith. i've gotten ways through book, doing examples copy code far different trying build yourself. right i'm trying simple (for others): hide paragraph element when header2 element above clicked. here html: <div id="contentarea"> <h2><a href="#">heading articles</a></h2> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. integer nec odio. praesent libero. sed cursus ante dapibus diam. sed nisi. nulla quis sem @ nibh elementum imperdiet. duis sagittis ipsum. praesent mauris. fusce nec tellus sed augue semper porta. mauris massa. vestibulum lacinia arcu eget nulla. </p> <h2><a href="">second heading articles</a></h2> <p>lorem ipsum dolor sit amet, consectet...

osx - Does OS X Lion provide OpenCL image support for Radeon 5770? -

on os x snow leopard (10.6.8), opencl image support not available on mac pro radeon 5770 graphics card. indeed believed common amd/ati radeon cards under snow leopard , earlier. specifically: clgetdeviceinfo(cddevices[uideviceused], cl_device_image_support, sizeof(g_bimagesupport), &g_bimagesupport, null); results in g_bimagesupport being false. i want know if has final release 10.7 (lion) , radeon 5770 graphics card in mac pro, can check see if cl_device_image_support returns true hardware? an easy test download apple sample code raytraced quarternion julia-set: http://developer.apple.com/library/mac/#samplecode/opencl_raytraced_quaternion_julia-set_example/introduction/intro.html and build , run it. output on system sadly: connecting amd ati radeon hd 5770... qjulia requires images: images not supported on device. hope hear works in lion ... david. i'm running lion 10.7.1 radeon 5770 , given example works great (yay!), running around 150f...

c - Cortex: NVIC, please demostrate how to make it level or edge detects by software -

i have read arm document cortex-m3 (or m0) , can used level sensetive or pulse (edge) interrupt within nvic controller. problem rather vague on how this, if done software. i fails see kind of register within nvic or such control type of interrupt (to select edge or level adjusting register bits). must done software within handler again vague in field. i hear having way make edge or level trigger interrupt software. please demonstrate within handler code (if control it) make detect level or pulse. if level detect, can hold interrupt active , disable handler, until restore external code re-excute interrupt. i'm trying do, not work if pulse detect type. thx a document describes how cortex-m3 nivc handles level or edge (pulse) triggered interrupts can found here: cortex-m3 devices generic user guide , 4.2.9. level-sensitive , pulse interrupts this may document refer in question. joseph yiu's book, "the definitive guide arm cortex-m3" has pret...

iphone - What library is used for the main menu in the facebook iOS app? -

Image
i'm making app has more options fit uitabbarcontroller. wanted use facebook app has main menu. my guess isn't proprietary facebook, because scvngr app uses similar. this library lets re-order icons way can re-order apps main menu (i.e. press , hold -> icons jiggle -> can drag them around). does know library provides uiview? i'd use if possible. thanks! it's part of three20 framework; it's launcher feature.

intellij idea - idea9.0.3 commit -

Image
i use idea 9.0.3 , want commit few application's files svn. please can tell me step step have do? you need add version control project, using 'version control' menu option @ top. have idea 10, might different, in menu, there 'import version control' option. add svn repo there. once have done can right click on file or directory, go 'subversion' option, , svn operations on file. i use command+k on mac automatically start commit process. thing need remember add files when first created, else don't committed. edit -- might have failed add svn project -- did enter credentials? assumed there svn repo project. don't see like:

Stylesheet/javascript management rails 3 -

the application writing pretty complex , has different stylesheets/javascripts depending on action. right have added methods application controller allows me build array used in application.html.erb layout. feels little sloppy. nice somehow configure settings file based on action or something. (i guess might messy though) any ideas? def initialize super() @application_stylesheets = array.new @application_javascripts = array.new end def add_stylesheet(stylesheet) @application_stylesheets.push(stylesheet) end def add_javascript(javascript) @application_javascripts.push(javascript) end

c# - Remove part of Expression -

i have generic method: public void expressionbuilder<t>() t: ientity { expression<func<t, long>> expr = e => e.id; //id part of ientity ... } the resulted expression contains casting of t ientity: e => convert(e).id want remove casting (to make possible ef generate sql). in other words replace convert(e) e. if assume public long id {get;} on t , , expression simple, maybe build manually: var param = expression.parameter(typeof (t), "e"); var lambda = expression.lambda<func<t, long>>( expression.propertyorfield(param,"id"), param); a visitor should work more complex examples; example: internal class flatteninterface<t> : expressionvisitor { protected override expression visitmember(memberexpression node) { if(node.member.declaringtype == typeof(t)) { return expression.makememberaccess( node.expression, node.expression.t...