Posts

Showing posts from August, 2010

c - Is there a better function that rand()? -

i have program, in c, creates array of 1000 integers using random number 0-999 , performs sort of algorithm on array. in order test algorithm's running time, try running program 10000 times, every time run array same few arrays , changes. have used srand() function feed seed current time, still not help. is there alternative solution rand() or way fix this? function is: void getarray(int *ptr1,int size,int option){ int n; srand(time(null)); for(n=0; n<size;n++) *(ptr1+n) = *(ptr2+n)= rand()%1000; } thanks in advance! you should call srand once: on program startup. right now, if call function multiple times before time changes sequence same.

asp.net - Binding WCF service -

i have launched asp. net aplication use wcf service, here code of web.config: <system.servicemodel> <client> <endpoint address="http://somehost.com/giservice.svc" binding="basichttpbinding" contract="respservice.iprocess"/> </client> </system.servicemodel> problem service bind absolute uri, if set relative have error: uri should absolute try following: <system.servicemodel> <client> <endpoint address="/giservice.svc" binding="basichttpbinding" contract="respservice.iprocess"/> </client> </system.servicemodel>

javascript - Trying to get 1 day or 2min ago from a timestamp in JS -

hi want auto convert timestamps things : x min ago x hour ago x month ago but dont know after : function gettimeago(timestamp){ var = new date(timestamp*1000); .. } i'm new javascript, has coded kind of function ? thanks timeago.js what? timeago jquery plugin makes easy support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). download, view examples, , enjoy. you opened page less minute ago. (this update every minute. wait it.) this page last modified month ago. ryan born 34 years ago. usage: jquery.timeago(new date()); //=> "less minute ago" jquery.timeago("2008-07-17"); //=> "5 years ago" jquery.timeago(jquery("abbr#some_id")); //=> "5 years ago" // [title="2008-07-20"]

javascript - How to Make If statement for a specific Image source? -

i have line in program (run in dreamweaver) following: function go() { if((document.test.test1.src == document.test.test2.src && document.test.test2.src == document.test.test3.src )) ...... ...... ..... } this function runs when have 3 different images when either of 3 equal each other in page. however, how make specify images equal each other, instead of doing of three. for ex, if 1 image titled 'x' if 3 test1,test2,test of value 'x' run function , display message, however, displays same message other images (if equal 'y') id have separate messages somehow. i'd separate comparison separate function current image element parameter , use method different image objects: function compare(imgelem){ if((document.test.test1.src == document.test.test2.src && document.test.test2.src == document.test.test3.src )) console.log(imgelem.id,"triggered"); // or else } } compare(document.test.test1); compare(docum

xna - Monogame Content pipeline don't work -

i can't understand how set monogame content project.. please, me :) tried read stuff: https://github.com/mono/monogame/wiki/monogame-content-processing can't make works... what i'm do: create monogame project. add new project solution "monogame content" change main project file, added input , platform options in references of main project add content project. then add some.png file content project, , here see: http://richinside-games.net/my/mono.jpg i have no monogame song, monogame texture, etc... can 1 tell me, how set monogame content step-by-step, please? ps. sorry english, please. since developers of monogame didn't want have rewrite content pipeline xna reused it. that's why when created monocontentproject added 2 projects. 1 xna extension (the_gamecontent) has ability reference xna content project , other xna content project itself(the_gamecontentcontent). need reference in game project extension(the_gamecontentcont

java - Append to an XML file -

