Posts

Showing posts from June, 2011

When to create new apps in django -

i've tried reading few things before asking, when should new apps created in django? for instance, have website domain scanner have registration/login/etc? should functionalities login , registration (2) separate apps? what best practices in order determine if new app should created in django? excuse newbieness, tried searching , reading this before asking but couldn't concrete explanation of best practices this. here login , registration make account app. upto you, how want fragment whole site. use intuition.

php - cURL call to web service not working -

i trying make simple call .net restful web service @ https://salesgenie.com/brandingservice/details?url=att.salesgenie.com test page making curl call @ https://test-cms.salesgenie.com/wp-content/themes/salesgenie/branding-proxy.php web service can called in browser timing out when called via curl. here code branding-proxy.php page: if (!function_exists('curl_init')){ die('sorry curl not installed!'); } $url = 'https://salesgenie.com/brandingservice/details?url=att.salesgenie.com'; $handle = curl_init(); curl_setopt($handle, curlopt_url, $url); curl_setopt($handle, curlopt_returntransfer, true); curl_setopt($handle, curlopt_ssl_verifyhost, 2); curl_setopt($handle, curlopt_ssl_verifypeer, false); curl_setopt($handle, curlopt_sslversion,3); $response = curl_exec($handle); $code = curl_getinfo($handle, curlinfo_http_code); curl_close($handle); setcookie('cmscookie', $code . ' ' . $response, 0, '/', 'salesgenie.com'

facebook - Not being able to authenticate using in Android App -

