Posts

Showing posts from January, 2014

asp.net - Set Visible property with server tag <%= %> in Framework 3.5 -

i have been working in .net framework 4 project using server tags <%=whatever %> set visibility of runat="server" controls, following: <div id="myid" runat="server" visible="<%=myvisiblepropertyoncodebehind %>" > content </div> this works on framework 4, trying use on framework 3.5 project doesn't seems work. framework 4 feature? there coolest (and .aspx side) alternative setting visibility codebehind? i'm using ugly: miid.visible = myvisiblepropertyoncodebehind thanks in advance, tom [edited] solution: thanks comments makes me understand problem , solution! it fault in more 1 thing. in vs2010 project using <%# instead of <%= also, didn’t notice in vs2010 project using pages inherited not “page”, custompage class, making binding automatically, without me noticing it, , makes me think framework 4.0 feature. as told here, if have following markup: <div id="myid

python - How to order django-mptt tree by DateTimeField? -

this model using: class comment(mpttmodel): comment = models.charfield(max_length=1023) resource = models.foreignkey('resource') created_at = models.datetimefield(auto_now_add=true) parent = treeforeignkey('self', null=true, blank=true, related_name='children') author = models.foreignkey(user) class mpttmeta: order_insertion_by = ['created_at'] however, when try add comment admin site get: valueerror @ /admin/app/comment/add/ cannot use none query value am doing wrong model? feel django-mptt trying datetimefield while still "none", before has been set @ db level. no, you're not doing wrong. bug in django-mptt. basically datetime fields auto_add_now=true don't value until after django-mptt tries figure out insert model in tree. i've created issue on django-mptt fix this: https://github.com/django-mptt/django-mptt/issues/175 in meantime, can work around proactively setting

addressbook - What user info shall I ask for on iOS app signup? -

i want users see friends contact book have joined app. whatsapp asks phone number on signup way? because need unique primary id, apps/web services use emailid phone numbers used. whatsapp uses phone numbers such. if can tell more trying can give better answer.

html - How to Fix Rounded Borders on Text that is Wrapped -

Image
i have table in application (generated dynamically) has 3 columns. cells text long, wraps around fine except rounded borders bad. currently, table wrapped in div id set item-list , css follows: #item-list { text-align: center; } #item-list table { margin: auto auto; } #item-list td { padding: 10px; text-align: center; } #item-list { font-size: 0.8em; color: #fff; margin: 10px; border-radius: 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px; padding: 4px; padding-left: 10px; padding-right: 10px; background-color: #1a546a; text-decoration: none; font-weight: bold; } #item-list a:hover { background-color: #8f2525; } my question is, there way using css make wrapped text still rounded on edges? [disclaimer] expertise in php. css skill know enough accomplish need do, not beyond amateurish. add display: block; #item-list a . #item-list { font-size: 0.8em; color: #fff; display: block; margin: 10px; border-radius: 8px; -moz-border-radius

java - SSL Handshaking Using Self-Signed Certs and SSLEngine (JSSE) -

i have been tasked implement custom/standalone java webserver can process ssl , non-ssl messages on same port. i have implemented nio server , working quite non-ssl requests. having heck of time ssl piece , use guidance. here's have done far. in order distinguish between ssl , non-ssl messages, check first byte of inbound request see if ssl/tls message. example: byte = read(buf); if (totalbytesread==1 && (a>19 && a<25)){ parsetls(buf); } in parsetls() method instantiate sslengine this: java.security.keystore ks = java.security.keystore.getinstance("jks"); java.security.keystore ts = java.security.keystore.getinstance("jks"); ks.load(new java.io.fileinputstream(keystorefile), passphrase); ts.load(new java.io.fileinputstream(truststorefile), passphrase); keymanagerfactory kmf = keymanagerfactory.getinstance("sunx509"); kmf.init(ks, passphrase); trustmanagerfactory tmf = trustma

Hadoop or Postgresql for effective processing -

i student trying use of machine learning algorithms large data set.we have 140 million records in our training set(currently in postgresql tables) , there 5 tables 6 million records exhibit primary key - foreign key relationships. we have 2 machines following configurations 1) 6gb ram 2nd generation i5 processor 2) 8gb ram 2nd generation i7 processor we right planning split them logical groupings before running our statistical analysis since turnaround time quite high. 1) should split them separate tables in postgresql , them use matlab or r programming or 2) should use hadoop hbase porting database 3) should combine , use them(i.e) decompose them based on logical groups , dump in postgresql database , setup hadoop +hbase analysis , use based on necessary algorithms. thanks it hard believe in such small cluster hadoop effective. if can parralelize task without - more effective sure consideration take account - iteration time in learning process. if iteration

