Posts

Showing posts from February, 2011

Testing a non-trivial AngularJS app with Jasmine & Karma -

i'm working on non-trivial application, following folder structure: build (required files such angular.js) gruntfile.js karma.conf.js logs/ node_modules/ src/ - app/ - app.js - module_name/ - module.js - controllers/ - controller1.js - controller2.js - views/ - view1.html - assets/ - 1.jpg - styler.css - components/ (plugged in modules [angular-ui, etc]) - index.html my controllers each attached parent module. module required in app.js file. i have tried writing unit tests, seem keep having trouble dependancies, since controller try test requires it's module, module requires one, etc. my question has few parts: how go structuring karma.conf.js file include necessary files? part of configuration: files: [ 'files_to_be_tested.js', ] using jasmine, how write unit test proper dependancies? example, run following test j...

c# - Modify Compiled .Net Exe -

i have application written in c# (without source of course), needs changed little bit. example, need stop few lines of code create unnecessary menu. think should comment them out. the source code not obfuscated. know can decompile, change, , compile again, using tools reflector/reflexil. knows doing this, many parts of code won't compile again! there way in reflector (or other product) part of disabled/changed without process? thanks. you might want try dnspy. .net assembly editor, decompiler, , debugger forked ilspy. https://github.com/0xd4d/dnspy

c# - Inter-Process communication options -

i need subscribe inside 1 app event exposed app. noticed many people consider using of wcf named pipes best practice. right if choose wcf named pipes i'll have use iis? and way, options have in general? named pipes 1 of fastest way ipc (inter-process communication) on same machine. have existed long while (was nt4 first os?) , not specific wcf. i not use wcf/named pipes through asp.net iis not use named pipes it's communication. means app close if iis have not received http requests while. how should host ipc depends on type of application. if want have server running should host in windows service. otherwise include in desktop app. you not have use wcf, can use named pipes directly (look @ link in beginning of message). depends on how complex communication is.

Confusing with a php variable issue -

in below code, after preg_match , $videoinfo['video']['rendering'] equals "progressive". so, expecting final echo output "rendering: progressive scan". however, doesn't. outputs "rendering: progressive" missing obvious here? thanks help! if(preg_match("/^video field order\s+:(.*)$/im",$output,$matches)){ $videoinfo['video']['rendering'] = $matches[1]; if($videoinfo['video']['rendering'] == "progressive"){ $videoinfo['video']['rendering'] = 'progressive scan'; } echo("rendering: " . $videoinfo['video']['rendering']); } you this echo("rendering: " . $videoinfo['video']['rendering']); and outputs "rendering: progressive." that means $videoinfo['video']['rendering'] contains string pr...

java - Result empty on setting projection for Hibernate criteria -

i have join query want put in programs hibernate criteria. select a.accountname,a.username,b.name account , user b a.id=b.accountid , b.name '%abc%' , a.username '%def%' my criteria : criteria usercriteria = session.createcriteria(user.class); detachedcriteria accountcriteria = detachedcriteria.forclass(account.class); accountcriteria .add(restrictions.like("name", "%" + def+ "%")); accountcriteria.setprojection(projections.property("id")); usercriteria.add(property.forname("accountid").in(accountcriteria)); usercriteria.add(restrictions.eq("username", "%" + abc+ "%")); list tmplist = usercriteria.setprojection(projections.rowcount()).list(); usercriteria.setmaxresults(pagesize); result = usercriteria.list(); list tmplist showing empty. can list data before: list tmplist = usercriteria.setprojection(projections.rowcount()).list(); what problem in l...

jquery - How close other element when clicked using .slideToggle -

i'm trying make accordion menu, how ever, need menus open 1. how close other li when clicked? below code use toggling menu. how target other li close when li clicked. <li class="cat_parent"> <h2 class="head par_title">books</h2> <div class="content">01</div> <div class="content">02</div> </li> <li class="cat_parent"> <h2 class="head par_title">magazine</h2> <div class="content">01</div> <div class="content">02</div> <div class="content">03</div> <div class="content">04</div> </li> $(document).ready(function(){ ('.head').click(function(e){ e.preventdefault(); $(this).closest('li').find('.content').slidetoggle(); }); }); your appreciated! try $('.cat_parent').find('div').hi...

