Posts

Showing posts from January, 2011

parsing - Generic scala json parser playframework 2 -

i'm using play2.1.1 in scala , i'm trying make writes[indexresults[t]] definition of indexresults[t] can find @ end of file . my code: import com.github.cleverage.elasticsearch.scalahelpers._ import com.github.cleverage.elasticsearch._ // used others stuffs ... val writeresults: writes[scalahelpers.indexresults[t]] = ( (__ \ "totalcount").write[long] , (__ \ "pagesize").write[long] , (__ \ "pagecurrent").write[long] , (__ \ "pagenb").write[long] , (__ \ "results").write[list[t]](writes) )(unlift(scalahelpers.indexresults[t].unapply)) my error: overloaded method value write alternatives: [error] (t: list[t])(implicit w: play.api.libs.json.writes[list[t]])play.api.libs.json.owrites[play.api.libs.json.jsvalue] <and> [error] (implicit w: play.api.libs.json.writes[list[t]])play.api.libs.json.owrites[list[t]] [error] cannot applied (play.api.libs.json.writes[t]) [error] (__ \ "results")

windows 7 - Detect monitor off on Win7 -

win7-based kiosk, clerk-accessible switch powers off monitor, task detect , either orderly shutdown or shutdown/reboot or nothing @ all, based on other factors. if had input on physical design i'd things differently, ... have work with. i've found few different methods supposed detect monitor powered off, none of them have worked. i'd prefer sent event rather polling once/second. screen.allscreens.length continues return 1 when monitor powered off. systemevents.displaysettingschanged not invoked. systemevents.powermodechanged not invoked. registerpowersettingnotification guid_session_display_status not result in messages (but later found lead me think guid_session_display_status isn't supported until windows 8 - correct?). registerpowersettingnotification guid_monitor_power_on gives me 1 message when start not give wm_powerbroadcast message when monitor powered off (nor when monitor powered on). had high hopes because ms doc says "the display turned on o

google app engine - appengine-maven-plugin has a maven-war-plugin in the background? it gets called twice if I define on my own -

i have tried lot of things, , seems project executes "maven-war-plugin" twice. because of can't run optimizations merging classes single jar (using maven shade plugin). i pretty sure appengine-maven-plugin calling maven-war-plugin create appengine packaging. know because tried removing own definitition of "maven-war-plugin" , it's still execute "magically". makes sense in way? my pom.xml is: <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-war-plugin</artifactid> <version>2.3</version> <executions> <execution> <phase>package</phase> <goals> <goal>war</goal> </goals> </execution> </executions> <configuration> <webresources>

repeatedly toggle iframe scrollbar in javascript -

to ward off closing, yes have looked @ of related questions. here related questions not duplicates, share same title: scrollbar iframe in javascript , toggle iframe scrolling in javascript? unable make solutions suggested there work. lets begin hi, need toggle scrollbar on iframe content changes. have code thought work, fails. code below http://jsfiddle.net/3nnaf/2 to demo concept, i'm trying iframe scrollbar turn on , off in loop html: <iframe src="www.google.com" id="iframe" seamless scrolling="no" ></iframe> attempt using 'scrolling' attribute: (function toggleiframe(){ var togglescroll = document.getelementbyid('iframe').scrolling == 'no'; if (togglescroll){ document.getelementbyid('iframe').scrolling = 'yes'; }else{ document.getelementbyid('iframe').scrolling = 'no'; } settimeout(toggleiframe, 2000); }()); attempt using stylin

Vim function to copy a code function to clipboard -