i writing data xml file. here code: try { documentbuilderfactory docfactory = documentbuilderfactory.newinstance(); documentbuilder docbuilder = docfactory.newdocumentbuilder(); // root elements document doc = docbuilder.newdocument(); element rootelement = doc.createelement("company"); doc.appendchild(rootelement); // staff elements element staff = doc.createelement("staff"); rootelement.appendchild(staff); // set attribute staff element attr attr = doc.createattribute("id"); attr.setvalue("1"); staff.setattributenode(attr); // shorten way // staff.setattribute("id", "1"); // firstname elements element firstname = doc.createelement("firstname"); firstname.appendchild(doc.createtextnode("yong")); staff.appendchild(firstname); // lastname elements element lastname = doc.createelement("lastname");

Creating new Database in Oracle 10g XE -

problem creating new database in oracle express edition. platform: ubuntu 12 oracle : 10g express edition i trying create new database in oracle , took of oracle docs achieve that. i successful in creating 'initialization parameter file' database 'mynewdb'. even, have changed environment variable oracle_sid point value 'mynewdb'. the problem is, when try connect database hitting connect sys/passwd sysdba , prompted error saying insufficient privileges'. so, restored oracle_sid variable 'xe'. now, logged in sysdba privileges , issued 'create database' command create 'mynewdb' database. time prompted again error saying database name 'mynewdb' not match parameter db_name 'xe'

c# winforms create email from outlook template file -

i creating mail using winforms so: private void createoutlookemail(string addresses) { try { outlook.application outlookapp = new outlook.application(); outlook.mailitem mailitem = (outlook.mailitem)outlookapp.createitem(outlook.olitemtype.olmailitem); mailitem.subject = "this subject"; mailitem.to = addresses; mailitem.body = "this message."; mailitem.importance = outlook.olimportance.olimportancelow; mailitem.display(false); } catch (exception ex) { throw new exception("cdocument: error occurred trying create outlook email" + environment.newline + ex.message); } } is possible insert email addresses/subject saved outlook template (.oft file) within winforms app? the oft file somewhere in root of ap

javascript - Set value on different html element types with same jQuery function -

using cordova 2.5.0, i'm using following function go <input> elements within html page. function getinput() { var formelements = new object(); $("form :input").each(function(){ formelements[this.name] = $(this).val(); //that's line }); return formelements; } actually, don't "get" elements, rather values, can see in fourth line of snippet. now, i'm trying set values later on in application. function insertresults(data) { //data json string console.log("in insertresults (js): " + data); var jso = json.parse(data); (var key in jso) { addcontenttoelement(key, jso[key]); } } function addcontenttoelement(elementname, valuetoset) { $(function() { $("input[name='" +elementname +"']").val(valuetoset); }); } the console.log() prints this: in insertresults (js): {"checkbox3":"","textfieldmulti1":"some te

java - How to rewrite ArrayList in opposite direction -

this question has answer here: what simplest way reverse arraylist? 6 answers i have arraylist , need rewrite in opposite direction. how it? list<posts> viewlist = new arraylist<posts>(); viewlist = viewlogic.getpostslist(username); you can use: collections.reverse(viewlist); as documented oracle here.

python - Pandas: Period object to abstract from time -

i have following dataframe: df = pd.dataframe({ 'trader': 'carl mark carl joe mark carl max max'.split(), 'share': list('abaabaaa'), 'quantity': [5,2,5,10,1,5,2,1] }, index=[ dt.datetime(2013,1,1,13,0), dt.datetime(2013,1,1,13,5), dt.datetime(2013,1,1,20,0), dt.datetime(2013,1,2,10,0), dt.datetime(2013,1,2,12,0), dt.datetime(2013,1,2,14,0), dt.datetime(2013,6,2,14,0), dt.datetime(2013,7,2,14,0), ]) is possible create period object on daily basis abstracts concrete day. evaluate question whether there tendency among traders in sample trade lower volumes. to create table this: period | trader | quantity -------------------------- 1 | carl | 10 1 | mark | 2 1 | joe | 10 1 | max | 2 2 | carl | 5 2 | mark | 1 2 | max | 1 andy update: the datasampel above simple show problem. hope create period object abstracts

java - How to get source object from DocumentListener (DocumentEvent)? -

this question has answer here: how find source component generated documentevent 2 answers i have class , have implemented documentlistener public void removeupdate( documentevent arg0 ) { system.out.println( arg0.getdocument()); } it print javax.swing.text.plaindocument@49ea903c is there possible way object can value of changed textfield? @ moment have 1 field not need check, if use 2 or more, how know jtextfield has notified listener? i'm not sure it's possible swing component document. issue solved: add different instance of listener every text field, , store text field in listener itself. textfield1.getdocument().adddocumentlistener(new mydocumentlistener(textfield1)); textfield2.getdocument().adddocumentlistener(new mydocumentlistener(textfield2)); textfield3.getdocument().adddocumentlistener(new mydocumentlistener(textfield3));

jquery - jqGrid Trying to freeze column with colmodel defined in json . Only freezes header row -

i have grid load server columns controlled data selection. have part working fine, want freeze column 1. i've set frozen:true attribute in json model definition, freezes header. i try set columns frozen within success event ajax call. thanks. $(document).ready(function () { var functionsmapping = { "fncsplitorders": function (pcellvalue, poptions, prowobject) { var strcell=pcellvalue.replace(/\|/g,'<br />'); return strcell; } }; $.ajax({ type: "get", url: "json/machinejobssummary.asp?qrydatabase="+$('#wsdatabase').val(), data: "", datatype: "json", success: function (result) { var columndata = result.mypage.outerwrapper, columnnames = result.colnames, columnmodel = result.colmodel; var i,objcol; (i=0;i<columnmodel.length;i++) {

html - Changing a an image src file using javascript wont change picture displayed -

essentially have div <div id="trafficcam" style="text-align:center;display:none;"> <img id="image" src="http://131940.qld.gov.au/dmr.controls/webcams/displayimage.ashx?filepath=gold_coast/grandissth.jpg" alt="sorry, no traffic cam available"> and i'd change src of file when button pressed image changes. can't hide , have show different 1 because div traffic cams, , i'd rather have bit more compact. the button execute is <input type=button value="cam" onclick="selectcam()"> which have tested , works the function calls is: function selectcam() { alert(document.getelementbyid("image")) document.getelementbyid("image").src="http://i.imgur.com/zp9ktfe.jpg"; } which seems not change on page when button pressed there no method getelementbyid , it's called getelementbyid . check out error console, there

angularjs - Can one host an angular.js based static blog on Github? -

i know 1 can host jekyl based static site/blog via github pages. can 1 same static site/blog based on angularjs? i yes considering angular ui github pages in fact angular apps demos: http://angular-ui.github.io/ http://angular-ui.github.io/bootstrap/ etc

java - What is the difference between `opencv.android.JavaCameraView` and `opencv.android.NativeCameraView` -

exacly stated in subject: difference between opencv.android.javacameraview , opencv.android.nativecameraview . advantages 1 on other, main ones, gives more options? from opencv documentation : the org.opencv.android.javacameraview class implemented inside opencv library. inherited camerabridgeviewbase , extends surfaceview , uses standard android camera api. alternatively can use org.opencv.android.nativecameraview class, implements same interface, uses videocapture class camera access back-end. opencv:show_fps="true" , opencv:camera_id="any" options enable fps message , allow use camera on device. application tries use camera first. implementation of cvcameraviewlistener interface allows add processing steps after frame grabbing camera , before rendering on screen. important function oncameraframe . callback function , called on retrieving frame camera. callback input object of cvcameraviewframe class represents frame camera.

jquery spring mvc html in javascript code -

Image
i have 2 tabs 1 shown below. user selects checkbox want edit , next tab shows field editing field. first tab loaded using jquery load function. preparing second tab using direct jquery code like.. ("#tab2").append(username[i] + "....."); i worried if have change tab2 page structure in future difficult modify. friend gave me suggestion instead of appending html in javascript, load tab2 using ajax. meant write design in tab2.jsp , when next button triggered tab2.jsp page loaded. solution problem if user goes tab1 , edit fields , click on next tab2.jsp loaded again means sending request server again. what think better way? give me suggestion if any

css - How can I manage classes like "row" and "span(X)" of Twitter Bootstrap to work on @media print? -

i need print web pages in website , i'm wondering how make row , spanx classes of bootstrap work can manage content of printed page. for example: <div class="row-fluid"> <div class="span12"> <strong>some stuff</strong> </div> </div> and <div class="row-fluid"> <div class="span6 offset6"> <strong>some stuff</strong> </div> </div> look same when calling window.print() . in example above, <strong>some stuff</strong> not being pushed ahead offset6 . i've done 2 things: taken @media print code bootstrap.css , bootstrapresponsive.css ; changed media all : <link rel="stylesheet" type="text/css" href="/path/css/bstrapmin.css" media="screen" /> to <link rel="stylesheet" type="text/css" href="/path/css/bstrapmin.css" media="all" /> ; w

matlab - Passing variable from event handler -

i grateful help, advice or suggestion. have application control geodetic instrument using synchoronous interface. commands asynchronous nature, e.g. getreflectors . after command triggered receive many server answers number of available reflectors. have registered com event , associate handler function. far good. can display data coming not know how pass variable main function. tried save variable .mat file or in .txt file , read it. works in matlab not works in compiled .exe aplication (error firing event). disp command not work in compiled aplication (display nothing). main question is: how pass variables handler main function. there way? global variables? thank filip edit: adding code demostrate problem... need save reflector name , reflector id user can choose 1 (because there multiple events coming different reflectors). function pushbutton_getreflectors_callback(hobject, eventdata, handles) ltsync = actxserver ('ltcontrol.ltcommandsync2'); %act server: lt

javascript - ASP.NET CheckBox inside a hidden DIV always returns false -

i have set of form elements within hidden div follows: <div id="jdivupdatefolder" style="display:none;"> <asp:textbox id="txteditfoldername" runat="server"></asp:textbox><br /> <asp:textbox id="txteditfolderdesc" runat="server" textmode="multiline"></asp:textbox><br /> <asp:fileupload id="fueditphoto" runat="server" /><br /> <asp:dropdownlist id="ddleditcontentorder" runat="server"> <asp:listitem value="0" text="ascending"></asp:listitem> <asp:listitem value="1" text="descending"></asp:listitem> </asp:dropdownlist><br /> <asp:checkbox id="chkeditisactive" runat="server" text="active" /><br /> <asp:checkbox id="chkeditshowonhome" runat="

objective c - Syntax error trying to set a property value -

i want pass id table view ( tableviewcontroller ) view ( viewcontroller ) after tap table cell. have declared storyboard id "viewcontroller" viewcontroller here tableviewcontroller.m - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { uistoryboard *storyboard = [uistoryboard storyboardwithname:@"mainstoryboard" bundle: nil]; uiviewcontroller *viewcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"viewcontroller"]; viewcontroller.id=@"test"; [self.navigationcontroller pushviewcontroller:viewcontroller animated:yes]; } here viewcontroller.h @property (nonatomic) nsstring *id; viewcontroller.m - (void)viewdidload{ id= [[nsstring alloc] init]; } but statement viewcontroller.id=@"test"; occurred syntax error. id reserved word in objective-c. not name variable or property id . rename else. also, viewcontroller var

