Posts

Showing posts from February, 2011

java - Cors filter for localhost and staging url -

we developing java-spring mvc project. in order client team able connect our services created corsfilter: @override protected void dofilterinternal(httpservletrequest request, httpservletresponse response, filterchain filterchain) throws servletexception, ioexception { // populating header required cors string responseurl = this.corsmap.get(request.getservername().tostring()); response.addheader( "access-control-allow-origin", (responseurl == null ? "https://default.ourcompany.com" : responseurl)); response.addheader( "access-control-allow-credentials", "true"); if (request.getheader("access-control-request-method") != null && "options".equals(request.getmethod())) { // cors "pre-flight" request response.addheader( "access-control-allow-methods", "get, post, put, delete"); response.addhead

c++ - Is it a good style to use this to refer private member in the class? -

i have class class t { private: int x; public: int getx() { return this->x; } } is use this->x rather x itself? no. perhaps use m_x instead. signify member variable. perhaps read use of const

ruby - Ubuntu 14.04 Rails missing file -

when installing rails, then, write: rails -v and output: /home/toshiba/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rails/cli (loaderror) /home/toshiba/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' /usr/bin/rails:7:in `<main>' everyone know how it? i used tutorial: http://installfest.railsbridge.org/ and yes, run: gem install rails i noticed when run install rails thing pop up building native extensions. take while... error: error installing rails: error: failed build gem native extension. /home/toshiba/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150816-3818-sm5w21.rb extconf.rb checking if c compiler accepts -ggdb3 -o0 -std=c99 -wall -werror... yes building nokogiri using packaged libraries. checking gzdopen() in -lz... no zlib missing; necessary building libxml2 *** extconf.rb failed *** not create makefil

tm - How to convert corpus to data.frame with meta data in R -

how can convert corpus data frame in r contains meta data? tried suggestion convert corpus data.frame in r , resulting data frame contains text lines docs in corpus. need document id , maybe line number of text line in 2 columns. so, how can extend command: dataframe <- data.frame(text=unlist(sapply(mycorpus, [ , "content")), stringsasfactors=false) data? i tried dataframe <- data.frame(id=sapply(corpus, meta(corpus, "id")), text=unlist(sapply(corpus, `[`, "content")), stringsasfactors=f) but didn't help; got error message "error in match.fun(fun) : 'meta(corpus, "id")' ist nicht funktion, zeichen oder symbol" the corpus extracted plain text files; here example: > str(corpus) [...] $ 1178531510 :list of 2 ..$ content: chr [1:67] " uberrasch sagt [...] gemacht echt schad verursacht" ... ..$ meta :list of 7 .. ..$ author : chr(0) .. ..$ datetimestamp: posixlt[1:1],

How to enable ZoomControls in android WebView when open specific URL? -

i'm using webview in android; want show zoomcontrols not pages specific webpage. should do? please help! assuming it's activity , receiving url intent string url = getintent().getstringextra("url"); webview webview = (webview) findviewbyid(r.id.webview_id_here) webview.getsettings().setbuiltinzoomcontrols(url.equals("your_url_here")); if want happen every time url changes, use custom webview client. webview.setwebviewclient(new customwebviewclient()); wherever webview initialized. customwebviewclient : private class customwebviewclient extends webviewclient { @override public boolean shouldoverrideurlloading(webview view, string url) { view.loadurl(url); view.getsettings().setbuiltinzoomcontrols(url.equals("your_url_here")); return false; } }

java - Alternative to a very long switch-case statement -

i find myself in situation, have write java programm processes various methods in form of strings, after being scanned in. handle method, has pretty long switch-case statement processes method in form of string. not sure whether approach or not, think looks , behaves dirty, wanted ask if there better solution problem. you can use map instead. final map<string, consumer<string>> actionmap = new hashmap<>(); consumer<string> defaultaction = ... // add actions map actionmap.put("case 1", s -> { dosomething() }); actionmap.put("case 2", s -> { dosomething() }); actionmap.put("case 3", s -> { dosomething() }); // instead of switch string action = ... actionmap.getofdefault(action, defaultaction).apply(action); with construct can lay out "switch" way wish, dynamically , across many methods/class/libraries.

javascript - jQuery: Simple plugin does not work -

i trying create plugin jquery. basic plugin ( plugin.js ) (function ( $ ) { $.fn.testplugin= function() { alert('test'); }( jquery )); this file ( ext.js ) calls function testplugin() inside plugin.js $(document).ready(function(){ $('p').testplugin(); }; in html page included files above plus jquery library ( jquery.js ) <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/plugin.js"></script> <script type="text/javascript" src="js/ext.js"></script> unfortunately plugin not work expected. well, simple example work (after removed ) mentioned tibzon , wojtek). $.fn.testplugin=function(){ alert('test'); }; $('p').testplugin() <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> i left out enclosing parenthetic

r - Extra/Inter-polate from a Model -

i managed regression done using lm(d$result~d$param1+d$param2) -> model now use model extrapolate (or interpolate) result new dataframe. how can ? i'm sure there function that. lookup ?predict.lm . if dat data frame new data, predict(model, newdata = dat)

startup - local pc batch that runs different variables based on Active Directory group / local group -

i have 1 device on network requires special configuration. since users need normal group policy settings on other devices want place batch in startup run configuration files on 1 machine based on group membership in active directory without modification of network group policy. i found bit of code , modified slightly, keep getting errors system error 5 access denied , password errors on local accounts pc code: @echo on set i=0 set group=network-oper set groupa=network-eng set groupb=network-tech set user=%username% /f %%f in ('"net user %user% /domain | findstr /i %group%"') set /a i-%i%+1 /f %%f in ('"net user %user% /domain | findstr /i %groupa%"') set /a i-%i%+2 /f %%f in ('"net user %user% /domain | findstr /i %groupb%"') set /a i-%i%+5 /f %%f in ('"net user %user% administrator"') set /a i-%i%+5 /f %%f in ('"net user %user% operator"') set /a i-%i%+1 rem- local pc account if %i% equ

Automation of PowerShell from Delphi? -

can powershell automated? i.e. there com interface powershell can imported delphi type-library interface automate it, , if so, relevant file name(s)? googling, etc, i've found numerous references automating things within powershell script, haven't been able find whether or not control powershell via com it ms word or whatever, , maybe receive events it. i'm wanting hand command within delphi app execute arbitrary cmdlet , status information while it's executing script (otherwise i'd make doing shellexecute on it). i'm not sure whether fact have been able find because powershell design not automatable or because haven't managed frame effective query filters out automation can done using powershell script host. this using xe8 on win7 64-bit or win10 upgrade, btw. elaborating on raelb's suggestion of http://delphidabbler.com/software/consoleapp : this worked me since powershell can run console app. if wanted run cmdlet "abc -par

image - How to obtain the red, green and blue values from gray value in java? -

i obtain gray value of pixel : val=img.getrgb(j, i) & 0xff; for processing purpose. now , after processing want red, green , blue values back. how do this? here sample code obtain r, g, b, alpha, , gray-scale values pixel @ coordinates (x, y) on bufferedimage . bufferedimage image; // assume have image int rgb = image.getrgb(x, y); // desired pixel int r = (rgb >> 16) & 0xff; int g = (rgb >> 8) & 0xff; int b = (rgb & 0xff); int alpha = (rgb >> 24) & 0xff; int gray = (r + g + b) / 3; // rgb not affected

sql - How can I create a query which yields the MAXDATE for each order? -

i have table called test 5 columns: clientname, clientid, productnum, ordernum, orderdeliverydate , , thousands of rows. stores orders. each order can composed of several product items, , each product item can have specific delivery date. i need table shows, each ordernum latest orderdeliverydate rest of test table columns (nb: null values must excluded because should not considered valid dates). i know need use join, can't find solution. select * `test` inner join (select ordernum, max(orderdeliverydate) maxdate test group ordernum) groupedorders on test.ordernum = groupedorders.ordernum , test.orderdeliverydate = groupedorders.maxdate group ordernum order groupedorders.maxdate asc can me solve this? thank help. you dont need join, unless want hook in table. need take max value. null values excluded groupings, if needed, add where orderdeliverydate not null select ordernum, max(orderdelive

javascript - Function ordering properly working? -

i new html/css/js , not understanding or missing completely. trying update variable of "citizencost" using math.pow(2, numcitizens) part working. part having trouble updating citizencost correct number , having html represent correct number. right updates it's behind ie: should x = 2^1 x = 2^2 on , forth however in html doesn't update accordingly behind 1 equation if real cost x = 2^2. text show x = 2^1. unless player clicks button again. function buycitizen(){ citizencost = math.pow(2, numcitizens); document.getelementbyid("citizencost").innerhtml = "cost of citizen " + citizencost; if(land >= citizencost){ land = land - citizencost; eps = eps + 2; numcitizens++; document.getelementbyid("numcitizens").innerhtml = numcitizens; } else document.getelementbyid("systemmessage").innerhtml = "you not have enough land resources provide more citizens right now

android - How to disable highlight colour in ListView? -

even though question got asked million times before, still can't find solution. here tried: <style name="listviewnohighlight" parent="@android:style/widget.listview"> <item name="android:listselector">@android:color/transparent</item> <item name="android:cachecolorhint">@android:color/transparent</item> <item name="android:choicemode">none</item> </style> then set in theme: <item name="android:listviewstyle">@style/listviewnohighlight</item> what works: while tapping, there no highlight. what doesn't work: after tapping still annoying orange highlight colour. this on android 5.1.0 nexus 6 genymotion emulator.

use of variable substitution for curl in bash -

i trying cas registry numbers nist webbook. have large file of chemical compounds search. find example: eval curl -o tmp --data-urlencode name=barium webbook.nist.gov/cgi/cbook.cgi works fine, reading file in while read line eval curl -o tmp --data-urlencode name=$line webbook.nist.gov/cgi/cbook.cgi done<inventory.txt fails--the html output says "the requested name (barium)" not found. ideas how proceed? thanks!

Python tkinter, Making two text widget's scrolling synchronize -

i trying make 2 text widget's scrolling synchronize. far i've achieved using scrollbar, when using scrollbar works fine. example, when have focus on 1 of text widgets , use mousewheel scroll, text widget focus scrolled, scrollbar updated other text remains same. same behaviour occurs when using page down or page keys , fas know every form of scrolling doesn't use scrollbar. this code, think init relevant part bind events, in case decided put code: ## hextext class # # class hextext (tkk.frame): __pos_text = "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f" __offset_text = "0x00000000" __line_length = len(__pos_text) def __init__(self, master): super(hextext, self).__init__(master) self.__create_widgets() self.__organize_widgets() def __scrolls(self, *args): self.__data.yview(*args) self.__offset.yview(*args) def __create_widgets(self): self.__scrollbar = tkk.scrollbar

javascript - Replicate Yelp star review widget -

im trying replicate star rating widget on yelp.com - 5 star rating widget hover on next star, previous stars change color match active star. need hover state displays description star rating. you can see widget in action here: https://www.yelp.com/writeareview/biz/c5siha89rv4gw05zd8vlqg?return_url=%2fwriteareview%2fsearch%3fwar_desc%3dtacos%26war_loc%3daustin%252c%2btx any hugely appreciated! made without js here's result: .stars{ display:inline-block; position:relative; } .stars span{ color:#999; display:inline-block; vertical-align:middle; float:right; cursor:pointer; } .stars>span:hover:after{ position:absolute; content: attr(title); left:100%; } .stars>span:nth-child(1):hover, .stars>span:nth-child(1):hover ~ span{color: red;} .stars>span:nth-child(2):hover, .stars>span:nth-child(2):hover ~ span{color: #f73;} .stars>span:nth-child(3):hover, .stars>span:nth-child(3):hover ~ span{color: #fa2;}

printing - How can I insert a text and then separate in <p> inside one variable in php? -

<?php $text = "lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text ever since 1500s, when unknown printer took galley of type , scrambled make type specimen book. has survived not 5 centuries, leap electronic typesetting, remaining unchanged. popularised in 1960s release of letraset sheets containing lorem ipsum passages, , more desktop publishing software aldus pagemaker including versions of lorem ipsum. long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here, content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions have evolved on years, accident, on purpose (injected humour , like)."; ?> what i

php - Large CSV file import to mysql, best practice -

looking insight on best approach large csv file imports mysql , managing dataset. ecommerce storefront "startup". product data read csv files download via curl (server server). each csv file represents different supplier/warehouse 100,000 products. in total there 1.2 million products spread on 90-100 suppliers. @ least 75% of row data (51 columns) redundant garbage , not needed. would better use mysqli load data local infile 'temp_products' table. then, make needed data adjustments per row, insert live 'products' table or use fgetcsv() , go row row? import handled cronjob using sites php.ini memory limit of 128m. apache v2.2.29 php v5.4.43 mysql v5.5.42-37.1-log memory_limit 128m i'm not looking "how to's". i'm looking "best approach" communities perspective , experience. i have direct experience of doing virtually identical describe -- lots of third party data sources in different formats needing go si

java - determine whether an int is power of 2 -

this question has answer here: how check if number power of 2 22 answers public class test{ public static void main(string[] args) { int a=536870912; system.out.print((math.log(a)/math.log(2))); } } 536870912 number power of two, result 29.000000000000004, explain this? thanks. if n power of 2 , binary representation start 1 , contain 0 s after it. so, can do: string binary = integer.tobinarystring(a); pattern poweroftwopattern = pattern.compile("10*"); system.out.println(poweroftwopattern.matcher(binary).matches()); anyway, if number not huge (i.e. fits int or long range), can follow suggestions here

swing - Mouse Listener not working with a JFrame in Java -

i'm trying make 2d game in java. need way detect mouse input player attacks , other stuff. have working key listener in game when tried adding mouse listener same way did key listener doesn't work. here mouse listener class (just test codes , these line never output in console when spamming mouse everywhere on display) package input; import java.awt.event.mouseadapter; import java.awt.event.mouseevent; public class mouseinput extends mouseadapter { public mouseinput() { } @override public void mouseclicked(mouseevent e) { system.out.println("hello"); } @override public void mousepressed(mouseevent e) { system.out.println("mouse pressed"); } @override public void mousereleased(mouseevent e) { system.out.println("mouse released"); } } also here display class create jframe , add canvas, key listener , mouse listener it. package display; import java.awt.canvas; import java.awt.color; import java.awt.dimension; import jav

string - Lua Carrying over a value through line wrap code -

previously, received in following link: lua line wrapping excluding characters short description of above looking way able run line wrap function while ignoring character count of characters. now i've come across issue. want able carry last colour code on new line. example: if line @rwere on 79 characters, want @breturn last known colour code @yon line break. running function have in mind result in: if line @rwere on 79 characters, want @breturn last known @bcolour code @yon line break. instead of if line @rwere on 79 characters, want @breturn last known colour code @yon line break. i wish because in many cases, mud default @w colour code, make colourizing text rather difficult. i've figured easiest way reverse match, i've written reverse_text function: function reverse_text(str) local text = {} word in str:gmatch("[^%s]+") table.insert(text, 1, word) end return table.concat(text, " ") end and turns: @gthis @yis

ios - Xcode custom font not showing in app -

Image
i have downloaded open sans font , added .tff files xcode project, , have checked checkbox in "target membership" pane each file. have added uiappfonts key , values in info.plist, , sure values typo-free. plus, .tff files added "copy bundle resources", , custom font showing in interface builder. , changed font of labels open sans in interface builder (no code). but when run app in simulator, labels , buttons showing system font in ultra small sizes, this: one thing note using xcode 7 beta 5, , app's base sdk ios 9. but why there problem? bug? thanks! check fonts inside proyect part of target. select fonts, verify property target membership app checked @ right in file inspector. that solved problem me:

css - What the difference between two double point and one in pseudo-selector -

i bit not understand difference between :before , ::before example. 1 should use? this differentiate between pseudo-classes (such :hover , :focus , :active ) , pseudo-elements (such ::before , ::after , ::first-line ). this introduced part of css3, world wide web consortium (the w3c), because pseudo-elements introduced prior syntactic differentiation browsers support both ::before , :before . according reference @ mdn (mozilla developer network): browser | lowest version | support of -------------------+--------------------+------------------ internet explorer | 8.0 | :pseudo-element +--------------------+------------------ | 9.0 | :pseudo-element | | ::pseudo-element -------------------+--------------------+------------------ firefox (gecko) | 1.0 (1.0) | :pseudo-element +--------------------+----------

java - GNU Crypto Encrypt returns blank string -

i'm using gnu crypto library encrypt simple strings. believe have followed documentation correctly, problem returns blank string (in case 5 characters) of spaces. i'm not sure whether miss coded or if encoding issue. hope not embarrassingly simple. import gnu.crypto.cipher.cipherfactory; import gnu.crypto.cipher.iblockcipher; import java.util.hashmap; import java.util.map; public class ftnsamain { public static void main(string[] args) throws exception { string data = "apple"; string key = "abcdefghijklmnop"; byte[] temp = encrypt(data.getbytes(), key.getbytes(), "aes"); system.out.println(new string(temp)); } public static byte[] encrypt(byte[] input, byte[] key, string algorithm) throws exception { byte[] output = new byte[input.length]; iblockcipher cipher = cipherfactory.getinstance(algorithm); map attributes = new hashmap(); attributes.put(iblockcipher.cipher_block_size, 16); attributes.put(ibloc

asp.net mvc 5 - The entity type IdentityRole is not part of the model for the current context -

i having trouble implementing aspnetidentity on mvc project getting error in var line (the entity type identityrole not part of model current context.): using system; using system.linq; using system.web.mvc; using ez.models; using microsoft.aspnet.identity.entityframework; namespace ez.controllers { public class rolecontroller : controller { applicationdbcontext context; public rolecontroller() { context = new applicationdbcontext(); } /// <summary> /// roles /// </summary> /// <returns></returns> public actionresult index() { var roles = context.roles.tolist(); return view(roles); } /// <summary> /// create new role /// </summary> /// <returns></returns> // get: /roles/create public actionresult create() { return view(); } // // post: /roles/create [httppost] public actionresult create(formcollection

c++ - Default constructing template parameters to zero if numeric? -

consider example: template<typename t> auto f(t u, t v = t()) { return v; } int main() { double a; float b; int c; long d; // possible numerical types here auto res1 = f(a); // res1 == 0.0? auto res2 = f(b); // res2 == 0.0? auto res3 = f(c); // res3 == 0? auto res4 = f(d); // res4 == 0? } is there guarantee standard t() default construct 0 numerical value whenever t numerical type? if not, how can make sure if t numerical, default argument 'v' v = 0 , , if t not numerical, v = t() ?

javascript - HTML DOM form select option dropdown -

i have javascript code country list. var country_list = [ {"country_code": "ad", "country_name": "andorra"}, {"country_code": "ae", "country_name": "united arab emirates"}, {"country_code": "af", "country_name": "afghanistan"}, {"country_code": "ag", "country_name": "antigua , barbuda"}, {"country_code": "ai", "country_name": "anguilla"}, {"country_code": "al", "country_name": "albania"}, {"country_code": "am", "country_name": "armenia"}, {"country_code": "an", "country_name": "netherlands antilles"}, {"country_code": "ao", "country_name": "angola"}, {"country_code": "aq", "country_

java - Web service stopped working after deploy -

it works locally on localhost. tried deploy on heroku , aws. doesn't work. static resources ok. response 404. @springbootapplication @restcontroller public class webservice implements webserviceinterface{ public static void main(string[] args) throws throwable { springapplication.run(webservice.class, args); } @override @requestmapping("/getcontent") public webcontent getcontent(@requestparam(value="id", defaultvalue="summary") string id) { try { return new webcontent(id); } catch (ioexception e) { e.printstacktrace(); } return null; } } locally used mvn spring-boot:run that's why had no problem web service for heroku , aws deployed war package. didn't work code. initializer helped solve problem: public class servletinitializer extends springbootservletinitializer { @override protected springapplicationbuilder configure(spri

Changing border of a radio Button in Cognos -

how change or make border disappear of radio buttons in cognos? trying give padding between text in radio button , border. tried adding table border still radio buttons border persists , looks ugly. you can use css: <style> .clscheckboxlist { border: none; } </style> put in html item on prompt page , radio buttons no longer have borders. if want target specific radio button prompt while not affecting others, wrap span , give span id. add html item following contents right before prompt: <span id="myradiobutton"> add second html item following contents right after prompt: </span> modify css use span's id isolate radio button group desired: <style> #myradiobutton .clscheckboxlist { border: none; } </style>

javascript - convert getJson to table and make sortable WITHOUT plugins -

ok, close here. sort function works on regular html table, when try load table using getjson not work, , hoping due lack of knowledge in realm of jquery , js. not headed down wrong path completely. here code. in advance! <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> </head> <body> <div id="cattable"></div> <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script type="text/javascript"> var tableidvalue = "indextable"; var tablelastsortedcolumn = -1; function sorttable() { var sortcolumn = parseint(arguments[0]); var type = arguments.length > 1 ? arguments[1] : 't'; var dateformat = arguments.length > 2

php - Unable to access wp-admin - Redirecting to upgrade -

i trying access localhost/mysite/wp-admin and getting message: your wordpress database up-to-date! and gives me option "continue". does know why not able access wp-admin? the usual cause of problem related cache. try rename or delete file wp-content/object-cache.php within wordpress installation.

python - PyInstaller isn't creating an .exe file -

i'm using 64-bit ubuntu 15.04, reference. the location of .py script (the 1 .exe of) is: /home/zix/pyinstaller-python3/btg_v0_5_0.py so open terminal, and: zix@meh:~$ cd pyinstaller-python3 zix@meh:~/pyinstaller-python3$ python3 pyinstaller.py --onefile --console btg_v0_5_0.py 934 info: pyinstaller version 3.0dev 936 info: wrote /home/zix/pyinstaller-python3/btg_v0_5_0/btg_v0_5_0.spec 945 info: upx not available. 953 info: extending pythonpath /home/zix/pyinstaller-python3 953 info: checking analysis 954 info: building analysis because out00-analysis.toc non existent 955 info: initializing module dependency graph... 960 info: looking graph hooks ... 969 info: analyzing base_library.zip ... 20757 info: running analysis out00-analysis.toc 20850 info: analyzing btg_v0_5_0.py 21387 info: looking import hooks ... 21400 info: processing hook hook-distutils.py 21417 info: processing hook hook-pydoc.py 21420 info: processing hook hook-encodings.py 21498 info: processing hoo

web site project - Any recommendations for setting up a campaign website? -

a friend of mine asked me setup website school board campaign. wants let people donate time , money through site. don't want go through effort setting up. i've integrated sites payment api's in past, , don't want this. anyone have recommendations quick, easy, , cheap campaign site? found bunch when searching, expensive while others not. advice? good: use facebook, , skip website entirely • use facebook “donate” button accept donations (supported first giving https://www.firstgiving.com/nposignup?&__hssc=&__hstc=&hsctatracking=63dc40dc-143f-4619-8011-3d1a09594d88|7a1ba0e5-61a3-4323-940b-cf2c3fe07175#0 ) • use facebook communicate supporters. people can post on facebook page want donate time. can notified, , keep track manually. • why choose this? far easiest , fastest setup, least customized. first giving looks little pricey (7.5% per donation), ease , timing may worth it. setup week, won’t have own domain or website. summarize: fast low

Format PHP and Javascript clock -

Image
i took code php javascript code, live clock , , put on website. code here: <?php function d1() { $time1 = time(); $date1 = date("h:i:sa",$time1); echo $date1; } ?> <script> var = new date(<?php echo time() * 1000 ?>); function startinterval(){ setinterval('updatetime();', 1000); } startinterval();//start right away function updatetime(){ var nowms = now.gettime(); nowms += 1000; now.settime(nowms); var clock = document.getelementbyid('qwe'); if(clock){ clock.innerhtml = now.totimestring();//adjust suit } } </script> <div id="qwe"></div> however, time format shows this: 21:41:44 gmt-0400 (eastern standard time) i want show 9:41:44 pm i assume line clock.innerhtml = now.totimestring();//adjust suit is 1 need change, can't find formats show simply. need write myself show in custom format?

asp.net - displaying date in MM/dd/yyyy format using label -

i m new asp.net,i m trying display out date output in terms of mm/dd/yyyy but came out mm/dd/yyyy 12:00:00 what can remove time? vb.net code this: dim date string = mydatareader("date").tostring() lbldate.text = date you need pass format .tostring method, this: .tostring("mm/dd/yyyy") it idea cast mydatareader("date") datetime object, this: dim datevalue datetime = ctype(mydatareader("date"), datetime) dim date string if datevalue not nothing date = datevalue.tostring("mm/dd/yyyy") end if note - if trycast fails, nothing value of datevalue , hence if datevalue not nothing then logic there.

How to fix `left hand operand has no effect` warning with variadic macro in C -

i'm using variadic macro simulate default argument. compile -wunused-value . thus, following warning: warning: left-hand operand of comma expression has no effect is there way somehow fix warning without having remove -wunused-value ? or have end using #pragma gcc diagnostic ignored "-wunused-value" ? #include <stdio.h> #define sum(a,...) sum( a, (5, ##__va_args__) ) int sum (int a, int b) { return + b; } int main() { printf("%d\n", sum( 3, 7 ) ); printf("%d\n", sum( 3 ) ); } the ## construct using gcc speciality , not portable. don't use it, there other ways. the following should expect #define sum2(a, b, ...) sum((a), (b)) #define sum1(...) sum2(__va_args__) #define sum(...) sum1(__va_args__, 5, 0) such games macro default arguments frowned upon many, because may make code more difficult read. moment i'd suggest don't use such constructs in programs. should perhaps learn more of basics before go su

equation - How to Graph x^2 + (y - (x^2)^(1/3))^2 = 1 on a TI-83+ -

i trying graph equation, seems on ti-83, none of graphing modes can support this. how go this? ps: wasn't sure whether-or-not put on math.stackexchange, or put here. if should go under math.stackexchange, please let me know. if you're trying graph equation, use desmos or wolfram|alpha . these sort of general-purpose tools more powerful graphing calculators, , can graph can think of, including implicit equations. if want graph on ti-83+ specifically, you'll need easy math: x² + (y-x^(2/3))² = 1 (y - x^(2/3))² = 1 - x² y - x^(2/3) = ±√(1 - x²) y = x^(2/3) ± √(1 - x²) now have y in terms of x. ti-83+ series doesn't have ± sign, though, you'll need graph 2 equations list. type in in y= mode: x^(2/3)+{1,-1}√(1-x²)

xcode - NSVisualEffectView with rounded corners -

Image
how display nsvisualeffectview with rounded corners in os x? my code add nsvisualeffectview: let visualeffectview = nsvisualeffectview(frame: nsmakerect(0, 0, 300, 300)) visualeffectview.material = nsvisualeffectmaterial.dark visualeffectview.blendingmode = nsvisualeffectblendingmode.behindwindow self.addsubview(visualeffectview) you can enable layer backed views nsvisualeffectview setting wantslayer true , set cornerradius of backing layer: let visualeffectview = nsvisualeffectview(frame: nsmakerect(0, 0, 300, 300)) visualeffectview.material = nsvisualeffectmaterial.dark visualeffectview.blendingmode = nsvisualeffectblendingmode.behindwindow visualeffectview.wantslayer = true visualeffectview.layer?.cornerradius = 15.0 self.view.addsubview(visualeffectview) this results in effect view nice rounded corners:

java - Extending BaseActivity for a class which already extends from third party library -

i have mainactivity inherited third party library as: public class mainactivity extends parallaxviewpagerbaseactivity { } this works fine, added baseactivity() class move common functionality current classes have. don't have idea how extend mainactivity baseactivity extending third party library. ps: first android project, hence not sure if query lame. java doesn't support multiple inheritance. can't extend more 1 base classes. instead make function in activity want extend , create object class. using object , function make process need.

Crashlytics - how can I delete builds/versions? -

i want delete 2 of builds/versions/archives crashlytics dashboard - uploaded wrong version number , it's creating havoc in testing process. i prefer , totally remove them crashlytics alex fabric here. if want archive version of app, head to: https://fabric.io/settings/apps then select app, click on versions tab, , disable versions no longer need.

c++ - Debugging dump file Call Stack has not much info -

our customer reported "microsoft visual c++ runtime library: runtime error!" received dump file (.dmp) them. debugged using visual studio 2013 call stack has 5 lines: [external code] myprogram.exe!afxinternalpumpmessage() line 153 myprogram.exe!afxwinmain(hinstance__ * hinstance, hinstance__ * hprevinstance, char * lpcmdline, int ncmdshow) line 47 myprogram.exe!__tmaincrtstartup() line 263 [external code] all lines trace mfc code, , nothing our source code. what "[external code]" referring there? am doing wrong? thank you! actually, found out can expand [external code] , becomes this: user32.dll!_ntusergetmessage@16() user32.dll!_getmessagea@16() myprogram.exe!afxinternalpumpmessage() line 153 myprogram.exe!afxwinmain(hinstance__ * hinstance, hinstance__ * hprevinstance, char * lpcmdline, int ncmdshow) line 47 myprogram.exe!__tmaincrtstartup() line 263 kernel32.dll!@basethreadinitthunk@12() ntdll.dll!___rtluserthreadstart@8() ntdll.dll!__rt