i want have keyboard shortcut in vim copy whole function powershell file windows clipboard. here command it: 1) va{vok"*y - visual mode, select {} block, visual line mode, go selection top, include header line, yank windows clipboard. but work functions without inner {} block. here valid workaround it: 2) va{a{a{a{a{a{a{vok"*y - same (1), selecting {} block done multiple times - work code blocks have 7 inner {} braces. but thing - (1) command works fine when called vim function, (2) misbehaves , selects wrong code block when called vim function: function! copycodeblocktoclipboard () let cursor_pos = getpos('.') execute "normal" 'va{a{a{a{a{a{a{vok"*y' call setpos('.', cursor_pos) endfunction " copy code block clipboard map <c-q> :call copycodeblocktoclipboard()<cr> what doing wrong here in copycodeblocktoclipboard? (2) command works expected when executed directly in vim. update: i'

breeze - Observable item has zero element in knockout Binding -

i running wired problem, record count of array 8 before , after applying custom binding, when debugging the binding array empty. since array empty grid not displaying anything. doing wrong? var vm = { recordscount: ko.observable(), countries: ko.observablearray() }; $(function () { getallcountries(); // handler .ready() called. //alert(myns.javascript1); //alert(myns.javascript1); //alert(myns.javascript2); }); var servicename = "/breeze/countriesbreeze/"; var manager = new breeze.entitymanager(servicename); /*** supporting functions ***/ function getallcountries() { var query = breeze.entityquery.from("getcountries"); console.log("getting countries"); return manager.executequery(query) .then(function(data) { vm.countries(data.results); alert(vm.countries().length);

gwt - My CSS are overridden by Bootstrap CSS -

i want add gwt-bootstrap already-started project. managed use it, bootstrap css overriding every other css. result previous ui elements mixed up. the margin, text size, , lot of elements don't fit more. can't use bootstrap because rest of project unusable. progressive change bootstrap , keep old stuff is. i have csss in priority order: myapp gwt bootstrap i tried order them in *.gwt.xml without success: <stylesheet src="css/gwt-bootstrap.css" /> <stylesheet src="css/bootstrap.min.css" /> <stylesheet src="gwt/clean/clean.css" /> <stylesheet src="myapp.css" /> what can do? the priority of using styles driven more complicated algorithms order on inclusion in html. css style chosen specific selection rule, inline rules considered more specific externally attached, selection id, class , @ end selection tag name. example, paragraph <p id="xyz" class="xyz"> red indep

heroku - Obtain real Remote ADDR to peer -

i use development heroku account, , wrote simple web application. when try obtain remoteaddr http request, ip: 10.151.38.13:47253 , private address, , not ip address shown www.whatismyipaddress.com example. understand there proxy, relaying web traffic, possible real ip address. thank you. no. ip address change , can't guaranteed. use domain name. if need static ip address, check out proximo add-on.

git alias with bash conditional logic comparing strings - syntax issues -

i'm working on git alias , have run syntax issues @ current (incomplete) state: [alias] gup2 = !git checkout $1 && before=$(git stash list) && git stash save gup-temporary-stash && git fetch && git rebase -p origin/$1 && if [ "$before" != "$(git stash list)" ]; git stash pop; fi the problem seems start when double quotes introduced. i've tried many combinations of single quotes , double quotes escape sequences, can't seem find right combination. what syntactically correct way form above alias? after a year of using git alias, decided not worth trouble. in mind, benefit of using alias can put git foo instead of git-foo.sh and in fact if script named example here, can call as git foo.sh or if name script git-foo can call as git foo completely eliminating benefit of git alias in opinion. git syntax scripting crap compared writing external script, i have done .

jQuery's resizable() method is acting nuts -

i've been having lot of trouble taming resizable() method. had element had built, called "imgbox" contained img tag , img wanted make resizable. whole thing prepended "canvas" div, ended line: .prependto('#canvas')).find('img').resizable(image_resizeops); this worked fine firefox, chrome, , ie safari height resizable() method assigned ui_wrapper around img height of container canvas, i.e, height of #canvascontainer. if tried prepending #canvascontainer height assigned ui_wrapper height of container of canvascontainer, #wrapper. somehow parameters prepend part of chain getting mixed latter part of chain! decided couldn't trust values resizable() assigned ui_wrapper or img after call manually set ui_wrapper , img width , height wanted. i'm wondering if resizable() has reputation misbehaving , if there guidelines out there. thanks

c# - Enumerate SqlDataReader Columns -

given following code snip: using (var reader = cmd.executereader()) { while(reader.read()) { var count = reader.fieldcount; // first column must name subsequent columns treated data var data = new list<double>(); (var = 1; < count; i++) { data.add(convert.todouble(reader[i].tostring())); } barchartseries.add(new columnbarchart.columnchartseries((string)reader[0], data)); columnchart.xaxis.categories.add((string)reader[0]); } } is there easy way eliminate loop? perhaps using linq? reader[0] string reader[0+?] double i want pull doubles list if possible. speed of concern suppose. then you're focusing on entirely wrong problem. out of things you're doing here, looping least inefficient part. more worrying you're converting double string , double . @ least fix code to: for (var = 1; < count;

c# - How to detect AutomationElement name change -

i using ui automation in c# program. have managed acquire element using automation id. however, exposes no patterns. using ui spy, can see text want under identification->name. however, when try register event detect change of text, nothing happens; event handler not called. ui spy doesn't show controlpatterns. mean must manually poll changes element's "name" or there way this? you'll have implement kind of event yourself, manually polling name property, or rather continuously calling findfirst old name, until returns no result.

python - How do I format a string within a function call? -

i want pass string variable string, in turn gets passwd onto function. had written code below: not working env = 'd' myfunction("checking processes a%s/b%s",'')% (env,env) error myfunction("checking processes a%s/b%s",'')% (env,env) typeerror: unsupported operand type(s) %: 'nonetype' , 'tuple' since code failed re-wrote below: working env = 'd' str = "checking processes a%s/b%s" %(env,env) myfunction(str,'') can suggest alternative shorter approaches ?ideally in lines of first attemp mean less loc. myfunction("checking processes a%s/b%s" % (env,env),'')

ruby on rails - Why is counter_cache column not increasing when << an association? -

given have following models: class location < active::record has_many :storables, foreign_key: :bin_id # ... end class storable < active::record belongs_to :bin, class_name: :location, counter_cache: true # ... end when run following spec, counter_cache doesn't increment correctly. method #1 , #2 work expected, not #3 . gives? describe "location storables" specify "adding storable increments counter cache" l = location.create l.storables_count.should == 0 #=> passes # method 1 s = storable.create(bin: l) l.reload l.storables_count.should == 1 #=> passes # method 2 l.storables.create l.reload l.storables_count.should == 2 #=> passes # method 3 l.storables << storable.create l.reload l.storables_count.should == 3 #=> fails, got 2 not 3 end end i'm confused counter_cache half working . can't spot configuration problem either. using rails 3.2.12

SQL Server 2008 linked server connection string setup -

i'm trying setup linked server instance of sql server installed on same windows server. in sql server management console have both instances added , i'm trying insert 1 database another. setup linked server using query below , i'm getting following failure message when test connection of the linked server. can me solve problem? use master go -- use named parameters: exec sp_addlinkedserver @server = 'server name', --actual server name @srvproduct = '', @provider = 'msdasql', @provstr = 'driver={sql server};server=database name;uid=test_user;pwd=test_pwd;' go error message cannot initialize data source object of ole db provider "msdasql" linked server "server name". ole db provider "msdasql" linked server "server name" returned message "[microsoft] [odbc sql server driver][dbnetlib]connectionopen (connect()).". ole db provider "msdasql" linked

IBM JAX-RPC web service : Though the response is Boolean we are getting a number in the output -

we have generated webservice based on wsdl using jax-rpc, in wsdl have response below <element name="notificationsresponse"> <complextype> <sequence> <element name="ack" type="xsd:boolean"/> </sequence> </complextype> </element> </schema> even generated code has method return type boolean public boolean notificationxxxxx(java.lang.string xxxx, java.lang.string xxxx, java.lang.string xxxx) but when invoke service soap ui, seeing response 'ack' 0, 1 not true / false. working fine jax-ws. any on highly appreciated according xml schema datatypes specification , boolean may have 4 values: booleanrep ::= 'true' | 'false' | '1' | '0'

bash - Monitor directory and change ownership of files upon creation -

i have tried method not work... inotifywait -mr -e create /opt/freeswitch/storage/ 2>&-| sed 's/ create //g' | while read file; chown apache.apache $file done from command line inotifywait -mr -e create /opt/freeswitch/storage/ 2>&-| sed 's/ create //g' gives exact output need full path of file, moment try output sed file or pipe it's output else stops working. can point me in right direction here? by default, sed buffers output when it's writing pipe. use -u option unbuffer it. inotifywait -mr -e create /opt/freeswitch/storage/ 2>&-| sed -u 's/ create //g' | while read file; chown apache.apache $file done

python - scrapy avoid crawler logging out -

i using scrapy library facilitate crawling website. the website uses authentication , can login page using scrapy. the page has url log out user , destroy session. how ensure scrapy avoids logout page when crawling? if using link extractors , don't want follow particular "logout" link, can set deny property: rules = [rule(sgmllinkextractor(deny=[r'logout/']), follow=true),] another option check response.url inside spider's parse method: def parse(self, response): if 'logout' in response.url: return # extract items hope helps.

amazon s3 - SVG Fonts with Rails Asset Pipeline and S3 Hosting -

i have rails project, hosted on heroku, , moved hosting assets s3. has gone smooth except custom fonts (svg fonts icomoon). they're not working, , when view web source, can see s3 bucket doesn't show up: @font-face{font-family:'starter-icons';src:url(https://.s3.amazonaws.com/fonts/starter-icons.eot);src:url(https://.s3.amazonaws.com/fonts/starter-icons.eot?#iefix) etc. however, other assets (images, stylesheets, etc) hosted s3 include proper bucket name. my font-face declarations in .less file (this doesn't need .less.erb file it?) @font-face { font-family: 'starter-icons'; src:font-url("starter-icons.eot"); src:font-url("starter-icons.eot?#iefix") format('embedded-opentype'), font-url("starter-icons.woff") format('woff'), font-url("starter-icons.ttf") format('truetype'), font-url("starter-icons.svg#starter-icons") format('svg'); font-weight: normal;

ios - How to get customize table cell from UIPopoverController -

the popover uitableviewcontroller, , table-cell's class customize class 'myoptionstableviewcell', has 4 uilables. when table load , called 'cellforrowatindexpath' method, want bind customize data, code not work. the code is: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"optioncell"; myoptionstableviewcell *cell =(myoptionstableviewcell*) [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell =[[myoptionstableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } prodoption *currentoption = [self.options objectatindex:indexpath.row]; //this 4 line code not work cell.lbltitle.text = currentoption.title; cell.lblpoints.text = currentoption.dig; cell.lblstatus.text = currentoption.status; cell.lbldescription.text = currentoption.desc

android - Best Practice to locally cache web service responses -

i populating infinite list view data webservice. data obtained response post requests made app. best practice cache such data network call not made every time user scrolls , down list? thank you! check out lrucache class, or better yet check out android volley framework developed google.

git - How to have a separate branch for tagged commits only? -

i tasked organize repository in way aside other branches there dedicated branch, store commits of released version. below simplified scheme of achieve: | trunk | | releases | |----------+-----------+----------| | commit 1 | | | | commit 2 | v0.1 ---> | tag 1 | | commit 3 | | | | commit 4 | | | | commit 5 | | | | commit 6 | v0.2 ---> | tag 2 | | commit 7 | | | | commit 8 | | | | commit 9 | | | this little bit advanced me now, i'd appreciate guidance on how that! i'm not sure on how able have second tag in "releases" branch w/o having import intermediate commits. possible @ all? also, if have better scheme achieving same goal (the goal being have dedicated branch releases only), please not hesitate advise! that wouldn't make sense, since tagged commits represents state of branch, composed of

.htaccess - Document root of my Mediatemple Gridserver to access public folder of Laravel 4 -

i trying set gridserver point public folder when go domain: example.com should point example.com/public. i have tried few things in .htaccess, have failed. have idea of how this? thank you. also, if know how run php artisan commands terminal, pointing them @ ftp @ project on gridserver. rename public folder html (as (gs) convention) , update path public folder in bootstrap/paths.php .

c# - Discard functionality of "/" in CultureInfo -

what property in cultureinfo.invariantculture helps discard functionality of "/" . i having problem because have customculture. , when use format datetime replaces "/" culture specific separator. so want know property if change in customculture functionality of "/" discarded. let me clear problem, i want export data file datetime specified user. i creating customculture follows cultureinfo customculture = new cultureinfo(cultureinfo.currentculture.name); i taking date format user , injecting customculture object as customculture.datetimeformat.shortdatepattern = myclass.dateformatfromuser; now when want convert string pattern. doing follows, string.format(customculture, "{0:g}", datetimevalue); now problem string.format replaces "/" present in shortdatepattern customculture.datetimeformat.dateseparator for example if user gives format dd/mm/yyyy and current culture faeroese ie., {fo-fo} for

php - how to count number of rows in html table generated dynamically? -

can please me count number of rows in html table dynamically generated using javascript?if can in let me know have trying insert data of dynamically generated rows database my js code : <script language="javascript"> var count=1; function addrow(tableid) { /*if(empty(index)) { var index = 0; } else { index++; alert(index); document.getelementbyid('cat').name = 'cat'+index; }*/ var table = document.getelementbyid(tableid); var rowcount = table.rows.length; var count = rowcount-1; alert(rowcount); var selectofcat = $("#"+tableid).find('tr:eq(0)').find('.cat').get(0); var row = table.insertrow(rowcount); var colcount = table.rows[0].cells.length; for(var i=0; i<colcount; i++) { var newcell = row.insertcell(i); newcell.innerhtml = table.rows[0

javascript - google drive api - copyfile working only with permission for accessing all files in drive (but jst need to copy) -

we can copy using page https://developers.google.com/drive/v2/reference/files/copy . but working when ask them permission https://www.googleapis.com/auth/drive means can modify file drive bad. need copy public file authenticated user's account. how can that? when taking permission https://www.googleapis.com/auth/drive.file , saying, user has not granted write access file file 1 copying.. i using application of type 'web' api console. according documentation , files.copy() requires @ least 1 of following 3 permissions: https://www.googleapis.com/auth/drive : "view , manage files , documents in google drive" 1 want avoid https://www.googleapis.com/auth/drive.file : "view , manage google drive files have opened or created app." means can freely create file open files app created. you can copy file created , cannot copy other files if public. https://www.googleapis.com/auth/drive.appdata : "view , manage own configuration da

Using Maven license plugin in multimodule project -

i working on multi-module projects modules share common licence (apache 2.0). want add headers source files , want configure in parent's pom.xml (packaging type pom) i created folder license in base dir , added file licenses.properties state apache_2_0=apache_2_0 . also, added subfolder apache_2_0 have 2 files header.txt , license.txt . added following plugin parent pom: <build> <plugins> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>license-maven-plugin</artifactid> <version>1.5</version> <configuration> <licensename>apache_2_0</licensename> <licenseresolver>${project.basedir}/license</licenseresolver> </configuration> <executions> <execution> <goals> <goal>update-file-hea

parsing - Why does "new Date().toString()" work given Javascript operator precedence? -

mdn states there 2 operators in javscript share highest precedence: the left-associative member operator: foo.bar the right-associative new operator: new foo() i explicitly separate two: (new date()).tostring() see both of them combined: new date().tostring() according this answer , reason second way works it's second operator's associativity matters when both operators have equal precedence. in case, member operator left associative means new date() evaluated first. however, if that's case, why new date.tostring() fail? after all, new date just syntactic sugar new date() . above argument says should work, doesn't. what missing? the syntax is memberexpression : primaryexpression functionexpression memberexpression [ expression ] memberexpression . identifiername new memberexpression arguments new foo().bar cannot parsed new (foo().bar) because foo().bar not memberexpression. moreover, new foo() cannot parsed n

windows phone 8 - How are C# and C++/CX objects related? -

i have wp c++ runtime component consumed c# wp application. in c++ runtime component, have public interface class icallback { public: virtual void dosomething(); }; public ref class windowsphoneruntimecomponent sealed { public: windowsphoneruntimecomponent(); void setcallback(icallback ^callback); imap<platform::string^, platform::object^>^ createdictionary(); }; in c# application, have callbackimp , implements icallback . do callbackimp cb = new callbackimp (); windowsphoneruntimecomponent com = new windowsphoneruntimecomponent(); // set callback com.setcallback(cb); // dictionary idictionary<string, object> dict = com.createdictionary(); i have following questions cb , com managed objects. c++/cx objects? i've heard cb , com point c++/cx objects (which reside on native heap), right ? if cb , com released .net gc, how c++/cx objects released then? when pass cb runtime component, cb b

scala - What's the difference between `trait ValueHolder { type ValueType }` and `trait ValueHolder[T] {}` -

this question has answer here: abstract types versus type parameters 1 answer when read source code of liftweb, found trait declarations: trait valueholder { type valuetype def get: valuetype } trait pvalueholder[t] extends valueholder { type valuetype = t } my question is, following 2 trait declarations: trait valueholder { type valuetype } trait valueholder[t] { } i think equal each other, there difference between them? 1 can or offer 1 can't? the first 1 called abstract type member , second 1 close analog java generics, there not complete same. 2 different ways achieve same goal. martin odersky explained his interview, 1 reason having both abstract type members , generic type parameters orthogonality: there have been 2 notions of abstraction: parameterization , abstract members. in java have both, depends on abstracting

java - How to extract attribute values with XPath -

i have following xml document , want transform station element attribute values in java object: <locvalres flag="final" id="dummy"> <station name="sampieri" distance="2901857" duration="3482348" externalid="008302686#80" externalstationnr="008302686" type="wgs84" x="14744601" y="36731901"/> <station name="pozzallo" distance="2903750" duration="3484620" externalid="008302642#80" externalstationnr="008302642" type="wgs84" x="14847168" y="36733609"/> <station name="scicli" distance="2907477" duration="3489092" externalid="008302695#80" externalstationnr="008302695" type="wgs84" x="14699187" y="36790088"/> <station name="ispica" distance="2909739" duration="3491

Duplicate Notifications are being received in appfabric caching -

i configuring notifications appfabric cache. first add operation sending 1 notification. when replace (update) same cache item new value or delete item, receiving multiple number of notifications single operation. suspect has nothing type of operation perform. because have seen multiple add notifications too. there configuration messing up?? have written delegate in codeback file. hitting delegate continually time single operation. my configuration : <datacacheclient requesttimeout="150000" channelopentimeout="19000" maxconnectionstoserver="10"> <localcache isenabled="true" sync="timeoutbased" ttlvalue="300" objectcount="10000"/> <clientnotification pollinterval="30" maxqueuelength="10000" /> <hosts> <host name="192.10.14.20" cacheport="22233"/> </hosts> <securityproperties mode="none" protect

amazon ec2 - mongodb.conf bind_ip = 127.0.0.1 does not work but 0.0.0.0 works -

i not understand bind_ip in mongodb is. make remote connection desktop ec2 machine having bind_ip = 0.0.0.0 , not make work bind_ip = 127.0.0.1 . please explain me bind_ip , why works 0.0.0.0 , not 127.0.0.1 . for reference mongodb docs : bind_ip default: interfaces. set option configure mongod or mongos process bind , listen connections applications on address. may attach mongod or mongos instances interface; however, if attach process publicly accessible interface, implement proper authentication or firewall restrictions protect integrity of database. you may concatenate list of comma separated values bind mongod multiple ip addresses. you can't access machine when bind 127.0.0.1 on ec2. that's not bug, it's reasoned network interface bindings. 127.0.0.1 bind loopback interface (so able access locally), while 0.0.0.0 bind network interfaces available. that's why can access mongodb on ec2 when bind 0.0.0.0 (as i

c# - How to assign multiple threads to similar controls on windows form? -

how assign different threads more 1 control on windows form using c# .net 3.5? want 3 textboxes each connected thread running same function, count number of odd numbers in array. ideally usage like: //count number of odd numbers in array , when //done set textbox value void assigntasktotexbox( textbox textbox, int[] array); the code can run in thread assigned textbox have signature like: int getcount(int[] array); //usage: asssigntasktotexbox( textbox1, array1); asssigntasktotexbox( textbox2, array2); after each call of assigntasktotextbox task assigned asynchronously textbox. go of count , set text when done i.e. program go of other things , when tasks complete textboxes updated in background. new threading , pointers how proceed. it doesn't make sense assign thread control. of ui runs on single thread, called "main" or "ui" thread. and there's not point in running same code multiple times, if it's happening "simultaneou

c++ - Override nVidia's 3D settings override -

my application depends on antialising - mode being set default application-controlled . seems, since nvidia made (way to) easy override application attempt use, disturbing percentage of users (roughly 1-2%) use non-default settings , either (1) request support tickets, or (2) allege application poorly coded, when things go wrong. is there way detect or override whether user using nvidia's control panel override settings? causing customer support nightmare me... in general: having user-settings in driver , letting apps overide settings time render user-settings pretty pointless, wouldn't it? any app instantly decide best on behalf of user. that said: https://developer.nvidia.com/nvapi looking @ nvapidriversettings.h can spot lot of aa related things: aa_behavior_flags_id = 0x10ecdb82, aa_mode_method_id = 0x10d773d2, from have read in docs might generate app-profile on fly. might have problem overridin

perl - How to traverse all the files in a directory and subdirectories as well -

i working on script read file , based on file content have rename file. problem facing : 1st not able read file in subdirectory. 2nd trying rename file error occuring. here code: folder structur : logs / / / \ b c d / \ \ e file file where a,b,c,d,e dir file,file txt file #!/usr/bin/perl use strict; use warnings; use file::copy::recursive; use cwd; $file; (@files,@file_01); ($dir_01,$dir_02); $new_file="kernel.txt"; chdir('c:\\abd\\efg'); $dir_01 = getcwd; opendir(dir_01, $dir_01); @files=readdir(dir_01); close(dir_01); foreach $dir_02 (@files) { opendir (dir_02, "$dir_01"."/"."$dir_02") ; @file_01=readdir(dir_02); close(dir_02); foreach $file (@file_01) { open(fh,"<","$dir_01/$dir_02/$file") or die "can not open file $!\n"; while(my

iphone - Producing Custom Vibration in iOS -

i have app makes custom vibrations. i.e. changes intensity , duration. came know can done using 1 of private functions of audiotoolbox framework. function details: void audioservicesplaysystemsoundwithvibration(systemsoundid insystemsoundid,id arg,nsdictionary* vibratepattern) the method on how use function described in post : are there apis custom vibrations in ios? my question : as said in 1 of comments in above post, possible use function , app approved apple. or there certainty rejected apple?

javascript - How to check validation of IP Address in jquery -

i need add ip validation in project .is there function in jquery or in jquery mobile.so validate in put field? thanks refer document ip validation here has used jqueryvalidator.js , explained example. $.validator.addmethod('ip4checker', function(value) { var ip = "^(?:(?:25[0-5]2[0-4][0-9][01]?[0-9][0-9]?)\.){3}" + "(?:25[0-5]2[0-4][0-9][01]?[0-9][0-9]?)$"; return value.match(ip); }, 'invalid ip address'); $('#form1').validate({ rules: { ip: { required: true, ip4checker: true } } });

objective c - When do variables' values get defined? -

nsstring *string1 = @"string one"; nsstring *string2 = @"string two"; nsstring *string3 = [string1 stringbyappendingstring:string2 ]; for current version of xcode, above snippet each string1, string2, string3 defined @ compile time or run time? the code allocate space variables (if compiler deems necessary so) generated @ compile-time , executed @ runtime. 2 constant strings created @ compile-time well, similar constant c strings. message send not executed until runtime.

jquery - Sort jQGrid's select options by label not by value -

what experiencing jqgrid sorts select options value, , can't find way make sort label. the options loaded locally: var cities = { "15604":"akashi", "7538":"lompolo", "13488":"akersloot", "15516":"akita", "17301":"akizuki", "15848":"akola", "11415":"akron", "15224":"akron", "7458":"akrotiri", "10783":"aksaray", "15127":"aksu", "9563":"aktobe" }; but options appears this: <option role="option" value="7458">akrotiri</option> <option role="option" value="7538">lompolo</option> <option role="option" value="9563">aktobe</option> <option role="option" value="10783">aksaray&l

ruby on rails - custom inputs of simple form for images -

in form, let user upload file (image), looks this: = simple_form_for [:admin, @team] |f| = f.input :logo, as: :photo = image_tag @team.logo.url if @team.logo? = f.hidden_field :logo_cache and want create custom input photos, should include hidden field , displaying image. class photoinput < simpleform::inputs::base def input @builder.file_field(attribute_name, input_html_options).html_safe end end this basics, have problems input, because doesnt seem know methods image_tag or link_to...

Print a list of space-separated elements in Python 3 -

i have list l of elements, natural numbers. want print them in 1 line single space separator. don't want space after last element of list (or before first). in python 2, can done following code. implementation of print statement (mysteriously, must confess) avoids print space before newline. l = [1, 2, 3, 4, 5] x in l: print x, print however, in python 3 seems (supposedly) equivalent code using print function produces space after last number: l = [1, 2, 3, 4, 5] x in l: print(x, end=" ") print() of course there easy answers question. know can use string concatenation: l = [1, 2, 3, 4, 5] print(" ".join(str(x) x in l)) this quite solution, compared python 2 code find counter-intuitive , slower. also, know can choose whether print space or not myself, like: l = [1, 2, 3, 4, 5] i, x in enumerate(l): print(" " if i>0 else "", x, sep="", end="") print() but again worse had in pyth

iphone - iOS change number lines of label -

i tried code number of lines 1 label. i did : [lblname setfont:[uifont fontwithname:@"opensans-condensedlight" size:19]]; [lblname settext:[objet titre]]; [lblname setlinebreakmode:nslinebreakbywordwrapping]; lblname.numberoflines = 2; but it's not running, i've 1 line... someone me plz ? for set dynamic frame uilabel use following method -(void) setdynamicheightoflabel:(uilabel *) mylabel withlblwidth:(cgfloat) width andfontsize:(int) fontsize { cgsize mylabelsize = cgsizemake(width, flt_max); cgsize expecteingmylabelsize = [mylabel.text sizewithfont:mylabel.font constrainedtosize:mylabelsize linebreakmode:mylabel.linebreakmode]; cgrect lblframe = mylabel.frame; lblframe.size.height = expecteingmylabelsize.height; mylabel.frame = lblframe; int addressline = mylabel.frame.size.height/fontsize; mylabel.numberoflines = addressline; } in above method need pass label object, width of label , font size of text, such lik

jquery - Get values of table row? -

here code: html <table class="table table-striped table-bordered table-condensed"> <thead> <tr style='background-color: white'> <th> <i class="fa fa-male"></i> name</th> <th><i class="fa fa-bars"></i> particular</th> <th><i class="fa fa-envelope-o"></i>unit</th> <th><i class="fa fa-map-marker"></i>quantity</th> <th><i class="fa fa-phone"></i>from</th> <th><i class="fa fa-phone"></i>date</th> <th><i class="fa fa-phone"></i>take actions</th> </tr> </thead> <tbody> <tr> <td>sam</td> <td>dsfjhfskdj</td> <td>jhg</td> <td>9</td> <td>

maven - 2 apps in the same JRE, are getting different result from java.awt.Desktop.isDesktopSupported() -

i have maven project uses java.awt.desktop . i'm using google authentication, need way open browser dialog google login, , user confirmation. i'm exporting library in .jar file, intend include in lots of liferay portlets, in web-inf/lib if test standalone project, running liferay's tomcat jre, works fine, , desktop.isdesktopsupported() returns true . when portlet, deployed on same tomcat , calls same library function, desktop.isdesktopsupported() returns false . since in both cases, i'm using same java environment , why getting different behavior ? also, if know alternative way open browser window instead of using desktop.browse, nice share. still not sure why it's not working in servlet/portletcontext. a workaround opening os browser java.lang.runtime, demonstated here

How to copy one table of mongodb to another table of mongodb at different location location? -

i have 2 mongodb database, 1 in in local host and 2nd in in other computer here myinfo <= database name customerdetails <= table name let's see 1st : `localhost / myinfo / customerdetails` i want copy collection of customerdetails db @ : let's 2nd : `192.168.1.10/ myinfo / customerdetails how can that? ` note: not want copy whole db , 1 table! use method target host, in shell: > use myinfo > db.clonedatabase("origin hostname/ or ip")

javascript - Leaflet popup clears content on first close -

for app i'm using leaflet , went pretty far it, i'm sure understood "leaflet way" of getting things done. as have 1 static layout of markers created simple mustache template, inserts variable data , gives me html: can.view("leads/popup", viewoptions) this works expected , results in html string, gets displayed. but when close , reopen popup results in empty popup content. var popup = l.popup({maxwidth: 1000, closeonclick: true}, marker); popup.setcontent(can.view("leads/popup", viewoptions)); var marker = l.marker(l.latlng(lng, lat), {icon: l.divicon({ classname: 'lead-icon lead_'+lead._id.$oid, iconsize: [size, size], html: '<span class="marker-label">' + label + '</span>' }) }); marker.bindpopup(popup); self.displaymarker(marker); what thought extending l.popup class , set _content fixed html code. i'm unsure if isn't little bit overpowered. thanks lot help,

C++ mktime and DST -

i processing stored dates , times. store them in file in gmt in string format (i.e. ddmmyyyyhhmmss ). when client queries, convert string struct tm , convert seconds using mktime . check invalid datetime. again convert seconds string format. these processing fine, no issues @ all. but have 1 weird issue: stored date , time in gmt locale gmt. because of day light saving, locale time changed gmt+1. now, if query stored date , time 1 hour less because mktime function uses locale, i.e. gmt+1, convert struct tm seconds ( tm_isdst set -1 mktime detects daylight savings etc. automatically). any ideas how solve issue? use _mkgmtime / timegm complement mktime . time_t mkgmtime(struct tm* tm) { #if defined(_win32) return _mkgmtime(tm); #elif defined(linux) return timegm(tm); #endif }