github - ERROR: Permission to user1/repo.git denied to user2 -

someone know trying clone github repo , make changes directly it. it's public repo. he's cloned read-write access link , can pull repo. problem when tries push gets error error: permission user1/repo.git denied user2 where he's user2 , i'm user1. i've allowed other people use different repos before , i've never had problem. missing allow him access or did github change? i've seen on page github: this error occurs when attach key deploy key on repo1. can push , pull repo without issue, won’t have access other repo key. solve this, remove key repo1’s deploy keys , attach on account page instead. key have access repos account has access to. we haven't messed deploy keys, can't find other solution on web. i stupid , didn't add them collaborators. to this, follow these instructions: go repository > admin > collaborators you see text box add button. in order add collaborator start typing in tex

c# - How can I remove a reference from an entity object to another entity with the Entity Framework? -

i have entity locations primary key consisting of longitude , latitude double . from entity object want remove reference entity object in locations every time try set reference null optimisticconcurrencyexception . using (mymodelcontainer context = new mymodelcontainer()) { note note = context.notes.single(n => n.nid == noteupdate.nid); note.locationreference.load(); note.locationreference = null; context.savechanges(); } but not working. same note.locationreference.value = null . how can set reference null or default value? i believe purpose update db location column of note row set null here, detaching not going work. think replacing note.locationreference = null; note.location = null; in code above should work

imaplib - how do I convert text containing \r\n to represent carriage return and line feed in python -

i have written code in python using imapclient , poplib collect emails online account. received emails saved plain text file. when email using pop3 saved in text file carriage returns , line spacings in correct place. believe because pop3 emails saved line line automatically implement carriage returns each new line. imap on other hand not friendly. imap text contains \r\n occasional \t, when view text file in vi, notepad, wordpad , word, none of them implement carriage return, linefeed or tabs. from i've read reason because programs see \r\n text , don't know it. so question is, how convert imap text \r\n seen in windows , linux using python. thanks. try email_content.decode('string_escape') . example: >>> s = r'a\tb\nc' >>> print s.decode('string_escape') b c

javascript - TinyMCE not updating textbox -

i'm trying tinymce work , i'm struggling. here complete page: <!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> <head> <title>tinymce test</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinymce.init({ mode: "textareas" }); </script> </head> <body> <form method="post" action="show.php"> <p> <textarea name="content" cols="50" rows="15">this content editable tinymce.</textarea>

PHP 5.4 Interpreter for Eclipse PDT -

so php 5.4 released, when interpreter come out eclipse pdt support new syntax of php 5.4? all find on web far old "bug report": https://bugs.eclipse.org/bugs/show_bug.cgi?id=362672 . seems can't sign there post question on status. is working on it? there dev version publicly available? how long typically take them release new interpreter after new php version comes out? the php 5.4 syntax has been announced quite time ago. how come still not supported in eclipse (i not complaining, want know hanging)? yep there interpreter php 5.4 although seems buggy, static function click throughs dont work on mac eclipse install , on windows eclipse install no function click throughs work. give try in eclipse go preferences -> php -> phpinterpreter select php version php 5.4 if not available need update pdt help -> check updates i commented on bug report mentioned other day before realised there interpreter can sign , comment self go to... http

osx - github for mac sync failed -

i using github mac app http://desktop.github.com/ , every time try sync branch a network error occurred. not sync server. working fine earlier , machine other machine able run sync fine same app. not sure how ge debugging this. found out why got email github, crazy. a security vulnerability discovered made possible attacker add new ssh keys arbitrary github user accounts. have provided attacker clone/pull access repositories read permissions, , clone/pull/push access repositories write permissions. of 5:53 pm utc on sunday, march 4th vulnerability no longer exists. while no known malicious activity has been reported, taking additional precautions forcing audit of existing ssh keys. required action since have 1 or more ssh keys associated github account must visit https://github.com/settings/ssh/audit approve each valid ssh key. until have approved ssh keys, unable clone/pull/push repositories on ssh. status we take security , recognize never should have ha

objective c - Is it possible to access an iCloud document data across multiple apps (same id) or is it sandboxed? -

had simple question. icloud, if create 2 apps, able access same icloud document storage folder, if have luxury of having same app id prefix etc, or sandboxed , restricted? yes. developer, can configure icloud entitlements across different apps such may utilize 'shared' sandbox. by setting container identifier string single key, different apps can use same icloud data. see documentation: https://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/icloud/icloud.html#/

Why does my Android app allocate substantially different amounts of memory on different OS versions? -