Accessing Android Files and Database Directly on the device if rooted? -

when developing android prefer working real device plugged in of time since android emulators such total garbage. 1 pain point when want access files , sqlite databases though. believe adb shell possible pull database across, isn't convenient process. i'm wondering if there tools on market allow see database in real time, if requires rooting device i'm open it. i afraid there no tools let see db real time. need db device , see on system. have root phone , superuser permission access app databases. database (after getting root) available in /data/data/com.your.application/databases folder.

run php script inside javascript without leaving page -

i have javascript alert (from image onclick) - want have alert box , run php script. right have this.. <script type="text/javascript"> function doit() { window.location.href='script.php'; alert("test"); } </script> it works, except physically takes me script page. want run php script , stay on current page i'm on. any ideas? also, using ajax had serious issues working in ie , ios decided not use it. use ajax provider such jquery . have @ jquery with ajax, can execute php scripts without leaving current page.

php - Selecting html select list from sql database -

i kind if have interesting question. i'm trying prefill edit form in codeignitert. have of values coming through database, select box giving me few issues. want highlight had selected not erase list , fill in selected...if makes sence. here html <?foreach($info $row) :?> <select multiple="multiple" class="multi" name="wgenre[]"> <option value="action/adventure">action/adventure</option> <option value="angst">angst</option> <option value="crime">crime</option> <option value="drama">drama</option> <option value="family">family</option> <option value="fantasy">fantasy</option> <option value="friendship">friendship</option> <option value="general">general</option> </select> <?endforeach;?> i'

