Posts

Showing posts from May, 2015

objective c - how to temporarily hide the main menu (NSMenu)? -

i'm trying implement feature password protect cocoa app. in appdelegate, if password entered correctly on window, i'll bring main app window calling nsapp runmodelforwindow method. it works fine, except, in preferences allow user change password. means in order prevent hacking users, i'll have hide main menu, until password entered correctly. i don't want remove menu items using removeitematindex or programmatically set target action call method bring preference window. instead, temporary hide [nsapp mainmenu]. searched , can't seem find method, sethidden:yes in order hide it. i have tried [[nsapp mainmenu] canceltracking] doesn't job is there easy way this? you can use -setpresentationoptions: method on nsapp hide , show many parts of standard os ui, including menu bar , dock. note must hide both menu bar , dock together: /* hide */ [nsapp setpresentationoptions:[nsapp presentationoptions] | nsapplicationp

asp.net mvc 3 - Setting focus for MVC (Html.TextBoxFor) using jquery -

i'm working on mvc project , trying set focus on this: <td><%=html.textboxfor(de => model.emailaddress1)%></td> my jquery in same view near top of page: <script type="text/javascript"> $(document).ready(function () { $("[id$=maincontent_emailaddress1").focus(); $("#emailaddress1").focus(); }); </script> i've tried few combinations set focus box nothing i've tried works. can help? you take several steps in solving problem. first of all, load html , see, weather id being rendered matches 1 provided. secondly, i'd rather suggest more rigid way capture element, or control output. you add functional class grab element html.textboxfor(x => x.emailaddress1, new { @class = "fhandleclass" }); and script <script type="text/javascript"> //<![cdata[ $(function(){ $(".fhandleclass").focus(); }); //]]> </script&

graph - How to find a path from source to destination by adding edges with minimum total weight -

i have 100 atoms in 3-d space. each atom node. edges added between 2 nodes when closer 0.32 nm weight equals distance. want find path source node destination node. since 100 atoms not connected, can't find path. what want add 1 or more edges make source , destination connected. meanwhile, want minimize total weights of new added edges. again, weight calculated 2 nodes' distance. it kind of reverse problem of minimum cut. there algorithm helps this? thanks lot! it seems 1 way make use of graph search algorithm finding shortest path, dijkstra's algorithm, , perhaps work both ends (source , destination). the difference can't know if edge exists or not, , creating graph go. if start @ a, , nodes of graph a, b, c, d, e. need check if a-b, a-c, a-d, , a-e exists. if a-b exists, check b-c, b-d, , b-e. this o(|v|^2), depend on how many edges explored. the same idea applies if interested in adding edges longer 0.32 nm. it's path length calculation ch

mysql - group by with min max but can I do this? -

i've created query (thanks tips on stackoverflow) works great. table structure , data: create table if not exists `transactions` ( `id` int(11) not null auto_increment, `actid` int(11) not null, `memberid` int(11) not null, `description` varchar(30) not null, `amount` decimal(10,2) not null, `date` datetime not null, `type` varchar(3) not null, primary key (`id`) ) engine=innodb default charset=utf8 auto_increment=38 ; data: insert `transactions` (`id`, `actid`, `memberid`, `description`, `amount`, `date`, `type`) values (1, 601, 1, '', '4.00', '2008-10-31 00:00:00', 'reg'), (2, 603, 1, '', '5.00', '2010-10-26 00:00:00', 'reg'), (3, 604, 1, '', '8.00', '2011-10-21 00:00:00', 'reg'), (4, 1040, 1, '3/5', '2.00', '2009-02-18 00:00:00', 'reg'), (5, 1042, 1, '8/19', '2.00', '2010-08-19 00:00:00', 'reg'

javascript - How to update raphael Text dynamically -

i drawing flow chart based on raphael shapes & text. on page load, drew rapahel shapes text inside. text status. there background processing happening changing status. want update status(which rapahel text inside raphael shape)on button click without redrawing on flow chart shapes again. i.e wants update text inside shape. here both shapes , texts in array. using json status. please refer following stackoverflow question code , flow chart. looking pointer achieve this. cannot whole code because of server side scripting dependency how avoid overlapping of rapahel js path assuming raphtext raphaeljs text element reference raphtext.attr("text", "new status"); change text content. for further information: have @ http://raphaeljs.com/reference.html#element.attr .

jsf - ValidateOnePer row -

i love project, amazing! i have observation scenario great validate , think, humble perspective, not covered. i have repeated component (e.g. data table, data grid, etc..) iterates input component , commandbutton, input components required , obligates user set value, need validate pair input, button. when data entered in input , button fire not interfered other required input components. thanks before hand answers!

Where is the error in this Scheme program? -

i getting "error: invalid lambda: (lambda (insert-all))." (define permutations (lambda (l) (let ((insert-all (lambda (e ls) (let ((insert-one (lambda (l) (letrec ((helper (lambda(l r) (if (null? r) (list (append l(list e)r)) (helper (append l (list (car r) ) ) (cdr r) ) )))) (helper '() l))))) (apply append(map insert-one ls))))))) (cond ((null? l) '() ) ((null?(cdr l)) (list l)) (else (insert-all (car l) (permutations ((cdr l)))))))) it supposed return permutations of given list. the form have provided in not valid scheme. specifically, highest-level let form not have body. might thinking cond clause body owing parenthesis not part of let . honestly, fault of formatting. here 'properly' formatted scheme form: (define (permutations l) (let ((insert-all (lambda (e ls) (let ((insert-one

Mask Input phone number in PHP -

i new php want mask input phone number somehow wouldn't allow javascript or jquery $_session["oh"]["phone"]=(empty($_session["oh"]["phone"]))?$_cookie["phone"]:$_session["oh"]["phone"]; follow kind of patterns mask phone , validate $pattern = "/^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$/i" reference afaik , have used mask() jquery helps validate $("#phone").mask("(999) 999-9999"); its handy use

android - Is it better to requestLocationUpdates in bursts with short intervals, or over a long period of time with long intervals? -

i have android app wants track user's movements throughout day , report them each week trends. thought long user had location services and/or gps enabled, system trying keep user's location date. however, after reading article on location strategies , realized not case. it appears that, though user has checked boxes location services or gps, receivers attempt determine location of device after application calls requestlocationupdates , continue until call removeupdates. (if not correct, please let me know). since app needs "rough" idea of device's movements, thinking recording location of device once every 5 minutes or so. however, neither of examples in article described kind of application. both examples more determining location of device @ specific point in time rather trying "follow" device around: tagging user-created content location @ created , locating nearby points of interest. my question is, more efficient have app "wake u

ruby on rails - Why is this not valid YAML? -

i can't figure out why code trips rails yaml parser. sections: [ {title: "journal entry testing", procedures: ["select sample of journal entries prepared during year , determine if prepared correctly , approved.”] } ] because of non-matching double-quotes, enlarged highlight difference: ["select sample ... , approved.”] see how ending quotes "smart" quotes? with fixed, passes @ http://yamllint.com/ , , gets turned actual yaml.

What is the difference between literal and variables in Python? -

i'm beginner user python, confused between literal , variables. this know literal: "a"+"b" and variables: sentence="a"+"b" a literal notation representing fixed ( const ) value. variable storage location associated symbolic name (pointed to, if you'd like). it's best explained in use: foo = bar(42) ^ ^ ^ | | |--- literal, 42 *literally* 42 | |------- function, represents "something" in memory |------------- variable, named "foo", , content may vary (is variable)

Generic class that accepts C++ string & C style string -

so know: c style string character array end "null" c++ style string is: string s = "some text"; so accept both c++ string , c style string, i'm pretty sure have use c++ template. i'm trying write class , method returns second character of string c++ or c style string. on right track? template <class t> class mystring { t pointer; public: mystring(t input) { pointer = input } char getsecondletter() { t temp = pointer; temp++; return temp; } }; int main () { mystring<i dont know put> myobject("hello"); cout << myobject.getsecondletter(); return 0; } p.s. programmers use 't' template class datatype? there no need, c string implicit convert std::string char getsecondletter( const std::string & s ) { return s[1]; } const char *c_str = "hello"; std::string str = "world"; getsecondletter( c_str ); // e getsecondletter( str );

html - Make two elements with dimensions inline -

i trying make 2 elements in header, pink section , green section, inline ( in 1 line , not wrapping new line green section currently). however, can't use display:inline; items need have width. how can achieve both of these elements being inline , keep widths? here page elements are: https://dl.dropboxusercontent.com/u/270523/help/new.html the inline-block solution: #logo { width: [width1]%; min-width: 225px; background: pink; } #input{ width: [width2]%; background: green; } #input,#logo { display: inline-block; height: 100%; vertical-align:top; } where [width1] + [width2] = 100%. work, need delete whitespaces between 2 elements. so not now: <section id="logo"></section> <section id="input"> <input id="searchinput" type="text" name="search" autocomplete="off"> </section> but instead: <section id="logo"></

Generating a Random Number for HTML -

i trying generate random number between 2 values can changed whatever choose. on load of page, want number shown in body of site. thanks! your question pretty vague needed here javascript solution generates random number between 2 variables , sets <div> content that: fiddle: http://jsfiddle.net/benedictlewis/xmpgr/ js: var link = document.getelementbyid('getnumber'); // gets link link.onclick = getnumber; // runs function on click function getnumber() { var minnumber = 0; // minimum number want var maxnumber = 100; // maximum number want var randomnumber = math.floor(math.random() * (maxnumber + 1) + minnumber); // generates random number $('#mynumber').html(randomnumber); // sets content of <div> number return false; // returns false tidy } html: <div id="mynumber"></div> <!-- number appear in here --> <a href="no-javascript.html" id="getnumber">get number&l

sql server 2005 - Unicode Query in OpenRowSet -

i have stored procedure nvarchar parameters. want returned table using openrowset. when use following codes results incorrect declare @id int declare @sql nvarchar(max) declare @p1 nvarchar(8) set @id=1 set @sql='select * openrowset( ''sqlncli'', ''driver={sql server};'', ''exec dbo.usp_test @p1 =''''' + @p1 + ''''')' exec(@sql) the openrowset convert query varchar , doesn't execute procedure correctly. seems openrowset execute code this: exec dbo.usp_test @p1='????????' so results incorrect. there option in openrowset resolve problem? when using nvarchar data need add specific character ( n ) before string values this: declare @id int declare @sql nvarchar(max) declare @p1 nvarchar(8) set @id=1 set @sql = n'select * openrowset(''sqlncli'', ''driver={sql server};'',

localreport - Making rdlc datasource filter from other datasource -

so summarise problem, have report has 2 datasources - , 2 reports stuck each other. want second part of report display data based on first part of report showing. to go more detail, situation follows. have 2 database tables - lets call 1 customers, , other orders. customers contains data customers. orders contains link customers , contains person's orders. the report supposed display sort of letter in part 1: "hello [customername], have ongoing balance of [totalbalance] bla bla bla..." , list of orders has made in part 2 "order 1: item 1: 1 euro order 2: item 2: 2 euro ..." originally these 2 separate reports generating 1 record @ time, outputting pdf files , merging them using third party software such letter , list of orders next each other. problem system need generate hundreds of them @ time, , taking ages. want pass pair of large data sources , generate them in batches (call them 600 @ time) - works faster. so how can force second tablix use

email - Sending mail attachment using Java -

i trying send email using java , g mail have stored files on cloud , stored files want send attachment mail. it should add files mail , not links of files. how can send such attachments ? working code, have used java mail 1.4.7 jar import java.util.properties; import javax.activation.*; import javax.mail.*; public class mailprojectclass { public static void main(string[] args) { final string username = "your.mail.id@gmail.com"; final string password = "your.password"; properties props = new properties(); props.put("mail.smtp.auth", true); props.put("mail.smtp.starttls.enable", true); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); session session = session.getinstance(props, new javax.mail.authenticator() { protected passwordauthentication getpasswordauthentication() { r

php - How do I redirect https:// to https://www on .htacess file? -

i modifying .htacess. tried changing https://mydomain.com https://www.mydomain.com code below. failed. # redirect https:// https://www. rewritecond %{https} on rewritecond %{http_host} ^my___domain\.com$ [nc] rewriterule ^(.*)$ http://www.my___domain.com/$1 [r=301,l] what doing wrong? as note: if helps, redirect both ip , original 3_$ (_">http://my3_$.com) _">http://www.3__$.com used these codes in beginning, worked. # redirect ip www. rewritecond %{http_host} ^xxx\.xxx\.xxx\.xxx rewriterule (.*) http://www.my___domain.com/$1 [r=301,l] # redirect http:// http://www. rewritecond %{http_host} ^my___domain\.com$ [nc] rewriterule ^(.*)$ http://www.my___domain.com/$1 [r=301,l] i trying redirect https:// because after modifying 2 above successfully, unable log in, https:// pages. thank you instead of http://www.___.com/$1 , use //www.___.com/$1 . use http or https, whichever used in original request. currently, you're forcing http, seems

xml - R xmlParse() Indexing -

i have data generated xmlparse() . able obtain reference xmlnode called root > class(root) [1] "xmlinternalelementnode" "xmlinternalnode" "xmlabstractnode" when, do > root[[2]][[1]] <tr class="party-republican race-winner"><th rowspan="5" class="results-county">autauga <span class="precincts-reporting">100.0% reporting</span></th>&#13; &#13; <th scope="row" class="results-candidate">m. romney</th>&#13; <td class="results-party"><abbr title="republican">gop</abbr></td>&#13; <td class="results-percentage">72.6%</td>&#13; <td class="results-popular"> 17,366</td>&

ios - Playing audio with AVAudio Record from SQLite BLOB -

i have uibutton inside of uitableviewcell hooked method play avaudio file this: cell.playbutton = [uibutton buttonwithtype:uibuttontyperoundedrect]; cell.playbutton.tag = indexpath.row; [cell.playbutton addtarget:self action:@selector(useselectedfile:) forcontrolevents:uicontroleventtouchupinside]; and useselectedfile method looks this: -(void) useselectedfile:(id)sender{ int tag = [(uibutton *)sender tag]; nsdictionary *audiofileinformation = [audiocellsarray objectatindex:tag]; nsdata *selectedaudiofile = [audiofileinformation objectforkey:@"data"]; nserror *error; nsstring *filepath = [[nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0] stringbyappendingpathcomponent:@"sound.caf"]; [[nsfilemanager defaultmanager] removeitematpath:filepath error:nil]; [selectedaudiofile writetofile:filepath atomically:yes]; nsurl *file = [nsurl fileurlwithpath:filepath]; _audioplayerfo

java - Performance issues in Regular Expression -

i having rest service running under heavy load, meaning getting lot of traffic around million read calls per day. rest servcie lookup database basis on userid , retrieve few bunch of columns corresponding userid. so seeing high performance issues in code currently. suspecting below method 1 of methods should start optimizing first of all. below method accept attributename , basis on give me match using regular expression. let's take example- if attrname technology.profile.financial then below method return me technology.profile . , way work other case well. private string getattrdomain(string attrname){ pattern r = pattern.compile(commonconstants.valid_domain); matcher m = r.matcher(attrname.tolowercase()); if (m.find()) { return m.group(0); } return null; } in commonconstants class file string valid_domain = "(technology|computer|sdc|adj|wdc|pp|stub).(profile|preference|experience|behavioral)"; i trying see, whether there

android - Retaining fragment state along with activity -

i have retained state of activity while switching between activities setting intent flag single top. activity contains fragment.the activity state gets retained fragment gets recreated. how retain activity state along fragment state android using flags? you can call fragment.setretaininstance(true); method tell fragment should retain it's state when activity recreated: http://developer.android.com/reference/android/app/fragment.html#setretaininstance(boolean)

tfsbuild - Is it possible to install TFS Build Service on Domain server while connecting to TFS server installed on non-Domain server -

my scenario is: i installed tfs server 2012 (application tie) on server (s1) in workgroup . installed tfs 2012 build service on server (s2) in domain (d1). i created user (build_user) on both s1 , domain controller of s2 same password. then started tfs administration console -> build configuration -> configure installed features -> configure build service -> connected tfs server on s1 -> run build service as: "build_user", when clicked "test", passed -> went well. after clicked "configure", got error saying user "d1\build_user" not found . must install tfs build service on server in workgroup? if not, how should do? i have similar setup, except tfs server on domain , build servers not. should able set follows: ensure both machines have build_user same password. log build machine build_user load control panel -> credential manager create following credentials: windows credential network addres

java - Custom SimpleCursorAdapter - overloaded bindView issue with onClickListener -

i have created custom simplecursoradapter in have overridden bindview can connect onclick listener of imagebutton in list item layout. want start new application on when button clicked using intent data set underlying cursor . the problem when onclick function of button gets called, cursor seems no longer pointing @ correct row in database (i assume because has been changed point @ different row list scrolls). here code: private class wavefxcursoradapter extends simplecursoradapter { public wavefxcursoradapter(context context, int layout, cursor c, string[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); } @override public void bindview(view v, context context, cursor c) { super.bindview(v, context, c); imagebutton b = (imagebutton) v.findviewbyid(r.id.btn_show_spec); // fchr correct here: int fchr = c.getint(c.getcolumnindex( wavedatacontentprovider.siteforecast.forecast_period)); log.d(tag, "

configuration - propel could not find postgresql driver - wrong pdo version? -

i can't propel script running on system. my build.properties looks this: propel.project = test # propel driver use generating sql, etc. propel.database = pgsql # must pdo dsn propel.database.url = pgsql:host=localhost;port=5432;dbname=test propel.database.user = user propel.database.password = password i following error when run propel-gen . reverse: [propel-schema-reverse] there error building xml metadata: /home/user/web/dev/vendor/propel/generator/build-propel.xml:296:1: not find driver pdo_pgsql enabled (there several applications running succesfully); in phpinfo there seems wrong version stated: postgresql(libpq) version 8.4.13 i'm running postgresql 9.1. think causes error have no idea why versions different. have installed first postgresql , php5-fpm etc. via apt-get. using php 5.3.5 on ubuntu 11.04. can help? remove empty spaces , newlines in between xml tags in buildtime-conf.xml. worked me. my file looked after using runtim

c# - Extracting files using SevenZip -

im getting exception in can 1 me? exception:unable cast com object of type 'system.__comobject' interface type 'sevenzip.iinarchive'. operation failed because queryinterface call on com component interface iid '{23170f69-40c1-278a-0000-000600600000}' failed due following error: no such interface supported (exception hresult: 0x80004002 (e_nointerface)) code: private void unzip(string ziptoextract, string unzipdirectoryl) // extract zip/lot file in same directory { #region extraction test - extractfiles using (var tmp = new sevenzipextractor(ziptoextract)) { if (this.progressbar1.invokerequired) { progressbar1.invoke(new action(delegate() { progressbar1.maximum = tmp.archivefiledata.count; progressbar1.value = 0; })); } else {

authentication - Django : request.user not set after redirect -

specifically, after authentication , redirect, request.user anonymous user. login (view function) def login(request): if request.method == 'post': form = loginform(request.post) if form.is_valid(): #django.contrib.auth.login login(request, form.get_user()) str = reverse('cm_base.views.index') return httpresponseredirect(str) else: # password / email combination must have been incorrect pass else: form = loginform() return render_to_response('cm_base/login.html', {"debug": true, 'form' : form }, context_instance=requestcontext(request)) in index view, removed login_required decorator , tested request.user object def index(request): test = request.user.is_authenticated() return render_to_response('cm_base/index.html', {&qu

Kernel Dev In assembly & C -

i trying create simple kernel using assembly , c on linux using bochs. problem each time try calling c code assembly code emulator gives me error , resets simulation. when start in 16 bit real mode use code global _start [bits 16] _start: mov [boot_drive] , dl mov bp , 0x7000 mov sp , bp mov bx , 0x0000 ;load 5 sectors 0x0000(es):0x9000(bx) mov es , bx mov bx , kernel_offset mov dh , 15 mov dl , [boot_drive] call disk_load mov dx , [es:kernel_offset] call print_hex call switch_to_pm jmp $ and after switching protected mode code [bits 32] extern kmain begin_pm: ;print char vram testing , printed, means switch has suceeded mov ebx , vram_address mov al , 'h' mov [ebx] , al mov al , 0x07 inc ebx mov [ebx] , al call kmain jmp $ and c function nothing empty one about commands using use these nasm $asm_file_name.asm -f elf -o $asm_file_name.o gcc -ffreestanding -c $c_file_name.c -o $c_file_name.o ld -o $c_file_name.bin -ttext 0x7c00 $asm_file_name.o $c_fil

java - Using Textwatcher with a simpleexpandablelistview in Android -

in previous app, had listview , and edittext @ bottom of it. have been using textwatcher in edittext filter listview. contents of listview come simplecursoradapter. edittext.addtextchangedlistener(filtertextwatcher); cursor.setfilterqueryprovider(new filterqueryprovider() { @override public cursor runquery(charsequence constraint) { cursor cursor=mdbhelper.fetchfilterednotes(edittext.gettext().tostring()); return cur; } }); private textwatcher filtertextwatcher = new textwatcher() { public void aftertextchanged(android.text.editable s) { }; public void beforetextchanged(charsequence s, int start, int count, int after) {}; public void ontextchanged(charsequence s, int start, int before, int count) { simplecursoradapter.getfilter().filter(s.tostring()); }; }; in current app, have expandablelistview. use similar feature filtering content

tfs - TFS2012 - New Task - "Assigned To" shows people outside the project -

i testing new tfs 2012 installation , noticed following issue when trying create new tasks. in "assigned to" drop down shows service , global domain administrator accounts outside team members project. http://imgur.com/j1djyb3 is there way show team members of project? regards steve here looking for: http://social.msdn.microsoft.com/forums/vstudio/en-us/ecb9cac7-979f-4996-af2b-ea1e729f10d5/manage-users-in-tfsfor-assign-to-field basically, can limit field security group, need alter "allowed values" field in process template.

android - listactivity having 2 items with sectionindexer -

hi guys developing dictionary application in android. problem how can put sectionindexer (a-z) in listactivity having 2 items. in onclicklistener choosing item view meaning in class (i solved it). want guys combine listactivity having 2 items (items , sub-items) having a-z (in right side) onclicklistener. mylist.class ' public class mylist extends listactivity { public sqlitedatabase database; public static final string row_id = "row_id"; public static final string db_word = "dspeakdictionary"; public static cursor crs = null; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); arraylist<map<string, string>> list = builddata(); string[] = { "name", "purpose" }; int[] = {r.id.tvnameml,r.id.tvpurpose}; simpleadapter adapter = new simpleadapter(this, list, r.layout.mylist, from, to); setlistadapter(adapter); } protected void onlistitemclick(listview l, view v, int position,

mysql - jQuery post serialize russian -

i trying post data database , campaigns run in 6 languages, 1 being russian , unable handle cyrillic text. the dtb setup utf8 last campaign used russian, jquery one. $(document).ready(function () { $("#form").submit(function () { //use forms id var str = $(this).serialize(); $.ajax({ type: "post", url: "includes/postdata.php", data: str, success: function (msg) { if (msg == 'ok') { //alert('success'); $('#thankyou').delay(100).fadein(350); } else { result = msg; console.log(msg); } } }); return false; }); }); the error getting "incorrect string value: '\xc3\x91\xc2\x80\xc3\x91...'" tried editing post data $country = utf8_decode($_

c - If i run this program even if i give the input as 0 it countinuosly getting the values in it? -

#include<stdio.h> #include<conio.h> #include<malloc.h> void main() { struct node { int data; struct node *next; }; struct node *head,*temp; int x; clrscr(); head=(struct node *) malloc (sizeof(struct node)); temp=head; while(temp!=null) { scanf("%d",x); temp->data=x; if(x==0) {temp->next=null;} else {temp->next=(struct node *) malloc (sizeof(struct node));} temp=temp->next; } } i writing code simple linke list program ... can run program when press 0 program not stopping.. firstly, scanf wrong. needs passed reference: scanf("%d", &x); secondly, should set x other 0 before scanf'ing it, in case. way written, have no exit condition in loop. you try using gdb , stepping line line if want right it. hope helps

c# - QAS Pro. Problems with certain addresses -

i work call centre has been using qas pro near 2 years now. use resource dll inside access databases talk internally hosted qas server. use gather address details based on postcode. first function gets list of address postcode, inserts them combo box in access. after operator can select appropriate address , inserts correct fields. this written developer no longer us. job fix code. testing i've been able verify c# code use , not addresses. test harness works fine. the resource dll uses c# test code qas file few functions. i'm new c# , have never worked on before. appreciated. this code written old colleague. namespace mangoqas { using com.qas.proweb; using system; using system.runtime.compilerservices; using system.runtime.interopservices; [comvisible(true)] public class qas { public qas() { quickaddress address = new quickaddress("http://10.10.15.7:2021") { engine = quicka

jsf - Setting Default selection on selectOneMenu via Bean -

this seams easy problem, perhaps i'm missing something. i'm trying prepopulate user field in search filter current logged in user. role filter being populated expected, user field defaults blank. i've set log statement in bean, , verifies bean being set. i've done search within gotobasicsearch function, , searches based on current logged in user. the dropdown being populated correctly, , selecting user , searching works correctly. know why ui isn't populating field default value. technology stack: seam 2.3, jboss 7, jsf 2, richfaces 4 bean: @name( "searchaction" ) @scope( scopetype.conversation ) public class searchaction { private searchfilter searchfilter = new searchfilter; // other stuff @begin(join = false ) public string gotobasicsearch() { searchfilter.setrole( roles.any ); searchfilter.setstaff( user.getstaff() ); return search; } xhtml <!-- normal stuff --> &l

security - Set folders writable to joomla instalation -

i have jommla website have issues permissions. there problem if set 777 recursively these folders in terms of security? /public_html/tmp /public_html/logs /public_html/images /public_html/cache /public_html/administrator/cache if set 755 folders, still not writable joomla. 777. can ownership problem? or fine 777 in specified folders? it bad idea set folders 777 poses security threats due fact enables read, write , execute permissions. folders should 755 , files should 644. this website give god examples of security issues: http://www.anchor.com.au/blog/2012/09/the-chmod-777-trap-how-and-why-to-avoid-it/ the reason why still might not writable due folder ownership. sort out, need talk host.

Why is it a good idea to avoid nested blocks in a function? (PHP) -

i installed netbeans 7.4 beta, , there's new hint says "too many nested blocks in function declaration - it's practice introduce new function...". i try avoid nested blocks within function better readability, there other reason why better "idea," php, if matters. the formal name cyclomatic complexity . this measure of how complex function is, based on number of 'decision points' in function. higher number, more complex function. complexity determined number of decision points in method plus 1 method entry. decision points 'if', 'while', 'for', , 'case labels'. generally, 1-4 low complexity, 5-7 indicates moderate complexity, 8-10 high complexity, , 11+ high complexity. (taken http://phpmd.org/rules/codesize.html ) the reason considered bad have complexity values high because makes function difficult test. in order test function full potential, need have separate test each possible code path

python - Creating a Lexer -

hey guys trying understand concepts regarding lexers. understand lexers used in compilers separate individual characters in string form known tokens. thing confuses me matching part. not understand logic of why need match characters corresponding position. import sys import re def lex(characters, token_exprs): pos = 0 tokens = [] while pos < len(characters): match = none token_expr in token_exprs: pattern, tag = token_expr regex = re.compile(pattern) match = regex.match(characters, pos) if match: text = match.group(0) if tag: token = (text, tag) tokens.append(token) break if not match: sys.stderr.write('illegal character: %s\n' % characters[pos]) sys.exit(1) else: pos = match.end(0) return tokens this code not understand. after loop, not quite grasp

option - jquery: how to prevent dropdown change after user made selection? -

hej folks! i got following script-example make selections: fiddle example: http://jsfiddle.net/dataminer/7zyus/1/ $(function(){ var my_2_madeselection = { // second selection '001': ['004'], '002': ['005'], '003': ['006'] }; // third selection var my_3_madeselection = { '001': ['007'], '002': ['008'], '003': ['009'] }; // fourth selection var my_4_madeselection = { '001': ['010'], '002': ['011'], '003': ['012'] }; // var $('#001').change(function() { var availablemy_2_madeselection = my_2_madeselection[this.options[this.selectedindex].value]; var availablemy_3_madeselection = my_3_madeselection[this.options[this.selectedindex].value]; var availablemy_4_madeselection = my_4_madeselection[this.options[this.selectedindex].value]; // groups $('#002 option').attr('disabled', function () { return $.inarray(t

sql server - Does SSDT bulid script for only changed objects? -

i'm in process of redesigning our department's source control strategy using team foundation server (tfs) in regard database objects. essentially, store nothing in tfs @ time. have discovered ssdt , enjoy integration within visual studio , think make our transition tfs easier. so, ssdt have capability of generating scripts based on delta's of ssdt project verses in our server? seems have researched, able generate entire database script. requirements (mind you, our developers not have ddl access production): i cannot drop database re-create i cannot drop objects stored procs re-create them need tables need altered not dropped , has changed dacpac's out of question our best option based on our environment @ time use scripts updates our database environment sql server 2008 r2. ssdt version latest 2013 published in june. yes, if publish project pretty meet of these requirements, though dacpacs built part of process. schema compare , pre/post deplo

css - Bootstrap sidebar code -

i never coded css. i've overrided bootstrap css containers (container-two menu, container rest). also, there custom css. i've copied here: http://paste.laravel.com/jiy . how make sidebar on right/left side (easy configurable) in well. i've tried several things margins don't trick. little boxes. provide example or something? can view master/base layout: http://paste.laravel.com/jiz thanks in advance. instead of trying override bootstrap's container , should use bootstrap's container-fluid instead (right below container in docs ). allows do: <div class="container-fluid"> <div class="row-fluid"> <div class="span2"> <!--sidebar content--> </div> <div class="span10"> <!--posts content--> </div> </div> </div> to have sidebars on left, or: <div class="container-fluid"> <div class="row-flui

surveymonkey - Import/Export of survey definition -

is there api import or export entire survey definition survey id? definition include question text, question kind, , possible answers depending on type of question. i'm not talking specific responses or summary of responses, rather information survey itself. there complete api export survey data (as or little please). output in json format. in case, way works first download list of survey ids ( get_survey_list ). note these not same survey code part of web address you've sent respondents. after have retrieved survey ids, can retrieve survey details ( get_survey_details ) passing api survey id. you have register on developer site , request api key , authentication token. can done in browser if aren't familiar programming. you can download api browser using api console . if comfortable python, or want learn, can find pre-programmed stuff here: https://github.com/surveymonkey/python_guides you can use curl access survey data.

Webstorm says console is an unresolved variable -

Image
for reason webstorm says global console variable in javascript unresolved. i using node.js. appreciated. the solution webstorm 6.* enable 'html' library in settings/javascript/libraries (same webstorm 7.0.1)

android - Application crushes and throw NullPointerException while Orientation is changing -

i using fragment , put asynctask inside network oriented task. works fine. when change orientation protrait landscape, wors fine. when changed orientation again portrait , crashes. trying code. public class problemstatistics extends sherlockprogressfragment { view mcontentview; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { mcontentview = inflater.inflate(r.layout.submission_statistics, container, false); return super.oncreateview(inflater, container, savedinstancestate); } @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); setcontentshown(false); setcontentview(mcontentview); bundle bundle = this.getarguments(); int problemno = 100; if (bundle != null) { problemno = bundle.getint("problem_no", problemno); }