i have simple android application consisting of single activity text boxes , little bit of processing code. when install on 2.3 device , open first time, allocates ~2.7mb of memory (according heap update tab in eclipse ddms). on 3.1 device, allocates ~6.1mb. on 4.0 device, allocates ~13.8mb. i've made no code changes between 3, , these measures taken upon initial install/opening of application (so hasn't had time leaking). uses no images, , not have hardware acceleration enabled. does know why footprints might differ much? assume has differences in os versions, i'm wondering if knows differences might be. i have read change in bitmap allocation 3.0 onward causing apparent increases in allocated memory, application doesn't use images. consists of few edittext fields , textviews. pre-honeycomb bitmaps allocated in native heap. since android 3.0 (including ics), pixel data bitmaps allocated in dalvik heap. difference between 2.3 , 3.1 might because

osgi - Failed to install spring-dm 1.2.1 in Karaf 2.2.5 -

i newbie karaf. tried install spring-dm 1.2.1 in karaf 2.2.5. failed following error message: error executing command: manifest not present in first entry of zip mvn:org.springframework.osgi/spring-osgi-annotation/1.2.1 does know problem be? thanks in advance. works fine me. suspect you've picked corrupt artifact, have in local repo, try opening zip application. are installing directly in karaf shell or via feature? if it's via feature , artifact isn't corrupt try installing karaf shell - if works may bug in karaf features or error in features file

Android ICS MTP can sync only *.mpg format video files? -

tried sync video files galaxy nexus via mtp, *mpg format video can synced , other formats video files sync got error (c00d123e). error code indicated device doesn't support video format. is known issue? thanks xin

c# 4.0 - Error in insert the value into database in asp.net ,c# of registration form -

code show follow: nection cnn = new sqlconnection("data source=user-pc\\khemchand;integrated security=true"); protected void page_load(object sender, eventargs e) { cnn.open(); } protected void button1_click(object sender, eventargs e) { sqlcommand cmd = new sqlcommand("insert tbl_ragistration values(@f_name,@l_name,@email_id,@pass_word,@[date of brth],@add_ress,@gender)", cnn); cmd.parameters.addwithvalue("@f_name", texfname.text); cmd.parameters.addwithvalue("@l_name", texlname.text); cmd.parameters.addwithvalue("@email_id", texemail.text); cmd.parameters.addwithvalue("@pass_word", texpwd.text); cmd.parameters.addwithvalue("@[date o birth]", texdbt.text); cmd.parameters.addwithvalue("@add_ress", texadd.text); cmd.parameters.addwithvalue("@gender", dropdownlist1.text); cmd.executenonquery(); cnn.close(); } change cmd.parameters.addwi

python - Using Linux kernel add_key and keyctl syscalls with group keyring -

i'm building application needs use linux group keyring share sensitive data between processes different owners. whenever try access group keyring (e.g."@g" or "-6") using either keyctl command or underlying api, error. i'm guessing have set kind of state let know of groups keyring for, documentation on kernel feature sparse. know how make work groups? the method call (currently using python's ctypes, directly call shared library functions, works fine other keyrings): >>> import ctypes >>> keyutils = ctypes.cdll('libkeyutils.so.1') >>> key_id = 'foo' >>> key_value = 'bar' >>> keyutils.add_key('user', key_id, key_value, len(key_value), -5) 268186515 >>> keyutils.add_key('user', key_id, key_value, len(key_value), -6) -1 based on looking @ man page keyctl seem group based keyrings aren't implemented in kernel yet. (*) group specific keyring:

wpf - Does visual studio check Xaml static resource on compile time? -

i use static resource converter in xaml, e.g. visibility="{binding showadditionalview, converter={staticresource booleantovisibilityconverter}}" and declare <booleantovisibilityconverter x:key="booleantovisibilityconverter"/> this works of time, if say, mistype booleantovisibilityconverter, or forgot add declaring line, program still compiles , nasty exception in runtime that's hard debug. is there way tell vs check such problems? have vs 2010 express straight msdn: debugging silverlight xaml : static resource references evaluated @ xaml load time. order in individual xaml components loaded important. 1 common failure of resource lookup making forward reference: staticresource reference key made prior item definition of item x:key value. at design time, visual studio can show highlighting , place warnings in error list cases staticresource reference not resolve existing key in resource dictionary. visual studio accounts applic

ruby - Find the position of a marker in a string relative to another -

i've got 2 strings, 1 sanitized , 1 marker . marker fixed string , chosen arbitrary, inserted string other code. sanitized = "100 biz other stuff" marked = " 100 biz marker other stuff" now match surroundings of marker sanitized string. # _ empty, string expanded visual sanitized = "100 ___biz_______ other stuff" marked = " 100 biz marker other stuff" and index of marker in sanitized string. sanitized = "100 ___biz_marker other stuff" ^ marked = " 100 biz marker other stuff" which 7 . i'm not clear on you're asking either. sounds need know how find location of string inside of string. virtual = "100 biz marker other stuff" virtual.index 'marker' # => 8

Perl IPC::Cmd doesn't run application if PATH env variable is initialized -

i'm writing test script library i've written, , part of test i'm clearing $env{path} variable make sure things i've put in path don't cause successes. library appends needed paths path variable. for background, i'm running strawberry perl v5.12.0 on 32-bit windows xp. ipc::cmd @ version 0.76 , ipc::open3 @ version 1.05. the error i'm seeing if clear path variable , set it, ipc::cmd using ipc::open3 not find application. if don't this, it'll run fine. here's example script illustrates error: use strict; use warnings; use ipc::cmd qw(run); $env{path} = ''; $env{path} = 'c:\\strawberry\\perl\\bin'; ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) = run(command => 'perl -v', verbose => 0); if ($success) { print 'success: '; print join("\n", @{$stdout_buf}); } else { print 'failure: '; print join("\n", @{$full_buf}); } exit 0; if run