java - Can I somehow iterate through collection with definite initial and end index using standard JSTL? Or should I create a custom jstl tag? -

i need create pagination on jsp page list of objects, need iterate through range of indexes. suppose class person { int age; string name; } and personlist list of persons. can iterate this... <c:foreach var="person" items="${personlist}" varstatus="status"> <c:if test="${status.index >= startindex && status.index < endindex}"> ${person} </c:if> </c:foreach>

javascript - Nested Callback stuck in Loop -

i have nested callback setup following: function submitform() { buildcontent($('#content').val(), '', true, submitform) performsubmit(); } function buildcontent(textwithurl, textsource, issubmit, callback) { console.log("getwebcontent in progress"); getwebcontent(sendurls, buildcontent) console.log("getwebcontent done"); callback(); } function getwebcontent(content, callback) { $.ajax({.... sucess:function(msg) { ..... callback(); } } expected outcome when submitform called calls build conetent calls getwebcontent. o* nly after ajax call in inside getwebcontent sucessfull performsubmit(); executed. * reason loops , js hangs , becomes unresponsive , buildcontent console logs keeps prininting in loop. it looks have misunderstanding of how callbacks work. when callback returns, not resume execution left off. function calling callback finishes immediately. you need structure code so: function submi

parsing - PHP video site parser -

so i've been working on php parser. supposed parser filenuke video url. however, when running following script , clicking play says video not found, when load regular filenuke url video plays. don't know do, thanks! <?php include("simple_html_dom.php"); $url = "http://filenuke.com/fizzoquaog43"; $cookie = tmpfile(); $ch = curl_init($url); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_followlocation, true); curl_setopt($ch, curlopt_useragent, 'mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.31 (khtml, gecko) chrome/26.0.1410.64 safari/537.31'); curl_setopt($ch, curlopt_cookiefile, $cookie); curl_setopt($ch, curlopt_cookiejar, $cookie); $contents = curl_exec($ch); curl_close($ch); $html = new simple_html_dom(); $html->load($contents); $items = $html->find("input[name=id]"); $items2 = $html->find("input[name=fname]"); $items3 = $html->find("input[name=referrer]"); fo

php - Javascript Not Updating Database -

i have edit profile, user's profile. well, javascript seems getting value of age's form. php file getting age, no others , it's not updating database. javascript: function updateprofile() { var newage = $("#newage").val(); var newimage = $("#newimage").val(); var newbio = $("#newbio").val(); var datastring = 'newage=' + newage || 'newimage=' + newimage || 'newbio=' + newbio; if (newbio.length , newage.length , newimage.length == 0) { $('#required').fadein(300); $('#mask').fadein(300); } else { $.ajax({ type: "post", url: "update_profile.php", data: datastring, cache: false, success: function (updateprofile) { $('#editinfo').hide(); $("#updatedprofile").html(updateprofile); $("#updatedprofile").fadein('slow'); $("#age"

css - Absolute Positioned Div is hiding my other divs below -

have at, http://thomaspalumbo.com i have css website's container: .graybox { padding: 0 30px 30px 30px; background: #ededed; position:absolute; left:0; right:0; } then have container on top of center info. .graybox container spreads width of page want footer div hidden, according firebug behind? , on page? is there fix this? while i'm here can explain white space on right side of page. comes effect once page resized smaller. you can use css z-index property make sure footer in front of content. z-index works when element positioned though. make sure add position:relative footer #footer{ position:relative; z-index:999; } read more: http://www.w3schools.com/cssref/pr_pos_z-index.asp edit just checked out code of website, , don't understand why graybox positioned absolutely, make things more complex. same goes menu, why position absolute, why not add in right order in html in first place? edit if want center content background has

c# - Smoothing function for PRM output -

i've implemented probabilistic roadmap method function, works , executes correctly. problem output of prm not smooth example, if hand needs rotate 30 100 degrees, steps might 30,55,42,66,99,100, wat able smoothen transition betwen 30 , 100 degree. know problem related tp smoothing of signal yet dont know type of smoothing might able job. no sophisticated method needed. implementation in c#, if possible wish let such job done library. there such library? can give array of integers , likewise produce array of smoothed values. i think need simple curve fitting algorithm. quick google search give lots of example code. , if want have strictly increasing curve, need sort values before curve fitting. if interested in reaching target, can drop values in between , linear interpolation start end or similar.

rest - Is it appropriate to return HTTP 503 in response to a database deadlock? -

is appropriate server return 503 ("service unavailable") when requested operation resulted in database deadlock? here reasoning: initially tried avoiding database deadlocks, ran across https://stackoverflow.com/a/112256/14731 next, tried repeating request on server-side, ran across java servlets: how repeat http request? . technically speaking can buffer request entity scalability suffer , clients more see 503 service unavailable anyway. seeing as: it's easier ask clients repeat operation. they need able handle 503 service unavailable anyway. database deadlocks rather rare. i'm leaning towards solution. think? update : think returning 503 ("service unavailable") still acceptable if wish it, no longer think technically required. see https://stackoverflow.com/a/17960047/14731 . i think it's fine long entire transaction rolled or if request idempotent.

file - How to save custom preferences of python's IDLE? -

i have several computers @ different locations, , although i'm not coding in idle, running in background, small testing, debugging , researching tasks. configured idle custom highlighting, key set, etc. @ home, , pretty comfy save settings external file, , install these settings onto machines i'm working on. so question: there way that? or nice, if knows idle stores these datas — can copy file(s) there.. thanks in advance! idle saves preferences in several files in $home/.idlerc directory, creating files (for example, config-main.cfg ) needed. important ones, @ least, simple text files should able copy files home directory on 1 machine another. there few potential gotcha's watch out for: when copy files home directory, make sure no idle instances running. be aware versions of idle (with python 2.7, 3.2, 3.3, etc) share same .idlerc directory , files. i'm not aware of major conflicts @ point other possibly recent files file names non-ascii cha

Prolog List instantiation -

i want create predifined list. doing wrong because when pass argument doesnt work. here code have: list([5, 1, 2, 8, 10, 4, 3, 6, 9, 7]). print( [ ] ). print( [ x | y ] ):- write(x), write(' '), print( y ). test:- print(list). console output: 1 ?- a. true . it doesnt work. here when pass list myself: 2 ?- print([5, 1, 2, 8, 10, 4, 3, 6, 9, 7]). 5 1 2 8 10 4 3 6 9 7 true. you should use variables communicate information between predicates. list predicate doesn't "return" value, instantiates variable. test :- list(l), print(l).

python - ImportError with VirtualEnv -

i'm trying use virtualenv flask app i'm creating since has recommended me so. after creating virtual environment, installed libraries needed using pip while environment activated. i'm running importerror problems script. code works fine when i'm not in virtual environment. my script: #!/usr/bin/python import sc2reader ... ... when try run this: (flaskapp)xxxx@xxxx-virtualbox:~/flaskapp/bin$ ./test.py traceback (most recent call last): file "./test.py", line 3, in <module> import sc2reader importerror: no module named sc2reader i've tried changing shebang reflect virtualenv path python, didn't fix anything. library found in site-packages folder in virtual environment, i'm not sure why i'm getting importerror. i've never used virtualenv before i'm assuming configured wrong it's not seeing site-packages. try using #!/usr/bin/env python as shebang. if not work, try seeing output of which p

asp.net mvc - MVC can't override EditorTemplate name when used in EditorFor for child object -

i trying use editortemplate display child collection in table in parent’s view. problem have run seems work if template named same child’s class. when attempt use template different name, , pass name templatename argument editorfor,i runtime error. hoping use different child editortemplates different purposes same child collection. here abbreviated example: models: public class customer { int id { get; set; } public string name { get; set; } public list<order> orders { get; set; } } public class order { public int id { get; set; } public datetime orderdate { get; set; } public decimal amount { get; set; } public customer customer { get; set; } } customer controller index() method: public actionresult index() { customer customer = new customer() {id = 1, name = "acme corp.", orders = new list<order>()}; customer.orders.add(new order() {id = 1, orderdate = datetime.now, amount = 100m}); customer.orders.add(new order() { id

drawing a line moves like a clock pointer in pygame -

i trying draw line moving in same way clock pointer , when run program line move 20 degrees program got frozen , , can read :"valueerror: math domain error" here code have written : import pygame import sys import time import math pygame.locals import * pygame.init() windowsurface = pygame.display.set_mode((300, 600), 0, 32) pygame.display.set_caption("circle_line") black = (0, 0, 0) white = (250, 250, 250) r = 50 circle_line_start_x = 150 circle_line_start_y = 300 circle_line_end_x = circle_line_start_x circle_line_end_y = circle_line_start_y - r move_speed = 3 while true: event in pygame.event.get(): if event.type == quit: pygame.quit() sys.exit() if circle_line_end_x <= circle_line_start_x , circle_line_end_y <= circle_line_start_y : circle_line_end_x -= move_speed circle_line_end_y = math.sqrt(r**2 - ((circle_line_end_x - circle_line_start_x)**2)) + circle_line_start_y if c

mobile - Widths of footer/ navigation at 100% not equal to widths of header/ container at 100% -

i'm building website (summer-band.com) , trying tweak mobile settings (browser @ < 600px) 100% width settings several of elements. unfortunately, i've done far, header/ container , navigation bar footer seem shooting out different widths , can't seem fix on own, asking assistance. first, menu: #navigation li a , #navigation li.current_page_item a 's width 100% has padding, box model won't want. width should auto . recurring problem of yours. next, header: have #headerimg 's width set constant 600px . in media query, you'll want make width , height auto , make actual img 's width 100% . moving down, main #box has width of 100% , padding. due box model, won't want. make width auto . further down, #footer has display of inline-block , width of 100% . you'll want change display block , width auto . i think that's it, might want set article img 's max-width 100% , remove explicit width on kickstar

ios - snapping uiview to particular angle when rotating, locks it and cannot move again -

i want use able rotate 0 degrees, 90 degrees, 180 degree, 270 degrees, not in-between. after rotating, want user not locked in rotating , rotate once again if desired. before had view rotating freely, i'm changing code. myview uiview i'm rotating - (ibaction)rotation:(uirotationgesturerecognizer *)recognizer { uiview *myview = recognizer.view; switch (recognizer.state) { case uigesturerecognizerstatepossible: break; case uigesturerecognizerstatebegan: break; case uigesturerecognizerstatechanged: { cgfloat rotation = [recognizer rotation]; cgaffinetransform rotate = cgaffinetransformmakerotation(rotation); cgaffinetransform transform = cgaffinetransformconcat(myview.transform, rotate); myview.transform = transform; [recognizer setrotation:0.0]; } break; case uigesturerecognizerstateended: { nslog(@"s

java - Working with SQLServer 2008, stored procedures and WebService -

so i'm trying invoke stored procedure web service add either "preparecall" or "preparestatement" webservice stops working. when test it shows big big error service invocation threw exception message : null; refer server log more details and exceptions details : java.lang.reflect.invocationtargetexception followed this javax.servlet.servletexception: java.lang.reflect.invocationtargetexception @ org.glassfish.webservices.monitoring.webservicetesterservlet.dopost(webservicetesterservlet.java:330) @ org.glassfish.webservices.monitoring.webservicetesterservlet.invoke(webservicetesterservlet.java:106) @ org.glassfish.webservices.jaxwsservlet.dopost(jaxwsservlet.java:133) @ javax.servlet.http.httpservlet.service(httpservlet.java:688) @ javax.servlet.http.httpservlet.service(httpservlet.java:770) @ org.apache.catalina.core.standardwrapper.service(standardwrapper.java:1550) @ org.apache.catalina.core.standardwrappervalve.invoke(stan

java - Can i insert a some code in HTML to set android wallpaper -

this first post ever on stackoverflow.com have found many many of answers questions 1 question cannot figure out. know possible invoke few android commands via either java code or other html code , wondering if possible website set image on site wallpaper on android phone. better explain im doing. website have example 50 images of , when user clicks on 1 of photos website ( if possible ) invoke android " set background " process. set download phone , user goes , selects photo wallpaper download folder on phone. thank in advance vick s. interesting question. in android, java runtime environment being run inside os, , in order execute commands wish make, rooting os way, , can done in java. so, if in shoes, i'd drop idea of rooting command line android via html - on onto java side. in other words...yes, possible. but, end-users have phone/mobile pre-set guard against rooting commands, ask permission owner. if owner clicked yes, in game. hardest pa

sql - How to use IF Else in store procedure? -

i trying execute select query id parameter, if id empty want rows, otherwise row contains id, far, have created store procedure, if(@custid = null) begin select * tblcustomer end else begin select * tblcustomer custid=@custid end when executing query id, getting result when passing, not getting result. what's correct way this? null handled differently other values, need use if (@custid null) your current code of if(@custid = null) evaluate false, else case executed regardless of pass @custid . this article goes more detail how handle null values:

c - Using fscanf to scan a value or use default if no value exists -

i have function read text file following format string int int string int int string int int i want write function assign values text file variables, there cases format of text file be string int string int string int in case, i'd set value of last int variable 1. code have far works first example i'm bit stuck on getting second scenario work: void readfile(linkedlist *inlist, char* file) { char tempname[30]; int temploc, tempnum; file* f; f = fopen(file, "r"); if(f==null) { printf("error: not open file"); } else { while (fscanf(f, "%s %d %d\n", tempname, &temploc, &tempnum) != eof) { insertfirst (inlist, tempname, temploc, tempnum); } } } in second case, fscanf return 2 instead of 3. can rewrite code this: while (1) { int ret = fscanf(f, "%s %d %d\n", tempname, &temploc, &am

python - Find b'' in command output? -

i'm trying find specific string command output in terminal. doesn't work however. here command i'm running: check = subprocess.check_output("netctl list | sed -n 's/^\* //p'", shell=true) that brings 1 of 2 things. if not connected, returns b'', otherwise returns b'$networkname\n'. the code i'm using check follows: p = re.compile(r"\bb''\b") if p.search("b''"): print("false") return false else: print("true") return true however, returns true no matter what. i've tried: if check == "b''": but returns true no matter what. i'm losing mind here. causing not work? thanks in advance, cody the fact should looking empty bytes literal b'' , not string "b''" . if check == b'':

angularjs - File pick with Angular JS -

i pick file angularjs: html: <div ng-controller="topmenuctrl"> <button class="btn" ng-click="iscollapsed = !iscollapsed">toggle collapse</button> <input type="file" ng-model="filepick" ng-change="pickimg()" multiple /> <output id="list"></output> </div> javascript: angular.module('plunker', ['ui.bootstrap']); function topmenuctrl($scope) { $scope.pickimg = function() { alert('a'); }; } how can bind input file onchange action on angularjs pickimg function? , how can manipulate files uploaded after? angular doesn't yet support ng-change input[type=file] have roll onchange implementation yourself. first, in html, define javascript onchange follows: <input ng-model="photo" onchange="angular.element(this).scope().file_changed(this)" type="file" acc

Explicitly setting iVar class in Ruby (ala Obj-C) -

i'm experienced obj-c/java programmer, , getting ruby. fact it's dynamic great (re-opening classes awesome!) there's 1 thing bugs me/worries me when start writing ruby code. i'd interested know ruby-ers (if anything) explicitly set type of ivars in own classes. can see, can set ivar object , ruby won't complain. if expect specific ivar of type, can cause problems down line. example: class mystring def initialize(mystring) @mystring = mystring end def uppercase_my_string @mystring.upcase end end st1 = mystring.new("a string!") st1.uppercase_my_string st2 = mystring.new(["a string"]) st2.uppercase_my_string this code throw nomethoderror , since of course array has no method upcase . unfortunately doesn't tell went wrong (the line above, when creating str2 ) we're not helped when debugging (if str2 happens created several modules away in inconspicuous place) 1 natural step might add checks initialize follows: