Posts

Showing posts from August, 2012

javascript - create jumping effect for an object -

here created grass object , has 2 methods jump , fall.it jumps when user presses key on keyboard.it jumps ,its alright.but want fall previous position.. i have created keypressed variable value either true of false.it determine boundary how high object can jump. the object should fall previous position after each jump.which can't manage do.. also jump not realistic enough ...how problems can solved jsfiddle link image full code: <html> <body> <canvas id="mycanvas"></canvas> <script> var canvas=document.getelementbyid("mycanvas"); var ctx=canvas.getcontext('2d'); canvas.width=500; canvas.height=500; canvas.style.border="1px solid black"; var keypressed=true; var img=new image(); img.src="grass.jpg"; function grass(x,y){ this.x=x; this.y=y; this.image=img; } grass.prototype.draw=function(){ ctx.drawimage(this.image,this.x,this.y); } grass.prototype.hop=function(){ this.y-

angularjs - Directive listening for click event with 3 paramaters -

i have directive listening click event , picking parameter values 3 values showing in debugger param 1's value, param 2 & 3 being undefined. html: <div my-directive data-ng-click="(vm.id, vm.title, vm.name)"></div> directive: .directive('mydirective', ['config', function (config) { // ... link: function (scope, elem, attrs) { // ... // click event elem.bind('click', function () { attrs.$observe('onclick', function (param1, param2, param3) { // ... how should ng-click parameter values in html written values picked individually directive? html: <div my-directive data-ng-click="clickme();" data-param1="samplea" data-param2="sampleb" data-param3="samplec"> </div> directive: .directive('mydirective', ['config', function (config) { .............. link: function (sc

python - Removing a row in a numpy recarray -

is there convenient way delete row containing value in recarray? have following array, a=numpy.array([(1.0, 2.0, 3.0), (4.0, 5.0, 10.0),(1.0,10.0,4.0)], dtype=[('a', '<f8'), ('b', '<f8'), ('c', '<f8')]) and wanted remove rows 10 in b column output is ([(1.0, 2.0, 3.0), (4.0, 5.0, 10.0)], dtype=[('a', '<f8'), ('b', '<f8'), ('c', '<f8')]) is there quick way this? just pull out relevant rows of original array: new_a = a[a["b"]!=10.0]

php - Code to get file size after upload and insert into table is not working -