javascript click event queue -

i made simple gallery when click on image thumb nail, show larger image fade in fade out effect jquery. $('#thumnail').click(function(){ $('#piccontainer').fadeout(function(){ $('#piccontainer').html('<div> <img src="' + imgsource + '" /> </div>'); }); $('#piccontainer').fadein(); }); but if click on 5 different thumbnails quickly, large image fade in fade out 5 images. how can disable lets clicked on 5 thumbnails very quickly , should fadein last 5th one. basicaly how can stop queue of click events? thanks help. take @ - http://api.jquery.com/queue/

drawing - Draw to YCbCr color to screen -

i'm attempting draw screen bunch of colors have in ycbcr coordinates. however, drawing libraries can find (windows or cross-platform) want specify colors in rgb , don't want convert , lose precision. can tell me how this? since monitor rgb have convert colors somewhere. if yourself, or let third party library doesn't matter. believe sdl lets put ycbcr/yuv-values directly. colors converted rgb either software or graphics card on way monitor.

Multiple access to the same HTML file on a standard file server over a LAN -

i have requirement create html file contain .swf (flash) object reside on server on lan. multiple users, on lan, access file each of terminals @ same time. will there issue if many users trying access file @ same time? understand network isnt best , server regular file server. this depends on computer , network traffic. file servers able handle multiple requests if incredibly high number of requests come in computational power on server might not able handle it. however, let roll , if there issues, consider upgrading specs on server computer.

c# - how can i get twitter email with dotnetopenauth? -

