Posts

Showing posts from March, 2013

java - Code to tell whether a string is a Pangram or not? -

import java.io.*; import java.util.*; public class solution { public static final int n = 26; public int check(string arr){ // int count = 0; if(arr.length() < n){ return -1; } for(char c = 'a'; c <= 'z' ; c++){ if((arr.indexof(c) < 0) && (arr.indexof((char)(c + 32)) < 0)){ return -1; } } return 1; } public static void main(string[] args) { scanner s1 = new scanner(system.in); string s = s1.next(); solution obj = new solution(); int d = obj.check(s); if(d == -1) system.out.print("not pangram"); else system.out.print("pangram"); } } if string entered : "we promptly judged antique ivory buckles next prize" gives wrong output " not pangram" m not able find out wrong code thanx in advance ! the pro

ios - Xcode view transparent background without influencing subviews -

i want program custom keyboard textfield. background of keyboard should transparent, when try set alpha of keyboardview, alpha of subviews changes too. how can change keyboard's alpha only? don't want set [uicolor clearcolor]. keyboardview.backgroundcolor = [uicolor colorwithred:0 green:0 blue:0 alpha:0.5]; keyboardview.alpha = 0.2; keyboardview.backgroundcolor = [[uicolor clearcolor] colorwithalphacomponent]; changing view's alpha alters view , it's subviews. if want non-drawn parts of view show what's underneath, set view's opaque flag no , set background color clearcolor.

go - Why are struct literals "literal" -

in golang struct literals? why following literal though there variable? , aren't structs literally variable, when not const? how make sense. mytype{field: var) it has variable , yet it's "literal"? also why called "struct literal" when first initialize it? programming languages use word "literal" when referring sytactic ways construct data structure. means it's not constructed creating empty 1 , adding or subtracting go. compare: mytype{field: myvariable} to var x = new(mytype) x.field = myvariable the benefit code's appearance reflects data structure in way. downside have know layout in advance , have content initialized already, not possible, if instance, you're constructing map unknown keys.

java - Insert into database AsyncTask error -

i make android application on movies. have database movies. in application display movies in listview , add new movie. have problem when try insert in database new movie. indeed, have n error in asynctask in doinbackground don't know why. when use debugger, have reject on begin of doinbackground @ line : string title = etitle.gettext().tostring(); so give java code : public class addmovie extends activity implements onclicklistener{ // edit , button user fill private edittext etitle, eactors, edirector, ekind, edate, eimage, esummary ; private button badd; // progress dialog private progressdialog pdialog; //json parser class //jsonparser jsonparser = new jsonparser(); private static final string tag_success = "success"; private static final string tag_message = "message"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.acti

Android Studio does not detect my Moto G -

i've connected phone in camera mode, have installed latest motorola drivers https://motorola-global-portal.custhelp.com/app/answers/detail/a_id/88481/action/auth . , i've installed avd http://forum.xda-developers.com/showthread.php?t=2588979 my device not showing in available devices when try testing app. please help. enable usb debugging on device (developer options).

javascript - On click function appears to be active after element removal -

i'm making program finds shortest path in graph, program created on click appending divs container. main program appears work intended, problem arises when remove program , start again. functions appear execute 2 times. you can see problem on http://runaider.github.io/ click "path finder" create vertexes, click "path finder" again , try create vertexes again you'll see problem. i tried using .remove(), .unbind(), .cleandata() nothing helps. this 1 of functions spoke of $(document).on ("click", "#b1", function () { count++; alert(count); $('.mainfield').append( $('<div class="vertex">').attr("id","v"+count).text("v"+count) ); jsplumb.draggable('v'+count, {containment:"parent"}) }); this how remove the objects: function dispandgraphfield(){ jsplumb.detacheveryconnection(); $('.mainfield').animate({opacity:0},1

Jersey 2.x Restlets - apply governance control (like limit on number of requests allowed for restlet resource) -

i have been reading jersey 2.17 user guide possibities around applying governance limits on exposed restlet resources. particularly interested in applying limits on incoming requests particular jersey restlet resource particular client consumer (for example: want allow 10 requests per 30 second particular source). please let me know if has feasible approach in mind based on experience native api capabilities. in advance! what can achieve restlet use apispark extension . this similar question should answer question: limit request on restlet resource apispark restlet extension where can this: firewallrule rule = new periodicfirewallcounterrule(60, timeunit.seconds, new ipaddresscountingpolicy()); ((periodicfirewallcounterrule)rule).addhandler(new ratelimitationhandler(new uniquelimitpolicy(10))); firewallfilter firewallfiler = new firewallfilter(getcontext(), list(rule)); firewallfiler.setnext(router); to limit access app's restlet server resources. hope helps

Not able to connect to Azure Virtual Machine using Remote Desktop after my VM got restarted -

today, azure subscription credit has expired , vm got shutdown automatically. have added credit , activated account , restarted virtual machine. now, not able remote login vm using remote desktop before. have checked endpoints "remote desktop (tcp, 3389, 3389)" , exist. , check vm status , running. when tried login using remote desktop says "remote desktop can’t connect remote computer 1 of these reasons: 1) remote access server not enabled 2) remote computer turned off 3) remote computer not available on network" kindly me resolve issue. thanks in advance sundar check machine ip address. becuase ip changes after shutdown.

javascript - Serve stylesheet from Rails asset pipeline on nginx error 495 (bad client certificate)? -

i have basic rails application layout, with <%= stylesheet_link_tag 'application', media: 'all' %> <%= javascript_include_tag 'application' %> using nginx, i'm asking optional client certificate: ssl on; ssl_verify_client optional; when client connects bad certificate (expired, not yet valid, or not trusted, example) nginx responds weakly generic page reading, "the ssl certificate error". to provide reasonable user experience, tell nginx: error_page 495 /actual_useful_information.html; but lose stylesheets , javascripts, when browser loads page , follows links of rails layout, certificate still bad , stylesheets not forthcoming. is there solution serve styled page making use of layout? there way inline assets pipeline (for 1 case)? having javascript in there nice too, @ least, how styles. i found own answer: <% if @inline_assets %> <script><%== file.read("public#{javascript_path(

c# - How to get notified about the deletion of a directory watched by FileSystemWatcher? -

i informed if monitored directory gets deleted (/renamed/moved). perhaps following pseudo c# code helps understand problem: bool called = false; var fsw = new filesystemwatcher(path); fsw.error += delegate(object s, erroreventargs args) { assert.that(args.getexception() ioexception); called = true; }; fsw.deleted += delegate(object source, filesystemeventargs e) { assert.that(e.changetype, is.equalto(watcherchangetypes.deleted)); called = true; }; directory.delete(path); thread.sleep(1000); assert.that(called, is.true); if call waitforchanged method ioexception returned there way notified problem? the mono implementation on linux works fine , returns deleted event. .net implementation on windows seems differ in behaviour. you create second filesystemwatcher, 1 level up, , set filter , notifyfilter monitor directory , events interested in.

jquery - Bootstrap Carousel not working in IE -

i have carousel fades next slide. works fine in chrome , firefox doesn't seem fade in or out in ie. suggestions on how fix this? here code similar mine: html: <div id="carousel" class="carousel slide carousel-fade"> <ol class="carousel-indicators"> <li data-target="#carousel" data-slide-to="0" class="active"></li> <li data-target="#carousel" data-slide-to="1"></li> <li data-target="#carousel" data-slide-to="2"></li> </ol> <div class="carousel-inner"> <div class="active item"></div> <div class="item"></div> <div class="item"></div> </div> <a class="carousel-control left" href="#carousel" data-slide="prev">‹</a> <a class="carousel-control right" href="#carousel&qu

r - Rscript Linux timestamp to ISO Date format -

how can take linux timestamp , convert following string format? linux time = 1426644063000 iso date format = "2015-03-18t02:01:03.000z" strptime might 1 option there simpler solution? thanks this how solved it: x <- 1426644063000 format(as.posixct(x/1000, origin="1970-01-01", tz="utc"), "%y-%m-%dt%h:%m:%sz") output: "2015-03-18t02:01:03z"

asp.net - Display data of the field in a Label using Function -

i have around 14 pages 6-10 questions on each true , false answers, written db 1 , 0. i have created summary page printable contains 14 pages 6-10 questions on each want display answer question via label i bad @ vb.net , sql on great i managed first 1 working, display "yes or no" second 1 doesn't work is able formulate function can call single line of code each label instead of having ton of if statements? i'm super bad @ sql , vb , have hardly experience appreciated. this code have, please edit needed (if right?) imports system.data imports system.data.sqlclient public class draftprint inherits system.web.ui.page dim con new sqlconnection dim comm_id string protected sub page_load(byval sender object, byval e system.eventargs) handles me.load comm_id = request.querystring("comm").tostring con.connectionstring = "data source=yk15-ykc0201;initial catalog=testing;integrated security=t

c++ - What's the usecase of volatile operations on std::atomic<T>? -

this question has answer here: why volatile qualifier used through out std::atomic? 3 answers there has been lot of debate going on concerning usefulness of volatile in multi-threaded code. people agree, principal usecases of volatile bare metal applications such device drivers , interrupt handlers, not make variable of built-in type thread-safe. in fact, volatile has lead confusion because of this. however, has been added function overloads of std::atomic<t> types, suggests there usecase this. usecases of these operations? there general usefulness volatile in sense compiler must not optimise away accesses variable. however, in case, think it's because input may volatile - in case of const , can "add" not "remove" volatile attribute passed in paramater. thus: int foo(volatile int *a) { ... } will accept: int

ruby on rails - rspec controller test for json api : ActionController::RoutingError -

just simple question render json call i'm trying test. i'm still learning rspec, , have tried , can't seem work. keep getting actioncontroller::routingerror, though defined route , call api works. in controller have method: class placescontroller < applicationcontroller def objects @objects = place.find(params[:id]).objects.active render json: @objects.map(&:api) end end with render json: @objects.map(&:api), i'm calling api method in object model class object def api { id: id, something: something, something_else: something_else, etc: etc, ... } end end my routes file: get "places/:id/objects" => "places#objects" my rspec: spec/controllers/places_controller_spec.rb describe "objects" "get properties" m = factorygirl.create :object_name, _id: "1", shape: "square" "/places/#{m._id}/objects", {}

angularjs - $location.search() setter not causing reload in ui-router -

with ngroute , using $location.search() setter cause route reload , can turn off behaviour reloadonsearch: false . however if swap ngroute code above ui-route code, controller no longer gets reloaded. how can trigger route reload in ui-router while keeping query parameters in url ngroute? edit: need keep queries in url, , unchanged after route reload because want user able bookmark it. /?people=bob&people=james&people=pete...&color=red&color=blue...etc script.js angular.module('app', ['ui.router', 'ngroute']) // .config(['$stateprovider', '$urlrouterprovider', function($stateprovider, $urlrouterprovider) { // $stateprovider // .state('home', { // url: '/', // templateurl: 'page1.html', // controller: 'mycontroller' // }); // $urlrouterprovider.otherwise('/'); // }]) .config(function($routeprovider, $locati

python - How to count a field and this same field but filtered, in one query in Django? -

i'm not web developper sorry title of question doesn't make sense. to make things easier, here models (i stripped non necessary fields demonstration): class user(models.model): username = models.charfield(max_length=100) class vote(models.model): user = models.foreignkey(askfmuser) date = models.datetimefield('vote date') and in view, need list users, number of votes received, ordered votes. have no problem doing this, query : global_votecount = vote.objects.all().values('user', 'user__username').annotate(votestotal=count('user__username')).order_by('-votestotal') and in template, display on table 2 columns (username, , vote count). but need do, display total vote count received time, also, in same html table, name of votes received today . i know can votes today query: now = timezone.now() today_votecount = vote.objects.filter(date__year=now.year, date__month=now.month, date__day=now.day).values('user

javascript - How do websites end up breaking middle-click functionality? -

by default, middle-click open link in new tab. some sites end breaking functionality. middle-click ends being same left-click. why happen? because program functionality click event, , erroneously have apply clicks instead of left-click? is problem solved explicitly giving behavior middle-click? or making existing click behavior code apply more narrowly? overview: it easy inadvertently prevent middle-click functionality in webkit browsers. in webkit browsers such chrome, safari, , modern opera, middle-clicking on link fires preventable click event. behavior differs firefox , ie, middle-clicking link not fire click event. there an open bug report 2008 on issue , unfortunately not appear have gone anywhere in last 7 years. problem code: so let's take @ how easy break functionality in webkit browsers while doing ordinary. var link = document.getelementbyid('link'); link.addeventlistener('click', function(e) { e.preventdefault();

radius - FreeRadius + PHP Configuration -

i'm trying configure freeradius authenticate using php script. i've been messing around trying get server authenticate based on script, can't find documentation on doing way. this we're trying configure. we have web server, has wordpress site installed on thousands of users. we're wanting install wifi service @ locations uses freeradius authentication , want allow users signed on wordpress site use credentials. the problem i'm facing right can't seem freeradius authenticate based on php script. this i've configured far based on other stackoverflow posts have mentioned configuration. i've created following file in /etc/modules/php , added this exec php { wait = yes program = "/usr/bin/php -f /etc/raddb/myscript.php" input_pairs = request output_pairs = reply } in /etc/raddb/sites-enabled/default i've added following: authenticate { auth-type php { php } } in /etc/raddb/users i've added

java - Designing API for writing to file -

i have networking library can configured write traffic parsed strings specified file. in other words, had method signature this: public void setfiletowriteto(file file) and intent user can later, either manually or programmatically, read file string , perform more operations. realized user may not want write file. furthermore, having lot of trouble writing proper unit tests because can't find way mock file.class. alternative design should use both flexible user , testable on end? have considered allowing user pass in outputstream or writer instance instead of file not sure best. thanks! ask user pass outputstream . if necessary, can later overload method , ask them pass writer . both of these systems included in java.io see no reason write own.

java - Auto scaling few Components at the same time -

saying going make game moving ball on background image , few obstacles. have jpanel on left side few buttons. made jsplitpane buttonpanel on left side , try make part game on right side of jsplitpane. i hava part game auto scaling both background , obstacles whenever change size of window. (background, , obstacles in diffrent classes extends jpanel). how make auto scaling together?? please :) appreciated. sorry english it's not native language, still learning ;-)

php - How do I `use` a namespace in Yii and HAML? -

i'm using mthaml , yii. have following lines. -use yii\helpers\url %a{:href => url::toroute(['shopping/ping', 'id' => (string)$item->productid, 'category' => (string)$item->primarycategory->categoryid])} test however gives error. syntax error, unexpected 'use' (t_use) <?php function __mthamltemplate_65307eb071e28021db686cb46d491c8faae477235051858b05f212731637dd40($__variables) { extract($__variables); ?><?php use yii\helpers\url; ?> i fixed bug today. update package running: composer update or download latest release 0.1.3 github

Javascript random array -

var title = 'a', 'b'; var length = 326, '424'; how random pick options , make sure if picks 'a' needs pick '326' , how assign them number? for instances if picks automatically needs 326 , need give var title1 = (picked number) var length = (picked number) and other didn't pick need make var title2 = (title didn't pick) var title2 = (didnt picked length) you can create own object: data=new array(); data[0]=new data('a',326); data[1]=new data('b',424); function data(title,length) { this.title=title; this.length=length; return this; } console.log(data); now need choose random element data array. access values use: data[0].title data[0].length for example.

php - Zend Routing -- Grabbing Variables from URL with Ampersands and not Slashes - Tapjoy -

i'm creating attempting integrate tapjoy api callback url request comes in form: <callback_url>?snuid=<user_id>&currency=&mac_address=<mac_address>&display_multiplier=<display_multiplier> however, using zf1 -- zend_controller_router_route seems dependent on variable separation being delimited slashes , not ampersands. here current route code > $router->addroute( 'api-tapjoy', new zend_controller_router_route('api/tapjoy?snuid=:snuid&mac_address=:&mac_address&display_multiplier....etc.etc, array('controller'=>'api', 'action' =>'tapjoy'))); whenever remove ampersands , initial question mark , replace them slashes works. how can receive http request whilst using ampersands? looks figured out. has nothing ampersands , slashes, etc. rather route wasn't created properly. i thrown off this documentation on zf1's website routers: the first para

php - database doesn't allow special chars even after using mysqli_real_escape_string -

i have found lots of question @ so , followed solution,but didn't work in case. i want insert + database,so have used $tex5=mysqli_real_escape_string($connect_dude,$_post['text5']); but doesn't insert + .it gives empty space(whitespace) in database. please informed,i'm using prepared statement , parameterized query .is reason why database doesn't allow + ?if yes,then how can fix this? thanks time. code javascript //call con_edi() on first button clicked.insert email on text field , click button fire off change5() function con_edi(){ document.getelementbyid("alu").innerhtml="<input type='text' id='taxi' style='border:1px solid black;'><input type='submit' id='' onclick='change5(taxi.value)' value='change'>"; } function change5(s){ var form=s; if(!form.match(/^[a-za-z0-9_.+-]+@[a-za-z0-9-]+\.[a-za-z0-9-.]+$/)){ alert("wrong ema

Swift Delegate (contactDelegate) explanation -

i've research lot on delegate means somehow understand doesn't fit explanation. tutorial: physicsworld.contactdelegate = self and explanation: "this sets physics world have no gravity, , sets scene delegate notified when 2 physics bodies collide. " i thought delegate class uses protocol. have different explanation this? line do? thanks. (ignore gravity part, there's line of code) a delegate is protocol, called "delegate protocol". class containing quoted line of code becomes delegate , gets messages of protocol in question. physicsworld contact delegate inform of collision. if delegate methods implemented (i.e. controller conforms delegate protocol), can take appropriate action when notified. clear?

javascript - Store file content in a table(html table tr td) jquery -

i wanted insert multiple files in database uploading/adding each file content table after adding files table add tables' value including file content in form data pass ajax. tried var file = $('#file')[0].files[0]; //var file = document.getelementbyid('file').files[0]; var name = file.name; var size = file.size; var type = file.type; var blob = new blob([file], { type: "application/octet-binary" }); var filecontent = blob; here used value of filecontent passed ajax in php condition if(!empty($_files) remaind false) and on console.log filecontent looks [object blob] want achieve primary goal store database asked question it. can found here problem why asked first one. my question how store file content variable in case store value of $('#file')[0].files[0] file . update when used value of var file = $('#file')[0].files[0]; still same error update is possible store input:file table td or input or any other eleme

Starting tomcat7 service on OpenShift error -

was able stop tomcat 7 service on openshift, trying start gives error: /etc/init.d/tomcat7 start starting tomcat7: touch: cannot touch /var/run/tomcat7.pid': permission denied chown: cannot access /var/run/tomcat7.pid': no such file or directory /etc/init.d/tomcat7: line 181: /var/log/tomcat7-initd.log: permission denied [failed] permission denied /var/log cannot check/change /var/log/tomcat7-initd.log permissions. no permission sudo either. any ideas welcome. i deleted , recreated openshift application.

windows - Create custom keyboard layout with AutoHotKey (or something else) -

i'm looking create custom keyboard layout, typing unicode math symbols. symbol set need large, , scheme came involves multiple layouts , special combinations. i type ` (backtick) once , instead special character we'll symbolize *. typing additional keys, specific keyboard layouts relevant particular theme. (i want replace tick special symbol remember it's control code of sorts. typing twice, normal tick) here example mappings: *s -> set theory layout: [ -> ∈ (element of) o -> ∅ (empty set) *r -> general math: s -> ∫ (integral sign) s -> ∬ (double integral sign) *e -> misc operators: 8 -> ∗ (convolution asterisk) * -> ⋆ (star operator) *g -> greek alphabet after typing character such = , can type few other special combinations modify character. example: *x -> negates previous character: = -> ≠ (unequal) ≡ -> ≢ (negation of 3 line equality) *w -> expands previous character: ∫ ->

assembly - MIPS lw semantics: difference between "lw $t2, $t0" and "lw $t2, ($t0)"? -

i'm picking mips in quick tutorial , author distinguishes between these 2 lw instructions: lw $t2, $t0 # copy word (4 bytes) @ source ram location destination register. lw $t2, ($t0) # load word @ ram address contained in $t0 $t2 i feel author's 2 comments mean same... when think of these registers loosely pointers in c++ (of course they're not since registers contain both memory addresses , actual data), both statements seem same thing: copying $t0's "pointee" $t2, $t2's actual value $t0's "pointee", basically: word * $t0, $t2; //some hypothetical pointers word somedata=1111000011110000.... //some hypothetical type (32 bits in total) somedata = *$t0; //de-reference $t0 , copy value somedata $t2 = somedata; //impossible in real c++ know mean is there difference between 2 instructions @ all? lw $t2, 0($t0) , lw $t2, (0)$t0 ? i'm confused... lw $t2, $t0 isn't mips instruction --- suspect may have misread

.net - What datatype should be used in VB.NET to handle a precision of like a 100 decimal numbers or more? Double seems to display only about 17 -

what datatype should used in vb.net handle precision of 100 decimal numbers or more? double seems display 17. decimal can display 28 places right of decimal according documentation. there no built in type can handle 100. potentially build own type handle requirements.

c - How to use linked list to implement the multiplication of two polynomial in O(M^2N)? -

this exercise "data structure , algorithm analysis in c", exercise 3.7. assume there 2 polynomials implemented in linked list. 1 has m terms. has n terms. exercise ask me implement multiplication of 2 polynomial in o(m^2n)(assume m smaller one). how solve this? i can give idea. suppose polynomials 1+x+x^3 , 1+x^2. create linked list p using (1,1)--->(1,1)--->(1,3) create linked list q (1,1)--->(1,2) (a,b) denotes coefficient of x^b. now each node in p, multiply each node of q. how? create node res (x,y) x= p->coeff * q->coeff. and y=p->exp+q->exp . add new node polynomial contain answer. during insertion in answer polynomial have keep in mind 2 things- i) keep sorted list (sorted against exp)(increasing maybe have takem increasing here--you can take decreasing also). ii) correct position in case add new node , if node same exp value exists add coeff , delete node insert. ok! print polynomial. the comple

Wordpress Custom Plugin Installable code -

i have created own custom plugin , when paste in plugin folder working fine. wanted make installable if try install in project can install given plugin upload menu in admin panel. copy plugin_file_name.php in folder /wp-content/plugins , ready work. better create folder , put in file.

database - Java ArrayList acting up -

i running in odd issue. have database 6 different "bids". trying extract bids following code: public arraylist<projectbid> getprojectbids(string projectid) { arraylist<projectbid> result = new arraylist<projectbid>(); projectbid bid = new projectbid(); try{ st = con.createstatement(); string query = "select * bids projectid=\""+projectid+"\""; system.out.println(query); resultset rs = st.executequery(query); while (rs.next()) { bid.setprojectid(projectid); bid.setbidid(rs.getstring("bidid")); bid.setbidderemail(rs.getstring("bidder_email")); bid.setbidamount(rs.getint("bid_amount")); bid.setbidmessage(rs.getstring("bid_message")); bid.settimestamp(rs.getstring("timestamp")); result.add(bid); }

button - VBA - Creating a Data Sheet from a User Form -

i'm hoping can me issue. i've searched site correct coding spreadsheets, nothing seems work. i have 2 spreadsheets: have front facing form (sheet1) user can input information. once user done inputting information, press button transfer data large data spreadsheet ("records"). once data copies sheet1 records, want sheet1 clear (so next user has blank form work from). additionally, when new user inputs information, want information go on line below previous user's data input on records. i hope makes sense... code i'm using now, doesn't populate in "records" (i've made mess of this). sub button() dim reftable variant, trans variant reftable = array("c = e6", "d = e7", "e=e8", "f=e9", "g=e10") dim row long row = worksheets("records").usedrange.rows.count + 1 each trans in reftable dim dest string, field string dest = trim(left(trans, instr(1, trans, "=") - 1))

multithreading - Is it possible to create a thread in Rails subscribe to Redis message channel? -

i trying create thread in rails subscribe message channel of redis. there way this? using unicorn. i have tried in unicorn configuration this: after_fork |server, worker| thread.new begin $redis.subscribe(:one, :two) |on| on.subscribe |channel, subscriptions| puts "subscribed ##{channel} (#{subscriptions} subscriptions)" end on.message |channel, message| puts "##{channel}: #{message}" $redis.unsubscribe if message == "exit" end on.unsubscribe |channel, subscriptions| puts "unsubscribed ##{channel} (#{subscriptions} subscriptions)" end end rescue redis::baseconnectionerror => error puts "#{error}, retrying in 1s" sleep 1 retry end end end but make unicorn server unable handle web request. thought if using different thread subscribe redis, won't block main thread; missing here? th

php - How to add link to mysql database record as a <html> href? -

if($rezultat = $polaczenie->query($sql)) $ilu_userow = $rezultat->num_rows; while($ilu_userow>0){ $wiersz = $rezultat->fetch_assoc(); $id = $wiersz['id']; $like = $wiersz['likes']; $price = $wiersz['price']; echo '<div class="pozycja"> <span> <h1><font color="blue"/> ' . $id . ' </h1></font><font color="red"/> ' . $like . ' </font><h2><strong><font color="green"/> ' . $price . '</h2></strong></font></span></div>'; $ilu_userow = $ilu_userow - 1; } this code, , - in topic - want create html adress every row database, , question - how? if($rezultat = $polaczenie->query($sql)) $ilu_userow = $rezultat->num_rows; while($ilu_userow>0){ $wiersz = $rezultat-&g

Asp.net Membership and Simple Membership -

what difference between simple membership , membership in asp.net? simple membership introduced in mvc 4.0? asp.net membership traditional approach authentication, authorization microsoft team.but, release of mvc 4, introduced new improved version name simple membership.simple membership relies on extended membership provider behind scenes, simplemembershipprovider , extendedmembershipprovider, dotnetopenauth @ work. these changes need, because many web sites no longer want store user credentials locally. instead, want use oauth , openid else responsible keeping passwords safe, , people coming site have 1 less password invent (or 1 less place share existing password). these changes easy authenticate user via facebook, twitter, microsoft, or google. need plugin right keys. summary: 1)simplemembership has been designed replacement previous asp.net role , membership provider system. 2)simplemembership solves common problems developers ran membership provider system ,

c# - What is wrong with inferred type of template and implicit type conversion? -

i reading "the d programming language" andrei alexandrescu , 1 sentence puzzled me. consider such code (p.138): t[] find(t)(t[] haystack, t needle) { while (haystack.length > 0 && haystack[0] != needle) { haystack = haystack[1 .. $]; } return haystack; } and call (p.140): double[] = [ 1.0, 2.5, 2.0, 3.4 ]; = find(a, 2); // error! ' find(double[], int)' undefined explanation (paragraph below code): if squint hard enough, see intent of caller in case have t = double , benefit nice implicit conversion int double . however, having language attempt combinatorially @ same time implicit conversions , type deduction dicey proposition in general case, d not attempt that. i puzzled because such language c# tries infer type — if cannot this, user gets error, if can, well, works. c# lives several years , didn't hear story how feature ruined somebody's day. and questions — dangers involved inferring types in example above?

ios - Set anchor point in UICollectionViewLayoutAttributes -

i want perform transform animation in uicollectionviewlayout . achieved can't find way set anchorpoint of uicollectionviewlayoutattributes . want perform door opening , closing animation while collection view item inserted -(uicollectionviewlayoutattributes *)initiallayoutattributesforappearingitematindexpath:(nsindexpath *)itemindexpath{ uicollectionviewlayoutattributes *attributes = [super initiallayoutattributesforappearingitematindexpath:itemindexpath]; attributes.alpha = 1.0; cgfloat progress = 0.0; catransform3d transform = catransform3didentity; transform.m34 = -1.0/500.0; cgfloat angle = (1 - progress) * m_pi_2; transform = catransform3drotate(transform, angle, 0, 1, 0 ); uicollectionviewcell *cell = [self.collectionview cellforitematindexpath:itemindexpath]; cell.hidden = yes; attributes.transform3d = transform; return attributes; } there doesn't seem anchorpoint attribute in uicollectionviewlayoutattri

mysql - How to organize external API database relation keys in a database design? -

i'm sole developer of football (soccer) website. due that, bought access football api provides football data competitions favorite team in. this api exposes looks database primary , foreign keys in results. fetching data done integer ids. query string of normal request this: ?action=commentaries&match_id=[match_id] how should store these kinds of api primary , foreign keys in own database design? make sense adopt match_id primary key in own match table, should store foreign key, or should entirely different? there best practices on external data dependencies? this 1 api sole datasource @ moment, might change in future.

jquery - find a tag that contains the window.location.href -

in order replace text displays language on page, want find 'a' tag contains window.location.href url , set text current language text i've tried doing: a[href=window.location.href] doesn't work var href = window.location.href; var currentlangval = jquery('.countryselector a[href=href ]').text(); jquery('.language-display').text(currentlangval); what need string concatenation, in case, want value of href variable, , not "href" itself. var href = window.location.href; var currentlangval = jquery('.countryselector a[href="' + href + '"]').text(); jquery('.language-display').text(currentlangval);

java - JavaFx display image instantly -

im making memory card game. i want able catch 2 clicks, display them , compare them. i tried achieve doesn't work way want it. code ive written waits 2 clicks, displays first card , secound card never displays because right away when got 2 cards compare them, , if aren't same remove both cards. eventhandler<mouseevent> keyeventhandler = new eventhandler<mouseevent>() { @override public void handle(mouseevent event) { clickedcards(event); if (klickade.size() == 2) { boolean issame = cardsaresame(); if (issame) { firstmemorycard.setpair(boolean.true); secoundmemorycard.setpair(boolean.true); klickade.clear(); } else { firstmemorycard.setgraphic(firstmemorycard.getimagefacedown());

c# - how to get element value inside gridview using javascript -

i have gridview view have label lblprice , textbox txtquanty , 1 more label lblamount. <asp:gridview id="griditem2" headerstyle-backcolor="#fc8d10" headerstyle-forecolor="white" rowstyle-backcolor="skyblue" alternatingrowstyle-backcolor="white" alternatingrowstyle-forecolor="#000" runat="server" autogeneratecolumns="false" allowpaging="false" onpageindexchanging="griditems_pageindexchanging"> <alternatingrowstyle backcolor="white" forecolor="#000000" /> <columns> <asp:templatefield> <headerstyle width="80px" horizontalalign="center" /> <headertemplate> <p>action</p> </headertemplate> <itemtemplate> <asp:imagebutton runat="server" commandname="cmddel"

jQuery/Javascript basic object property -

im attempting create property called startposition , assign top property button's top value in css. here jquery: var morphobject = { button: $('button.morphbutton'), container: $('div.morphcontainer'), overlay: $('div.overlay'), content: $('h1.content, p.content'), startposition: { top: morphobject.button.css('top') // top: 150, // left: '20%', // width: 200, // height: 70, // marginleft: -100 }, of course, there more, error occurs. error is: [error] typeerror: undefined not object (evaluating 'morphobject.button') how can this? thanks. morphobject not exist yet when call morphobject.button . you move outside: var morphobject = { button: $('button.morphbutton'), container: $('div.morphcontainer'), overlay: $('div.overlay'), content: $('h1.content, p.content'), startpositi

javascript - Pass function to submitHandler callback -

i use mainsubmithandler multiple pages, , willing define global variable if necessary. mainsubmithandler , however, requires tweaking, , handling using subsubmithandler . instead of having subsubmithandler global variable, how can pass agrument mainsubmithandler ? var mainsubmithandler=function(form) { //do bunch of stuff subsubmithandler(form); }; var subsubmithandler=function(form) { //do stuff }; // uses jquery validation plugin var validator=$("#form1").validate({ rules: {}, messages: {}, submithandler: mainsubmithandler }); you can use bind here. bind wraps around function reference allowing pass scope , variables targeted function: function.bind(thisarg[, arg1[, arg2[, ...]]]) parameters: thisarg: value passed parameter target function when bound function called. value ignored if bound function constructed using new operator. arg1, arg2, ...arguments prepend arguments provided bound function when invoking targ

c - program stuck on first printline of the program -

i'm following introductory tutorial c programming. told me write simple program converts degree celsius fahrenheit. i wrote code shown in video prints first line , gets stuck. i don't understand what's wrong program: #include <stdio.h> //program convert celsius fahrenheit int main() { int c; int f; printf("enter temperature in celsius:"); scanf("%d\n", &c); f=9*c/5 + 32; printf("the temperature in fahrenheit is: %d\n",f); return 0; } i have started using ubuntu , using code block building program gcc compiler. please thank you; the problem lies in line of code: scanf("%d\n", &c); the escape sequence '\n' not behave think in context: it's not telling scanf() expect input x number in form x\n '\n' linefeed interpreted pattern must matched since scanf() doesn't expand escape sequences. from glibc manual : other characters in template st

Creating link in JavaScript, and integrating it into createTextNode() -

i'm looking integrate link created text node, comes text (title), not link. how fix this? code in function: function createmessage() { var = document.createelement('a'); var linktext = document.createtextnode("http://www.example.com"); a.title = "http://www.example.com"; a.href = "http://www.example.com"; var message2 = document.createelement("p"); var message2text = document.createtextnode("website: " + + "."); message2.appendchild(message2text); var olelem = document.getelementbyid("display"); var old = document.getelementbyid("display"); var display = old.parentnode; return display.replacechild(message2, olelem); } problem here: var message2text = document.createtextnode("website: " + + "."); // ---------------------------------------------------^^^^^^^ you can't append dom element string , useful result. it's

gcc - cvxopt installation on windows 7/64bit -

i'm trying install cvxopt package on python 3.4. i'm using pip error message "command 'c:\mingw\bin\gcc.exe' failed exit status 1" i tried numerous stuff installing numpy+mkl not running don't know why, or installing atlas none of helps resolve problem i'm stuck. should install atlas or else ? could me please? in advance!

javascript - Colvis don't work for datatable with yadcf -

i don't understand why colvis don't work table. include these css , js: <link rel="stylesheet" type="text/css" href="https://datatables.net/release-datatables/extensions/colvis/css/datatables.colvis.css"> <script src="https://datatables.net/release-datatables/extensions/colvis/js/datatables.colvis.js"></script> and initialisation dom: 'c<"clear">lfrtip' so code this: otable = $('#example').datatable({ dom: 'c<"clear">lfrtip', "bjqueryui": true, "bstatesave": true }).yadcf([{ but solution don't work table because colvis doesn't appear , destroy other css/layout of table. here table: my table you need read datatables docs , understand difference between 1.9 hungarian notation syntax , camelcase of 1.10 replace dom: 'c<"clear">lfrtip', "sdom": '

c - Why am I not able to produce a "Hello World" executable using gcc? -

i'm trying compile first "hello world" application using gcc (build-on clang , stand-alone gcc-4.9.2) without success: os version os x yosemite 10.10.2. i'm using following code (main.c): #include <stdlib.h> #include <stdio.h> int main (){ printf("hello world!"); getchar(); return 0; } then compile in terminal command (clang shipped xcode): gcc -o hello -c main.c as result got following error whe running compiled hello file: mbp-andrii:ctest andrii$ gcc -o hello -c main.c mbp-andrii:ctest andrii$ hello -bash: /users/andrii/avrtest/ctest/hello: permission denied if change permissions hello file 777 , new error again: mbp-andrii:ctest andrii$ chmod 777 hello mbp-andrii:ctest andrii$ hello killed: 9 mbp-andrii:ctest andrii$ the same thing happens stand-alone gcc-4.9.2. i guess might related output binary format or missing flags compiler. remove -c command you're using compile application. the

java - Android: How to get the uploaded file URL in Google Drive -

i can upload files google drive account need url (link) of file use later? example: https://docs.google.com/file/d/ob-xxxxxxxxxxx/edit this method upload file google drive: private void savefiletodrive() { thread t = new thread(new runnable() { @override public void run() { try { // create uri real path string path; path = "/sdcard/dcim/camera/a.png"; mfileuri = uri.fromfile(new java.io.file(path)); contentresolver cr = uploadactivity.this.getcontentresolver(); // file's binary content java.io.file filecontent = new java.io.file(mfileuri.getpath()); filecontent mediacontent = new filecontent(cr.gettype(mfileuri), filecontent); showtoast("selected " + mfileuri.getpath() + "to upload"); // file's meta data. file body = new file();