Posts

Showing posts from May, 2015

android - How to maintain scroll position of listview when the adapter update -

i bind adapter listview , @ first have fetch 10 records when scroll ends again items added in listview , works perfect. but when added items after scroll end @ time items added listview position set top. want set position new added items. here codes: onscroll function: public void onscroll(abslistview view, int firstvisibleitem, int visibleitemcount, int totalitemcount) { new items().execute(); } async function: class items extends asynctask<string, string, string> { @override protected void onpreexecute() { ... } protected string doinbackground(string... args) { list<namevaluepair> params = new arraylist<namevaluepair>(); params.add(new basicnamevaluepair("id", string.valueof(id))); jsonobject json = jparser.makehttprequest(url, "get", params); try { (int = 0; < products.length(); i++) {

excel - In VBA, when I change the format of one column, the adjacent one changes too -

i trying format 2 columns - 1 "general" , 1 "number 0.000," when second 1 formats, changes format of first column "number 0.000" well. if manually select columns , change format works fine. why macro changing format of both columns? here code snippet: range("c:c").select selection.numberformat = "general" range("d:d").select selection.numberformat = "0.000" try avoid using .select , might cause issues. try: range("c:c").numberformat = "general" range("d:d").numberformat = "0.000" that works me. the reason works if manually select range because when select range, .select part in macro use selected. avoiding .select helps ensure no matter cell/range have selected, use explicit range want (in case, range("c:c") , range("d:d")).

haskell - How can packages be unhidden when using only stack? -

i'd try out writer monad in ghci. advised here , tried use stack manage ghc , packages, , avoid global installation. from fresh ubuntu 15.04 install, after installing stack: stack setup mkdir lyah && cd lyah stack new stack install mtl stack ghci ghci> import control.monad.writer not find module ‘control.monad.writer’ member of hidden package ‘mtl-2.1.3.1’. i understand pre-stack ghc-pkg used show/hide packages, i'm not sure how proceed here 'unhide' mtl package. edit .cabal file stack new created , add mtl build-depends section. part of file should this: build-depends: base >= 4.7 && < 5 , mtl then, stack build before stack ghci . by way, not use stack install install libraries - merely shortcut copy binaries. e.g. stack install hlint first build package , copy resulting binary ~/.local/bin/ . instead, add packages .cabal file, shown above, , use stack build installed.

javascript - Defining A Variable With the Result of the Previous, And Are There Better Ways To Go About It? -

i'm writing web page generates list of blog posts, along associated data (such timestamps , previews of articles), , i'm attempting generate unique variable every blogpost generation increments one. in order this, i've created variable called "name" on line 59, , take string "dtartnum" , concatenate integer of loop, maximum of i, or variable $sqlindex (which index of number of articles in database). on line 60, have variable want define result of variable name, , assign value of $sqlindex (with result_of_name being placeholder result of name each time it's defined). reason (based on other articles on stack overflow i've read) php executes during page load (roughly). in line of logic, means php variables become inaccessible, , have procedural generated , stored locally php generates page. later on, i'm planning on using ajax library i've found post variable page (which has yet created) act "id" (which primary key) row

javascript - Django dynamically generated form sets. Deleted forms throwing validation error -

i have inline formset created inlineformset_factory. here simplified example. #models.py class mymodel(models.model): owner = models.foreignkey(user) job_type = models.foreignkey(jobtype) price = models.integerfield() class meta: unique_together = (('owner', 'job_type'),) #forms.py formset = inlineformset_factory(user, mymodel, fields=('job_type', 'price')) i using javascript dynamically add forms , delete forms formset. when click delete form hidden. i'm submitting forms ajax , sending errors if necessary. this works fine except 1 detail. mymodel has unique condition. if deletes preexisting form (so hidden) , adds form same job_type , submits, django throws uniqueness validation error though 1 of forms being deleted. i thought fix clearing job_type field on deleted form throws 'this field required' error , still throws uniqueness error. any appreciated! update further research reveals error present in admin

mysql - Cannot submit a form on php and mysqli_query -

i have html form want submit data specific database in wamp using phpmyadmin, connection done. however, data cannot submitted. message after submitting data in form : successful connection ( ! ) warning: mysqli_query() expects parameter 1 mysqli, resource given in c:\wamp\www\ex\insert-data.php on line 11 call stack # time memory function location 1 0.0005 136600 {main}( ) ..\insert-data.php:0 2 0.0023 144480 mysqli_query ( ) ..\insert-data.php:11 error inserting new records! my code in 'insert-data.php' is: <?php if(isset($_post['submitted'])){ include('connect.php'); $fname = $_post['fname']; $lname = $_post['lname']; $sqlinsert= "insertinto`test`(`fname`,`lname`)values('$fname','$lname')"; if(!mysqli_query($dbconn,$sqlinsert)){ die('error inserting new records!'); } echo "1 record added database"; } ?> <!doctype html> <

java - The method getHostConfiguration() is undefined for the type HttpClient -

trying twilio working proxy get: the method gethostconfiguration() undefined type httpclient in following code: twiliorestclient client = new twiliorestclient(accountsid, authtoken); client.gethttpclient().gethostconfiguration().setproxy("1.1.1.1", "8080"); the imports have are: import java.io.ioexception; import org.apache.commons.httpclient.credentials; import org.apache.commons.httpclient.hostconfiguration; import org.apache.commons.httpclient.httpclient; import org.apache.commons.httpclient.httpmethod; import org.apache.commons.httpclient.httpstatus; import org.apache.commons.httpclient.usernamepasswordcredentials; import org.apache.commons.httpclient.auth.authscope; import org.apache.commons.httpclient.methods.getmethod; import org.apache.http.httpresponse; import org.apache.http.client.methods.httpget; import org.apache.http.impl.client.closeablehttpclient; import org.apache.http.impl.client.httpclientbuilder; import java.io.unsupportedencodi

Use of 'prototype' vs. 'this' in JavaScript? -

what's difference between var = function () { this.x = function () { //do }; }; and var = function () { }; a.prototype.x = function () { //do }; the examples have different outcomes. before looking @ differences, following should noted: a constructor's prototype provides way share methods , values among instances via instance's private [[prototype]] property. a function's this set how function called or use of bind (not discussed here). function called on object (e.g. myobj.method() ) this within method references object. this not set call or use of bind , defaults global object (window in browser) or in strict mode, remains undefined. javascript object oriented language, i.e. object, including functions. so here snippets in question: var = function () { this.x = function () { //do }; }; in case, variable a assigned value reference function. when function called using a() , function's this

Smarty mysql date + 1 day -

i have variable give me date mysql: {row.date} how can add 1 day this? exampe: row.date = 2015-07-23 , wish = 2015-07-24 thanks in advance. you can use date functions this. here way achieve this: date_add('2015-07-23', interval 1 day); you can replace "2015-07-23" column name contains date in select query.

python - How to change x axis increments and plot using log(x) on the xaxis? -

Image
i shorten xaxis data more visible. however, don't know how accomplish while leaving xaxis log(x). here code above image: data = data([ bar( y=[x/float(114767406) x in yp_views], x=[x x in yp_views], name='relative frequency')]) layout = layout(xaxis=xaxis(type='log',title = "number of premium highlight views") ,yaxis=yaxis(title = "frequency")) fig = figure(data = data, layout = layout) py.iplot(fig) here tried: i tried solving problem using histogram , xbins. however, doesn't allow me freedom of using custom x , y axis plot. don't see xbins property bar charts. there name it? here trying plot using range: data = data([ bar( y=[x/float(114767406) x in yp_views], x=[x x in yp_views], name='relative frequency')]) layout = layout(xaxis=xaxis(type='log', range = [3000,10000], title = "number of premium highlight views")

Upgrade Visual Studio 2013 solutions to Visual Studio 2015 -

i have installed both visual studio 2013 , visual studio 2015. projects , solutions created in vs2013 opened vs2013 expect, able upgrade files opened vs2015 when double clicked. how can upgrade solution files in vs2013 format microsoft visual studio version selector open them in vs2015? the simplest solution imo (also worked 2012 , 2013) is: open solution file using visual studio 2015 select solution file in solution explorer select file / save mysolution.sln as... overwrite existing solution file.

Can slack incoming webhooks post message to all private groups? -

i searching if slack incoming webhooks can send message private groups, didn't find slack documentation on that. so, can slack incoming webhooks send message private groups? incoming webooks can post private groups. when set incoming webhook @ https://team.slack.com/services/new/incoming-webhook , choose private group want send to. you can send different channel (including different private group) "channel" json key. a single incoming webhook cannot send multiple destinations.

xml - postgresql xpath integer index -

i wondering if there way create indexes based on type conversion of xpath results. integer index, can imagine date, floating points, etc. if experimental or coming in future version of postgres... or database. looked @ existdb looked far being production ready. some test xml: <?xml version="1.0"?> <book> <isbn>1</isbn> <title>goldfinger</title> <author>ian fleming</author> </book> i able obtain satisfactory results table , index this. table "public.test" column | type | modifiers | storage | stats target | description --------+---------+---------------------------------------------------+----------+--------------+------------- id | integer | not null default nextval('test_id_seq'::regclass) | plain | | num | integer | |

php - The "--no-migration" option does not exist in laravel 5 -

i have installed laravel 5 , looking scaffolding when run command php artisan make:scaffold tweet --schema="title:string:default('tweet #1'), body:text" it giving exception "the "--no-migration" option not exist". have checked php artisan migrate --help command , option not exists. can me please? thanks. the laralib/l5scaffold extension not have --no-migration option. cannot prevent creating migration files via command. currently don't see suitable way achieve desired behaviour. delete migration files afterwards. or implement feature , create pull request repository . need change src/commands/scaffoldmakecommand.php . here hints: public function fire() { // ... // generate files if (!$this->option('no-migration')) { $this->makemigration(); } $this->makeseed(); // ... } protected function getoptions() { return [ ['schema', 's', inputoptio

ios - Loading Data Asynchronously into UITableView -

i using xcode 7 beta , swift, , storing data using parse.com. in method in uitableviewcontroller should asking data database? need ensure present point in lifecycle of controller @ cells need presented. is there anyway guarantee if loading data asynchronously? viewdidload place there might few second difference between displaying blank tableview , when gets populated depending on how long takes pull data. so in viewdidload you'll tell parse sdk pull data , when it's complete, can call [self.tableview reloaddata]

ios - Alert Message with links to navigate to different scenes in an Swift application -

i need develop alert message links navigate different scenes in swift application. please suggest me techniques or sample codes thanks you implement alert so: let alertcontroller = uialertcontroller(title: "hi", message: "...", preferredstyle: .alert) let cancelaction = uialertaction(title: "cancel", style: .cancel) { (action) in self.performseguewithidentifier("seguetitle", sender: self) } alertcontroller.addaction(cancelaction) let okaction = uialertaction(title: "ok", style: .default) { (action) in self.performseguewithidentifier("seguetitle", sender: self) } alertcontroller.addaction(okaction) self.presentviewcontroller(alertcontroller, animated: true) { // ... }

c# - Filtering a list in a list using linq -

i have list want filter based on user input. so i've got this: var fulllist = blogic.getdatastorecompaniesforfilterlist(); var filterlist = fulllist .where(w => w.name.tolower().startswith(filterstring.tolower()) || filterstring.length > 2 && w.vat.tolower().contains(filterstring.tolower()) || w.industrylang != null && w.industrylang.where(ww => ww.languageid == usrx.languageid) .select(s => s.name.tolower()) .contains(filterstring.tolower()) ).tolist(); more last part of filter query what's giving me troubles: w.industrylang != null && w.industrylang.where(ww => ww.languageid == usrx.languageid) .select(s => s.name.tolower()).contains(filterstring.tolower()) the full list list of objects contains id, name, vat , possible list (hence null check) of industrylang objects. such industrylang object contains id, languageid check language ,

excel - Python based vba automation? -

i have set of vba sheets i'd combine form online questionnaire. online applet should able carry out calculations (simple math equations) , plot figures excel (vba) sheets doing on pc. wasn't sure best approach achieve this. comfortable in python have never created website. in end i'd have website customers can enter details request , performs set of basic calculations result in basic plot. don't want customers download programming language i'd use. going python idea? have better suggestion? cheers! if want data entry in spreadsheet can at, use google form populate google spreadsheet . can add charts , spreadsheet. can download google spreadsheet xlsx file more offline manipulation. if have questions google spreadsheets ask on webapps.stackexchange.com

angularjs - Date fails to appear for object on angular front end while it shows up when console.logged in back end -

when console log object in server (right sent front express) see property: creation: mon jul 13 2015 16:49:25 gmt-0400 (edt), however, console log on front end shows: creation: null the mongoose model entry is: creation: {type: date, default: null} i don't know start...i imagine has default being null, removed , problem same...? i solved problem using npm module "mongoose-timestamp" https://github.com/drudge/mongoose-timestamp

How maintain GCM push message in Android, its replaced by new one -

my android application receives push notification text messages.if tap push redirects me desired activity latest push message (intent message) want show desired activity corresponding push messages. example if receives 10 push notifications , tap 3rd notification, code redirects me specified activity 10th push notification's message, want show 3rd intent push notification's message. i know pendingintent.flag_update_current replace intent message, how can redirect corresponding message instead last message? i have tried following: intent intent = new intent(this, testactivity2.class); intent.setflags(intent.flag_activity_new_task | intent.flag_activity_clear_task); intent.putextra("uid", uid); pendingintent resultpendingintent = pendingintent.getactivity(this, 0, intent, pendingintent.flag_update_current); notificationcompat.builder mbuilder = new notificationcompat.builder( getapplicationcontext()); notification notification = mbuil

create rounded corner border in android with three colors for a layout -

create rounded corner border in android 3 colors layout i want create layout rounded borders , have border in 3 colors outer border green , middle border blue , last inner border again green how can achieved i have tried code create rou <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#ffffff" /> <stroke android:width="3dip" android:color="#b1bcbe" /> <corners android:radius="10dip" /> <padding android:bottom="0dip" android:left="0dip" android:right="0dip" android:top="0dip" /> </shape> but have can add multiple borders same layout you can use layer-list multiple color corner like- <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/shape_1"> &l

javascript - chaining functions with a function argument -

what i'm trying 'connect' array of functions function. in array of functions: var functionarray = [functiona, functionb, functionc]; functiona(next) should able invoke call function argument next call functionb . the problem cannot use promises (it make lot easier, unfortunate), devised way this: var functionarray = [functiona, functionb]; functionarray.push(functionc.bind(undefined, args)); (var = functionarray.length - 1; i-- > 0; ) { functionarray[i] = functionarray[i].bind(undefined, args, functionarray[i + 1]); } functionarray[0](); my question whether or not there better way accomplish this, above function looks terribly hacky. maybe array.prototype.reduce ? why not use multidimensional array store function , it's arguments. can cleaned basic idea this: var functionarray = [ { func: yourfunction, args: [1, 2] } ]; (var = 0 < functionarray.length; i++) { var func = functionarray[i].func; var args = functionarray[i]

javascript - How to generate .csv file for Excel without error messages? -

the file created in javascript , downloaded through tag. excel complains there wrong file format. in file format excel not throw errors? and can generated javascript? apparently excel wants bom @ beginning, have no idea how change that. file encoded in base64 . first error: file format , extension of 'filename.csv' don't match. file corrupted or unsafe. unless trust source, don't open it. wan open anyway? second error after yes: excel has detected 'filename.csv' sylk file, cannot load it. either file has errors or not sylk file format. click ok try open file in different format. does output file start 'id' ? if open csv in text editor , change it. see http://support.microsoft.com/en-us/kb/215591 more info

php - How can I check if a username already exists in a file and also add his points to him? -

i intentionally want use text file this. read text file , want check if username exists in text file or not , want either add username text file if doesn't exists or add points him. my current code: <?php $myfile = fopen("test.txt", "r") or die("unable open file!"); $file = fread($myfile,filesize("test.txt")); //echo $file; fclose($myfile); //$username = $_request['username']; //$points = $_request['point']; $username = 'chinmay'; //chinmay username unique $points = 200; //if username chinmay not exitst insert first time otherwise if username chimay exist next onwards point update everytime in text file. $myfilewrite = fopen("test.txt", "a") or die("unable open file!"); $txt = $username."|".$points."\n"; fwrite($myfilewrite, $txt); fclose($myfilewrite); ?> test.txt: chinmay|800 john|200 sanjib|480 debasish|541 this complete code. requirement is:

multithreading - Javascript object lifecycle -

i have javascript class below: var myclass = function(elem, data, op) { var options = {}; var loopforever = function() { console.log('i cant stop me'); settimeout(function() { loopforever(); }, 1000); } this.init = function() { loopforever(); } } when instantiate class , call init function, loop starts , text in console every 1 second : var ins = new myclass(); ins.init(); why when set instance null, thread not stop? or time create new instance , assign previous instance name, increases calls. in production code, not have infinite loop, have business logic. need worried performance when create new instance? when call settimeout not bound function called it. need add property object called timeoutid . long function still required being used settimeout remain in scope. var myclass = function(elem, data, op) { var options = {}; var timeoutid = null; var loopforever = function()

mongodb - Play framework 2.4 (Java) mongo async db driver 3.0 query -

hello i'm trying write async code mongodb async driver (3.0) http://mongodb.github.io/mongo-java-driver/3.0/driver-async/ play framework 2.4 (java) in controller async result https://www.playframework.com/documentation/2.3.x/javaasync , when i'm testing promise results outside async call mongodb have empty json in response, please can me ? public f.promise<result> list() { final list<document> accounts = new arraylist<document>(); f.promise<list<document>> promiseofaccounts = f.promise.promise( new f.function0<list<document>>() { public list<document> apply() { accountrepository.getcollection().find().into(accounts, new singleresultcallback<list<document>>() { @override public void onresult(final list<document> result, final throwable t) { }

wpf - Style border and Title Bar cause NullReferenceException -

Image
i want change form border , title bar , fount this solution. after add xaml (i using first solution in first answer) application running , can see style changed after few seconds can see exception in designer: my application still run , show new style happening again , again, try remove , add changes several times error still jump after while. update this code added xaml : <window x:class="csharpwpf.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" > <windowchrome.windowchrome> <windowchrome captionheight="{binding actualheight,elementname=titlebar}"/> </windowchrome.windowchrome> <dockpanel lastchildfill="true"> <border background="lightblue" dockpanel.dock="top" height="25" x:nam

matlab - Delay a signal in time domain with a phase change in the frequency domain after FFT -

Image
i have problem basic time/frequency property implemented in matlab script. property is: i've tried implement in matlab script. i've supposed sinusoidal signal 5hz of frequency value, sampling frequency equal 800hz , want delay signal 1.8 seconds. i've implemented script: fs = 800; time_max = 4; % seconds t = 0:(1/fs):time_max; delay = 1.8; % 1 second of delay f = 5; %hz y = sin(2 * pi * f * t); figure subplot(2,1,1) plot(t,y); xlabel('time (s)') legend('original'); %fft size = 2^nextpow2(length(y)); y = fft(y,size); df = fs/size; f= -fs/2:df:fs/2 - df; k = 1:size y(k) = y(k)*exp(-(1i*2*pi*f(k)*delay)); end subplot(2,1,2) plot(real(ifft(y)),'r') legend('shifted'); and output plot : where problem? how can achieve correct time delay? thanks the problem not in implementation, lies within properties of fft (respectively of dft): formula posted time delay correct, have keep in mind, doing circular shift . mean

How to publish events to multiple receivers using ServiceStack -

i've been using servicestack communicate between systems , wondering if it's possible using servicestack in way events can published 0 n other can subscribe. it should work in async/disonnected way if event published when subscriber temporarily down/unavailable event still delivered. can achieved using servicestack, , if so, what's best way? servicestack supports notifying multiple subscribers server events supports both javascript or c#/.net clients . another option implement pub/sub messaging use native pub/sub library support in redis . but neither of these supports durable pub/sub , i.e. clients don't receive messages sent whilst they're not connected. mq support in rabbitmq , redismq support durable messaging they're not pub/sub, i.e they're 1:1 message queues.

windows 10 - Visual Studio 2015 does not start, missing .Net Framework 4.6 -

i created virtual machine hyper-v , installed windows 10 technical preview on it, due necessity had install visual studio 2015 rtm features. no sooner said done! after setup process, restarted, usual, machine , wanted start visual studio, didn't work, telling me: ".net framework 4.6 missing, please install or repair" i checked installation. .net framework 4.6 installed. downloaded .net framework 4.6 preview , visual studio .net framework 4.6 installers (offline+web) telling me installed. does have clue, how can solve this? try use offline installer of .net 4.6 instead of web installer. faced same issue, , it's somehow gone. here's did: used offline installer "repaired" both .net 4.6 , vs (several times) rebooted after each repairing

c# - Windows 8.1 Handle potentially different data types -

i have gridview can fire holding event on item. items consist of stackpanel , textblock , image handling below code private async void gvjobs_holding(object sender, windows.ui.xaml.input.holdingroutedeventargs e) { joblocal job = null; if(e.originalsource textblock) { job = (joblocal)((textblock)e.originalsource).datacontext; } else if (e.originalsource image) { job = (joblocal)((image)e.originalsource).datacontext; } else if (e.originalsource stackpanel) { job = (joblocal)((stackpanel)e.originalsource).datacontext; } ....code based on above result } but feel there better way using multiple if statements. tried using var cannot access datacontext please advise on better way achieve objective your ui elements derived frameworkelement can cast this. if (e.originalsource frameworkelement

sectionheader - Tortoisesvn error passwd:6: Section header expected -

Image
sorry asking need access remote repository. given account on server side , have installed tortoise svn on client machine. problem cant access, update or commit changes because keep geting above error. think have make changes in .conf file not know changes make exactly. in advance there error in c:\repository\conf\passwd contains usernames , password authentication. take closer @ file, fix , should solve issue.

html4 - HTML emails - do fonts cascade? -

if specify arial font table, cascade down default font cells/tables within table? e.g work consistently among popular email clients? <table align="left" style="font-family: arial, sans-serif; font-size: 13px;"> <tr> <td> <table width="100%"> <tr> <td> table - text here still arial? </td> </tr> </table> </td> </tr> </table> it work clients not all.. in outlook 2010 , 2013. (same percentage of width) best specify wanted styles , fonts each <td> in following: <table align="left" border="0" cellpadding="0" cellspacing="0"> <tr> <td style="width: 100%;"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td style="font-family: arial, s

apache - PHP code is not being executed, instead code shows on the page -

Image
i'm trying execute php code on project (using dreamweaver) code isn't being run. when check source code, php code appears html tags (i can see in source code). apache running (i'm working xampp), php pages being opened php code isn't being executed. does have suggestion happening? note: file named filename.php edit: code..: <? include_once("/code/configs.php"); ?> sounds there wrong configuration, here few things can check: make sure php installed , running correctly. may sound silly, never know. easy way check run php -v command line , see if returns version information or errors. make sure php module listed and uncommented inside of apache's httpd.conf should loadmodule php5_module "c:/php/php5apache2_2.dll" in file. search loadmodule php , , make sure there no comment ( ; ) in front of it. make sure apache's httpd.conf file has php mime type in it. should addtype application/x-httpd-php .php . tells

tibco - Does the Spotfire API provides a CustomMenuGroup in the View menu? -

spotfire provides creating custommenugroup in tools menu. looks that: public sealed class customtoolsaddin : addin { protected override void registertools(toolregistrar registrar) { base.registertools(registrar); custommenugroup menugroup = new custommenugroup("my menu sub group"); registrar.register(new mytool(), menugroup); } ... } but instead of tools creating views , register that: protected override void registerviews(viewregistrar registrar) { base.registerviews(registrar); registrar.register(typeof(control), typeof(custompanelmodel), typeof(custompanelui)); } this works fine wondering if possible group our own views in custom group menu in views menu possible in tool menu. idea?

html - Navigation bar with button that controls whether it's hidden or displayed -

was wondering if redirect me site/tutorial horizontal navigation bar @ top of page, button hides/displays it. think semicircle attached bottom of bar, down/up arrow according whether bar hidden or displayed. i've been looking on internet, , cannot find site has this, or tutorial teaches how implement onto site. i could've sworn i've seen before, not sure where. thanks i don't know tutorials this, have written small snippet using html & css (no js). i've used checkbox toggle navigation bar. navigation .bar toggled using :checked pseudo element , + selector. there comments in css, i'm not sure if clear, please comment, if there unclear. /* general styling */ * { box-sizing: border-box; padding: 0; margin: 0; font-family: sans-serif; } .bar { width: 100%; height: 80px; background: #eee; border-bottom: 1px solid #555; /* smooth animation (transition) */ transition: margin 0.4s; } .bar ul li { li

AngularJs : List Polling -

i'm using angular $interval service grab data backend periodically using $ngresource . each time i'm getting new list backend, i'm replacing old 1 new one. display list in template using ng-repeat . the issue approach : each time data update, interface blinks. plus, if selected text in list, selection disappears each list refresh. is there easy way keep frontend , backend list synced appart of forloop on new data , pushing them in old 1 ?

php - How to custom library DB using Codeigniter -

i want custom few things in library db ... and created core system classes my_db in application/core folder: class my_db extends ci_db { public function __construct() { $ci =& get_instance(); $ci->load->database(); $this->db = $ci->db; } public function get($table = '', $limit = null, $offset = null) { // code custom... $this->db->get($table, $limit, $offset); } public function insert($table = '', $set = null) { // code custom... $this->db->insert($table, $set); } } but apparently not work. i want when execute $this->db->get() , run code customized within class my_db . if take @ problem , share bit of science, i'd grateful. thanks! codeigniter (at time, latest version 3.0.0) doesn't support extending database classes other libraries. it's not impossible of course, there's no official, built-into framework way , you&

reverse engineering - CRC32 calculation with CRC hash at the beginning of the message in C -

i need calculate crc of message , put at beginning of message, final crc of message 'prepended' patch bytes equals 0. able of few articles, not specific parameters. thing have use given crc32 algorithm calculates crc of memory block, don't have 'reverse' algorithm calculates 4 patch bytes/'kind of crc'. parameters of given crc32 algorithm are: polynomial: 0x04c11db7 endianess: big-endian initial value: 0xffffffff reflected: false xor out with: 0l test stream: 0x0123, 0x4567, 0x89ab, 0xcdef results in crc = 0x612793c3 the code calculate crc (half-byte, table-driven, hope data type definitions self-explanatory): uint32 crc32tab(uint16* data, uint32 len, uint32 crc) { uint8 nibble; int i; while(len--) { for(i = 3; >= 0; i--) { nibble = (*data >> i*4) & 0x0f; crc = ((crc << 4) | nibble) ^ tab[crc >> 28]; } data++; } return crc; } t

ios - How to increase the Gaussian Blur as the user scrolls up -

i have uiimage inside uiimageview on gaussian blur filter radius of 50 has been applied of now. per new requirement, need set initial gaussian blur @ 3px. increase 3px 10 px user scrolls view? please me understand how can done? this code i'm using blur image of radius of 50. - (uiimage *)blurwithcoreimage:(uiimage *)sourceimage blurvalue:(int)valblur { ciimage *inputimage = [ciimage imagewithcgimage:sourceimage.cgimage]; // apply affine-clamp filter stretch image not // shrunken when gaussian blur applied cgaffinetransform transform = cgaffinetransformidentity; cifilter *clampfilter = [cifilter filterwithname:@"ciaffineclamp"]; [clampfilter setvalue:inputimage forkey:@"inputimage"]; [clampfilter setvalue:[nsvalue valuewithbytes:&transform objctype:@encode(cgaffinetransform)] forkey:@"inputtransform"]; cifilter *gaussianblurfilter = [cifilter filterwithname: @"cigaussianblur"]; [gaussianblu

java - How to add a button into a specific JPanel -

i have bigpanel. inside bigpanel has multiple panels(panel_1, panel_2, panel_3, etc....) bigpanel use gridbaglayout. panel_1 , etc use gridlayout. in other panel, have created add button. if user click this, jdialog appear , user must fill form: button name: number : alphabet : after user finished fill in jdialog form, new button created based on jdialog form. this code executed after user click finished button in jdialog form: if(number=="1"){ if(alphabet=="a") { jbutton newbutton = new jbutton(buttonname); //bigpanel.add(newbutton); //bigpanel.updateui(); panel_1.add(newbutton); panel_1.updateui(); joptionpane.showmessagedialog(null,"successfully added !"); } } else if(alphabet=="b&

php - CS-Cart dynamic option -

how can add dynamic option product in cs-cart? mean want add option product in product page based on db field value. that plan doing this: 1- add new hook 'get_product_options_post'. 2- in function of hook check db values. 3- depending on previous check show option or not. so, can see steps 1 , 2 clear me i'm asking step 3. how can this? , take account option have price modifier , value different depending on db check. idea i had idea doing adding new product option @ addon installation , apply option products. need apply option whole category rather individual products. this means current products @ specified category should automatically have specified option as new products added in future. any suggestion doing good. we can offer extend product option statuses , add hidden status 2 existent ones - active , disabled. hidden options not displayed customers default. in hook check necessary fields in database , enable hidden options if necessary.

php - PDO do not able to fetch huge data -

i'm trying fetch data 1 mysql table more 5 m rows , 50 gb total size, use pdo it. looks like $urlscontent = $db->query('select url_hash,content sy_search_site_stat'); while($result = $urlscontent->fetch()) { ... write content files; ... echo content hashes; } but when run without limit in console, output "killed" after several minutes of working. when write limit sql query, works fine. there particular restrictions on pdo? $pdo->setattribute(pdo::mysql_attr_use_buffered_query, false); source

javascript - Hide dates of other months in datepicker plugin? -

i'm using datepicker jquery ui , customizing css according needs. want hide other dates not active i.e. dates shown of other months. don't know if can done css or need use jquery that. here image explains want. image. here jquery code: $(function(){ $('#datepicker').datepicker({ inline: true, showothermonths: true, daynamesmin: ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'], }); }); setting selectothermonths option false solve problem. may remove line, since defaults option set false

When I display a whitespace followed by long string in android textview, it skips the first line and displays the actual string on the next -

i having trouble while displaying string in textview policyvaltv.settext(": " +trimpolicyno); problem if trimpolicyno long string, textview(policyvaltv) displays whitespace breaks line , displays actual string on next line. how can avoid this? want display on 1 line not keep singleline = true. please help try policyvaltv.settext(":\u00a0" +trimpolicyno); \u00a0 unicode char non breaking space.

java - Not able receiving all messages, only every second, from Google Cloud Messaging with CCS using Smack -

i'm trying set connection google cloud messaging via cloud connection server (xmpp-connection) using smack 4.1.2. able establish connection , receive incoming messages. problem stanzalistener isn't triggered each message (but every second one). smack debugging console shows "raw received packets", sending device-to-cloud works each message. thank help! here's code server app: my class gcmserver main: public class gcmserver { public static final logger logger = logger.getlogger(gcmserver.class.getname()); public static sslcontext sslctx; public static xmpptcpconnection connection; private static final string gcm_server = "gcm.googleapis.com"; private static final int gcm_port = 5235; private static final string gcm_element_name = "gcm"; private static final string gcm_namespace = "google:mobile:data"; private static final string your_project_id = "xxxxxxxxxxxx"; private static final string your_api_key = "

c# - Implementing read-only properties with { get; } -

why doesn't run: class program { static void main(string[] args) { apple = new apple("green"); } } class apple { public string colour{ get; } public apple(string colour) { this.colour = colour; } } your code valid c# 6, comes visual studio 2015. not valid previous versions of language or visual studio. technically, can install old pre-release version of roslyn in vs 2013 isn't worth trouble vs 2015 released. for problem occur, either using wrong version of visual studio compile c# 6 code, or trying compile code command line using wrong development environment -ie, path points old compiler. perhaps opened 'developer command prompt 2013' instead of 2015? you should either compile code using visual studio 2015, or ensure path variable points latest compiler. if have use visual studio 2013 or older, you'll have change code use older syntax, eg: public readonly string _colour; publ

For Regex, if the two pattern are all greedy, how does the pattern engine chose the match practically? -

yesterday , , roommate discussed question on stack. , questions here how second column command output? they talk how separate second column input stream this: 1540 "a b" 6 "c" 119 "d" and first upvoted answer <some_command> | sed 's/^.* \(".*"$\)/\1/' the result satisfied request. but find if follow greedy rule of regex, pattern ^.*␣ match 1540 "a confused roommate. benefit of hindsight, pattern ^.*␣ should make compromise pattern (".*"$) . otherwise, second pattern match nothing. however, roommate can't convinced hypothesis. guy give me example test , did it. we made 2 experiment. 1st add quote " follow character this: 1540 "a" b" 6 "c" 119 "d" and easy result previous regex code: "a" b" "c" "d" and 2nd 1 , add white space , quote ␣" follow this: 1540 "a " b" 6 "c&quo