possible duplicate: is there way user's email id after verifying twitter identity using oauth? i've pretty got openid working using dotnetopenauth library. email. public actionresult oauth() { var twitter = new webconsumer(twitterconsumer.servicedescription, twittertokenmanager); authorizedtokenresponse accesstokenresponse = twitter.processuserauthorization(); if (accesstokenresponse != null) { string accesstoken = accesstokenresponse.accesstoken; string username = accesstokenresponse.extradata["screen_name"]; // email goes here ?? createauthcookie(username, accesstoken); } else { return redirecttoaction("logon"); } return redirecttoaction("index", "home"); sorry it's not possible users email address twitter. take @ following is there way user's email id after verifying

c# - LINQ Count() until, is this more efficient? -

say want check whether there @ least n elements in collection. is better doing? count() >= n using: public static bool atleast<t>(this ienumerable<t> enumerable, int max) { int count = 0; return enumerable.any(item => ++count >= max); } or even public static bool equals<t>(this ienumerable<t> enumerable, int amount) { return enumerable.take(amount).count() == amount; } how benchmark this? /// <summary> /// returns whether enumerable has @ least provided amount of elements. /// </summary> public static bool hasatleast<t>(this ienumerable<t> enumerable, int amount) { return enumerable.take(amount).count() == amount; } /// <summary> /// returns whether enumerable has @ provided amount of elements. /// </summary> public static bool hasatmost<t>(this ienumerable<t> enumerable, int amount) {

Persistent problems deploying a Grails application on a Tomcat server -

i have deploy grails application on tomcat server. packaged war file, renamed war file root.war, , replaced root directory in tomcat installation root.war application run off server root directory. whenever access page should in web application, 404 not found, error mentioning "the requested resource () not found". parenthesis empty no matter subdirectory specify. after spending several hours on that, looked deploying project using maven. got stuck mavenizing project when grails couldn't find proper maven files. i later found supposedly possible deploy grails applications on tomcat "grails tomcat deploy". got persistent error authentication , streaming data. couldn't find on disabling streaming. i've tried every solution appears exist online. is application deploying? when @ tomcat manager application listed there? if not check tomcat_home/conf/server.xml , @ host entry. make sure @ least autodeploy="true" , if have un

java - Using a native Maven artifact (nar) in a webapp -

i have native shared library built , packaged using maven-nar plugin. works great , builds on linux/macosx/windows. i've defined jni library, built using maven-nar, wraps shared library. both of these produced nar artifacts , require maven-nar plugin in order used. the problem arises when declaring dependency on these nars non-nar-packaged project. maven-nar plugin never seems invoked. when change project's packaging nar maven-nar plugin kick in. makes seem nar packaging needs infectious in order work, if there's nar dependency upstream projects need nar-packaged. correct or missing something? can native shared library , jni artifacts produced using maven-nar plugin used in web applications, i.e. wars? if can used , deployed in war, how done? otherwise, option manually place native libraries in location in java.library.path on app server? here's snippet of pom project depends on nar jni artifact: <?xml version="1.0" encoding="utf-8"?

java - Finding XML Tags by Namespace URI -

i seem having problems doing basic parsing of xml document in java. trying retrieve list of tags based on specific namespace. unfortunately, list of tags returned empty. can enlighten me doing wrong? thanks. example java documentbuilder bob = documentbuilderfactory.newinstance().newdocumentbuilder(); document template = bob.parse( new inputsource( new filereader( xmlfile ) ) ); nodelist tags = template.getelementsbytagnamens( "http://www.example.com/schema/v1_0_0", "*" ); example xhtml <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ex="http://www.example.com/schema/v1_0_0"> <head><title>test</title></head> <body> <h1>test</h1> <p>hello, world!

tmux status bar configuration -

Image
how status bar customized? noticed in this youtube video (at 3:05 - image below), status bar looks different default 1 see after installing tmux on mac os x. in particular, how middle of status bar shows current program , left side shows name of current session. in comparison, setup shows name of of sessions , doesn't show current application (for focused pane). if show me sample configuration or show me can find customization rules, great! thanks! update : in case curious, able customize status bar similar 1 seen in video (minor tweaks) , can find config file on github if you'd see example. the man page has detailed descriptions of of various options (the status bar highly configurable). best bet read through man tmux , pay particular attention options begin status- . so, example, status-bg red set background colour of bar. the 3 components of bar, left , right sections , window-list in middle, can configured suit preferences. status-left , statu

Copy resources from c# pjct to a windows directory -

how can copy file in project resources temp directory using c# "i have install.bat file in project resources folder want copy c:\ directory " file.copy(@"resources\install.bat", @"c:\directory\install.bat"); note : should have resources folder in debug\bin. (if there isn't one, click on property of install.bat file in visual studio solution exprorer , set 'copy output directory' 'copy always'

Active Data/Script on Facebook Wall Post? -

i want post on facebook wall dont want post simple text/image or url want post active code, kind of data/information server , display in on user wall, user of application data based on current statstics. so, how can post script wether ajax, jquery ,js or other run whenever page loaded , display desired info, fb app provide user via server. please help you cannot post scripts on facebook wall or without api.

javascript - How to reorder the list box items in html via drag&drop -

i have change order of items in listbox via drag , drop.how can make possible? regards, mahesh you can use jquery's sortable http://jqueryui.com/demos/sortable/ .post use php update sql db retain order jquery ui saving sortable list

ruby on rails - What is the best way to handle 4 way relation between 2 models? -

i have 2 models: company , user this situation: company can follow company user can follow company user can follow user what best way define relationships , how join model like? also, there best practises when addressing such situations? update sorry, have not mentioned earlier. aware of various relationship types available. question 'which best fit' ? thanks polymorphic associations, can put relations 1 table this: create_table :follows |t| t.references :followable, :polymorphic => true t.references :followed_by, :polymorphic => true end then models are: class user < activerecord::base has_many :following_objects, :class_name => 'follow', :as => :followed_by has_many :followed_objects, :class_name => 'follow', :as => :followable end class company < activerecord::base has_many :following_objects, :class_name => 'follow', :as => :followed_by has_many :follow

Oracle SQL Developer environment encoding -

i have oracle sql developer (3.1.07) , i'm trying work database uses we8iso8859p1 encoding: select * nls_database_parameters parameter = 'nls_characterset'; i have problems saving packages contains unicode symbols. when open saved package unicode symbols turned '¿' . what settings have change make sql developer keep symbols? i've tried set environment encoding 'iso-8859-15' , other encodings, won't help. if database encodes text non-unicode single-byte encoding (e.g. iso-8859), symbol not present on character table seen invalid , replaced placeholder. can't go that, information lost. that can worked around when storing data, source code, cannot control how oracle encode strings. if database configured use such encoding scheme you're not supposed write code violates rules.

cocoa touch - iOS 4 SMS composer not working correctly -

Image
i displaying mfmessagecomposeviewcontroller in app, , fine, on ios 5, users testing complaining ios 4, seems view controller appears result of code below displaying empty sms compose , in addition there no top navigation items such cancel button or title "new message". i don't have ios 4 device hand (very bad know), , cannot jump issue , debug it. can see if i'm doing wrong ? i've attached problem screenshot sent, it's strange. bool cantext = [mfmessagecomposeviewcontroller cansendtext]; if(cantext){ mfmessagecomposeviewcontroller * smsviewcontroller = [[mfmessagecomposeviewcontroller alloc] init]; if(smsviewcontroller){ smsviewcontroller.body = @"test message"; smsviewcontroller.messagecomposedelegate = self; [self presentmodalviewcontroller:smsviewcontroller animated:yes]; [smsviewcontroller release]; }else{ uialertview *alert = [[uialertview alloc] initwithtitle:@"sms"

python - How to easily print ascii-art text? -

Image
i have program dumps lot of output, , i want of output stand out . 1 way render important text ascii art , this web service example: # # ## ##### # # # # # #### # # # # # # ## # # ## # # # # # # # # # # # # # # # # # # ## # ###### ##### # # # # # # # # ### ## ## # # # # # ## # # ## # # # # # # # # # # # # # #### other solutions colored or bold output . how sort of stuff in python? pyfiglet - pure python implementation of http://www.figlet.org pip install pyfiglet termcolor - helper functions ansi color formatting pip install termcolor colorama - multiplatform support (windows) pip install colorama import sys colorama import init init(strip=not sys.stdout.isatty()) # strip colors if stdout redirected termcolor import cprint pyfiglet import figlet_format cprint(figlet_format('missile!', font='starwars'), 'yellow', 'on_red'

java - libgdx: SpriteBatch not displayed with PerspectiveCamera -

Image
while have basic knowledge of opengl i'm starting libgdx. my question is: why, having exact same code switching orthographiccamera perspectivecamera has effect of no longer displaying of spritebatches ? here's code use: the create() method: public void create() { texturemesh = new texture(gdx.files.internal("data/texmeshtest.png")); texturespritebatch = new texture(gdx.files.internal("data/texspritebatchtest.png")); squaremesh = new mesh(true, 4, 4, new vertexattribute(usage.position, 3, "a_position") ,new vertexattribute(usage.texturecoordinates, 2, "a_texcoords") ); squaremesh.setvertices(new float[] { squarexinitial, squareyinitial, squarezinitial, 0,1, //lower left squarexinitial+squaresize, squareyinitial, squarezinitial, 1,1, //lower right squarexinitial, squareyinitial+squaresize, squarezinitial, 0,0, //upper left

c# - Does order of <location> in web.config matters? -

i have set formauthentication website. i want allow annonymous access login page , resources (js, css, images). i have added web.config. order there matter? <configuration> <configsections> <section name="hibernate-configuration" type="nhibernate.cfg.configurationsectionhandler, nhibernate" /> <section name="log4net" type="log4net.config.log4netconfigurationsectionhandler, log4net" /> </configsections> <appsettings> <add key="webpages:version" value="1.0.0.0" /> <add key="clientvalidationenabled" value="true" /> <add key="unobtrusivejavascriptenabled" value="true" /> </appsettings> <location path="~/authentication.htm"> <system.web> <authorization> <deny users="*" /> </authorization>

open explorer with javascript/html -

is possible open actual explorer window rather have in directory on browser? windows key + e window... preferably using html or javascript? i've seen been done in firefox add-on called new tab king, couldn't figure out how split code. most, if not all, javascript blocked interacting outside of browser. maybe able accomplish flash based object. use of copy , paste techniques using javascript. its huge security hole open javascript windows environment. ust open hidden file browser , start coping files, or load on system.

UML aggregation vs association -

here am, question aggregation , association. wanted learn basics of uml, started reading "uml distilled" martin fowler. read both chapters classes, , there 1 thing can't grasp think, , aggregation vs association. in book there quote: in pre-uml days, people rather vague on aggregation , association. whether vague or not, inconsistent else. result, many modelers think aggregation important, although different reasons. uml included aggregation (figure 5.3) hardly semantics. jim rumbaugh says, "think of modeling placebo" [rumbaugh, uml reference]. as understand quote , topics read on stack overflow doesn't matter 1 of 2 relations use, mean bassicly same, or there situation usage of aggregation instead of association justified and/or not change 1 without changing "meaning" of class diagram? i asking this, beacuse book 2003, , things change during few years. rumbaugh's statement telling , uncle bob's advice. i&#

c - How to parse char str and create a new array of ints -

i want fill array int values extracted buffer. want like: char buffer[buff_max]; int numbers[num_max]; int = 0; fgets(buffer, buff_max, stdin); while(sscanf(buffer, "%d", &numbers[i]) == 1) { ++i; } but having kinds of problems using method. perhaps has \n in buffer? seems same value assigned every element , if type in greater around 130, garbage value stored. the user typing in like: 12 543 5 234 9 and want these values stored in numbers[] 5 different elements. there different amounts of numbers in buffer each time (depending on user types in). you can find out sscanf() got in parsing string using %n conversion specifier, thus: char buffer[buff_max]; int numbers[num_max]; int = 0; int offset = 0; int newlen; if (fgets(buffer, buff_max, stdin) != 0) { while (sscanf(buffer + offset, "%d%n", &numbers[i], &newlen) == 1 && < num_max) { ++i; offset += newlen; } } testing #inclu

visual studio - Change colour and size of a certain string in a textblock (Windows Phone 7) in VB.net -

hi have button (btnadd) adds content of textbox (txtname) textblock (lblname). want add date textblock when btnadd pressed want different font size , colour. far code looks like lblname.text = txtname.text " " + datetime.now i want datetime.now different size , colour. possible? edit: instead of label need display in listbox new code need on is: listbox1.items.add(txtname.text " " + datetime.now) what want assign inlines rather text : lblname.inlines.clear(); lblname.inlines.addrange(new inline[] { new run(txtname.text + " ") { foreground = new solidcolorbrush(color.black) }, new run(datetime.now.tostring()) { foreground = new solidcolorbrush(color.green) } }); you can (and should) bind run's directly xaml: <textblock> <textblock.inlines> <run text="{binding name}" foreground="black" /> <run text=" " foreground=&qu

css - Styling off after JQuery Append -

i have weird problem happens in browsers except firefox. show more button losses padding when ajax request , append data table... on first load (non-ajax) button displays in browsers. when click show more button sends request more data (rows) back, button losses it's bottom padding. if open chrome's or ie's development tool , click on or tag element button brings padding. it's dom needs refresh or trigger padding shown. <!-- html table --> <div class="cont"> <table id="table"> <tbody> <tr> <td>record data</td> </tr> </tbody> </table> <p><a id="showdata"href="#">show more</a></p> </div> <!-- css --> #table { position: relative; width: 800px; height: 470px; overflow-y: scroll; padding: 10px; } #showdata { di

javascript - jQueryPlugin: return this vs return this.each() -

yes, there many topics that, still didn't it: i prepared 2 jsfiddle: return this return this.each() what's difference? there many answers, examples show same output. some of these answers might wrong!? what "return this.each()" in jquery? "it allows 1 call plugin or event on bunch of elements , apply same function or event of them" --> work's " return this well!" "it allows chain multiple functions" --> same here "allows things like: $("myselector").foo().show();" --> still can well, when return 'this' i created jsfiddle shows - in opinion - doesn't matter if you're wrapping code return this.each(); : http://jsfiddle.net/7s3mw/1/ the chrome console show's same output! so what's difference? two things: your examples flawed in same thing each element. the real issue isn't return this versus return this.each , issue this versus th

Hard case with array which using hases inside (ruby) -

i have: a = [{:a=1,"b=2,:c=3},{:a=4,:b=5,:c=6},..] (including 2 items 3 keys) b = [{:d=7},{:d=8},...] (including 2 items 1 key) at final need have 2 items 4 keys: a = [{:a=1,:b=2,:c=3,:d=7},{:a=4,:b=5,:c=6,:d=8},..] please help, tried following: a.each |item| b.each |view| item.merge!(view) end end but @ final have in 2 items same dates item 1 in array b (d=7). first of definitions of , b not valid. need use either symbols or strings not valid key hash. should use => point key value. here how can achieve want do: a = [{:a=>1,:b=>2,:c=>3},{:a=>4,:b=>5,:c=>6}] b =[{:d=>7}, {:d=>8}] a.zip(b) |x,y| x.merge!(y) end zip performs operation on each matching pair of elements in , b - precisely want.

html - Background colour wont appear behind list items -

for reason list items not sitting within ul element disturbing flow of page, , doesn't right. have tried every position element under sun nothing works. wondered because i'm styling different div instead of ul element? please see example here the red border suppose hold list elements , if 1 list description becomes longer, red background should grow well. thanks try 1 ol, ul { overflow:auto; } see updated fiddle: http://jsfiddle.net/uc5cr/8/

Automatic updating and upgrade management for Windows Installer XML (WiX) -

i have been using installshield le in visual studio 2010, heavily limited , buggy. looked @ paid installshield versions, these have many limitations price tag. so decided switch wix. have had experience years ago. pretty easy build simple installer using sharpdevelop wix tools. now trying collect solutions , tools wix. basically, need following functionality (requested client): when launch installer, should check text file on server , see if newer version available. if it's case, installer should able download updated installer package , launch (are there downloader utilities in wix?) solving dependencies. major dependency of app .net 4 (which depends on windows installer 3). installer should offer user download , install them automatically logging installation process, collecting log file of dependencies' installation process. don't want user hunt various .log files in case .net4 or windowsinstaller3 installation fails. information should collected in 1 place

php - jQuery Unable to process cloned input fields -

i have code clone input field directly preceding clone 'button' renaming id , name of field goes (shown below): - $(".clone").live('click', function () { var doppleganger = $(this).prev(); // neater referencing. $(doppleganger).clone().insertafter(doppleganger); $(this).prev().attr("id", "input" + increment).attr("name", "input" + increment); increment++; return false; }); . form (#adv_magic) data loaded on fly jquery ajax event , submitted thusly: - $("#adv_magic").live('submit', function() { $("#editor_button, #date_select, #search").hide(); $(".loader").show(); $.ajax({ type: "post", url: "./scripts/aquire_template.php", data: $("#adv_magic").serialize(), success: function(html){ $("#right_container").empty(); $(".loader").fadeout(350); $("#right_container&quo

javascript proprietary date format and prototype -

i use proprietary date format looks this: var theuserdate = "3.11.2012.4.3"; // march 11th 2012 4:03am i created format because application uses lot of timezone changes , didn't want rely on browser's clock that. i have code everywhere: var datearray = theuserdate.split("."); var themonth = parseint($.trim(datearray[0]), 10); var theday = parseint($.trim(datearray[1]), 10); var theyear = parseint($.trim(datearray[2]), 10); how can rewrite emulated .getmonth() .getyear() functions built javascript. i'm thinking need modify prototype of strings first attempt @ doing this. i'd have functions like: var themonth = theuserdate.getmymonth(); var theday = theuserdate.getmyday(); var theyear = theuserdate.getmyyear(); var thedate = theuserdate.getmydate(); // convert format javascript date. how should this? thanks. use iso8601 date format yyyy-mm-dd thh:mm:ssz , there datetime standardisation libraries javascript, along utc metho

PHP - dynamically generated elements of an array()? -

1. array i have functon returns array of arrays: function show_array() { $myarray = array( array( 'foo' => 'bar', 'bar' => 'foo', 'aaa' => 'bbb'), array( 'foo' => 'bar2', 'bar' => 'foo', 'aaa' => 'bbb'), array( 'foo' => 'bar3', 'bar' => 'foo', 'aaa' => 'bbb'), array( 'foo' => 'bar4', 'bar' => 'foo', 'aaa' => 'bbb'), //i want add additional elements here using foreach ); return $myarray; } 2. elements add dynamically as stated in comment above want add additional elements $myarray based on foreach loop, here's simple function returns nothing, shows want ins

c++ - Where can I find the implementation of strncpy() function in GCC source code? -

i have download source code of gcc, using command: svn checkout svn://gcc.gnu.org/svn/gcc/trunk somelocaldir who can tell me can find implementation of standard library function strncpy()? thank you. gcc doesn't contain source of strncpy , gcc contains compiler code , not standard library code. you want source gnu libc (glibc): this link current trunk implementation of strncpy.c in glibc. http://sourceware.org/git/?p=glibc.git;a=blob;f=string/strncpy.c;h=f6ee27832da95d9da9aef8a6fcf73f53f997c796;hb=head

c++ - How to set decode pixel format in libavcodec? -

i decode video via libavcodec, using following code: //open input file if(avformat_open_input(&ctx, filename, null, null)!=0) return false; // couldn't open file if(avformat_find_stream_info(ctx, null)<0) return false; // couldn't find stream information videostream = -1; //find video stream for(i=0; i<ctx->nb_streams; i++) { if((ctx->streams[i])->codec->codec_type==avmedia_type_video) { videostream=i; break; } } if (videostream == -1) return false; // didn't find video stream video_codec_ctx=ctx->streams[videostream]->codec; //find decoder video_codec=avcodec_find_decoder(video_codec_ctx->codec_id); if(video_codec==null) return false; // codec not found if(avcodec_open(video_codec_ctx, video_codec)<0) return -1; // not open codec video_frame=avcodec_alloc_frame(); scaled_frame=avcodec_alloc_frame(); static struct swscontext *img_convert_ctx; if(img_convert_ctx == null) {