authentication - how to configure multiple users to access multiple ressources with different rights? -

i'm working on project i've multiple ressources , multiple users, need associate different access rignts every user depending on ressource wants access to the problem simple ldap server can't implement kind of situation, an idea use multiple ldap servers, 1 each ressource, how manage them all? or there authentication process can use in case? spring security has special acl module handle such situations. basic idea each domain object / ressource may have separate access control list. need fill list appropriate permissions , add corresponding checks in code. can have parent -> child relations between objects reduce number of permissions. check out .

java - how can I reload/refresh properties in spring at runtime without jvm restart? -

how can reload/refresh properties in spring @ runtime without jvm restart? i looking elegant , should applicable in prod. therefore, jrebel off table guess. currently, have properties in myproject.properties oms.url=abbc.com checkin.enabled=true and java file autowired search , use these properties applicationcontext provided different property files: <bean id="applicationproperties" class="myproject.config.custompropertyplaceholder"> <property name="ignoreresourcenotfound" value="true" /> <property name="locations"> <list> <value>classpath:myproject.properties</value> <value>file:${catalina_base}/lib/myproject.properties</value> <!--<value>file:///appl/conf/outlet.properties</value>--> <value>classpath:db.password</value> <value>file...

asp.net - change radmenu click events -

hi have rad menu set in master page , has url/links added there. i trying change 2 of radmenuitems navigation links aspx page code behind d) replace link javascript click event. e) when click fire vb.net void click event thanks protected sub page_load(sender object, e eventargs) dim rmenu radmenu = directcast(master.findcontrol("mymenu"), radmenu) dim d radmenuitem = directcast(rmenu.findcontrol("dogs"), radmenuitem) dim e radmenuitem = directcast(rmenu.findcontrol("cats"), radmenuitem) d.navigateurl = nothing e.navigateurl = nothing d.click = "alert('you clicked on dogs')" e.click = button1_click end sub protected sub button1_click(sender object, e eventargs) 'do cats end sub

MySQL search between dates -

i have field in table holds registration date in following format 26 august 2013, 5:48:17 am which best way search between dates in format? just use between select * table1 date between curdate() , curdate() - interval 1 day pay attention, borders included. works on timestamps.

java - How to use a callback URL in twitter for sharing a content -

i have code sharing content twitter,but contains field oauth_callback_url,oauth_callback_scheme etc.how use them , url should put inside callback_url? link code... https://github.com/dhaval0122/share_to_facebook_twitter .. in theirs file called constant.java,which has variable named oauth_callback_url,oauth_callback_scheme,oauth_callback_host.what supposed fill inside them?plz reply..

c# - WPF User Control Resources -

i have custom control extending wpf datagrid. inside custom control, resources , control template of grid defined <datagrid.resources> <local:visibilityconverter x:key="visibilityconverter" /> <style x:key="columnheadergripperstyle" targettype="{x:type thumb}"> <setter property="width" value="8" /> <setter property="background" value="transparent" /> <setter property="cursor" value="sizewe" /> <setter property="template"> <setter.value> <controltemplate targettype="{x:type thumb}"> <border padding="{templatebinding padding}" background="{templatebinding background}" /> </controltemplate> </setter.value> </setter> ...

android - Load different colors based on conditions -

i programming application contains layouts views. load these colors values/colors.xml . now, want define multiple themes application, e.g. blue , green (some sort of blue , green colors). question how can define 2 colors.xml file , load based on conditions or choosing user. want thing strings.xml can load strings based on locale defined. thanks in advance. string.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="white">#ffffff</string> </resources> values-fr/strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="white">#eeeeee</string> </resources> button.setbackgroundcolor(integer.parseint(getstring(r.string.white)));

asp.net - How to use sections in an app.config that's in a web.config? -

