Posts

Showing posts from March, 2011

javascript - How to use mouse event to do AJAX call only if user is idle for X seconds -

apologies if repost. have seen many examples. can't seem put needs. have "today" page displays groups. throughout day more , more groups appear. want able dynamically update these groups if user has page open , hasn't moved mouse x seconds. have chunk of code: var timeout = null; j$(document).on('mousemove', function() { if (timeout !== null) { cleartimeout(timeout); } timeout = settimeout(function() { timeout = null; //calls page check if there's new data display. if so, wipe existing data , update j$.ajax({ url: "/include/new_groups.php", cache: false, success: function(data){ j$( ".group_container_main" ).append( data ).fadein('slow'); } }) .done(function( html ) { }); }, 3000); }); what doin

html - Elements with visibility hidden causes white space -

i facing case this, popup hidden using "visibility : hidden" still holds space in screen, while have no control on coordinates of element it's auto calculated primefaces control jsfiddle example here's simulation case <div class="main"></div> <div class="dialog"></div> <style> .main{ background-color: red; width: 100%; height: 100%; } .dialog{ position: absolute; top: 800px; left: 0px; width: 200px; height: 200px; visibility: hidden; } </style> hope can help, thank you use jquery remove particular element screen $( ".dialog" ).remove();

javascript - How to include html file on click link -

hi want include file on link click here following code did not working in html page here code given below $("#reset").click(function() { $(function() { $("#rightpanecontainerdiv").html('<iframe src="open.php"></iframe>'); }); }); <a href="#" id="reset"></a> where wrong in following code how can achieve output you binding javascript handler link before including link in html. after click event fires, delaying reaction until dom ready — highly unlikely dom not ready time link clicked. swap 2 event handlers. wait dom ready. bind event handler. $(function() { $("#reset").click(function() { $("#rightpanecontainerdiv").html('<iframe src="open.php"></iframe>'); }); });

sql server - transfer data from one database to another regarding keys -

how can transfer rows 2 tables (patient , contactdetails) db1 db2? both dbs, have these 2 tables data. want add data these 2 tables db1 db2. i tried following that but didnt work, because there rows same keys , overwrite forbidden. is there other way it? or missing something? patient , contactdetails relationship is patient inner join contactdetails (foreign_key)patient.contactdetailsid = (primary_key)contactdetails.id loop on source contactdetails table, insert each row 1 time saving in temp table old contactdetail id , matching new contactdetail id ( here example of sql loop). temp table should like: create @temptableforcopy table ( oldcontactdetailsid [insertheretherightdatatype], newcontactdetailsid [insertheretherightdatatype] ) copy data patient table joined temp table used previous step this: insert newdb.newschema.patient (contactdetailsid, field1, field2, ...) select tt.newcontactdetailsid, old.field1, old.field2, ...

css - How to make my image responsive width and height? -

i wont image responsive rest of website be. how make adjust size of container. not width resize height? the image in container max-width of 1300px, have made test image has sizes 400px height , 1300px width here jsfiddle can have @ mean. http://jsfiddle.net/z6fj8dtg/2/ <div id="wrapper"> <div id="codeback"> </div> <div id="container"> <div class="nav"> </div> <div id="wrap"> <div class="banner"> <img src="http://s12.postimg.org/vnsghsvf1/banner.png" > </div><!-- end of banner --> </div> </div><!-- end of container --> body{ background-color:#272822; padding:0; margin:0; } #wrapper{ width:100%; height:inherit; } #codeback{ wi

mysql - Need insight into script to copy InnoDB tables to another database -

i have mysql database innodb tables need copy newly created database. automate copying process script since there on 100 tables. this current code. after 10 tables, it's getting tiresome: > use newdb; > create table tablea old_db.tablea > insert tablea select * old_db.tablea how can extract table names old_db in order automate process? use mysqlworkbench export schema , data source database , import new database.

Openlayers import features to geoserver catalog -

i have simple feature collection returned execution of vec:unionfeaturecollection wps process. need import these features geoserver catalog, means need assign them store , workspace. have tried gs:import wps process, close have come fails without exception. using openlayers. here code using: wpsclient1.execute({ server:'local', process:'gs:import', inputs:{ features:featurecollection, coverage:'', workspace:'workspace1', store:'analysis', name:layername, srs:new openlayers.projection('epsg:4326') }, success:function(layername1){ localstorage.setitem("layername",json.stringify(layername1)); window.location.reload(); } }); i have tried chaining processes shown below still nothing. var union = wpsclient.getprocess('local','gs:unionfeaturecollection'); var catalogimport = wpsclient.getprocess('local','gs:im

long polling - JS and CSS file fails to load when the page is refreshed in grails application which uses Atmosphere Meteor plugin -

in grails 2.3.7 application, using atmosphere-meteor 0.8.3. on home page load, subscribe client. , default run long-polling; , works fine. on page refresh, unsubscribe client. however, if refresh page; of js , css fails load. happens 5 out of 10 times of refresh. am doing wrong? (as subscribe on document.ready()). or need else? any appreciated. update: code inside gsp subscription: $('body').bind('beforeunload',function(){ jabber.unsubscribe(); }); $(document).ready(function () { if (typeof atmosphere == 'undefined') { jabber.socket = $.atmosphere; } else { jabber.socket = atmosphere; } var atmosphererequest = { type: 'public', url: 'atmosphere/public', trackmessagelength: false }; //settimeout(function(){ jabber.subscribe(atmosphererequest); //}, 10000); }); and jabber variable var jabber = { socket: null, publicsubscription: null,

jquery - passing credentials not working -

Image
i trying make json call, passing credentials. if user logged system using sql membership, how can pass credentials without getting this: here code calls web.api: note: call being made cross domain: i.e. www.project.com -> api.project.com var url = 'http://api.project.com/lookups/uploadtypes?callback=?'; $.ajax({ type: 'get', url: url, async: true, xhrfields: { withcredentials: true }, jsonpcallback: 'handler', contenttype: "application/javascript", datatype: 'jsonp', success: function (json, textstatus, jqxhr) { console.log(jqxhr.responsetext); }, error: function (json, textstatus, jqxhr) { console.log(jqxhr.responsetext); } }); edit: i still login when authentication disabled. there place window authentication setting? to prevent popup have change url following. var url = ' http://username:password@api.project.com/lookups/uploadtypes?callback= ?'; repla

c# - How can I reference a repeater inside a usercontrol inside a webpart -

noobie, question, dont remember ! i created visual webpart, creates user control, added repeater in htnml view, , need bind data, cant seem find repeater control in codebehind. <table id="engagementletterreport" class="display" border="0"> <thead> <tr> <th>jobcode</th> <th>jobname</th> </tr> </thead> <tbody> <asp:repeater runat="server" id="repeater"> <itemtemplate> <tr> <td> <%# databinder.eval(container.dataitem, "jobcode") %> </td> <td> <%# databinder.eval(container.dataitem, "jobname") %> </td> </tr> </itemtemplate>

php - Wordpress Custom Post type - data-thumb data-src Images -

i have html page in there slider. here's html code <div data-thumb="images/slide1.jpg" data-src="images/slide1.jpg"> </div> <div data-thumb="images/slide2.jpg" data-src="images/slide2.jpg"> </div> <div data-thumb="images/slide3.jpg" data-src="images/slide3.jpg"> </div> i trying convert page wordpress. here's how doing in wordpress load images. <?php $options = array( 'post_type' => "slideshow", ); while ($my_query->have_posts()) : $my_query->the_post(); ?> <div data-thumb="<?php if ( has_post_thumbnail() ) { the_post_thumbnail('full'); } ?>" data-src="<?php if ( has_post_thumbnail() ) { the_post_thumbnail('full'); } ?>"> </div> <?php endwhile; ?> but not wor

javascript - Chart.js replace all data -

im having issue chart.js. firts, set data, , when parameter change, want rebind entire chart. work, chart old data still behind new one. first -> chart.line(data, options); in event -> chart.line(newdata, options); i saw solution chart.js load totally new data but dont way. im in angular directive context, it's not best aproach. i tried without results .update( ), .removedata( ), .clear(), .destroy(), etc here current directive http://plnkr.co/edit/qn2uuyznonkm6zgei8fw?p=catalogue any idea ? you creating new chart, that's why end old chart behind new one. one simple option i've used: remove old chart canvas using chart: $('#canvas').replacewith('<canvas id="canvas"></canvas>'); and create chart new data in same canvas var ctxchart = document.getelementbyid("canvas").getcontext("2d"); window.mychart = new chart(ctxchart).line(newdata, options); hope helps!

javascript - How do I make my counter work correctly? -

i have function adds div when press button. have counter re-setting logic written in removal should re-count names. my problem when add 3 items, , remove 2nd item, 3rd item not rename itself. what doing wrong this? $(function () { var rowitem = $(".row", $(".formitems")); //select rows class formitems $(".formitems").on("click", ".addrow", function () { var newitem = rowitem.clone(), rowindex = $(".row", $(".formitems")).length; $(":input", newitem).each(function (c, obj) { $(obj).attr("name", $(obj).attr("crap") + rowindex); }); $(".formitems").append(newitem); // adds @ end of container }).on("click", ".removerow", function () { if ($(".row", $(".formitems")).length > 1) { var target = $(this).parent().parent().parent().paren

javascript - Calling a Object Oriented function from jQuery -

i kind of new jquery , javascript , need on missing here. know code works in jsfiddle.net when run on computer it's not doing anything. want keep object oriented functions in "updated-formcheck.js" file separately. i have form validation html file jquery function calls "updated-formcheck.js" file checks empty fields , returns msg. when submit button clicked, nothing happens. can tell me why? html file: <script src="updated-formcheck.js" type="text/javascript"></script> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <form id="myform" method="post" action="#"> <fieldset> <label for="attendee">i a...<font color="red">*</font>:<br /> <br /> </label> <select id="attendee" name="attendee" > <option value="">-- please c

php - Symfony security placeholders -

i'm trying find out if there possibility use placeholders in security.yml config of symfony. i have following security.yml: order_area: pattern: ^/{_checkout}/ anonymous: ~ provider: ehv_customer security: true context: customer i'm building checkout process multiple languages, don't want use 1 standard language handle routing e.g. /checkout/1, /checkout/2. checkout protected symfony firewall allow customers logged in. is there way can define placeholder handle security firewall routing per language. following link other example of problem didn't work me: symfony-2 > login & logout routes placeholders . use prefix that's last option. perhaps it's possible add firewall rules through php instead of yml or xml? symfony version: 2.5.3 you may want read on symfony localization component, uses _locale parameter. may usable in security.yml patterns, you'll have test sure.

R error in eval Function -

hi i'm trying create function in r clean data... following code part of it. limpio=function (tabla, campo, campo_conteo){ tabla1<-aggregate(campo_conteo ~ campo, tabla, length) colnames(tabla1)[2]<-"frecuencia" tabla2 <- gsub('\\s+','',toupper(tabla1$campo)) view(tabla2) } so, when run: limpio(vendidos, nacionality, customerid) i following error: error in eval(expr, envir, enclos) : object 'customerid' not found but column exist, don't know what's problem. colnames(vendidos) #[1] "id" "campaignid" "customerid" "phoneid" "name" #[6] "numbertype" "number" "birthday" "sex" "holder" #[11] "holdernumber" "nacionality" "address" "city" "zip" you can&#

c++ - Is this a valid downcasting -

i have cpp code in class c derived class b , class b derived class a. now class b has public data member. creating instance of class c on heap passing pointer class pointer , there downcasting pointer pointer of class b , printing public variables of class b. is valid downcasting. asking because change of compiler has broken working code. i including below code snippet captures problem having. #include <iostream> using namespace std; class grand { }; class parent : public grand { public : parent(){i=0;} int i; parent(int j){ = j;} void set(int j){i = j;} }; class child : public parent{ public: child(){}; }; void print ( grand* ptr) { parent *p = (parent*) ptr; std::cout << std::endl << p->i << std::endl; } int main() { // code goes here child c; c.set(9); print(&c); return 0; } thanks is valid downcasting. yes. cast internally applies static_cast , which, according §5.2.9/11,

asp.net mvc - breeze validationErrorsChanged don't work with custom validation -

in directive subscribe @ validationerrorschanged event. wwhen change data @ page. events works standart type validation. standart required validation <input class="form-control input-xs" type="text" required data-ng-model="item.description" data-entity-errors-indicator="item.description"> customer validation flowvalidation div data-eve-compartment-and-technosphere-flow-selector="item" data-eve-compartment="compartment" data-eve-compartment-id="compartmentid" data-eve-technosphere-flow="technosphereflow" data-eve-technosphere-flow-id="technosphereflowid" data-eve-data-source="activitymodel.compartmentsandtechnosphereflows" class="pull-left" data-entity-errors-indicator=&qu

haskell - Minimum of Two Maybes -

i want minimum of 2 maybe values, or if 1 nothing non-nothing one, or return nothing if both inputs nothing. can write simple function this, suspect there way without writing custom function. sorry, if petty question, there simpler way using custom function? minmaybe :: ord => maybe -> maybe -> maybe minmaybe nothing b = b minmaybe nothing = minmaybe (just a) (just b) = $ min b you cannot use applicative , or monad instance this, since nothing in contexts have total result being nothing . being said, term "simpler" highly opinionated, , function fine is.

c++ - Can I use a `unique_ptr` in a vector, or do I need to switch to `shared_ptr`? -

given class unique_ptr: class myclass { public: myclass(){} myclass(myclass &&other) : ptr(std::move(other.ptr)){} std::unique_ptr <int> ptr; }; is there way make possible have std::vector<myclass> ? void thisbreaksit() { myclass instance; std::vector<myclass> mv; mv.push_back(instance); } as-is, gives me error error c2248: 'std::unique_ptr<_ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_ty>' this makes sense, since have no copy constrctor, , when compiler tries creating default copy constructor, tries copying unique_ptr , isn't allowed. i can make compile adding constructor: myclass(const myclass&){} but of course, leaves unique_ptr uninitialized, , not want. i can't add myclass(const myclass& other) : ptr(std::move(other.ptr)){} because it's const , , cant call std::move() on const object. can create constructor myclass(mycl

android - Proguard and Object extends Parcelable - Class not found when unmarshalling -

i'm releasing apk. in debug mode, have no error. when sign apk proguard, app works til fourth screen, have deal value object class implement parcelable e/parcel(811): class not found when unmarshalling: com.spg.movil.vo.pdv e/parcel(811): java.lang.classnotfoundexception: com.spg.movil.vo.pdv e/parcel(811): @ java.lang.class.classforname(native method) e/parcel(811): @ java.lang.class.forname(class.java:251) e/parcel(811): @ java.lang.class.forname(class.java:216) e/parcel(811): @ android.os.parcel.readparcelablecreator(parcel.java:2133) e/parcel(811): @ android.os.parcel.readparcelable(parcel.java:2097) e/parcel(811): @ android.os.parcel.readvalue(parcel.java:2013) e/parcel(811): @ android.os.parcel.readarraymapinternal(parcel.java:2314) e/parcel(811): @ android.os.bundle.unparcel(bundle.java:249) e/parcel(811): @ android.os.bundle.getstring(bundle.java:1118) e/parcel(811): @ android.content.intent.getstringextra(intent.java:4991) e/parcel(811): @ com.android.se

java - What are %I% and %G% identifiers in Object class javadoc? -

Image
just out of curiosity. when hover on object word in eclipse, doc shows below info. know version represent. this not appear on online oracle javadocs http://docs.oracle.com/javase/7/docs/api/java/lang/object.html also, futher checking object class, intial comments show %w% %e% . know these identifiers for? those come sccs (source code control system), scm sun used use. when file checked in %i% converted version of file , %g% date file checked in. if memory serves correctly sun moved mercurial around 2007 or so, don't think there's danger of these getting updated! %e% date (in yy/mm/dd format, %g% mm/dd/yy). don't know %w%!

javascript - SOAP fault error when using AngularJS to request from SSRS -

i'm using angularjs try pull down list of reports ssrs display in iframe. problem i'm running getting soap fault error when doing post request. here angular controller looks making post. function reportssrscontroller($scope, $http, $location) { $scope.request = '<soap:envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema">' + '<soap:body>' + '<m:listchildren xmlns:m="http://example.com/reportingserver/reportservice2010">' + '<m:itempath>/reports</m:itempath>' + '<m:recursive>false</m:recursive>' + '</m:listchildren>' + '</soap:body>' + '</soap:envelope>'; $http({ method: 'post', url: '/reportserver/reportservi

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null .

entity framework - Updating a set of records in LINQ - All at once -

i have several records need updated same value. if using ado.net call stored procedure updated them @ 1 ... update mytable set mycolumn = "xxxxxx" filtercolumn == 'yyy' but since using entity framework wondering if similar way update set of records @ once without having loop through each of values , set them individually? using.. from s in mytables s.filtercolumn == 'yyy' select s; var results = s.tolist(); foreach (i in results){ s.mycolumn = "xxxxxx" } is there way set values @ once in sql? i using entity framework v6.1 you can still execute sql command when using entity framework. here how it. dbcontext.database.connection.open(); var cmd = dbcontext.database.connection.createcommand(); cmd.commandtext = @"update mytable set mycolumn = @mycolumn filtercolumn = @filtercolumn"; cmd.parameters.add(new sqlparameter("mycolumn", "xxxxxx")); cmd.parameters.add(new sqlparameter("filtercolum

I don't know what's wrong with one of my variable.[Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = 'm'] -

import java.util.scanner; public class labex03 { public static void main(string[] args) { system.out.println("name le01"); scanner kbd = new scanner(system.in); double m = 3; double n = 0; system.out.print("type 12 , press enter"); n = kbd.nextint(); double p = (double)m * (double)n; double q = 0; q = (double)math.sqrt(p); system.out.printf("%m"); system.out.printf("%n"); system.out.printf("%p"); system.out.printf("%q"); } } debug: name le01 type 12 , press enter12 exception in thread "main" java.util.unknownformatconversionexception: conversion = 'm' @ java.util.formatter$formatspecifier.conversion(formatter.java:2691) @ java.util.formatter$formatspecifier.(formatter.java:2720) @ java.util.formatter.parse(formatter.java:

Getting values from a DEFCONSTANT in LISP -

there defconstant statement: (defconstant *contant2* ’((allan 4) (zols 5) (milo 2) (judh 0))) i want take separated constant name , value associated name. how can that? give taste scores: ((name-1 score-1) ... (name-n score-n)) argument, lisp functions avare score , other generate word scores (9-10 verygood, 7-8 good). (defconstant contant2 ’((allan 4) (zols 5) (milo 2) (judh 0))) i appreciate help! thanks. to answer direct question: ? (mapcar #'car *cookie-scores*) (john mary mike jane) ? (mapcar #'cadr *cookie-scores*) (8 9 1 0) in loop , can use loop 's destructuring: for (name val) in other options available; here's 2 example implementations of required functions leave uncommented; please ask questions, or show code. (defun average-score (lst) (/ (reduce #'+ lst :key #'cadr) (length lst)))) ? (average-score *cookie-scores*) 9/2 and (defun word-scores (lst) (loop (name val) in lst collect (list name

html - Floated div to fill remainder space -

i have codepen set here: http://codepen.io/anon/pen/isqou div.linksbox { border:1px solid #a9a9a9; background:#fff; -moz-box-shadow:0 5px 12px rgba(0,0,0,0.3); -webkit-box-shadow:0 5px 12px rgba(0,0,0,0.3); box-shadow:0 5px 12px rgba(0,0,0,0.3); margin:0 12px 12px 0; text-align:center; overflow:hidden; } <div id="topfloats" style="margin-top:5px; overflow:hidden; border:1px solid black; margin-top: 10px;"> <div style="width:20px; height:340px; float:left; background-color:red;"></div> <div id="rightfloatwrapper" class="linksbox"> <div class="rollover linkiconlayout" id="" style='width: 134px; height: 122px; background-color:green;' href=""></div> <div class="rollover linkiconlayout" id="" style='width: 142px; height: 112px; background-color:blue;' href=""</div> </div> </div

Instagram API GET /Locations/search not working -

im developing app uses instagram's api having trouble using locations endpoint. the code bellow works, return list of tags based on qry_string value instaurl += 'tags/search?q=qry_string&callback=?'; $.getjson(instaurl, accessparam, oninstalistloaded); the problem when try search locations, can query media endpoint latitude/longitude not locations. bellow example of querying media lat/lng works instaurl += 'media/search??lat=-22.9732708&lng=-43.1857553&callback=?'; $.getjson(instaurl, accessparam, oninstalistloaded); but if try query locations not work. in instagram api console internal error 500 when try run same query above changing media locations. is there trick use locations endpoint different of others? vmenezes, if it's 500 error, it's 1 of 2 things: the location have reason not register back-end processing. more likely, 500 error never fault. on back-end messing , not able finish processing request. recomm

visual studio 2010 - Connect to informix database windows form application -

i trying figure out how connect ibm informix database. have been doing research , have found threads 5 years ago examples not working. i have installed latest sdk ibm informix. i have included ibm.data.informix.dll references in project. i have included using ibm.data.informix; i adding button , on click testing conenction. debug error "sql0035n file "c:\users\adam\documents\visual studio 2010\projects\test\test\msg\en_us\db2nmp.xml" cannot opened." this file not exist , dont see anywhere in program files (x86)\ibm informix client sdk directory. my on click code is private void button1_click(object sender, eventargs e) { const string host = "192.168.obfuscated"; const string servicenum = "1525"; //port? const string server = "serverobfuscated"; const string database = "dbobfuscatedy"; const string user = "myusername"; const string password = &

Unable to import python modules from different directories -

i have below directory structure /opt/juno/ +/opt/juno/__init__.py +/opt/juno/lib/__init__.py +/opt/juno/lib/gen_cert_request.py-class certdb->def generate_cert() +/opt/juno/tests/acceptance/cli_tests/cert-cli/test1.py test1.py pytest functions, need call generate_cert function , unable import modules. i created __init__.py in /opt/juno, /opt/juno/lib, /opt/juno/tests/, /opt/juno/tests/acceptance/, /opt/juno/tests/acceptance, /opt/juno/tests/acceptance/cli-tests/, /opt/juno/tests/acceptance/cli-tests/cert-cli, directory. any on how can call generate_cert function in test1.py ? i tried below [root@pkiserver1 pki-cert-cli]# pwd /opt/juno/tests/acceptance/cli-tests/pki-cert-cli [root@pkiserver1 pki-cert-cli]# ls -l /opt/juno/lib/ total 48 -rw-r--r--. 1 root root 5355 sep 10 13:13 gen_cert_request.py -rw-r--r--. 1 root root 5772 sep 10 13:14 gen_cert_request.pyc -rw-r--r--. 1 root root 0 sep 10 13:08 __init__.py -rw-r--r--. 1 root root 102 sep 10 13:14 __init__.p

mysql - child tables and foreign keys -

i know there have been myriads of questions concerning primary , foreign keys. looking through them, cannot seem find simple answer question. understanding of primary , foreign keys foreign key column designated in child table refers primary key column in parent table. correct, or have backwards? if indeed correct, trying find out why having difficulty creating foreign key in child table such: salesorders.sonumber (pk) < customer.sonumber (fk) i using navicat mariadb (same mysql) , error is: 1452 - cannot add or update child row: foreign key constraint fails ('customer_orders','#sql7a8_3'; constraint 'sonumber' foreign key ('sonumber') references 'salesorder' ('sonumber') on delete no action on update cascade) customer_orders database name. naming foreign key 'sonumber' same column name in child table (customer) , parent table (salesorders). incorrect? should give foreign key name? gitpicker the foreign k

serialization - Ensuring genuine parameters doesn't trigger "You tried to assign already serialized content to value. This is disabled due to security issues." -

i've created form builder in rails allows users construct own forms. many of form inputs supply straight strings rails (e.g. text field). provide arrays of values (like date choosers). right i'm storing values these in serialised column. works well, , lets me re-display custom forms when error occurs minimal effort. problem entered: -------- into text field , activerecord raised error saying: you tried assign serialized content value. disabled due security issues. i string looks yaml, i'm wondering if there's more graceful way around user entering bunch of dashes indicate had no phone number. i'd fail gracefully , perhaps drop value or store serialised string if there such thing. in rails 3.0.20 lts they've patched code check yaml strings being sent serialised columns. i've overridden assignment method on model fix string instead of raising error: module activerecord module attributemethods module write extend activesupport::

java - Google Games: Gingerbread w/ Multiple G+ Accounts > Indefinite Sign-In Loop - GameHelper -

with google play game services samples, if use gingerbread device has multiple google accounts, cannot sign in. gamehelper fails sign-in , stuck in never ending "sign-in screen" loop. if open gamehelper.java , comment out line 417: mexpectingresolution = false; ..then can log in. causes game crash. google play services , new class gamehelper example buttonclicker2000 on android 2.3 can not log in account. when dialog box (sign-in dialog) appears user's choice, method onstop(). /** call method activity's onstop(). */ public void onstop() { debuglog("onstop"); assertconfigured("onstop"); if (mgoogleapiclient.isconnected()) { debuglog("disconnecting client due onstop"); mgoogleapiclient.disconnect(); } else { debuglog("client disconnected when got onstop."); } mconnecting = false; mexpectingresolution = false; // let go of activity reference mactivity = null;

c - Frame rate changes with respect to window size -

i experimenting opengl when observed frame rate changes when window enlarged or compressed. observed 301 frames takes 60.116 fps , 3000 frames takes 6043 fps. enlarge window fps increases? have refresh rate ? no. term you're looking fillrate . make long story short: bigger window more pixels gpu has touch, takes longer.

java - Android programically added button has match parent width and height -

i'm trying add button button dalsi_akce = new button(this); dalsi_akce.setgravity(gravity.center); relativelayout.layoutparams p = new relativelayout.layoutparams(relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); dalsi_akce.setlayoutparams(p); setcontentview(dalsi_akce); dalsi_akce.settext("test"); button appears full match parent. have button on whole display. can advice me how set width , height of button ? you setting activity's content button. that's why spans on whole activity , wrong. instead create activity's layout (an xml file) , set setcontentview . can programatically add button content. example: your activity: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); viewgroup viewgroup = (viewgroup) findviewbyid(r.id.mylayout); button dalsi_akce =

linux - ffmpeg to convert .avi, .mp4, .mp3, .flv, .mkv to mp4 -

i searching script contains of attributes title. i have done 1 simple 1 attribute far , not want 1 script each of attributes not confused. like this, running script 10 minutes see if there file consist .flv , automatic doing convert file mp4 attribute. #!/bin/bash # convert flv mp4 ext=.mp4 file in *.flv; currmov=$file$ext ffmpeg -r 15 -i $file -b 296k -s 640x320 -vcodec mpeg4 -acodec aac $currmov done thanks help! /m for extensions: for file in *.{flv,avi,mp3,mkv}; target="${file%.*}.mp4" [[ -f "$target" ]] && { echo "skipping $file - $target exists" ; continue; } echo ffmpeg -r 15 -i "$file" -b 296k -s 640x320 -vcodec mpeg4 -acodec aac "$target" done remove echo before ffmpeg if satisfied

ios - Animation Blocks resets to original position after updating text -

i'm testing apps release of ios 8. noticed after performed animation block, animation resets if update text of label. ran simple example 1 method shown below. running example results in following: clicking mybutton first time- animation runs resets when label text changed. clicking mybutton second time - animation runs not reset original position. it seems happens because label text doesn't change. if remove line updating text, stops animation resetting @ end. i fix when method runs, label text can updated without resetting animation. - (ibaction)move:(id)sender { [uiview animatewithduration:0.4 delay:0.0 options:uiviewanimationoptionbeginfromcurrentstate animations:^{ self.mybutton.center = cgpointmake(200, 300); }completion:^(bool finished){ if(finished){ self.mylabel.text=@"moved"; } }]; }

ios8 - Xcode 6 Navigation bar weird -

i upgraded xcode 5 project xcode 6 (clean install). 2 viewcontrollers there problem: try hide button on 1 of them, goes weird (see pictures). didn't change anything. possible fix somehow? http://i60.tinypic.com/2qd096v.png http://i60.tinypic.com/npgv0y.png there should button on register screen en sparks title shouldn't there. if press on navigation bar goes welcome screen again , on ok. alright found solution this. in file push new controller have set hides button. controller.navigationitem.hidesbackbutton = yes; [self.navigationcontroller pushviewcontroller:controller animated:yes];

arrays - Parsing a WHERE clause string in java -

i using java version 1.7 have string: string customerlist="'c1','c2','c3','c4','c5'"; i parse each customer individual strings, like string c1, c2, c3, c4 , c5 how do this? for example: string customerlist="'c1','c2','c3','c4','c5'"; for( string s : customerlist.split(",") ) { system.out.println(s.replaceall("'", "")); }

Is it possible to execute function every x seconds in python, when it is performing pool.map? -

i running pool.map on big data array , want print report in console every minute. possible? understand, python synchronous language, can't nodejs. perhaps can done threading.. or how? finished = 0 def make_job(): sleep(1) global finished finished += 1 # want call function every minute def display_status(): print 'finished: ' + finished def main(): data = [...] pool = threadpool(45) results = pool.map(make_job, data) pool.close() pool.join() you can use permanent threaded timer, question: python threading.timer - repeat function every 'n' seconds from threading import timer,event class perpetualtimer(object): # give cycle time (t) , callback (hfunction) def __init__(self,t,hfunction): self.t=t self.stop = event() self.hfunction = hfunction self.thread = timer(self.t,self.handle_function) def handle_function(self): self.hfunction() self.thread = timer(self.t,self.

python - Optimization tips for reading/parsing large number of JSON.gz files -

i have interesting problem @ hand. who's beginner when comes working data @ morderate scale, i'd love tips veterans here. i have around 6000 json.gz files totalling around 5gb compressed , 20gb uncompressed. i'm opening each file , reading them line line using gzip module; using json.loads() loading each line , parsing complicated json structure. i'm inserting lines each file pytable @ once before iterating next file. all taking me around 3 hours. bulk inserting pytable didn't speed @ all. of time gone getting values parsed json line since have horrible structure. straightforward 'attrname':attrvalue , complicated , time consuming structures like: 'attrarray':[{'name':abc, 'value':12},{'value':12},{'name':xyz, 'value':12}...] ...where need pick value of objects in attr array have corresponding name , , ignore don't. need iterate through list , inspect each json object inside. (i'd glad