Posts

Showing posts from February, 2010

node.js - Node appendFile not appending data chunk to file on filesystem -

i have program trying values request using curl , store them in file , serve stored content back. decision store or append contents in file based on query parameter appendflag when run program getting in console " true " , " appending " suggests indeed reads flag goes if part somehow appendfile function not working. var http = require('http'); var url = require('url'); var querystring = require('querystring'); var fs = require('fs'); http.createserver(function(request,response){ var str = request.url.split('?')[1]; var query = querystring.parse(str); var writestream = fs.createwritestream(query['filename']); console.log("query - "); console.log(query["appendflag"]); request.on('data',function(chunk){ if(query["appendflag"]=="true"){ console.log("appending"); fs.appendfile(query['filename'],c

css - Where need to set display block and where not -

Image
my question need set display:block; element? use in header section , footer question have box inside images , text there need set display block header,section,footer{display:block;} set ul class elements? posible no set display block .box{display:block;} here brief detail inline & block elements.... inline elements: respect left & right margins , padding, not top & bottom cannot have width , height set allow other elements sit left , right. block elements: respect of those force line break after block element inline-block elements: allow other elements sit left , right respect top & bottom margins , padding respect height , width examples of block elements: <p>, <div>, <form>, <header>, <nav>, <ul>, <li>, , <h1>. examples of inline elements: <a>, <span>, <b>, <em>, <i>, <cite>, <mark>, , <code>. see article on

c# - Admob WP8 System.UnauthorizedAccessException -

i developing wp8 app using vs2012. wish add admob banner ads, unfortunately raising exception causing app freeze. catch admob exception, had disable 'just code' vs2012 setting, , after executing following code, 'system.unauthorizedaccessexception: access denied' @ last line. _adcontrol = new adview { format = adformats.smartbanner, adunitid = "ca-app-pub-31231-fake-fake-fake" }; _adcontrol.verticalalignment = verticalalignment.top; _adcontrol.failedtoreceivead += adcontrolonerroroccurred; adrequest adrequest = new adrequest(); gamepage.layoutgrid.children.add(_adcontrol); _adcontrol.loadad(adrequest); if enable 'id_cap_identity_device' , 'id_cap_identity_user', google docs state not required, start receiving 'system.exception' instead of 'system.unauthorizedaccessexception'. can not figure out how can fixed, if possible.

sql - How to calculate the longest winning streak with daterange -

i have table in sql server consists of data like userid amount startdate enddate game result ------------------------------------------------------------------------------- 68838 51.00 2014-05-29 15:41:41.167 2014-05-29 15:41:41.167 1 w 68838 51.00 2014-05-29 15:42:30.757 2014-05-29 15:42:30.757 1 w 68838 -0.50 2014-05-31 16:57:31.033 2014-05-31 16:57:31.033 1 l 68838 -0.50 2014-05-31 17:05:31.023 2014-05-31 17:05:31.023 1 l 68838 -0.50 2014-05-31 17:22:03.857 2014-05-31 17:22:03.857 1 l 68838 0.42 2014-05-31 17:26:32.570 2014-05-31 17:26:32.570 1 w 68838 0.42 2014-05-31 17:34:45.330 2014-05-31 17:34:45.330 1 w 68838 0.42 2014-05-31 17:38:44.107 2014-05-31 17:38:44.107 1 w 68838 0.42 2014-05-31 17:42:12.790 2014-05-31 17:42:12.790 1 w 434278 0.42 2014-05-31 16:57:31.033 2014-05-31 16:57:31.033 1 w 434278 0.42 2014-05-31 17:05:31.023 2014-05-31 17:05:31.023 1 w 434278 0.42 2014-05-31

Php and strings inside code -

i have 1 code , when execute code let other thing , example : <?php if ($ending=="ok") { $insert_end="ok"; } if ($insert_end=="ok") { print "ok"; } ?> but if go url , put example : http://www.domain.com/index.php?insert_end=ok execute code , don´t want possible because if people know can execute code , it´s possible no let execute code when put in url thank´s regards disable register_globals in php.ini file. should not used reason.

jquery - Page load actions in angular -

i jquery background working on angular application currently. want include code did on page load in jquery store arrays in sessionobject. e.g. $(document).ready(function(e) { storage.prototype.setobj = function(key, obj) { return this.setitem(key, json.stringify(obj)) } storage.prototype.getobj = function(key) { return json.parse(this.getitem(key)) } }); how can same in angular application. in advance. you can using init function. in html file add following code - <div ng-app="myapp"> <div ng-controller="myctrl" ng-init="init()"> </div> </div> then in main.js file, following - var app=angular.module("myapp",[]) app.controller("myctrl",function($scope){ $scope.init(function () { // add code here }) })

javascript - Refresh textfield after submitting -

i have code submits database without refresing, problem when sent, variables still remains in textfield <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> <script> $(document).ready(function(){ $("form").on('submit',function(event){ event.preventdefault(); data = $(this).serialize(); $.ajax({ type: "post", url: "insert.asp", data: data }).done(function( msg ) { }); }); }); </script> i thinking if there's way variables disappear textfiled after been sent database , bring alert fades automatically when data saved. i think you'll want add desired behavior in callback following ajax request. you're using "done" callback, in understanding execute whenever ajax call completes, regardless of success or failure. if that's desire, add textfield clearing , alert code within callback, otherwise

javascript - How to only transmit data through websocket if different from previous transmission -

i have built simple web application using nodejs + express, request , socket.io modules json data external api , transmit using websocket client. what transmit through websocket if externally requested json data has changed. i cannot figure out how add condition code have come far: io.on('connection', function (socket) { setinterval(function () { request({ url: url, json: true }, function (error, response, body) { var senddata = json.stringify(body.result).tolowercase(); if (!error && response.statuscode === 200) { socket.emit('result', senddata); } }) }, 3000) }); you can store last data each socket in object, compare senddata : var lastdata = {}; //declare object io.on('connection', function (socket) { setinterval(function () { request({ url: url, json: true }, function (error, response, body) { var senddata = json.stringify(body.result).tolowercase(); if (!error && response.stat

C++ how to implment a stoppable future function call? -

i want execute function after timeout period, like: sleep(1000); dowork(); but before timeout reached, can stop execution in thread or other thread, like: if(somecondition) { stop dowork() not started. } is there existing std/boost class kind of task? you may use combination of variable indicating whether work needs done combined timed condition variable: you'd wait sleep time , if wait terminates you'd check if work should aborted, more sleeping needed (condition variables can stop waiting spuriously), or work can started: bool do_work(true); std::mutex mutex; std::condition_variable condition; std::chrono::time_point<std::chrono::steady_clock> abs_time( std::chrono::steady_clock::now() + std::chrono::milliseconds(1000)); std::unique_lock<std::mutex> kerberos; if (condition.wait_until(kerberos, abs_time, [&]{ return do_work; })) { // work } the other thread cancelling work acquire lock mute

python - How to close connections in Requests (scalability) -

what equivalent of this, using requests library? with contextlib.closing(urllib2.urlopen(request)) response: return response.read().decode('utf-8') requests seems more modern solution 2.7 urllib2. what correct way close connections, running function 800 times or so, won't leave connections open , cause performance issues? should create session , use close() on it? is this? s = requests.session() s.get('http://httpbin.org/get') s.close() there should no connections open if use requests in basic way. if start using stream=true need concern whether or not entire response has been read, , whether or not should closed. otherwise, should never concern of yours.

ios - Swift "Bridging-Header.h" file not allowing me to instantiate objective-c classes in .swift files -

when x-code tries create bridging header automatically, crashes every single time, followed instructions on how manually create bridging header. (create .h file, name <#project_name>-bridging-header.h, import .h files need?) problem is, when try instantiate class in .swift file that's included in header, nothing happens (it says class doesn't exist) also, in bridging header doesn't seem autocomplete filenames when try include them, leading me believe somethings not linking properly. has run this? know how fix it? you need add target's build settings: in xcode, if go build settings target, , scroll way down you'll find "swift compiler - code generation" section. set "objective-c bridging header" <#project_name>-bridging-header.h i'm not sure of correct value "install objective-c compatibility header", it's yes/no, can toggle if doesn't work @ first.

ruby on rails - Password validation triggers when it should not be triggering? -

working on password reset mechanism users. password length validation triggering , i'm trying understand why. user.rb class user < activerecord::base has_secure_password validates :password, length: { minimum: 6 } ... def create_password_reset_token self.update_attributes!(password_reset_token: securerandom.urlsafe_base64, password_reset_sent_at: time.zone.now) end def reset_password(params) self.update_attributes!(params) self.update_attributes!(password_reset_token: nil, password_reset_sent_at: nil) end end password_resets_controller.rb def create user = user.find_by_email(params[:email]) if user user.create_password_reset_token usermailer.password_reset_email(user).deliver redirect_to root_url, :notice => "email sent password reset instructions!" else flash[:error] = "a user email address not found." render 'new' end end def edit @user = user.find_by_password_reset_tok

Is it possible to run java application on android through openjdk -

disambiguation first: question not developing or compiling openjdk code run on dalvik in production. using oracle runtime on android environment. i'm using java running small desktop utility application. have no experience in android , ios development , i'm curious extent classic java skills may transferred mobile field. i've googled couple of methods running java application on ios embedding runtime inside application package. android has own partially incompatible , slow java virtual machine. still better nothing, i'm curious if possible run application on genuine hotspot(openjdk) virtual machine. android ios have ability run native code. may ability exploited use third-party (non dalvik) jre on android? i'm not interested on google play market restrictions it, if there any, may not taken account. rooting possible since i'm going write tools myself. prefer methods easy installing. putting package files , editing couple of options. , not build own a

html - PHP Active Menu link under Submenu -

what i'm trying have main menu link active whilst viewing submenu page using php main menu in includes file. code moment in includes file is: <p class="menulinks"> <strong class="hide">main menu:</strong> <a <?php if (strpos($_server['php_self'], 'index.php')) echo 'class="menulink active"';?> class="menulink" href="index.php">home</a><span class="hide"> | </span> <a <?php if (strpos($_server['php_self'], 'food.php')) echo 'class="menulink active"';?> class="menulink" href="food.php">food</a><span class="hide"> | </span> <a <?php if (strpos($_server['php_self'], 'drinks.php')) echo 'class="menulink active"';?> class="menulink" href="drinks.php">drink</a><span class="hide"

c - take char input and store it in an array -

i want take n number of inputs , save in arrays c[] , p[] , later use them... i have written this,but i'm not getting desired output #include<stdio.h> #include<stdlib.h> int main() { int n,t,i,j,size=0; char s[100000]; char c[100]; char p[100]; scanf("%d", &n); for(i=0;i<n;i++) { scanf("%c", &c[i]); scanf("%c", &p[i]); } for(i=0; i<n;i++) { printf("%c %c", c[i],p[i]); } return 0; } considering second comment: "i want 4 w r 2 9 f g q t c should store w2fq , p should store r9gt ", should change for(...) loop for(i=0;i<n/2;i++)

objective c - Java ByteBuffer -> [NSData bytes] to UInt16 -

good day all. i'm writing client-server application based on sockets. server written java, client - objective-c on ios sdk 7. my server writes data connected socket next code: //socket client = new ...; dataoutputstream out = new dataoutputstream(client.getoutputstream()); // send package string message = "pings"; // package body byte bodysize = (byte) message.length(); java.nio.bytebuffer buffer = java.nio.bytebuffer.allocate(2 + 2 + 1 + bodysize); buffer.putshort((short) 16); // package id (2 bytes) buffer.putshort((short) 7); // package header (2 bytes, bitmask options) buffer.put(bodysize); // calculate & put body size in 5th byte (1 byte) buffer.put(message.getbytes()); // put message buffer (+5 bytes) out.write(buffer.array()); // write stream out.close(); // close stream then i'm trying parse accepted nsdata in objective-c client. here's code: - (uint16)packageidfrompackagehead:(nsdata *)data { const void *bytes = [data bytes]; ui

php - Update array key based on value change -

given have object $obj = new stdclass(); $obj->name = 'my-object'; and object stored thusly $store = [ $obj->name => &$obj ]; is there way change store key when property changes? $obj->name = 'new-name'; // $store['new-name'] not set, $store['my-object'] still edit: thanks scott pointing out shouldn't store them way. here's came with. there's overhead here, it's core function. $obj1 = new stdclass(); $obj1->name = 'my-object'; $obj2 = new stdclass(); $obj2->name = 'another-object'; $store = [ $obj1, $obj2 ]; $key = 'my-object'; $result = array_filter($store, function ($obj) use ($key) { return ($obj->name == $key); }); // results in: [$obj1] you shouldn't store value change. use unique identifier or guid. if can't (which should) make name property private , use setname() function. within function, find object store, remove old object,

Laravel issue with: language character encoding -

privjet! i don't understand reason not getting displayed non ascii language characters say, "ç, ñ, я " different languages. the text in question hardcoded, not served db. i have seen identical questions here charset=utf8 not working in php page i have seen should write this: header('content-type: text/html; charset=utf-8'); but heck go? cant write that, browser mirrors words , displays them plain text, no parsing. my encoding frontpage says this: <head> <meta charset="utf-8"> </head> which supposed unicode. i tried test page in validator.w3.org , went: sorry, unable validate document because on line 60 contained 1 or more bytes cannot interpret utf-8 (in other words, bytes found not valid values in specified character encoding). please check both content of file , character encoding indication. line 60 actuallly has word español (spanish) weird n. any hint? thank you best regards

ios - Exception when reusing CIDetector -

while attempting reduce computation time while detection faces using cidetector tried reuse single detector instance multiple face detections, recommended apple: this class can maintain many state variables can impact performance. best performance, reuse cidetector instances instead of creating new ones. all worked fine until began processing thousands of photos. now, time time random exception exc_bad_access . doesn't happen when don't reuse detector instantiate new 1 every time. some relevant code snippets: @property (retain, nonatomic) cidetector* facedetector; - (void)initialvals { nsdictionary *opts_context = @{kcicontextusesoftwarerenderer: @no}; self.context = [cicontext contextwithoptions:opts_context]; nsdictionary *opts = @{ cidetectoraccuracy: cidetectoraccuracyhigh, cidetectortracking: @yes, cidetectorminfeaturesize: @0.15 }; self.facedetector = [cidetector detectorof

javascript - Connecting carousel within a carousel using bootstrap 3 -

Image
please forgive me if worded terribly, i'll best. using bootstrap 3, have large carousel works indicators. however, want add sort of sidebar updates show slides not set active . upon clicking on of these sidebar tabs, active slide updated, sidebar tabs newly inactive slide. will change layout below, upon clicking on either of elements associated slide 3... at moment, clicking on either of elements updates active slide indicator, sidebar tab list remains same. is there simple way using jquery , data-* attributes slide tab list show inactive elements? the similar solution came across this other stack overflow question some code html structure: <div class="container carousel-wrap"> <div id="carousel" class="carousel slide" data-ride="carousel"> <!-- indicators --> <ol class="carousel-indicators breadcrumbs"> <li data-target="#carousel" data-slide-to="0&

what host to set for RabbitMQ send test -

so having trouble understanding how use rabbitmq. have following send.java class using rabbitmq send message: import com.rabbitmq.client.connectionfactory; import com.rabbitmq.client.connection; import com.rabbitmq.client.channel; public class send { private final static string queue_name = "hello"; public static void main(string[] argv) throws java.io.ioexception { // create connection server connectionfactory factory = new connectionfactory(); factory.sethost("what put here"); // <==========================what put here?? connection connection = factory.newconnection(); // next create channel, of api // getting things done resides channel channel = connection.createchannel(); // send must declare queue send to; // can publish message queue: channel.queuedeclare(queue_name, false, false, false, null); string message = "hello world!"; channel

sql - Displaying Image dynamically in the asp.net webpage -

i want display images in website developed in asp.net(web form) dynamically. have created a page in admin section uploading image , uploded image save in folder , path save in database. uploading , edit on image done me. want display in page in want 4 images in row. control need use. or there other idea can go creating task. i thanking ideas you can use datalist or datarepeater or data control display image. depend on requirement. if want show images on client side use datarepeater. for display images in datalist : http://www.dotnetfox.com/articles/how-to-display-images-in-datalist-control-using-asp-net-with-c-sharp-1037.aspx display images in repeater : http://ravisatyadarshi.wordpress.com/2012/11/17/how-to-display-an-image-gallery-using-repeater-in-asp-net/

authentication - How to handle User Registration via API Laravel -

i have being reading , watching tutorials api development in laravel. new api development entirely although have used laravel bit. from tutorials have gone through, handled: login, data, update information, delete information, , insert information database. my problem none of tutorials handle user registration. route::group(array('prefix' => 'api/v1', 'before' => 'auth.basic'), function() { route::resource('users', 'userscontroller'); route::resource('messages', 'messagescontroller'); }); from code above, assumes user must have registered before gaining access controllers cause of auth.basic . so, question this: how can handle registration? cause doesn't seem group codes above. you can't place registration routes in route group auth.basic filter. users logged in can register. so should make new routes registration: // opens view register form route::get('register', a

java - About changes which are not reflected back in netbeans -

i have java source code of project developed on netbeans ide-8.0 , edited gui on netbeans. after switched eclipse ide (kepler) , modified several files implement logic. after implementing logic want change gui again @ time netbeans not showing gui changes in design view (but code updated changed eclipse) made using same ide (before implementing logic in eclipse). have tried several options like cleaning , rebuilding. coping modified source code work space. also window builder in eclipse not able parse gui java file. any reply ide appreciated.

java - I tried to read string from file and store it in Excel sheet -

this have tried public class uniqueuser { static hssfworkbook hwb=new hssfworkbook(); static hssfsheet sheet = hwb.createsheet("new sheet"); public static void main(string[]args) throws ioexception { hssfrow row; hashset<string> names = new hashset<>(); bufferedreader br = new bufferedreader (new filereader("sample.log")); printstream out=new printstream("d:/excel.xls"); string str=null; while((str=br.readline())!=null) { if(str.contains("fltr")) { string user=str.substring(97, 135); names.add(user); hssfrow row1 = sheet.createrow((short)count); } } iterator itr=names.iterator(); while(itr.hasnext()) { out.println(itr.next()); } } } this program storing values excel sheet when read same file using following program, getting exception , errors.. public class country1 { private

How to get table fields from which was called a trigger with Oracle 10g? -

i want calculate average of values ​​in column of table (pra_coeff) (rapport_visite) field (pra_num) given, when add or change row of it. want save value in table (practitioner) row pra_num worth pra_num given above. create table "rapport_visite" ( "rap_num" number (10,0), "pra_num" number (10,0), "pra_coeff" number (10,0), ) create table "praticien" ( "pra_num" number (10,0), "pra_coefconf" number ) the trigger called when adding or modification rapport_visite table. tried this, can not retrieve row affected trigger, , pra_num, need read. create or replace trigger udpate_prat_coefconf after insert or update on rapport_visite declare somme number; nb number; moyenne number; rapport number; pra_id number; begin /*select max(rap_num) rapport rapport_visite; // not want need in case modify row... */ select pra_num pra_id rapport_visite rap_num=rapport; select sum(pra_coeff) som

powershell - IF statement + send-mailmessage confused -

quick question; want make log of bad stuff happening servers, that's not question. the log should deleted upon send, , if there no log @ time script being run should send different message, without attachment. here's script far: <# set-executionpolicy unrestricted -force iex ((new-object net.webclient).downloadstring('https://chocolatey.org/install.ps1')) cinst bettercredentials #> import-module bettercredentials $mailcred = get-credential -user user@gmail.com -pass 12345password try{ $file = c:/path/errorfile.log } catch [system.management.automation.psargumentexception] { "invalid object" } catch [system.exception] { "caught system exception" } { if ($file -eq ){ (send-mailmessage -erroraction silentlycontinue -from "server <server@company.com>" -to "it dept. <itdept@company.com>" -subject "log of day." -body "good morning, fortuneatly, no

c# - ASP repeater overflowing from div -

i'm having issues asp repeater. reads in database , writes out repeating divs.. problem h4 spilling out on div, ideas on how solve this? when use <%eval problem. divs i've manually typed out fine , not overspilling html <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:connectionstring %>" providername="<%$ connectionstrings:connectionstring.providername %>" selectcommand="select [headline], [story], [image] [news]"></asp:sqldatasource> <asp:repeater id="repeater1" runat="server" datasourceid="sqldatasource1"> <itemtemplate> <div id="news"> <div class="headline"> <div id="spacer"> <h5><%#eval("headline") %></h5> </div>

python - Adding more than one list -

i want try many ways function of python so, want not use zip use other python function ,how can to? this use zip , adding more 1 list: want other way not use zip: x = [12, 22, 32, 42, 52, 62, 72, 82, 29] y = [10, 11, 12, 13, 14, 15, 16, 17, 18] def add_list(i, j): l = [] n, m in zip(x, y): l.append(n + m) return l i know way, without using zip , can use map : from operator import add x = [12, 22, 32, 42, 52, 62, 72, 82, 29] y = [10, 11, 12, 13, 14, 15, 16, 17, 18] res = map(add, x, y) # [22, 33, 44, 55, 66, 77, 88, 99, 47] note if iterables of different lengths, shortest padded none cause typeerror in add instead of zip truncate shortest list. on aside there's absolutely nothing wrong using zip - i'd re-write list-comp though, eg: [sum(items) items in zip(x, y)] this scales doing zip(x, y, z, another_list) etc...

sql - where not exists error in upsert function -

i have gotten lot of writing strong upsert function postgresql. trying insert values table 3 columns, 2 foreign keys, , 1 text. i have similar function works great, not have subqueries 1 does. getting error "error: syntax error @ or near "where" line 24: not exists (select 1 sel)" the function: create or replace function upsert_dish_cluster_to_network(n_id int, c_id int, amsover text) returns setof dish_cluster_to_network $func$ begin loop begin return query sel ( select dctn.id dish_cluster_to_network dctn dctn.network_id = (select id unv_network amscode = n_id) , dctn.cluster_id = (select id dish_cluster_network axsyscode = c_id) share ), ins ( insert dish_cluster_to_network (network_id, cluster_id, amsname_override) values ( (select id unv_network amscode = n_id), (select id dish_cluster_network axsyscode = c_id),

cakephp - Database connection "Mysql" is missing, or could not be created -

i'm developing cakephp based application, on wamp. for reason cannot run cake bake anymore. after run command: c:\program files\wamp\www\my-application>"c:\program files\wamp\www\cakephp-246 0\app\console\cake.bat" bake ... i'm getting following error: welcome cakephp v2.4.6 console --------------------------------------------------------------- app : my-application path: c:\program files\wamp\www\my-application\ --------------------------------------------------------------- --------------------------------------------------------------- bake model path: c:\program files\wamp\www\my-application\model\ --------------------------------------------------------------- error: database connection "mysql" missing, or not created. #0 c:\program files\wamp\www\cakephp-2460\lib\cake\model\connectionmanager.php(1 05): dbosource->__construct(array) #1 c:\program files\wamp\www\cakephp-2460\lib\cake\console\command\task\modeltas k.php(927): connectio

ruby on rails - Build db:rake task from existing Database -

i have project has had alot of editing postgresql database. i tring find out there way build new db:rake file can rebuild database on new server easily. without manually editing db:rake files. thanks ruby 1.9.3 centos 6.4 ruby on rails 3 postgresql 9.3 for clarity, assuming referring migration files when mention db:rake files . in rails, don't want rebuild database using migration files. can become outdated, referring things no longer exist, etc. instead, best practice recreate database using schema.rb file instead. touched on an answer wrote while back . in short, schema.rb file represents database table structure; snapshot, if will. note it not contain data , table structure. in scenario, in order create, or ensure schema.rb date, need dump schema, so: rake db:schema:dump this regenerates schema.rb file. then, rebuild database file in environment, reload schema, so: rake db:schema:load as stated above, schema.rb not contain data tables, merely

javascript - Create directory with JS -

this question has answer here: activexobject in firefox or chrome (not ie!) 3 answers how create folders js: var sfolderpath = 'images'; var fso = new activexobject('scripting.filesystemobject'); if (!fso.folderexists(sfolderpath)) { fso.createfolder(retval); return; } i got error: uncaught referenceerror: activexobject not defined i know "activexobject" work on ie, need other solution work on browsers.. only internet explorer supports activexobject . if trying in browser, won't supported.

javascript - accessing to Jquery object values in a function -

i'm doing generic function validate form items. i'm calling way: $('#name').validate(20, 'alfanum'); next, in function i'll stuff, when try access value of object, wont work: function validate(size, type) { alert($(this).val()); // shouts error :( } how can access object's value? thank in advance. do need extend jquery's object use syntax? simpler pass object parameter function validate(obj, size, type) { alert(obj.val()); // shouts error :( } validate(jquery('#name'), 20, 'alfanum');

javascript - Why isn't overlay working on all images? -

Image
i'm coding image overlay w/ jquery, , got working (somewhat). if hover on first image, appears; however, if hover on second one, doesn't work. don't know problem is! think has unique ids or whatever. tried classes, , didn't work. here fiddle :: http://jsfiddle.net/pfwcz/7/ $(document).ready(function () { $('.overlay-link').mouseover(function () { $(this).find('.overlay').fadein(200); }).mouseleave(function () { $(this).find('.overlay').fadeout(200); }); }); you need make overlay-link elements containers child elements inherit positions. <a class="overlay-link"> <img src="https://d13yacurqjgara.cloudfront.net/users/67256/screenshots/1191507/shooot.png"/> <span class="overlay"><i>hellllllllooooooo</i></span> </a> your overlay-link class needs have position: relative , define position , size of , children: .overla

I am storing my query string with dynamic php variables in mysql DB and how can i retrive with actual values -

i stored query in table.: "select * tbl_customer bookingdate=$date" $tableresult[$i]['condition'] = "select * tbl_customer bookingdate=$date"; $date = date('y-m-d'); $anothervariable = $tableresult[$i]['condition']; echo $anothervariable; this echo prints same string. how can following result : select * tbl_customer bookingdate=2014-06-10 is solution available? $date = date('y-m-d'); $tableresult[$i]['condition'] = "select * tbl_customer bookingdate=$date"; $anothervariable = $tableresult[$i]['condition']; echo $anothervariable; try this

angularjs - Multiple module nested ui-router with multiple ui-views -

i'm working on complex ui architecture based on angular , angular ui router. i'm trying define routes nested ui-views on multiple modules. here i'm trying do: http://plnkr.co/edit/sxjopqagyezfcyfuregr?p=preview files here: index.html <body ng-app="app"> <h1 ui-view="title"></h1> <div ui-view="sidebar1"></div> <ul ui-view="sidebar2"></ul> <div ui-view="content"></div> </body> app.js angular .module('app', ['ui.router', 'page1']) .config(['$locationprovider','$stateprovider', '$urlrouterprovider', function ($locationprovider, $stateprovider, $urlrouterprovider) { $locationprovider.html5mode(true); $stateprovider.state({ name: "page1", url: "/page1", abstract: true }); $urlrouterprovider.otherwise('/page1'); }]); page1.js a

crop - need example of cropping an image in android app -

sorry not technical question. i researching understand how can implement common feature in android apps user can crop part of image. performed using square window hovering above shadowed image. example choosing profile image in linkedin app. know or have example of how it? thanks in advance. try sample method below. not can cut rectangle any shape place in bitmap want. you can cut micky mouse center of bitmap also. the below method cutting rectangular bitmap have pointed triangle on left side of bitmap. whatsapp thumbnails of images shared in chat. anything drawn paint setxfermode(new poterduffxfermode(mode.clear)) clear pixels bitmap. try out.. hope helps :) private bitmap cropandgivepointedshape(bitmap originalbitmap) { bitmap bmoverlay = bitmap.createbitmap(originalbitmap.getwidth(), originalbitmap.getheight(), bitmap.config.argb_8888); p

Implement installable themes for Android app -

as there no official solution one, i'm relying dev done it i implement "install theme play store , apply app" : the user install app he browse theme specific app on play store (or free in app) , install it then apply app to illustrate goal : beautifull widgets has done it, install widgets , can download theme apply my first thought go content provider theme provide elements app but don't know if it's best way ? what's thoughts ?

xcode - Objective C Add Announcement to a List in Sharepoint 2010 -

i'm building ios app school uses sharepoint 2010 website. need app add items (announcements) announcements page. there anyway go in objective c. have correct permissions , have authentication working don't know how post announcement. i have had brief using html's post doesn't seem working. thanks in advance. johann answering own question here again year later incase looking this. sharepoint (2010 using) has rest api more information can found here . thanks.

java - Get the selected model element in GMF editor -

i have gmf editor different elements on model. once select particular model element, how in handler ? currently, fetch elements present, using following code fragment: palladiocomponentmodeldiagrameditor diag = (palladiocomponentmodeldiagrameditor)handlerutil.getactiveeditorchecked(event); final list children = diag.getdiagrameditpart().getchildren(); i quite new gmf , hence question. not 100% sure understand question. if want find element that's selected in diagram editor, can use selectionprovider , example this: iselectionprovider selprovider = diagrameditor.geteditorsite().getselectionprovider(); if (selprovider.getselection() instanceof istructuredselection) { istructuredselection selection = (istructuredselection) selprovider.getselection(); object selected = selection.getfirstelement(); if (selected instanceof igraphicaleditpart) { igraphicaleditpart editpart = (igraphicaleditpart) selected; eobject eobject = ((view) editpart.ge

class - Limitation with classes derived from generic classes in swift -

i'm trying derive class generic class: class foo<t> {} class bar : foo<int> {} but code fails compile en error: classes derived generic classes must generic how avoid limitation? possible? ssreg, unfortunately official : you can subclass generic class, subclass must generic class. let hope apple fixes in future version. meanwhile, let see opportunity exploit aggregation instead of subclassing. note: as poor man's version of solution, 1 use typealias : class foo<t> {} class bar<int> : foo<int> {} typealias bar = bar<int> this way, rest of code can written if apple fixed matter.

ios - How to pass swift enum with @objc tag -

i need define protocol can called in class use objective-c type but doing doesn't work: enum newscellactiontype: int { case vote = 0 case comments case time } @objc protocol newscelldelegate { func newscelldidselectbutton(cell: newscell, actiontype: newscellactiontype) } you error swift enums cannot represented in objective-c if don't put @objc tag on protocol it'll crash app it's called in class adopt protocol , inherit objective-c type class (like uiviewcontroller). so question is, how should declare , pass enum @objc tag? swift enums different obj-c (or c) enums , can't passed directly obj-c. as workaround, can declare method int parameter. func newscelldidselectbutton(cell: newscell, actiontype: int) and pass newscellactiontype.vote.toraw() . won't able access enum names obj-c though , makes code more difficult. a better solution might implement enum in obj-c (for example, in briding header) because automati

java - f:validateDoubleRange not working when added currency symbol added to that textbox -

i new jsf. adding currency validation textbox.i using f:validatedoublerange validating textbox minimum , maximum characters.my textbox working fine when haven't currency added if added currency textbox f:validatedoublerange not working.can me out this.thanks in advance. <f:validatedoublerange minimum="20.00" maximum="20000.99" /> here , minimum , maximum properties type of javax.el.valueexpression , must evaluate java.lang.double . can't validate values include currency symbol. if want validate these values, can use <f:validateregex> or custom validator.

Exceeded maximum execution time in Google App Script with Contacts API -

i creating script responsible of generating report containing info set of groups , contacts in google app script. if select few groups, goes ok if select several (20 or more), scripts launches "exceeded maximum execution time" error. how reduce script time execution? thanks! my (reduced) script var allcontactsinfo = [] /ii. each group for(var = 0 ; < numberofgroups ; i++) { var selected = eventinfo.parameter["group"+i] var contactinfo = [] //iii. if has been selected user if(selected) { //iv. contact group , contacts var contactgroup = contactsapp.getcontactgroupbyid(eventinfo.parameter["group_"+i+"_id"]) var contacts = contactgroup.getcontacts() //iv. iterate on each group contact (var j=0; j < contacts.length; j++) { var contact = contacts[j]; contactinfo.push(contact.getgivenname()) contactinfo.push(c

recurring billing - PayPal recurrent payment. How to claim them? -

Image
i've been working (or should struggling) paypal sdk recurring billing running website. managed work, not see how automatically "claim" money? basically happens is: profile created, after 24 hours payment done , see following in merchant sandbox account: it seems need manually accept payment amount added paypal balance. there way of doing automatically? this caused issue recipient's account. commonly, recipient hasn’t confirmed email address on paypal account. once email address confirmed amount automatically post balance on future payments.

java - Reading updated variables after evaluating a script -

i testing jsr 223 (scripting) code works rhino see how works nashorn. 1 area of difference in handling of updates variables passed in via bindings argument engine.eval() . in rhino, can use method pass in dynamic variable bindings when evaluating script , read out updated values of these variables after executing script. in nashorn, however, not work - values of variables in bindings object still present initial values after executing script. to illustrate testng test case: @test public void shouldsupportreadingvariablesfrombindings() throws exception { // given scriptengine engine = new scriptenginemanager().getenginebyname("javascript"); bindings vars = new simplebindings(); vars.put("state", 1); // when engine.eval("state = 2", vars); number result = (number) vars.get("state"); // assertequals(result.intvalue(), 2); } with rhino (apple jdk 1.6.0_65 on mac os x 10.9.3) test passes. nashorn (orac

joomla2.5 - Joomla/Virtuemart scripts not working on the product detail view -

i have joomla 2.5.20 site virtuemart 2.6.4. i'm creating template among other things uses jquery , bootstrap. while site works in general, including vm's cart, i'm facing problems product detail view: no script virtuemart seems working: if click on thumbnail image, won't change main image. if click on main image, open in new window instead of opening fancybox. rating control won't allow me select star rate product. i've been searching on , every answer i've come it's jquery conflict. while jquery (v. 1.8.0) there, don't see conflict possibly be. the site is: http://www.dailymood.com.mx the url sample it's not working: http://www.dailymood.com.mx/catalog/mood/20014moodbarbcrh-detail any appreciated. in advance!

C: modifying const data in an array using pointer -

this question has answer here: deep analysis of const qualifier in c 9 answers i have const array in global scope this: const long array_test[5] = {1, 2, 3, 4, 5}; how modify elements of above array @ runtime using pointer? in no way. can't modify const objects.

c++ - How can I access the members of objects stored in a vector? -

the code giving problem below. have commented parts give correct output, , not, not know why, , how should accessing class member data normally. read trying access in c style loop isn't great, tried ith iterators met "error: no match 'operator<=' (operand types 'player' , '__gnu_cxx::__normal_iterator >')" class player { public: player() {} player(double strength) {} virtual ~player() {} double getstrength() const { return strength; } void setstrength(double val){ strength = val; } int getranking() const{ return ranking; } void setranking(int val){ ranking = val; } int getatppoints() const{ return atppoints; } void setatppoints(int val){ atppoints = val; } protected: private: double strength; //!< member variable "strength" int ranking; //!< member variable "ranking" int atppoints; //!< mem

python - Why does the Django filter() adds items instead of removing them? -

i'm curious filter() method behaviour. read in documentation can chained. ok let's try: # returns queryset of 2 objects : [<cliprofile: sven>, <cliprofile: david>] res = someclass.objects.all() # returns queryset of 3 objects : [<cliprofile: sven>, <cliprofile: sven>, <cliprofile: david>] res2 = res.filter(some_attr__gte=a_datetime_object) how possible? if initial queryset contains 2 objects, how possible filter() method makes queryset grow? your filter applies related objects ; <cliprofile: sven> 2 such objects matched, object listed twice. add .distinct() call : res2 = res.filter(some_attr__gte=a_datetime_object).distinct() as documentation .distinct() states: by default, queryset not eliminate duplicate rows. in practice, problem, because simple queries such blog.objects.all() don’t introduce possibility of duplicate result rows. however, if query spans multiple tables, it’s possible duplicate results whe