my web.config looks this: <configuration> <configsections> <appsettings configsource="exampleapp.config" /> <connectionstrings configsource="exampleprod.config" /> </configsections> <configuration> my app.config (exampleapp.config) looks this: <configsections> <sectiongroup name="examplesettings"> <section name="blah" type="system.configuration.namevaluesectionhandler" /> <section name="foo" type="system.configuration.namevaluesectionhandler" /> </sectiongroup> </configsections> <examplesettings> <blah> <add key="me" value="1" /> </blah> <foo> <add key="you" value="2" /> </foo> </examplesettings> i'm getting error says: xml document cannot contain multiple root level elements. how resolve this? a...

javascript - Can't read cookie except in IE -

i can read following cookie in firebug: fixxly_id=niflj34fiodrgrtk0mwqtmwqzmtyxnde5mtvh|1377513181|4f983fa4ca9c0554hfd6dcb24d1a3188a9d3fa2; expires=wed, 25 sep 2013 10:33:01 gmt; path=/; domain=mysub.mydomain.pt the request comes http://mysub.mydomain.com/myapp/#/login but can't read cookie javascript when use ff, chrome, safari. ie works. tried read cookie using document.cookie, jquery's $.cookie() , angularjs-cookies . cookie not httponly. i tried setting cookie domain .mydomain.pt , mydomain.pt . tried set path=/myapp . read other posts here in stackoverflow couldn't find answer this. the cookie being set on different server/domain! what i'm missing here? anyone? thanks. solved the problem in ports used. happening requests being made port 8081 (there proxy forwarding requests final destination, listening in port 8081), apparently ie has no problemas port http requests. changed our nginx server (in http://mysub.mydomain.com ) redirec...

linked server to excel permissions -