i have mysql/php project has files table creates virtual folders , links uploaded files, upload , accessing works fine, have added field 'size' , have amended code update file size after upload table, code not working. no errors , file still gets uploaded code inserting null value relevant field. code below: global $dal; $tbldocs = $dal->table("doc_files"); $filearray = my_json_decode($values["file"]); for($i = 0; $i < count($filearray); $i++) { $tbldocs->value["parent_folder_id"]=$_session["current_folder"]; $tbldocs->value["file_type"]="file"; $tbldocs->value["file"]=my_json_encode(array($filearray[$i])); $tbldocs->value["hash"]=generatepassword(hash_length); $tbldocs->value["name"]=$filearray[$i]["usrname"]; $tbldocs->value["ownerid"]=$_session["user_id"]; $tbldocs->value["created"]=now(); $tbldocs->value[&qu

random - Python how to check if something is in a list -

i making multiple choice game in python have variable selects random number. when next box clicked, want random number change every time button clicked. also, want append random list , check if random in list. if so, random changes again different number, questions don't repeat. i want change random random number again, integer has no attribute randint. how check see if random number in list? i have if statement tell me if clicked already, need figure out how change random again after startup. your problem, clear error message should have included in question, like: import random # 'random' refers module ... random = random.randint(...) # 'random' refers integer now can't access of functionality of random module. why on earth that?! give variable different name module. random_choice = random.randint(...)

Converting SQL into coldfusion for DateDiff -

i have date field have manipulate, have query gets , query have assign variety of things, 1 of late counters. accomplish have calculate less or equals 90 days or greater or equals 90 days. how can this the answer below not looking for all dates last 90 days? select updatedate active xxxdate >= <cfqueryparam cfsqltype="cf_sql_date" value = "#dateadd('d', -90, now())#"> , xxxdate < <cfqueryparam cfsqltype="cf_sql_date" value = "#dateadd('d', 1, now())#"> note this: cfsqltype="cf_sql_date" will strip time portion away results of datediff function result.

ios7 - which method iOS will call when enter by notification? -

when app in background , ios notification, after use type notification enter app, method ios call? because need open view controller after user tap notification enter app. - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo the above method can not distinguish app opened background. if app receives notification while in foreground , application:didreceiveremotenotification: called. however, when app in background , it's launched tapping on notification, application:didfinishlaunchingwithoptions: called launch option having key named uiapplicationlaunchoptionsremotenotificationkey . value of key nsdictionary payload of remote notification. hope answers question. ps. nice article on uiapplicationdelegate launch options

How to pull transaction reports through FirstData API? -

i have been rummaging through api docs , website cannot seem find information on pulling transaction reports firstdata api. interested in getting transaction report data similar found here: https://firstdata.zendesk.com/entries/407573-first-data-global-gateway-e4-web-service-transaction-search-and-reporting-api i using global gateway , cannot seem access e4 web service. have idea can find information or sample code? so turns out need e4 gateway. can sign demo gateway here: https://firstdata.zendesk.com/entries/21510561-first-data-global-gateway-e4sm-demo-accounts that page has of information required testing including demo credit cards , endpoint urls. can see how request reporting identified in link in original post above. ( https://firstdata.zendesk.com/entries/407573-first-data-global-gateway-e4-web-service-transaction-search-and-reporting-api ) this took forever find, appears global gateway not provide level of functionality.

html - Hyperlinks not working on navigation bar - not clickable -

Image
my links not working on navigation bar. cannot figure out i've done wrong. code. html: <div id="menu" <ul> <li><a href="http://kerryaltmantest.info">home</a></li> <li><a href="http://kerryaltmantest.info/aboutme.html">about me</a></li> <li><a href="publications">publications</a></li> <li><a href="location">location</a></li> <li><a href="strategicinteractions">strategic interactions</a></li> </ul> and css: #menu { width: 950px; height: 35px; font-size: 20px; font-family: cambria, georgia, sans-serif; font-weight: bold; text-align: center; background-color: #fff; border-radius: 0px; margin-top: -175px; margin-left: 25px; } #menu li { display: inline; padding: 20px; } #menu { text-decoration: none; color: #2b297f;

java - Error: Cannot assign requested address: JVM_Bind -

when used inetaddress addr = inetaddress.getbyname("192.168.1.104"); listen_socket = new serversocket(port,5,addr); then works fine but when use dynamic ip inetaddress addr = inetaddress.getbyname("114.143.95.69"); listen_socket = new serversocket(port,5,addr); the following error thrown error: cannot assign requested address: jvm_bind what should resolve problem? your dynamic ip address of router, not ip address belonging nic of localhost. use "0.0.0.0", or null inetaddress, parameter.

user interface - C# method failing to function for no known reason -

i'm taking programming class , learning c#. 1 of assignments have program run graphical user interface has text box input, text box output, , button copies whatever number in "input" text box , pastes output text box. reason method computebtn_click , method read number in input , put in output, doing absolutely nothing me, using method name computebtn_click_1 worked great. idea why? here code(without using.system stuff): namespace windowsformsapplication1 { public partial class form1 : form { public form1() { initializecomponent(); } private void exittoolstripmenuitem_click(object sender, eventargs e) { } //exittoolstripmenuitem1 method //purpose: close window , terminate application. //parameters: object generating event , event arguments. //returns: none void exittoolstripmenuitem1_click(object sender, eventargs e) { this.close();

Remove first occurence in array using jQuery -

i trying delete array first occurence, not elements searched element array like: groupedobjects: [ { value: 125, currency: "eur" }, { value: 100, currency: "usd" }, { value: 100, currency: "usd" }, { value: 320, currency: "ron" } ] the code using solve problem is: var newarr = $.grep(amount, function(item, idx) { return item.currency == currency || item.value == val; }, true); amount = newarr; the problem code using it, delete occurences found, not first 1 can me? $.each(amount, function(idx, item) { if (item.currency == currency || item.value == val) { amount.splice(idx, 1); // remove current item return false; // end loop } }); demo

Bootstrap 3 modal responsive -

i have modal it's not resizing on smaller screens ( tablets, etc ). there way make responsive ? couldn't find information on bootstrap docs. thanks i update html code: ( inside django loop ) <div class="modal fade " id="{{ p.id }}" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true" > <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title" id="mymodallabel">producto</h4> </div> <div class="modal-body"> <h5>nombre : {{ p.name}}</h5> </div> <div cl

visual studio - "OPTLINK : Error 118: Filename Expected" error for VisualD -

i have been trying setup visuald visual studio 2013 shell without luck. error trace is: debug\consoleapp.exe not date: command line changed ------ build started: project: consoleapp, configuration: debug win32 ------ building debug\consoleapp.exe... optlink (r) win32 release 8.00.15 copyright (c) digital mars 1989-2013 rights reserved. http://www.digitalmars.com/ctg/optlink.html optlink : error 118: filename expected path=d:\dirs\installed\dlang\d\dmd2\windows\\bin;c:\program files (x86)\microsoft sdks\windows\v7.0a\\\bin;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;d:\dirs\installed\sbt\\bin;d:\dirs\installed\dub;d:\dirs\installed\dlang\dmd2\windows\bin;d:\dirs\installed\dlang\dm\bin;"c:\program files (x86)\windows kits\8.1\windows performance toolkit\";"c:\program files (x86)\microsoft sdks\typescript\1.0\";d:\dirs\installed\dlang\d\dmd2\windows\bin;d:\dirs\installed\dlang\d\dm\bin;c:\windows\system32

ios - Is it possible to achieve string localization inside of a statically linked lib? -

i working on building sdk built out statically linked library third party applications can drop in applications. inside of sdk, looking able perform "localization." basically, code in sdk able access ".string" files perform string lookup , language translation capabilities. propagate these strings outward implementing app layers through exposed api's. possible? thought have been trying, having doubts. you can make specific api make localized strings fed static library. 1 way achieving defining predefined key value pair library strings , ask end user provide localized files if new language needs supported.

python - How to stop matplotlib.pyplot.show() from removing all figures? -

after plotting several figures matplotlib , can keep track of figures plt.get_fignums() . if call plt.show() , plt.get_fignums() return empty list. afterwards, when call plt.show() , ignored. question: there equivalent function plt.show() show figures in maintained matplotlib not affect internal state of matplotlib , can called multiple times same results? i know that for fn in plt.get_fignums(): plt.figure(fn).show() will job. there built-in solution?

stack overflow - Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -3 -

i'm new java , know there more posts 1 can't apply them code current limited understanding of java. using eclipse.exe want program work operators , kinds of brackets when type expression please me got wrong~(sorry english bad) still have problem java.lang.stringindexoutofboundsexception package hww3; import java.lang.character.subset; import java.util.scanner; public class demo { public static void main(string[] args) { // todo auto-generated method stub scanner s=new scanner(system.in); system.out.print("ìž…ë ¥: "); calculator cal=new calculator(); string susik=s.nextline(); system.out.println(susik); cal.process(susik); } } class calculator{ public void process(string susik) { susik=susik.replaceall(" ", ""); double result=calculate(susik); system.out.println("="+result); } private double calculate(string susik) { sy

parameters - typecasting to custom object - is data lost? -

i created custom uibutton object nsinteger property, assign enum value identification purposes. using .tag property else, created custom class. i had pass custom class function accepts uibutton parameter , returns uibutton. typecast button typing this: self.clockinbutton = (pacustombutton *)[self changebuttonimage:(pacustombutton *)self.clockinbutton withimage:@"white_square_small"]; when button method, lose custom buttonname property? conform uibutton or keep custom properties? edit fyi, im not looking solution problem. im asking informational purposes. solution (in case), write new function did same thing intended custom button instead of basic uibutton. however, if want offer alternative solutions, welcome. want make sure original question answered you can cast object whatever want. not change true type of object is. can assign uibutton subclass regular uibutton reference, not turn subclassed button else. key thing remember here difference between po

javascript - Uncaught TypeError: Cannot read property 'val' of null -

i'm new jquery , i'm getting error "uncaught typeerror: cannot read property 'val' of null" when try following. i'm trying call function check if value of textbox null , assign zero, calling id of function. know can assign directly, there many of them, feel calling function way go. here's code it: function fn_save { function fn_nullconvertor(input1) { if (document.getelementbyid("input1").val == "") { document.getelementbyid("input1").val == 1; } } if (confirm("save?")) { fn_nullconvertor(txtnum_tracks); var params = { num_tracks: $.trim($("#txtnum_tracks").val()) } } } thanks time, appreciate it! there 5 problems: the fn_save missing () there no element input1 id or code getting executed before dom ready. there no .val property htmlelement . .value you using == assignment according thi

javascript - fit images with different aspect ratios into multiple rows evenly -

good morning. first, in advance! i've been stack overflow spectator quite while, , guys great. i looking create photo layout webpage www.eden-koru.com, photos presented in rows. due cropping, , different cameras, each photo may have different aspect ratios , therefor there many uneven gaps when placed in row. a perfect example of want www.flickr.com/childe-roland. photos, laid out despite aspect ratio. on different, similar question found 80% solution jsfiddle http://jsfiddle.net/martinschaer/ajtdb/ : var container_width = $('#container2').width(); var container_width_temp = 0.0; // must float! var container_height = 100.0; // random initial container heigth calculations $('#container2 img').each(function(){ var newwidth = (this.width / this.height) * container_height; this.width = newwidth; $(this).data('width', newwidth); container_width_temp += newwidth; }); $('#container2 img').each(function(){ this.width = $(

Grails REST with @Resource - PUT is not updating -

i'm learning grails (2.4.0) right , have weird problem automatically generated rest methods. so, have simple domain @resource(uri = '/unit', formats = ['json']) class unit { string name; } i can list/create/delete instances get/post/delete methods, put method nothing: curl -i -x put -h "content-type: application/json" -d '{"name":"fail", "id":65}' localhost:8080/app/unit/65 http/1.1 200 ok server: apache-coyote/1.1 location: http://localhost:8080/app/unit/65 content-type: application/json;charset=utf-8 transfer-encoding: chunked date: sun, 01 jun 2014 09:25:02 gmt {"class":"app.unit","id":65,"name":"test"} subsequent requests return name:test instead of name:fail what can doing wrong? this bug relates updates (not newly created instances). have worked fix , have fix included in 2.4.1. see https://jira.grails.org/browse/grails-11462 . th

Open PHP without breaking JavaScript loop -

i'm iterating on table's values modify them if changes have been made user. currently have similar to: for (var = 0; < rows.length - 1; i++) { if (item[5]) { window.open("modify.php?id=" + id + "&delete=true"); } } my question how can connect modify.php file without breaking loop. tried with window.location("modify.php?id=" + id + "&delete=true"); too that's same story. i considered using window.open , setting new windows dimension's small appears hidden , closing again after php has finished executing. this seems ridiculously dumb hence why i'm wondering a/the better approach be? it sounds want using ajax here. conciseness, i'll show mean using jquery.ajax : for (var = 0; < rows.length - 1; i++) { if (item[5]) { $.ajax("modify.php?id=" + id + "&delete=true"); } } this sends asynchronous http request url provided. ajax ca

PHP to Javascript compare string with characters list -

i have php function compare username $value characters list: strlen($value) == count(array_intersect(array_map("strtoupper", str_split($value)), str_split("abcdefghijklmnopqrstuvwxyz0123456789_-"))) i need obtain similar using jquery. have problems array_intersect() @ moment, can't find similar function. answer. stack overflow has questions array intersection in javascript. you may interested intersection function in underscore.js . finally, wouldn't easier here use regular expressions? in php, code becomes simple as: $isvalidusername = preg_match('/^[a-z_\-]+$/i', $value); in javascript: var isvalidusername = (/^[a-z_\-]*$/i).test('hello_world');

C++ How do I to put this constructor in a cpp file? -

i have constructor in .h file c(std::string s = "",int = 0,double d = 1) { datamember1 = s; datamember2 = i; datamember3 = d; } if provide values of string, int , double use values, without them, use default ones. question how refactor put in .cpp file. when not refactoring works fine example if declare c object1("object1", 0, 1), object2; work, if refactor, object2 cause compile error saying don't have c() constructor fwiw: #include <iostream> #include <string> using namespace std; class c{ public: c(string a= "" , int foo=1, char bar=0); }; c::c(string a, int foo, char bar){ // can go .cpp file cout<<a<<foo<<bar; } int main() { c c("hi",1,'t'); return 0; } on ideone . but others stated should google "c++ tutorial "(actually deals similar in classes chapter) or read book . it'll lot frustrating,faster , fulfilling...

parsing - Python: End of File when writing a parser that reads multiple lines at a go -

i'm writing parser object , i'd understand best practice indicating end of file. seems code should this. myfp = newparser(filename) # package opens file pointer , scans through multiple lines entry while entry in myfp: yourcode(entry) i see raising exception better returning status call case seems handled differently. since parser reading multiple lines can't send result of readline() code chain, while loop runs infinitely in current implementation. def read(this): entry = '' while 1: line = this.fp.readline() if line = '\\': return entry else: entry += line return entry can show me how object structured on reading while loop exits in scenario? so here simplified example, since haven't indicated parser does. should @ least general concept. first, let's build generator yield tokens iterates across file. in simplified example, i'm going assume each t

Displaying dynamic images based on an Int value (for showing player's score on main menu) – JAVA/XML/Android/Eclipse -

disclaimer : i’m extremely new java/xml, please bear me. i’m using replica island source if there’s easier/newer way of doing this, please let me know. objective : display player’s score on main menu screen using .png numbers instead of text. why? because .png numbers more flashy/stylized standard text. currently : i’m capturing , displaying player’s score via int variable that’s saved , loaded in sharedpreferences . i’m displaying text via following: current xml : <textview android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:paddingtop="10dp" android:textsize="24sp" android:textcolor= "#ff0000" android:background="#99000000" /> current mainmenuactivity class: int mhighscorecoin = prefs.getint(preferenceconstants.preference_coins_collected, 0); textview text = (textview) findviewbyi

sql - referencing part of the composite primary key -

i have problems setting reference on database table. have following structure: create table club( id integer not null, name_short varchar(30), name_full varchar(70) not null ); create unique index club_uix on club(id); alter table club add constraint club_pk primary key (id); create table team( id integer not null, club_id integer not null, team_name varchar(30) ); create unique index team_uix on team(id, club_id); alter table team add constraint team_pk primary key (id, club_id); alter table team add foreign key (club_id) references club(id); create table person( id integer not null, first_name varchar(20), last_name varchar(20) not null ); create unique index person_uix on person(id); alter table person add primary key (id); create table contract( person_id integer not null, club_id integer not null, wage integer ); create unique index contract_uix on contract(person_id); alter table contract add constraint contract_pk primary

Scala String trimming by a set of characters -

given set of (trailing) characters, instance val s = "un".toset how trim string s , namely, "untidy stringnu".trimby(s) res: string = tidy string scala has dropwhile solves half of problem. has dropright that's analog drop right end of collection. unfortunately doesn't have dropwhileright , though, have creative. if don't particularly care efficiency, can drop characters off left end, reverse, repeat, , reverse again: scala> "untidy stringnu".dropwhile(s).reverse.dropwhile(s).reverse res0: string = tidy string if you're sure that's going bottleneck in program (hint: it's not), you'll want kind of imperative solution.

java - How to get my program to start over when the user hits "y" on -

so i've used system.out.print("enter more test scores? (y/n): "); yet when run , scores summarizes user isn't given chance again here code. guys think may have put in wrong place. public class testscoreapp { public static void main(string[] args) { // display operational messages system.out.println("please enter number of test scores entered"); system.out.println("to end program enter 999."); system.out.println(); // print blank line int scoretotal = 0; int scorecount = 0; int testscore = 0; int min = 100; int max = 0; int counter = 0; int setnumber = 0; string useranswer = "n"; scanner sc = new scanner(system.in); // series of test scores user outerloop: { // user enters number of test scores entered system.out.print("enter number of test sco

php - problems creating session with facebook api -

i have updated facebook api , i'm trying initiate session this, facebooksession::setdefaultapplication( 'foo foo','foo foo' ); i error on line, fatal error: class 'facebook\src\facebook\facebooksession'not found in /foo/foo/foo/header.php on line 41 my file path correct... any ideas? here full code, <?php error_reporting(e_all); ini_set('display_errors', 1); // include required files form facebook sdk // added in v4.0.5 require_once( 'facebook/src/facebook/facebookhttpable.php' ); require_once( 'facebook/src/facebook/facebookcurl.php' ); require_once( 'facebook/src/facebook/facebookcurlhttpclient.php' ); require_once( 'facebook/src/facebook/facebooksession.php' ); require_once( 'facebook/src/facebook/facebookredirectloginhelper.php' ); require_once( 'facebook/src/facebook/facebookrequest.php' ); require_once( 'facebook/src/facebook/facebookresponse.php' ); require_once(

php - Codeigniter customized user roles open specific pages only -

how define user privileges in ci opening specific pages? thinking calling database value every time open page , see if has right open particular page. if has no right show up, directly logged out. there many pages do. create function , check everytime open page. easiest way? thanks. you're on right track. query database on every page load, that's fine, , ideal if values change. alternatively, save privileges data session, , query session on page load (similar how check if user logged in). but there many pages do you can extend default ci_controller , add own code runs on every page. example, create new file called my_controller.php in application/core/ directory, , put code privileges check in __construct() function, runs automatically on every page load. application/core/my_controller.php class my_controller extends ci_controller { function __construct() { parent::__construct(); // check privileges here. like.. $

JavaFX editable ComboBox in a table view -

i using editable combobox cell in table view. here combobox cell class public class comboboxcell extends tablecell<classesproperty, string> { private combobox<string> combobox; public comboboxcell() { } @override public void startedit() { super.startedit(); if (combobox == null) { createcombobox(); } setgraphic(combobox); setcontentdisplay(contentdisplay.graphic_only); platform.runlater(new runnable() { @override public void run() { combobox.requestfocus(); combobox.geteditor().requestfocus(); combobox.geteditor().selectall(); } }); } @override public void canceledit() { super.canceledit(); settext(string.valueof(getitem())); setcontentdisplay(contentdisplay.text_only); } public void updateitem(string item, boolean empty) { super.updateitem(item

google bigquery - Failed to create view. Invalid field name -

this question has answer here: bigquery can't create view union tables containing timestamp fields 2 answers i trying save view. several of fields of type timestamp. following error message: failed create view. invalid field name "myfield.usec". fields must contain letters, numbers, , underscores, start letter or underscore, , @ 128 characters long. field name valid running query browser, , name "myfield" (the ".usec" appears in error message , represents type). when converting integer, no error. known bug? did wrong? thanks you need write as: select format_utc_usec(timestamp) timestamp ... also need de-reference nested record type fields views: select utm.campaign utm_campaign ...

ios - Make a UIVIew which appears on all .NIb files in xcode project -

i have uiview want make appear on controller have 5 controllers, 1 , 2 ,3 ,4 , 5 i have uiview on controller1 @ bottom contains 5 buttons want view appear on controllers, have searched didn't found reasonable solution, here please me out.i don't want make navigationbar because cannot add custom buttons on navigationbar. or there technique can make custom navigationbar? appear @ bottom, have uinavigationbar @ top you can put uiview 5 buttons in separate nib (im calling bottomnavigation in example) , add each controllers view this: uiview* containerview = [uiview alloc] initwithframe:cgmakerect(0, 440, 320, 40)]; //adjust rect needs [[nsbundle mainbundle] loadnibnamed:@"bottomnavigation" owner:containerview options:nil]; [self.view addsubview:containerview]; and if want set target-action buttons in containerview iterate through them (before add them subview self.view): for (uiview *view in containerview.subviews) { if ([view ismemberof

c# - XNA sound effect -

i have little problem sound effect. doesn't function because when play played around 500000 times in 2 seconds. take look here: soundeffect thunder; thunter=content.load<soundeffect>("thunder"); foreach (flash flash in flashes) if(flash.visible==true) if (time >1 && time <3) thunder.play(); //now sounds bad because played lot of times.. want played once! (the sound 5 sec long) hmm. simple this: foreach (var flash in flashes) if (flash.visible && time > 1 && time < 3) { thunder.play(); break; // play sound once }

c# - Delete hashs from line but keep string -

i writing program re-writes text file - needed remove line "#" in it, worked fine - need remove hashes keep string between hashes. example "#####texthere##### want texthere string... here code: string linedata = "#"; string copy = "rcpy"; string dash ="-------"; string total = "total"; string vv = "vvcp"; int count = 0; string name = "name"; // read file , display line line. using (system.io.streamreader file = new system.io.streamreader(textbox1.text)) { using (system.io.streamwriter writer = new system.io.streamwriter(@"c:\test4.txt")) { //while reader reads lines, perform re-write based on these conditions while ((line = file.readline()) != null) { line = l

html - is there any alternated method for anchor tag?(Deleted) -

this sample html page i'm using anchor tag inside need alternate method instead of anchor tag,could tell me. <body> <table><tr><td> <a href="http://www.w3schools.com">visit w3schools.com! <div></div> </a> </td></tr> </table> </body> thanks help. maybe use: <form method="get" action="foo.html"> <input type="submit" /> </form> the difference between 2 methods: <form method="link" > or <a>? what's difference?

python - Refreshing a package project in Eclipse PyDev -

i have pydev project organized (i have omitted .git directory). aim build package called stattests . | .gitignore | .project | .pydevproject | +---.git +---stattests | | setup.py | | | +---tests | | | tests.py | | | __init__.py | \---unittests tests1.py the top level directory stattests contains setup.py file, , sub-folder tests , module contains __init__.py imports functions tests.py in same module folder. note tests here not unit tests, statistical tests. unit tests contained in unittests folder, , looks this: # unittests/tests1.py stattests.tests import tests series1 = pd.series(np.random.randn(10)) tests.test1(series1) when execute testing script not refresh definition of stattests.tests.test1 function, , uses old definition instead. i have manually added folder , subfolders of project project pythonpath property. help appreciated. do have:

sql - IfNULL function in yii does not work -

in model wrote: $criteria->select = ' ( select avg( ifnull( tr.stars_rating_type_id , 0) ) stars_rating_type_id '.$tableprefix.'tour_review tr tr.tour_id = t.id , tr.status = \'a\' ) reviews_avg_rating '; and error : active record "tour" trying select invalid column "( select avg( ifnull( tr.stars_rating_type_id". note, column must exist in table or expression alias. the reason add "ifnull( ..., 0)" function in subquery escape "null" in result set. without have make additional verification , set 0 in case of null. if test raw sql " select ( select avg( ifnull( tr.stars_rating_type_id, 0) ) stars_rating_type_id..." works ok, problem yii side. how fix ? yii 1.1.14 thanks! take on manual: http://www.yiiframework.com/doc/api/1.1/cdbcriteria the select param receive columns search, not hole query

android - FramLayout : Fill empty space -

i have 3 framelayout in layout, first , third have fixed height (wrap_content of child views). and want second framelayout fill remaining space between first , third element. my xml : <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/root" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <framelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:orientation="horizontal" > // ... childs views fixed height </framelayout> <framelayout android:layout_width="match_parent" android:layout_height="0dp" <!-- fill remaining space --> android:layout_marginbottom="5dp" android:layout_ma

javascript - Angular directives - How to use JQuery to add ngModel and ngBind to custom directive elements? -

[info] trying achieve implement custom angular directives encapsulate js needed them work. directives unaware of displaying , store input value coming user. these information come attributes of directive. directives use parent scope , won't create own one. [problem] since directive not know in $scope map ng-model , ng-bind, approach read directive's properties, identify ng-model , ng-bing attributes shall , set them corresponding elements. not working. believe due lack of knowledge, asking here - if approach ok?; possible set ngmodel , ngbind in manner?; doing wrong?. [my directive's code] var directives = angular.module('test.directives', []); directives.directive("labeledinput", function() { return { restrict: 'e', scope: false, template: "<div>" + "<span class='label'></span>" + "<input class='input' type='text'>&l

openid - Design of IdM and SAML -

company has acquired company b. company & company b users have authenticated using federation. example, think company microsoft , company b skype. both microsoft(livemessenger) , skype has users registered im. microsoft has provide unified experience customers. how can solve problem using federation? there can be: 1) skype users 2) live users 3) live , skype users at end, customer should log in once , can log in skype or live messengers. should not ask login again. now, live service , skype service relying parties. skype , live expects application specific tokens rest based communication. as developer @ microsoft, understand need create idm. need migrate existing users live , skype idm? or should idm call user management service of live , skype in background? i understand need exchange saml token application specific token, how should done? need expose service endpoint @ skype , live services? there 2 sides problem: identity , entitlement management the f

c# - Convert array of string to array of double -

i have text file (.txt) decimal number : 0.3125 0.3 0.181818181818182 0.333333333333333 0.210526315789474 0.181818181818182 and want take these number array of double. here's code : double[] f1 = convert.todouble(file.readlines("decimal list.txt").toarray()); but , error of cannot implicity convert type 'double' 'double[]' file.readlines("decimal list.txt") .select(l => convert.todouble(l)) .toarray();

java - Jenkins Plugin development, use one global config for two builders? -

i have 2 builders within plugin developing, want them share same global config. have repeatable list of server details of can select server want use drop down in buildera's config. want same builderb's config, requirs me duplicating global config buildera , user filling out 2 lots of global config. is there anyway can access buildera's global config? or make buildera's global config global.... i found this: can 2 different jenkins builders exist in same hpi , share same global configuration? , copied it, test, doesnt tell how can globalfield1 in perform method of mybuildstepaclass. you can this. did selenium axis plugin needed name of selenium server kept in related class this in groovy easy convert. //so need @ name of selenium server in global config protected static descriptor<? extends complexaxisdescriptor> gettopleveldescriptor(){ seleniumaxis.descriptorimpl sad = jenkins.getinstance().getdescriptor(seleniumaxis.class) sad.load

.net - Get local migrations from assembly using EF Code First without a connection string -

so i'm stuck following situation, maybe guys can shed light on this: scenario our application exists of many client applications (winforms), each of use specific version of database model using ef code first migrations. client application has ability connect several different databases, support required schema client needs. next have 1 central service application. application responsible maintaining databases (creating/removing), , returning connection strings clients need access. client can send request central service create new database. 1 of arguments of call schema version needs (as string). problem lies: problem problem find out highest version of migration is, without providing connection string or database connect to. 1 use: var configuration = new migrationsconfiguration() { contexttype = typeof(corecontext) }; var migrator = new dbmigrator(configuration); var versions = migrator.getlocalmigrations(); but automatically results connecting database under hood