i have created button in ui on clicking should call function(fblogin()), opens session (if closed) , authorizes user. public void fblogin(view button) { log.e(getclass().getname(), "0"); settings.addloggingbehavior(loggingbehavior.include_access_tokens); session session = session.getactivesession(); if (session == null) { log.e(getclass().getname(), "1"); if (savedinstancestate != null) { log.e(getclass().getname(), "2"); session = session.restoresession(this, null, statuscallback, savedinstancestate); } if (session == null) { log.e(getclass().getname(), "3"); session = new session(this); } log.e(getclass().getname(), "4"); session.setactivesession(session); if (session.getstate().equals(sessionstate.created_token_loaded)) { log.e(getclass().getname(), "5");

c - The value of EOF different for different specifiers? -

this question has answer here: printf of size_t variable lld, ld , d type identifiers 3 answers im using codeblocks. below program in c: /*to find value of eof ( end of file ) number */ #include<stdio.h> int main() { printf("the eof value is: %d %5ld",eof, eof); /*when eof specified in %d specifier giving value -1, if given %ld number 4294967295 printed on console?*/ return 0; } as said in comments of program: when eof specified in %d specifier giving value -1, if given %ld number 4294967295 printed on console? i'm using 64 bit linux os on hp. [ if matters compiler assigning memory ints, floats , longs ] it's defined (-1) , it's implicitly int . correctly shown -1 when printed using %d . however, passing int printf() when long expected invokes undefined behavior. what probab

c# - Is the win32 api obsolete? -

is win32 api still being developed , worth learning today? can can .net framework can native api? the windows api still being developed. example, see windows 8.1 new apis , features developers , windows 8 , 8.1 api index . obsolete? not likely. there need people understand how windows works @ lower level. has write device drivers , low-level system utilities. knowledge useless. learning how windows api works absolutely necessary if you're writing low-level utilities, , handy when writing native applications in c++ or delphi. less when you're writing .net applications, of .net runtime libraries depends heavily on windows api. understanding how works "under hood" quite useful. in addition, there things .net libraries don't expose. example, c# program working on needed access waitable timer developer using in c++ application. .net libraries don't provide wrapper particular kernel object had write own, involved delving windows api. in .net dev

regex - Jquery Replace Second and Third Word -

im trying replace second , third word in html element. so far can replace second word using this: jquery("article#box-1 h2.join-box-head").each(function(i, v){ newhtml = jquery(this).html() .replace(/\s(.*?)\s/,'<span class="error">$1 </span>') jquery(this).html(newhtml); }); but im having hard time selecting third word too html <article id="box-1"> <h2 class="join-box-head">join family</h2> </article> any ideas? is regex needed? jquery("article#box-1 h2.join-box-head").each(function(i, v){ var newhtml = jquery(this).html().split(" "); (var = 1; < 3; i++) newhtml[i] = '<span class="error">' + newhtml[i] + '</span>'; jquery(this).html(newhtml.join(" ")); }); or both in 1 span jquery("article#box-1 h2.join-box-head").each(function(i, v){ var newhtml = jquery

expressionengine - Matrix fields & flexslider -

i'm using flexslider create carousel of pictures , use channel entries populate list items (images) flexslider uses create carousel. now want add link pdf on al list items have in matrix field in channel , works first list item. anybody knows why is? <div class="flexslider"> <ul class="slides"> {exp:channel:entries channel="lr_press"} {if press_slider_switch != ""} {press_artikel} <li><a href="{press_document}" targat="_blank"><img src="{press_beeld}" alt="{title}" /></a></li> {/press_artikel} {/if} {/exp:channel:entries} </ul> </div>

checkbox always in unchecked status no matter if is checked or not -

i using chekbox in code showing unchecked .i using chekbox show below in form , on submit ion cheking value if statement shown below <label class="checkbox"> <input type="checkbox" name="auto"><p>i accept </p> </label> if(isset($_post['auto'])) { echo "checked"; } else { echo "unchecked"; } some browser not support defalut value of "on". more stable solution - <label class="checkbox"> <input type="checkbox" name="auto" value="on" /><p>i accept </p> </label> and same php code. if(isset($_post['auto'])) { echo "checked"; } else { echo "unchecked"; }

powershell - Test WinRM/WSMan connectivity? -

i'm trying test if winrm works on list of systems; however, can't seem catch/silence error appears when attempt connect system. appears work on 1 system: ps c:\users\egr> winrm id -r:system1 identifyresponse protocolversion = http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd productvendor = microsoft corporation productversion = os: x.x.xxxx sp: x.x stack: x.x but doesn't work on another: ps c:\users\egr> winrm id -r:system2 wsmanfault message = winrm cannot process request. following error occured while using kerberos authentication: net work path not found. possible causes are: -the user name or password specified invalid. -kerberos used when no authentication method , no user name specified. -kerberos accepts domain user names, not local user names. -the service principal name (spn) remote computer name , port not exist. -the client , remote computers in different domains , there no trust between 2 domains. after checking above is

mysql - Excel ODBC connection drops columns -

i'm using excel odbc connection query editor retrieve data view have on mysql. excel ignoring 1 column should contain char(7) calculated other column. can happening here? the query i'm sending select * view . the solution ensuring none of fields represented mysql type blob , therefore representable in excel.

ios - iPod software version too high? -

i bought new ipod touch today , installed ios 7 on in order beta test new designs, color schemes, , speed enhancements. i'm running osx 10.6.8 xcode 4.2 build 4c199 (ios 5). when plugged ipod in , pressed "use development" in xcode organizer got error saying couldn't use ipod because software version high. should do? use xcode 5, which can same place got ios 7 from (provided you're registered developer).

encrypting a copy of a text file in c# (Windows Forms) -

i'm working on encryption program in c# (windows forms) , 1 of options i'd add user able choose existing text (.txt) file, , program make new file file chosen, encrypted (without making changes in original file). though making copy of original file , encrypting new file, have no clue how it. please tell me how it. lot in advance! streamreader/streamwriter loading , saving file. streamreader: string unencryptedtext; private void readtextfile() { using (streamreader reader = new streamreader("file.txt")) { unencryptedtext= reader.readtoend(); } } streamwriter using (streamwriter writer = new streamwriter("encryptedfile.txt", true)) { writer.write(encryptedtext); } encryption: simple insecure two-way "obfuscation" c# update chose directory save encrypted file(only directory) folderbrowserdialog fbd = new folderbrowserdialog(); if (fbd.showdia

angularjs - Accessing Value from JavaScript Callback -

i'm trying push value anglular.js service callback array. appreciated. thanks. $scope.checkaddondependencies = function(addon) { var addons = new array(); var arr = filterfilter($scope.addons, {checked: true}); var length = arr.length, element = null; (var = 0; < length; i++) { element = arr[i]['addoncode']; addons.push(element); //works fine myservice.addon_dependencies(arr[i]['addoncode']).then(function(dependency) { addons.push(dependency); //not working }); } console.log(addons); } basically need handle value in callback this: myservice.addon_dependencies(arr[i]['addoncode']).then(function(dependency) { addons.push(dependency); }); update since callback of function then() async, there no guarantee console.log(addons) shows in code order.

spring - How can I divide two HQL Count Results? -

i want compute percentage of people not active divided percentage of people being active. i following hql query did not work: (select count(x) people x x.active=false) / (select count(x) people x x.active=true) how can that? you can use group clause express this. here's how in grails: def countbyaction = people. executequery("select active, count(*) people group active")*. tolist(). collectentries{it} println (countbyaction[true]) println (countbyaction[false])

c++ - Overloading assignment operator when the object is on the right-hand side of the assignment -

given following code: template <typename t> struct wrapper { t value; wrapper(t val) : value(val) {} } int main() { wrapper<int> x(42); int y = x; // need solution y = x.value return 0; } is there way implement assignment int y = x; so means y = x.value . i know overloading assignment operator not possible because applies object on left side of assignment , friend function 2 arguments not allowed standard. if not possible overloading other operator, or using special tricks, how implement this, except invoking method provided wrapper class such as: int y = x.get(); why not provide implicit conversion t operator t() { return value; } this cause assignment function because compiler attempt convert right side of assignment t . implicit conversion allow succeed note cause other conversions work besides assignment. example possible pass wrapper<t> instances t parameters. may or may not work particular scenario

javascript - Change cursor style while processing Ext.Button handler -

using extjs 4, have ext.button handler function takes while run. while runs, button looks it's pressed , cursor keeps looking pointer hand. i'd change cursor style appear waiting (i.e. css style wait ). sample code need change: function myhandler(button) { //1. todo: change cursor wait processingstuff(); // might take 10 seconds //2. todo: change cursor default }; ext.application({ name: 'ext.array.clean()', launch: function () { ext.create('ext.button', { text : 'my button', renderto: ext.getbody(), handler : myhandler }); } // launch }); // ext.application() update: thank you, hopper , lauren, missing piece needed delay before running processingstuff() method explained here: extjs load mask while long processing here sample based on lauren's fiddle: http://jsfiddle.net/wbmsw/ the above sample not work in ie , i'm not sure why, guess hover event on button not triggere

php - Apostrophes not displaying correctly -

i’m making simple blog php, mysql , html. have problem while displaying apostrophes , quotes, instead of displaying "example" (in html page) displays \"example\", i’m using escape string , still not working :( page: <?php $servidor = "xx"; $bd = "xx"; $usuario = "xx"; $senha = "xx"; mysql_connect($servidor, $usuario, $senha) or trigger_error(mysql_error()); mysql_select_db('a3722962_main') or trigger_error(mysql_error()); $tutoid = $_get['tuto']; $query = mysql_query("select * tutorials id = '$tutoid'"); while($line = mysql_fetch_array($query)) { $content = $line['text']; $title = $line['title']; $creator = $line['creator']; $name = $line['name']; $idtest = $line['id']; } {echo "$content";} ?>

Images stored in database are cut/cropped when displayed on browser -

i trying display images mysql database. of images display correctly, appear cut/cropped @ bottom , cropped section shows whitespace, can't rid off becomes part of image. css can't solve , recreating images on go imagecreate etc won't restore it. have meta tags set utf-8. have read, might have utf-8 bom or so. use file_get_contents or fopen , fread images , store them in database , output them using header() or base64_encode. it, same result. this basic output image code browser: //html form <form action='' method='post' enctype='multipart/form-data'> <input type='file' name='image' size='10'> <input type='submit' name='submit_image' value='upload' /> </form> //table creation $my_photos = "create table if not exists photos ( id bigint not null auto_increment, pic blob not null, primary key (id) ) engine=innodb"; if (mysql_query($my_photos)){ print "succ

windows - Moved a Classic ASP site to a new server, now "VBScript runtime error '800a01a8' Object required" returned on Conn.Execute -

i have classic asp site connecting access database. it's been moved at&t web hosting dedicated cloud server running windows server 2012. when site hit's line of code query database returns error: microsoft vbscript runtime error '800a01a8' object required /menu.asp, line 145 the connection happening in different file , looks like: <% set conn = server.createobject("adodb.connection") dim constr conn.open = "provider=microsoft.jet.oledb.4.0;data source=" & server.mappath("/data/cncmachinery.mdb") %> the line throws error is: set rp=conn.execute(msql) 'msql contains basic query again, site working before move new server, i'm wondering if it's compatibility issue? should looking in to? was old server 32 or 64 bits machine? windows server 2012 runs on 64 bits machines , there not version of 64 bits microsoft.jet.oledb.4.0. it seems asp application can't create object conn due provid

asp.net mvc 4 - What .NET Twitter wrapper library is suited to managing followers easily? -

i new twitter app development , want know of many .net twitter wrapper libraries choice using in asp.net twitter follower management app. things library do: allow following/unfollowing users per user limit (not per application limit) list followers of user determine if user following user (or looking in follower list) run happily in .net 4.0 shared hosting environment (can't clever continually running processes etc) ideally written in c# examples/good docs available i decided give linqtotwitter go, example of following/unfollowing given here: http://linqtotwitter.codeplex.com/sourcecontrol/latest#linqtotwitterdemo/friendshipdemos.cs

php - form vs href link corrupt -

so have been trying upload/download system work kept running problems, specifically, downloaded file being corrupt (.xls). this have currently: <form action="{{block type=" core/template" name="my-template" template="php/download_file.php" }}" method="post"> <label for="date">date:</label> <input type="date" name="date" id="date"><br> <input type="submit" name="submit" value="download"> </form> <a href="link/to/file">download file</a> so, these both link same file , downloads fine. if click on download file link, file opens fine. if go through form download button, it'll download opening gives me warning/error: "the file format , extension of 'file' don't match" , hangs forcing me force close file. download_file.php: <?php if($_post['submit']) { $file =

python - Where do timers live in matplotlib -

i using matplotlib timer objects register own update function animation. can't seem stop callbacks once start though without keeping reference timer object. it has been experience far when create object in matplotlib given reference added list inside other object (axis in figures, lines in axis etc.) can queried later. cannot find timer objects live however. problem can summarized code snippet import matplotlib.pyplot plt import numpy np def update(): plt.get_current_fig_manager().canvas.figure.patch.set_facecolor(str(np.random.random())) plt.draw() def start_animation(): timer = fig.canvas.new_timer(interval = 50) timer.add_callback(update) timer.start() fig = plt.figure() start_animation() run above code snippet, try programmatically stop flashing. function needs called timer.remove_callback(update). to clear. know can keep reference timer object , problem goes away. looking explanation of object must living in matplotlib. how

Powershell remoting issue -

i trying use powershell remoting server server b using enter-pssession -computername serverb. both servers in same domain. remoting enabled on server b using enable-psremoting , has worked fine. can use enter-pssession -computername command servera other servers fine. when trying enter-pssession -computername serverb server a, gives following error: fullyqualifiederrorid: createremoterunspacefailed running winrm winrm/config on serverb gives following: listener address = * transport = http port = 5985 hostname enabled = true urlprefix = wsman certificatethumbprint listeningon = 127.0.0.1, 192.168.0.4, ::1, 2002:b40a:1a8b::b40a:1a8b, fe80::100:7f:fffe%12, fe80::200:5efe:180.10.26.139%14, fe80::681a:e480:25fd:e50e%13 firewall on servers off. any idea on "fullyqualifiederrorid: createremoterunspacefailed" error? thanks vb do have matching user account on server b? have tried doing: enter-pssession -computername server

Get instagram picture in android? -

i try instagram images hashtag ..is there library instagram picture special hashtag in android ? without authentication (tutorial ? sample code ?) maybe should take @ instagram api, http://instagram.com/developer/

image - Creating a 2D grid for a board game in Java using Slick2D -

i need create 2d grid of fixed size e.g 20x20 using java slick lib. have array [ ][ ] containing symbols (text). these symbols stand different tiles (squares) on board. i know how render/draw individual images onto screen not sure how same grid (loop? wouldn't rendering game?). should concept of spritesheets ? ideally thought of creating tile object: tilexpos, tileypos, size, image(based on type) grid object: tile tiles[ ][ ] i wouldn't know how draw/render screen. should draw in init method below , game start re-draw accordingly in update method ? would appreciate guidance. import org.newdawn.slick.*; import org.newdawn.slick.state.*; public class gameplaystate extends basicgamestate { public gameplaystate(int stateid){ } public void init(gamecontainer container, statebasedgame game) throws slickexception { } public void render(gamecontainer container, statebasedgame game, graphics g) throws slickexception

wordpress - Count length of one input field and print it in another with Gravity Forms and Javascript -

i using gravity forms wordpress , trying figure out how count length of characters user types 1 of input boxes , print number input box in same form. think can done javascript total newb , here watered down effort. can see trying do. <!-- edited --> <form> <input name="input_10" id="input_1_10" type="text" value="" class="small" tabindex="1"> <input name="input_2" id="input_1_2" type="text" value="" class="medium" tabindex="2"> <div style="padding:10px 15px; font-family:sans-serif !important;"> <p id="preview" style="text-align:center;font-size:22px;font-weight:bold;">sample text</p> </div> </form> <script> var bank = document.getelementbyid("input_1_2"); var countnum = document.getelementbyid("input_1_10"); bank.addeventlist

Break outside loop Python function other options -

i have code: def playagain1(): print("would keep boxing or quit while ahead? (y/n)") playagain = input().lower() if(playagain.startswith('y') == false): print("whatever chicken.") break i want break loop if playagain() doesn't start y . whenever try, error: 'break' outside loop how write better make work? as matt bryant's answer states, can't break outside loop can return function. add need return value function, main programme loop knows whether return start or quit: def main(): while true: # main game code goes here if not playagain(): break def playagain(): print("would keep boxing or quit while ahead? (y/n)") response = input().lower() return response.startswith('y')

knockout.js - Knockoutjs get parent object -

i having difficulties on getting parent object's field child object using knockout.js. function child(info){ var self = this; self.x = info.x; self.y = info.y; self.parentthing = parent.fieldtoget(); // when had problem } function main() { var self = this; self.fieldtoget = ko.observable(); self.things = ko.observablearray(); self.postfunction = function(){ $.post('xxx.php', $("form#filterform").serialize(), function(data){ var mappedthing = $.map(data.data, function(info){return new child(info); }); self.things(mappedthing); } }, 'json'); }; } var main = new main(); ko.applybindings(main, $("div#main")[0]); hierachy main has several child. in child object want parents 'attribute': fieldtoget. i think solution pass parent class child parameter . function child(info, parent){ var self = this; self.parent = p

unix - Outputting specific lines based on date and time -

i'm noob @ linux , i'm trying figure out way automate data mining process work since there many values need sort through. have log file in following format: yyyy-mm-dd hh:mm:ss sensor0 temperature (equation 1) <value0> celsius sensor1 temperature (equation 1) <value1> celsius sensor2 temperature (equation 1) <value2> celsius sensor3 temperature (equation 1) <value3> celsius the program spits out these values in format every 5 seconds. want find way process log file , log file has 4 sensor values need based on date , time. currently, able process file following format filtering phrases out using sed . yyyy-mm-dd hh:mm:ss <value0> <value1> <value2> <value3> how output 4 values searching specific date , time? have separate log file has time stamps of corner cycles ran, using reference in search of temperature values. format of file is: yyyy-mm-dd hh:mm:ss yyyy-mm-dd hh:mm:ss in final processed output, want contents

MYSQL Calculate Column value based on a Case Statement and other Row Values -

i new mysql apologies question, not sure start. i have mysql table looks below; table_1 record_id price price_difference new_value 1 100 null 2 101 1 3 115 14 4 135 20 5 95 -40 6 80 -15 what want add , entry record 1 of null since there no price difference. for record 2 want 'new_value' price difference value of 14 divided value dependent on price in previous record 1. e.g. 14/@var_1 where @var_1 = (case when price_1 < 50 0.5 when price_1 between 50.001 , 100 1 when price_1 between 100.001 , 150 1.25 when price_1 between 150.001 , 150 1.4 ....etc. end case i presume can done in mysql , ideas how can go it? this can done joining 2 aliases of same table, whereby 1 points current record_id , other points previous record_id adding 1 in join condition. this can work if rows record_id guaranteed sequential no intervening gaps. select pcur.price,

nosql - Practical example for each type of database (real cases) -

there several types of database different purposes, mysql used everything, because know database. give example in company application of big data has mysql database @ initial stage, unbelievable , bring serious consequences company. why mysql? because no 1 know how (and when) should use dbms. so, question not vendors, type of databases. can give me practical example of specific situations (or apps) each type of database highly recommended use it? example: • social network should use type x because of y. • mongodb or couch db can't support transactions, document db not app bank or auctions site. and on... relational: mysql , postgresql , sqlite , firebird , mariadb , oracle db , sql server , ibm db2 , ibm informix , teradata object: zodb , db4o , eloquera , versant , objectivity db , velocitydb graph databases: allegrograph , neo4j , orientdb , infinitegraph , graphbase , sparkledb , flockdb , brightstardb key value-stores: amazon dynamodb , redis , ria

playframework - How to get asset content in Play Framework -

i'm working on play framework version 1, need asset content (js or css file) under public folder merging. instance, want merge 2 js files 1 file , process on it. anyone know how play 1, or how merge assets rendering. there playframework v1 modules dealing js/css asset merge/compress. can try either greenscript or press

unicode - Difference between text file encoding in Android -

what difference between different text file encoding android project, such as: utf-8 utf-16be utf-16le utf-16 iso-8859-1 us-ascii for example, displaying korean, know should use utf-8. when should use others? about character_encoding , difference http://en.wikipedia.org/wiki/character_encoding . usually utf-8 works fine cross platform , multiple language. http://en.wikipedia.org/wiki/utf-8 but korean version of windows use unified hangul code unified hangul code (uhc) extends wansung code adding missing 8,822 hangul characters, , designed smooth migration unicode version 2.0. wansung code points map directly same uhc code points (but not vice versa). uhc provides round trip mapping unicode version 2.0. uhc used in korean versions of windows 95 , windows nt. there command iconv under linux (and libiconv c programming language), encoding translation. iconv -l to list encoding iconv supports.

Difference between static function and normal function in C? -

in our project, have pretty big c file of around 50k lines, written in 90's. wanted split file based on functionality. but, functions in file declared static. so, file scoped. if split file, function in file1 cannot call function in file2 , vice-versa. but, tl feels there memory optimization using static functions. wrote sample code see if stacks different different threads. seemed was. please enlighten me difference between static function , normal 1 other file scope? in c, while defining function, static keyword has following 2 major consequences : prevents function name being exported (i.e. function not have external linkage). thus, preventing linkage / direct calls other parts of code. as function marked private file, compiler in better position generate complete call-graph function. may result in compiler deciding automatically in-line function better performance.

android - Google Cloud Messaging registration id expiration -

i using google cloud messaging android application , trying understand when registration id expires. this post able understand google tends refresh id @ time. curious how application know when id gets refreshed? if google decides refresh id , server till sending message old id dont think message sent. have try , register every time , see if ids same? also same post says id refreshed when app version changes, on changing version through manifest registration id did not change. point on trying register again of version changes? edit here server side. canonical id stored? server side code: <?php // message sent $message = $_post['message'];   // set post variables $url = 'https://android.googleapis.com/gcm/send';   $fields = array(                 'registration_ids'  => array($_post['registrationids']),                 'data'              => array( "message" => $message ),                 );   $headers = array(

My rails -v differs from my gem list rails -

i'm working on ubuntu, , i'm not adept in windows, , i'm trying install rails. tried 1 installation , got rails 2.3.14, when wanted 4.0.0. found think correct installation via sudo gem install rails, , got 4.0.0. however, can't seem use rails 4.0.0 version. when i'm in terminal , run rails -v command, rails 2.3.14. however, in 'gem list', see rails 4.0.0, not rails 2.3.14... i'm not sure rails 2.3.14 is... how rid of and/or ruby use rails 4.0.0? sounds me installing ubuntu ruby/rails etc. in order have multiple ruby , rails different gem versions, should use rvm . can switch , forth between different versions of on project base. find ubuntu packages being little behind of rails community used to.

Override .ToString method c# -

okay, wrote program out of exercise of c# programming book (i'm trying learn here) , asks " override tostring() method return data members ". have done correctly? or have wrote code compiles nothing. purpose of tostring ? i have spent 30 minutes looking @ other posts on , havn't figured out, decided make this. using system; using system.collections.generic; using system.linq; using system.text; namespace consoleapplication297 { class program { static void main(string[] args) { string name = "stormtrooper"; employee s = new employee(name); console.writeline("the type of hire {0}", s.name); console.writeline("the identification number {0}", s.number); console.writeline("the date of hire {0} aby", s.date); console.writeline("the standard galactic salary is...{0:c}", s.salary); } class employee { private string _name; private s

android - AS3 Game, Collecting points, multiple movie clips with the same instance name, not working -

i've decided create android touch screen game. complete , utter beginner , learning go. my game has little elephant moves when press , hold on screen , falls when there no contact screen. aim collect many peanuts fly past possible gain highest score. pretty simple, you'd think so. so far, i've managed point elephant can collide peanut , peanut disappears. my issue right is, can't create more 1 peanut, same instance name of "peanut" because 1 work , others not recognized. i've done ole google search , nothing has given me right way go. give me clear answer of or go here? if need more info, code or picture of i've got far understand let me know :) samantha instance name must unique, , cannot use instance name find set of movie clips. should instead use array, , @ creating peanut add there using push() , , @ collecting peanut, splice out. in fact, whenever multi-instance class similar functionality (aka "collect"), use

how to use progress bar in wpf popup control? -

i using c# , wpf gui. goal display progress bar under wpf popup control. using below code add progress bar under popup control. <popup horizontalalignment="left" margin="338,261,0,0" name="popup1" verticalalignment="top" height="38" width="153" > <stackpanel background="red"> <progressbar height="15" horizontalalignment="left" margin="349,272,0,0" name="progressbar1" verticalalignment="top" width="130" foreground="#ff3ea3ea" value="{binding elementname=textbox1, path=text.length, mode=onetime}" maximum="140" /> </stackpanel> </popup> please me. thanx in advanced! you should use below code showing progressbar under popup control: <popup name="popup1" horizontalalignment="left" margin="338,261,0,0&quo

java - does %d in String.format() work for unsigned integers also? -

in printf() remember unsigned there %u ... can find no such %u in specs string.format() so if have large unsigned int %d work correctly on it? if want treat int if unsigned can to int = ... string s = string.format("%d", & 0xffffffffl); this turns signed int long, 0 .. 2^31-1 to reverse can do int = (int) long.parselong(s); string s2 = string.format("%d", & 0xffffffffl); and s2 same s provided in range. btw: simplest thing might use long in first place. unless creating a lot of these memory trivial , code simpler.

jquery - when <textarea> character count reaches 30 enable <button> -

i want display number (30) below <textarea> count characters inside it. it decreases characters being typed/pressed. im using $j required wordpress avoid conflict. this fiddle http://jsfiddle.net/jgmcn/1/ var $j = jquery.noconflict(); $j(function(){ $j("#textarea").keyup(function(){ count = $(this); // insert values here $j("#charnum").text(30); // display 30 if ($j(this).val().length >= 30 ) // if value length >= 30 then... { $j("#charnum").text(30 - count.val().length)); //display while subtracting 'count' 30 } else (30-count.val().length == 0) //if value == 0 { $j("#charnum").text("submit enabled"); //print $j("#submit").removeattr('disabled'); // allow submit button { }); }); you have large number of errors in code. since you're using jsfiddle, i'd suggest using jshint function , working through them

asp.net mvc - Should I have each ViewModel for each entity in my ASP MVC project? -

i have read many many solution can't understand or when use view model? example, when have register form user register, want hava field confirm password , don't think should add user entity. have viewmodel: public class registerviewmodel { public user user { get; set; } public ienumerable<selectlistitem> city { get; set; } public ienumerable<selectlistitem> ward { get; set; } [required(errormessage = "bạn chÆ°a nhập lại mật khẩu.")] [stringlength(100, errormessage = "mật khẩu phải có ít nhất {2} ký tÆ°̣.", minimumlength = 6)] [datatype(datatype.password)] [system.web.mvc.compare("user.password", errormessage = "mật khẩu không khÆ¡́p.")] public string confimpass { get; set; } } so after read link how implement "confirm password" in asp.net mvc 3? . don't know why should replace password field in user entity. i'm using unobstrusive client validation work if

spring - No mapping found for HTTP request with URI [/HelloWeb/WEB-INF/jsp/hello.jsp] -

i tried to load simple example of spring mvc simple jsp failed following error: no mapping found http request uri [/helloweb/web-inf/jsp/hello.jsp] i'm using spring 3.2.2. appreciate here. tried several thing still seems can not map jsp page in controller. web.xml looks that: <web-app id="webapp_id" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>spring mvc application</display-name> <servlet> <servlet-name>helloweb</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>helloweb<

c# - DropdownList Not Showing Selected Item -

Image
i creating page edit non-conformance reports. page takes in model follows: on page, trying show dropdown list current value of faultcode property pre-selected. however, not working. instead have stripped basics , tried hard code pre-selected value, follows: @{ var faultcodelist = new list<selectlistitem> { new selectlistitem { text = "internal damage", value = "internal damage" }, new selectlistitem { text = "customer problem", value = "customer problem" }, new selectlistitem { text = "incorrect material supplied", value = "incorrect material supplied" }, new selectlistitem { text = "received material damaged", value = "received material damaged" }, new selectlistitem { text = "no test certificate supplied", value = "no test certificate suppli

app store - Sorry, you don't have permission to download this app.message occure when downloading app in windows phone -

Image
i uploaded beta version of application in windows phone 8 app store.now got 1 link app store when click link nokia lumia 520 in india downloaded successfully. but when send link friend @ africa , click on link , gives message "sorry, don't have permission download app.message occure" you need grant access each beta users individually. you'll need whitelist microsoft account (formerly windows live id). you can @ submission page:

apache pig - Load data from Hbase with a Pig script without knowing the number of fields -

in hbase, have each row columns: u1:chararray, u2:chararray, ..., un:chararray in column family named u (from utable) number n can different each row. load these columns in tuples without naming them (for example using * character) don't see how so. for time being create tuples following line: qoe1 = load 'hbase://utable' using org.apache.pig.backend.hadoop.hbase.hbasestorage('u:u1, u:u2, u:u3', '-loadkey true') (id:chararray, u1:chararray, u2:chararray, u3:chararray); but told before, unsatisfying because can load fixed number of columns. any idea? i ran same problem. solved following: if know column family names, can load columns fall under column family hbase pig using following. comes down putting columns (using *) in map: result = load 'hbase://your_table_name' using org.apache.pig.backend.hadoop.hbase.hbasestorage('u:*', '-loadkey true') (id:bytearray, u:map[

c# - Cant get list from received XML file -

this xml receive: <?xml version="1.0" encoding="utf-8"?> <mdpr:data xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:mdpr="http://..."> <mdpr:contactlist> <mdpr:contact id="{123456}" classid="customer"> <mdpr:name>data1</mdpr:name> <mdpr:transportcode>data2</mdpr:transportcode> <mdpr:zipcode>data3</mdpr:zipcode> <mdpr:city>data4</mdpr:city> </mdpr:contact> <mdpr:contact id="{234567}" classid="customer"> <mdpr:name>data5</mdpr:name> <mdpr:transportcode>data6</mdpr:transportcode> <mdpr:zipcode>data7</mdpr:zipcode> <mdpr:city>data8</mdpr:city> </mdpr:contact> </mdpr:contactlist> ... here how try contacts: public class contact { public string name { get; set; } publi

.net - Should i use Static/Shared Methods for readability: -

i have been tought avoid using static methods. i've been tought try keep code readable , short possible. i have list of proxies , of them should perform 5 different validation. for me these validation different don't feel putting them in 1 big validation class. if validation extended class grow large. now in case can write validator class way: public class myvalidator1 public shared sub validate(proxy serviceclient, year integer) dim args = new arguments() args.year= year try console.writeline("test") console.writeline("--------------") dim result = proxy.generatreport(args) console.writeline("no errors") catch ex exception console.writeline(ex.message) console.writeline() end try end sub end class this how implemented: for each proxy in _proxies console.writeline(proxy.endpoint.address.uri.host) console.writeline("------------------------