ok, give up, have no clue , desperately need help. loath excel storing data but... can do? what want do: allow user data .xls file via stored procedure , linked server (using microsoft.ace.oledb.12.0) tthe problem: user gets error: ole db provider "microsoft.ace.oledb.12.0" linked server "ls" returned message "the microsoft access database engine cannot open or write file ''. opened exclusively user, or need permission view , write data.". msg 7303, level 16, state 1, line 1 cannot initialize data source object of ole db provider "microsoft.ace.oledb.12.0" linked server "ls". administrator runs select * ls...[data$] , gets full rowset what did: i gave user permissions temp in sql service account directory. user has full control on file linked server connected. what sure of: file not opened user. resolved there custom *.mdw file provider (i found somewhere in registry, hkey_local_mac...

How can I simplify code that modifies Window Styles using SetWindowLong & GetWindowLong? -

i'm writing wrapper functions , classes windows api. common occurrence i'm starting come across modifying windows styles. the following example code adjusts textbox's text alignment based on parameter alignment enum. after testing seems must remove 2 alternative alignment styles or conflict. setwindowpos(..swp_framechanged) doesn't work either, replaced invalidaterect() , updatewindow() force textbox repainted after style updated. i'd feedback if there simpler way of doing this. feel i'm overlooking something. thanks! :) enum alignment { left, right, center }; void textbox::alignment(alignment alignment) { switch (alignment) { case alignment::left: setwindowlongptr(m_hwnd, gwl_style, (getwindowlongptr(m_hwnd, gwl_style) & ~es_center & ~es_right) | es_left); break; case alignment::center: setwindowlongptr(m_hwnd, gwl_style, (getwindowlongptr(m_hwnd, gwl_style) & ~es_left ...

Git workflow to distribute changes to several branches -

i have git repo 2 massively diverged branches , b: a upstream branch of open source software b changes made (from commit starting point) what have is a above b having changes want make available upstream developers c changes apply our specific use of software so find myself in situation of having split changes in b 2 parts , commit them different branches. did until have 2 checkouts of repository (b , c) is there built-in git tool or workflow handles case? simply create c branch, , cherry-pick relevant commits b c . i avoid cherry-picking because duplicates commits , can create functional dependencies errors . but in case, if 'c' isn't merged other branch, solution.

How to get all child of a given id in SQL Server query -

i have 2 tables in sql server database: category( itemid, parentid ) articleassignedcategories( categid, artid ) categid foreign key of itemid i want count of artids , child of given itemid (child means categories parentid of given itemid .) for example; if given itemid = 1 , in table category have (3,1),(4,1)(5,3) all of 3, 4, 5 child of 1 can me write query? recursive queries can done using cte with cte(itemid, parentid) ( -- start category select itemid, parentid category itemid = <some_itemid> union -- recursively add children select c.itemid, c.parentid category c join cte on c.parentid = cte.itemid ) select count(*) articleassignedcategories join cte on cte.itemid = a.categid

Ruby on Rails - Send two text_field_tag values present inside form_for in hash format -

i have form_for have field related form object , there fields not related form object field using text_field_tag. field key - value pair, when submitting form, want combine or rather send in hash format in controller code can save these values together. here form_for code [demo] <%= form_for [@var], :url => {:action => form_action}, :html => {:id => form_id} |f| %> <table border=0 cellpadding="0" cellspacing="8" id='psp-config-form' > <tr class='psp_config_row'> <td><label for=''>screen label</label></td> <td> <%= text_field_tag "screen_label[]", "", :size => 20, :class => 'search-txt-input', :maxlength => 360 %> </td> <td><label for=''>value</label></td> <td> <%= text_field_tag "screen_value[]", "", :size => 20, :class => 'search-txt-...

web services - PHP : The specified procedure could not be found. in Unknown on line 0 -

i got stuck on php error receiving : php warning: php startup: unable load dynamic library 'c:\php\php_soap.dll' - specified procedure not found. in unknown on line 0 i have declared dll in both ini files. i'm running windows 7 , site hosted on iis using mssql database. i'm using php 5.4.1 (company policy) my ini file changes : ; directory in loadable extensions (modules) reside. extension_dir = "c:\php" extension=php_soap.dll [soap] ; enables or disables wsdl caching feature. soap.wsdl_cache_enabled = 0 ; sets directory name soap extension put cache files. soap.wsdl_cache_dir="/tmp" ; (time live) sets number of second while cached file used ; instead of original one. soap.wsdl_cache_ttl=86400 please help, i've tried everything. re-installing. thank you. are sure php_soap.dll in folder c:\php\ ? if not, need adjust extension_dir config setting in php.ini proper extension folder.

angularjs - tokenInput as angular.js directive -

i'm attempting create angular.js directive james smith's tokeninput jquery plugin: http://loopj.com/jquery-tokeninput here have far: antdna = angular.module('communication', []); antdna.factory('autocompleteservice', [function() { return { getsource: function() { return [{"id":1, "name":"john doe"}, {"id":2, "name":"jane smith"}]; } } }]); antdna.directive('autocomplete', function(autocompleteservice) { return { restrict: 'a', link: function(scope, elem) { elem.tokeninput(autocompleteservice.getsource(), { crossdomain:false, theme: "facebook", hinttext: "enter user name", preventduplicates: true }); } }; }); with following markup: <input type="text" name="recipient" ng-model="conver...

Where save help information in outlook? -

i making add-in outlook. periodically updated information wcf-service , need somewhere save last time add-in updated. can save information? in appsetting in app.config file, sounds place: <appsettings> <add key="updatedate" value="2013-08-27 10:00:00" /> </appsettings>

nltk - Methods in python -

so going though nltk , saw code entities = nltk.chunk.ne_chunk(tagged) now question how people know method use when , order of method calls? another strange code saw nltk.corpus.words.words('en') now how 1 interpret .words followed .words? why did call words method twice here & how know when need call method twice? i finished "udacity - intro. cs (with python)" "nltk" getting way confusing. please help, have been struggling logic of these since couple of days. you not calling words twice. calling words method of words module. it's namespaces , modules. read more python modules . :)

soa - Bpel arrays transformation foreach -

i have bpel process receive array , output one. the thing is, need first 1 elements, populate second 1 , add elements in second one. my first 1 array kind of object: <xsd:complextype name="comment_a"> <xsd:sequence> <xsd:element name="id" type="xsd:int"/> <xsd:element name="username" type="xsd:string"/> <xsd:element name="name" type="xsd:string"/> <xsd:element name="picture" type="xsd:base64binary"/> <xsd:element name="date" type="xsd:string"/> <xsd:element name="hour" type="xsd:string"/> <xsd:element name="bus-line" type="xsd:string"/> <xsd:element name="bus-number" type="xsd:integer"/> <xsd:element name="description" type="xsd:string"/> <xsd:element name="rate" type=...

php - Is it possible to set the process group of a child process with PCNTL? -

the man page pcntl_waitpid() documents following option: wait child process process group id equal absolute value of pid. i'm interested feature (waiting some child processes, not all), can't find reference how set process group id of child process. is possible @ pcntl ? found it. pcntl not offer function, posix extension offer posix_setpgid() : bool posix_setpgid ( int $pid , int $pgid )

python - How can php-files find namespaces in other php-files? -

coming python i'm trying make sense of way php uses namespaces. in python import follows: import somemodule anothermodule import someclass this works charm , expect. in php on other hand, we've got namespaces. far understand can define namespace on top of mymodule.php this: namespace mynamespace; if i'm correct means code in file can referred (or imported by) name "mynamespace" in myworkingcode.php doing this: use mynamespace; so question; how myworkingcode.php find mymodule.php? need in same folder work or need else? the use function in php completly different import in python. use there creating aliases long namespaces. example: use \my\very\long\omg\its\sooooo\long\how\stupid veryshort; now every class inside long namespace available under namespace veryshort. more info: http://php.net/manual/en/language.namespaces.importing.php then, how php find correct file? doesn't. have include yourself, if use strong naming conventio...

jquery - Changing class of all class="like" inside a <div> with particular data-id -

i'm stuck changing class of class=like spans within <div class="h2" data-id="9"> (one example only. there more on page). i need $('.h2[data-id="9"]') way, since need pick out particular div s. this being case, how can change class of class=like else. seem going no this. you'll see i'm trying achieve if @ code below. can pls help? success: function(data){ // remove class like, add class no-link $('.like[data-id="'+data+'"]').removeclass('like').addclass('no-like'); //for example $('.h2[data-id="9"]').siblings().removeclass('like').addclass('grey'); }, my <div> <div class="h1" data-id="8">restaurants</div> <div class="h2" data-id="9">which favourtie restaurant in town? <div>* mcdonalds &nbsp <span c...

ios - Show glow when a button is touched -

trying use info button in ios app. wondering if knows how simulate glow effect when click on it. see example weather or stocks apps in iphone; when touch it, glow highlight around touch. touch , hold see it. uibutton has property called showstouchwhenhighlighted . default set no . if set yes glow effect when button highlighted. you can set in interface builder checking "shows touch on highlight" option. or can in code with: infobutton.showstouchwhenhighlighted = yes; this applies uibuttons, not info ones.

android - displaying jsonarray data on textview -

im trying make android application school. want happen first, when user loggedin username saved in sharedpreferences second, using sharedpreference retrieve user info in database. third, parse data , display info in textviews. php file <?php /* our "config.inc.php" file connects database every time include or require within php script. since want script add new user our db, talking our database, , therefore, let's require connection happen: */ require("config.inc.php"); if (!empty($_post)) { //initial query $query = "select * userinfo username = :user"; $query_params = array(':user' = > $_post['username']); //execute query try { $stmt = $db - > prepare($query); $result = $stmt - > execute($query_params); } catch (pdoexception $ex) { $response["success"] = 0; $response[...

c++ - creating doubly linked list -

i want create doubly linked list , check if empty. please tell mistake. error shown : in function empty(), head , tail out of scope. didn't work when define struct in class dict. #include <iostream> #include <fstream> #include <string> using namespace std; class node { public: string data; node* next; node* prev; friend class dict; }; class dict { public: bool empty(); dict(); node* head; node* tail; }; dict::dict() { head=new node; tail= new node; head->next=tail; tail->prev=head; } bool empty() { return head->next==tail; } int main() { dict my_list; if(my_list.empty()) {cout<<"empty list"<<endl;} else {cout<<"not empty"<<endl;} } i think need include empty method in class: bool dict::empty() { return head->next==tail; }

delete image after 5 sec using qt creator -

i loaded image using qt creator c++ : inputimg=new qimage("c:/bimap/hud1.bmp") and can see on window. want delete image after 5 sec , load image. is possible it? answer. allocate images in constructor (or @ least once), , use index select them. added numimages variable, can have more 2 images rotate through. mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); qtimer *timer = new qtimer(this); connect(timer, signal(timeout()), this, slot(update())); timer->start(5000); index = 0; numimages = 2; inputimages[0] = new qimage("c:/bimap/hud1.bmp"); inputimages[1] = new qimage("c:/bimap/speed.bmp"); } void mainwindow::update() { showimage(inputimages[index]); index = ++index % numimages; }

android - Get gps coordinates with asyncTask -

Image
i need current coordinates. try next, not result. public class fragmentnear extends sherlockfragment implements android.location.locationlistener { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { locationmanager = (locationmanager) getactivity().getsystemservice( context.location_service); locationmanager.requestlocationupdates( locationmanager.gps_provider, 0, 0, this); v = inflater.inflate(r.layout.fragment_near, null); downloadwebpagetask dw = new downloadwebpagetask(); dw.execute(""); return v; } @override public void onlocationchanged(location loc) { if (showmfd == 0) { log.d("mylogs", "-------- onlochanged " + mylat + " " + mylong); mylat = loc.getlatitude(); mylong = loc.getlongitude(); log.d("mylogs", "-------- onlochangedend " + mylat + " " + mylong); } ...

android - Determining MIME type of shared Dropbox intent? -

my app receive share requests other apps including dropbox. need know kind of file receiving, mime type dropbox "text/plain". example: intent = getintent(); string smimetype = i.gettype(); //value = "text/plain" string sextratext = i.getstringextra(intent.extra_text); //value = "http://db.tt/th42k3b7" i need know difference between images, videos , music files. there way determine file type based on information in intent? or there way use dropbox api this? thanks, -gregg reno edit: based on proposed solution smarx, found android code here: android - detect url mime type? . added this: slocation = connection.getheaderfield("location"); mimetype = urlconnection.guesscontenttypefromname(slocation); i'm not sure norm here, think text/plain refers type of data being shared in intent. (because it's url, plain text seems appropriate.) from url, can find mime type issuing head request. first resolve shortened l...

c# - Entity Framework Strings vs lambda... Missing .Execute -

i using entity framework , want execute query , know besr way execute query. best practice , why, , 1 more per-formant. option 1) return this.storage.customer.oftype<preferred>() .include("order") .where("it.id = @customerid , it.customertype = @custype", new objectparameter("customerid ", customerid), new objectparameter("custype", (int)custype)) .execute(mergeoption.overwritechanges) .singleordefault(); or return this.storage.customer.oftype<preferred>() .include(b => b.order) .where(cust => cust.id == customerid && cust.customertype== (int)custype) .singleordefault(); the second question why in option 2 .execute not available? appears red. thanks in advance. the performance difference should negligible compared actual data access, need measure it determine sure. include lambda uses...

javascript - How do I click a button and have it remove two things without knowing their ID or class values? -

the 2 things i'm talking text field , string represents html need type text field appear. there's button makes 2 things appear. each time button clicked, pair of same kind appears. but, each time new pair generated, have button generated next text field upon being clicked supposed delete text field , string created it. so, how accomplish this? program in "when button class x1 clicked, remove text field , string have class x1" , "when button class x2 clicked, remove text field , string have class x2", , on, mean solution besides that. here's creation of text field/html pair looks like: $(document).ready(function() { $('#textfield').click(function() { $('#codebox').append('<div id="divtext'+vistext+'"><input type="text" class="textfield" maxlength="0" id="vistext'+vistext+'"><input type="button" value="o" id="o"> ...

c# - Recommended Optimization package for ILNumerics -

i starting code own machine learning package, adopting ilnumerics. i neural nets, svm, kernel methods , start moving more bayesian frameworks. i know ilnumerics offers 'machine learning toolbox', add contribution , code own algorithms, because of features not present (yet?) first, if understand well, of no optimization package included. hope wrong; if not case, suggestions on how implement through ilnumerics highly appreciated; mean: mixing pre-existing code impact performance? advisable mix ilarray , other vectors/matrices? adhering recommendations provided in quick guide enough leverage on excellent performance? or, if prefer, recommend pre-built available optimization package/library used in conjunction ilnumerics? thanks lot hints/advice, recommendations usual, gl you right in points. there no optimization package available in ilnumerics. however, know, 1 big advantage of .net ease of incorporation of external packages. several options exist here: ...

c# - IOException: "A required privilege is not held by the client." best way to overcome? -

i'm writing winform app using c#. while attempting create text file, got error "a required privilege not held client." googled, has user's privileges. put, not allowed create file in chosen path, c:/ tried solution: http://www.technitips.com/2010/06/a-required-privilege-is-not-held-by-the-client-windows-7/ , worked once. what's best way overcome kind of error? should change entire window's security setting? or change path somewhere not need admin's permission? maybe find better folderpath call getfolderpath environment.getfolderpath(environment.specialfolder.personal)); from msdndoc specialfolder enum the directory serves common repository documents. member equivalent mydocuments. if need create temporary file can call: path.gettempfilename(); which creates uniquely named, zero-byte temporary file on disk , returns full path of file , see msdn doc

insert html code to a page via php script in other page -

i'm little bit new php maybe question stupid. say have form: <form id="createnewgallery" name="newgallery" method="get" action="code.php"><p><strong>please choose number of pictures want upload: </strong> <select name="numofpictures" id="numofpictures"> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> </select></p> <input name="submitnumofpictures" type="submit" /> </form> by submiting form want add afterwards form, know can in particular page want code not messy, want in page, code.php and code: <?php if (isset($_get['numofpictures'])){ $times = $_get['numofpictu...

ios - Is it better to embed a view controller or add a subview? -

for example, if required uitableview appear beneath additional content in view, best practice either: add uitableview subview, or add container view holding uitableviewcontroller ? as far know, both provide same user experience, interested know method considered best practice? the general rule ios, iphone/ipod touch form factor, should have 1 view controller on screen @ given time. case can think of when want violate guideline when have subview has lot of logic built in it, , subview needs included in multiple other views. example, popover should have own view controller because might need shown in conjunction multiple other view controllers. in case, suggest adding uitableview subview unless (1) table view has lot of logic isn’t related of parent view controller, or (2) need display same table view in part of app.

php - Bypass other .htaccess files after RewriteRule -

the problem facing related cakephp , explain in context mod_rewrite issue: in cakephp, requests routed /app/webroot directory. in directory, have directory called assets in user-uploaded files stored. want able serve thumbnails every image in folder, , want auto-generate , cache them on first request. to that, have .htaccess file in assets directory, supposed route requests start thumbs/ phpthumb script. put said script assets directory , work fine. but: i want avoid file bloat (as there can multiple resolution thumbnails , on) , therefore rather store thumbnails in /app/tmp directory, the whole thing part of cakephp plugin developing, neat if script stay in plugin's folder. what have tried (inside /app/webroot/assets directory): rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^thumbs\/([^\/]*)\/(.*)$ ../../plugin/myplugin/lib/thumbnail.php?size=$1&path=$2 [qsa,l,s=2] now doesn't work. problem .htaccess files i...

fabric - python string iterpolation on files with % as comment -

this question has answer here: python placeholders in strings containing % symbol 1 answer i use fabric generate custom ejabberd config file , upload server. fabric uses python string interpolation in fabric.contrib.files.upload_template . unfortunately ejabberd config file uses %%% for comments using python string interpolation throws error on following simplified example: %%% comment {resurl, %(resturl)s} valueerror: unsupported format character 't' (0x74) @ index 4 i replace every non uneven occurence of % > 1 one. or val = re.sub("%", "??", open("ejabberd.cfg").read()) val = val % {"resturl": "http://localhost:500/"} val.replace("??", "%") there might better solution treat file's having %, maybe telling python use character mark start of specif...

ember.js - How do you use EmberData models with select2 view? -

i want use emberdata model select2 component/view. i started gist https://gist.github.com/aboma/5737133 of @buuda (referenced in dynamically setting selected option in ember.select uses select2 lib ). but have no idea how connect select2 model emberdata models. by giving initselection function in select2 options hook initialize existing initial selection. when call app.mymodel.find(id) in initselection() promise . idea resolve promise in initselection function? another option can give select2 query function. select2 uses function populate list of selectable options. how can connect results of app.mymodel.find({...}) select2 query() function?

sql - How to Count Duplicate Values in One Table? -

i have view following table/sample values: parentid, childcontainerid, childid 1 ccid1 cid1 1 ccid1 cid2 1 ccid2 cid1 1 ccid2 cid2 1 ccid2 cid3 2 ccid3 cid1 2 ccid3 cid2 2 ccid3 cid2 2 ccid4 cid5 2 ccid4 cid2 2 ccid5 cid5 my goal craft query return duplicate child's across parent id (disregarding childcontainerid) so example data above following result parentid, childid, countchildid 1 cid1 2 2 cid2 3 2 cid5 2 i've tried number of different queries aren't working , think i'm frustrated , overlooking simple @ point. any ideas? select parentid, chilid, count(*) countchildid yourtable group parentid, chilid having count(*) > 1

android - Duplicate elements in a listview -

i of sudden getting duplicate elements in listview. when onclick action on list items, comes normal. checked adapter, not adding multiple items in arraylist. can possibly wrong here. public view getview(int position, view convertview, viewgroup parent) { if (convertview == null || convertview.gettag() == null) { convertview = inflater.inflate(r.layout.bookingresponse_row, null); final cabbieviewholder viewholder = new cabbieviewholder(); viewholder.call = (imageview) convertview.findviewbyid(r.id.callcab); viewholder.call.setonclicklistener(this); viewholder.drivername = (textview) convertview.findviewbyid(r.id.drivername); //similar code more data items convertview.settag(viewholder); } // setting values in listview string temp = latestacceptedcabbiename.get(position); ((cabbieviewholder) (convertview.gettag())).drivername.settext(temp); ((cabbievi...

python - How to edit string letters in a for loop -

i'm new python , cannot find way this. i want change letters of string based on criteria. here code: for c in text: ordchar=ord(c) if ordchar>=65 , ordchar<=90: ordchar=ordchar+13 if ordchar>90: ordchar=ordchar-90+64 c=chr(ordchar) else: if ordchar>=97 , ordchar<=122: ordchar=ordchar+13 if ordchar>122: ordchar=ordchar-122+96 c=chr(ordchar) return text the returned text value same parameter value. thought variables pointers, editing c , should edit text . doing wrong? you're not "editing" c , you're assigning else. 1 alternative build new string instead of trying mutate old 1 (which impossible), instead of c=... have newstr += ... .

Delete files with batch job -

Image
i want delete .txt extention files in computer every 30 days using batch script... files name like: filename_20082013.txt filename_21082013.txt filename_22082013.txt filename_23082013.txt for windows: forfiles -p "c:\what\ever" -s -m *.* -d <number of days> -c "cmd /c del @path" so: forfiles -p "c:\your\path" -s -m *.txt -d -30 -c "cmd /c del @path" source: batch file delete files older n days this delete files @ least 30 days old (you can change number)...now need schedule task run every 30 days: you can use windows task scheduler: http://www.iopus.com/guides/winscheduler.htm http://windows.microsoft.com/en-us/windows7/schedule-a-task or can use streamserve task scheduler: http://streamshare.streamserve.com/articles/article/?articleid=424