Posts

Showing posts from February, 2014

html - multiple php calls slowing page load? -

i rewriting html site php. there various changing menus want make php calls: <?php include("header.php");?> with footer, , sidebars have 4 or 5 php includes on each page. how slowing pageload 5 php calls? if want fast load worth sacrificing sitewide editabitity , calling less php pages? or few milliseconds? is there difference speed wise between calling 2 css files or 2 php files? ( caching system use such simple php calls? ) for static files, css files, merging them decrease page loading time. because these files not server-side files. clients send more 1 request downloading these files. effect loading time. php files server-side files. it won't effect loading time (if files not complicated much).

c - This code of mine is showing floating point error.. can anyone please exlain -

#include<stdio.h> void main() { float = 5, b = 2; int c; c = % b; printf("%d", c); } i getting floating point error n program-me.. please explain this.. the operands of operator % have integral (i.e. int , byte , ...). have cast float s first: c = ((int)a) % ((int) b);

iphone - How to add an animated splash screen? -

this question has answer here: how make fancy splash screens? 4 answers i've seen loads of apps sky news , glympse etc. have kind of animation splash screen on app. i'm not sure if done animation in view controller or appdelegate or if actual movie file . does have idea of how type of effect can achieved? thanks. yes animating splash screen view controller. tutorial can create one.

c# - FirstOrDefault Behavior with Int and Int? -

i read post explained firstordefault() 's return type vary based on value of element being selected. example: icollection<string> list = new list<string>(); list.add("bye"); int = (from x in list (x == "hi") select x.length).firstordefault(); in example, a equal 0 since int default value 0. however, can append .cast<int?>() per linked post in order null when query returns 0 results. int? = (from x in list ... x.length).cast<int?>().firstordefault(); why don't compile-time error (or @ least warning) when, first example, use nullable int ( int? ) rather regular int ? if understand correctly, using int? when performing first query never result in value of null . why don't compile-time error (or @ least warning) when, first example, use nullable int rather regular int then? if understand correctly, using int? when performing first query never result in value of null . your understanding co

css - Divs with 2 columns in a vertical column -

i'm trying make column div's 1 after another, each div split 2 columns..i've managed tells me it's not semantic...so if take , tell me how code better? http://jsfiddle.net/synqp/1/ <body> <div id="wrapper"> <div id="lt"> <div id="bl"> <p>column 1</p> </div> <div id="br"> <p>column 2</p> </div> <p><br>&nbsp;</p> <div id="bl"> <p>column 1</p> </div> <div id="br"> <p>column 2</p> </div> </div> <div id="rt"> <p>123</p> </div> </div> </body> @import url("reset.css"); body { font-family: verdana, arial, helvetica, sans-

ios - Iterating an NSMutableDictionary with UIImage not working -

i trying add images fetched external service nsmutabledictionary , seeing weird results. doing: - (void)fetchimages{ //fetch item brand images //self.itembrands nsarray of nsdictionaries (nsdictionary *itembrand in self.itembrands){ nsstring *currentitemid = [itembrand objectforkey:@"item_id"]; //valid item id. log message displayed nslog(@"current item id: %@",currentitemid); nsstring *currentitemimageurl = [[image_url stringbyappendingstring:currentitemid] stringbyappendingstring:@".png"]; //image url valid. log message displayed nslog(@"current image url: %@",currentitemimageurl); nsurl *url = [nsurl urlwithstring:currentitemimageurl]; nsdata *data = [nsdata datawithcontentsofurl:url]; uiimage *image = [uiimage imagewithdata:data]; if (image == nil){ //this log message displayed when image not present nslog(@"image not present 1"); }else{ //this log messag

ios - How to copy file in iCloud to app sandbox using File Manager -

i have file in cloud 15.2 kb. cannot copy app sandbox. code listed below. appreciated nsurl *ubiq = [[nsfilemanager defaultmanager] urlforubiquitycontaineridentifier:nil]; if (ubiq) { nserror *error = nil; nsfilemanager *filemanager = [nsfilemanager defaultmanager]; nsurl *cloudcontainerurl = [filemanager urlforubiquitycontaineridentifier:nil]: nsurl*dirurl=[cloudcontainerurl urlbyappendingpathcomponent:@"documents" isdirectory:yes]; [filemanager createdirectoryaturl:dirurl withintermediatedirectories:no attributes:nil error:&error]; nsurl *icloudurl = [dirurl urlbyappendingpathcomponent:@"passwords file.txt"]; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentspath = [paths objectatindex:0]; // destination path nsstring *fileindocumentspath = [documentspath stringbyappendingpathcomponent:@"passwords file.txt"]

How do you get the state of a WorkflowExecution if all you have is a workflowId in Amazon SWF -

it seems swf operations getting execution state need runid (their reference workflow execution), , don't feel storing that. want able lookup based on workflowid (my id, not theirs). possible @ all? i mean, guess add tags retrieve tags, seems little awkward, if passed workflowid well. yes, according listopenworkflowexecutions api documentation user can filter open executions workflowid. a python example, using boto.swf (use 1. this post setup domain): $ ipython python 2.7.3 (default, apr 10 2013, 06:20:15) type "copyright", "credits" or "license" more information. in [1]: import boto.swf.layer2 swf in [2]: domain = swf.domain(name='stackoverflow') in [3]: domain.workflows() out[3]: [ workflowtype 'myworkflow-1.0' @ 0x32a44d0 ] in [4]: myworkflow = domain.workflows()[0] in [5]: execution = myworkflow.start(workflow_id='my_wf_id', task_list='default') in [6]: other_execution = myworkflow.sta

ruby on rails - carrierwave - create thumb for pictures and videos in same uploader -

i trying create thumb pictures or videos in same uploader ad model... so far, trying create conditional thumb that: version :thumb process :resize_to_limit => [50, 50] if %w(jpg jpeg gif png).include?(file.extension) process :screenshot => 5 if %w(mpg avi).include?(file.extension) end end but apparently, errors on file.extension part this nameerror: undefined local variable or method `file' does know how file extension in uploader? your code looks carrierwave generated uploader class , if understand question correctly, looking way restrict type of file can turned thumbnail. can whitelist types of files uploader class accept - in uploader class :thumb method located include following : # add white list of extensions allowed uploaded. # images might use this: def extension_white_list %w(jpg jpeg gif png) end

ios - How To Code Subview(s) Image Indicators Collapsing to the Right in Table View Cell -

Image
given ios 6.0+: i have 3 image indicators a, b, c appear in order left right. cannot repeat. no a a. any of a, b, c can on or off (show or not show) when letter not showing, others collapse right; example c what straight forward approach this? create 6 images , swap them in based on whether a, b, or c on? see image example. i have reviewed apple's a closer @ table view cells i 3 images a, b & c. put 3 hidden image views. unhide , put right image needed. ex1: visible, in i1, b in i2, c in i3 ex2: i3 visible b image.

documentation - google places xml in google docs -

i have xml google places, analyze in google docs. xml looks that <autocompletionresponse> <status>ok</status> <prediction> <description> chinatown restaurant, washington street, san francisco, ca, united states </description> <type>establishment</type> <reference>...</reference> <id>9bcb9788e5e5f0c5713da18f8075eee2c07024e1</id> <term>...</term> <term>...</term> <term>...</term> <term>...</term> <term>...</term> <matched_substring>...</matched_substring> </prediction> <prediction>...</prediction> <prediction>...</prediction> <prediction>...</prediction> <prediction>...</prediction> </autocompletionresponse> but error command. insteade of mysecretid, use api key google. =importxml("https://maps.googleapis.com/maps/api/place/autocomplete/xml?input=restaurant&types=estab

c++ - Make std::for_each more useful - is this a good idea for the functor to know the current index? -

often cannot use std::for_each because logic particular element depends on current index. end, i've invented functor class wraps main functor , passes current index. ideally want use lambda expressions. class have created safe , effective? there better solutions? did want wrapper's operator () return type of lambda expression, couldn't figure out. also, type should use index? should store main functor in wrapper value or reference? thanks! template<class func> class indexfunctor { public: typedef func func_t; explicit indexfunctor(const func_t& func) : func(func), index(0) {} // how can return return type of func? template<class t> void operator ()(t& param) { func(index++, param); } const func_t& getfunctor() const { return func; } int getindex() const { return index; } void setindex(int index) { this->index = index; } private: func_t

ios - Problems with uitableview sections using JSON -

i creating app demo purposes , have uitableview being populated json data , works fine. want create sections in table based on sessiondate app crashes error below: terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[sessions objectforkey:]: unrecognized selector sent instance 0xac2b460' here code parsing json: -(void) retrievedata { nsurl * url = [nsurl fileurlwithpath:[[nsbundle mainbundle]pathforresource:@"sessions-json.json" oftype:nil]]; nsdata * data = [nsdata datawithcontentsofurl:url]; json = [nsjsonserialization jsonobjectwithdata:data options:kniloptions error:nil]; //set our speakers array sessionsarray = [[nsmutablearray alloc] init]; (int = 0; < json.count; i++) { //create sessions object nsstring * sid = [[json objectatindex:i] objectforkey:@"id"]; nsstring * sstatus = [[json objectatindex:i] objectforkey:@"sessionstatus"]; nsstring * sday =

How to add a menu item to CKAN's naivigation menu? -

i want make functionality of custom extension available via menu item in ckan's main navigation menu. not sure how can add new menu item extension code. appreciated. thanks, pk if want take advantage of ckan's main navigation menu, gets little tricky. (we had figure out. not sure if did right way, did work ckan 2.2): first, need additional content in extension path somewhere. assuming it's @ my_extension/amazing.html , want add following my_extension/templates/header.html file (in custom extension): {% ckan_extends %} {% block header_site_navitagtion_tabs %} {{ h.build_nav_main( ('search', _('datasets')), ('organizations_index', _('organizations')), ('group_index', _('groups')), ('about', _('about')), ('amazing', _('amazing extension')) ) }} {% endblock %} this cause server error, since "amazing" hasn't been registered in pylons map

python - What is the "TPE1" KeyError? -

i'm using mutagen module python artist of various mp3 files have. here's code giving error: audio = easyid3(c:\users\owner\music\music\blue Öyster cult\blue Öyster cult\cities on flame) print audio["artist"] the code working of mp3 files, there select few continually give following error: keyerror: 'tpe1' and because of error, can't see artist. note these mp3 files have artist, , none of them have special characters or that. why happening? , how can fix it? thanks most likely, you're looking key doesn't exist in mutagens id3 dictionary. simple check regular dictionary: if 'artist' in audio: print audio['artist'] i've tried , without ensuring argument unicode , works in both cases python 2.7.3

operating system - Open folder with applescript (file path with spaces) -

i think problem spaces in file path. can't work. here folder path want open: /users/username/library/speech/speakable items assuming path correct be: tell application "finder" open ("/users/username/library/speech/speakable items" posix file) end tell

ios - PopupViewController returns null to ViewController -

Image
i pass datepicker.date datepickerpopupviewcontroller sensorvviewcontroller shown below. however, returns me "null". doing wrong? code follows: #import "datepopoverviewcontroller.h" @interface datepopoverviewcontroller () @end @implementation datepopoverviewcontroller @synthesize datepicker; - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // custom initialization } return self; } - (void)viewdidload { [super viewdidload]; // additional setup after loading view nib. datepicker.date=[nsdate date]; } @end #import "sensorviewcontroller.h" @interface sensorviewcontroller () @end // represent button triggers popupviewcontroller -(void)choosedate { if([popovercontroller ispopovervisible]) { [popovercontroller dismisspopoveranimated:yes]; } else { cgrect poprect=cg

wget - Cron output to nothing -

i've noticed cron outputs creating index.html files on server. command i'm using wget http://www.example.com 2>&1 . i've tried including --reject "index.html*" how can prevent output creating index.html files? --2013-07-21 16:03:01-- http://www.examplel.com resolving example.com... 192.0.43.10 connecting www.example.com|192.0.43.10|:80... connected. http request sent, awaiting response... 200 ok length: 0 [text/html] saving to: `index.html.9' 0k 0.00 =0s 2013-07-21 16:03:03 (0.00 b/s) - `index.html.9' saved [0/0] normally, whole point of running wget create output file. url http://www.example.com typically resolves http://www.example.com/index.html , creating index.html , wget command doing job. if want run wget , discard downloaded file, can use: wget -q -o /dev/null http://www.example.com the -o /dev/null discards log messages; -o /dev/null discards dow

php - Updating SQL with TextArea - only updates with short strings -

i have textarea in form. form, upon submit, inserts information databse. though "newstext" longtext, able insert short strings. update question exact amount of characters. the form: <form id="newsform" action="<?php echo $uploadhandler ?>" enctype="multipart/form-data" method="post"> <div class="managementnewstitle"> title<br /> <input id="inputnewstitle" name="inputnewstitle" type="text"></input> </div> <div class="managementnewstitle"> image<br /> <input id="inputnewsfile" type="file" name="file" onchange="document.getelementbyid('inputnewsfilename').value = value;"><br /> name<br /> <input id="inputnewsfilename" type="text"></input> </div> <div clas

C# delegates functions being defined in an array declaration? -

i making irc chat bot stream. found few basic connectivity examples using c# decided give try. so far love it but stuck on 1 part. i want store bot commands inside array of structure type. public delegate void cmdhandler(string[]); struct botcommand { string name; cmdhandler chandler; bool isadmin = false; string = "nothing here."; } is have, , want beable this: botcommand[]commands = { { "testcommand", testcommand(), 0, "help this" }, { "testcommand2", testcommand2(), 0 "..." }, ...... }; so how link generic function in array? or going wrong way? basically instead of having giant switch() statement check command used want loop through array , see if command in there. if call function associated command. edit: this have can see trying do public delegate void cmdhandler(string[] ex); struct botcommand { string name; cmdhandler chandler; bool isa

jquery - Hide <li> nested inside two divs -

i have following html, , want target hiding first 2 <li> instances. struggling addressing <li> inside list, have multiple other lists of same class on page, want target 1 only. as such, looking able nest jquery statement targetting <li> inside <ul class="productlist"> inside <div class="blockcontent"> inside <div class="featured"> <div class="featured" id="#featured"> <div class="blockcontent"> <ul class="productlist"> <li>product here</li> <--- hide <li>product here</li> <--- hide <li>product here</li> <li>product here</li> </ul> </div> </div> this current attempt: $('.featured').find('ul:li(2)').hide(); how can modify hide first 2 <li> elements? jquery's slice() functio

ios - Invite Users to A Mobile App Over Facebook -

i have ios app building uses rails server on backend (also building). @ point able invite users app, , think best way go via facebook. the facebook sdk allows create native dialog directly communicates servers device, server control interaction. so desired work flow this... user selects other fb friends invite device ships invited friend list (fb_uids) server server communicates facebook , sends out requests via fb platform invitee(s) notified in facebook they've been invited , provided deep link install app. i've been looking while on tutorials / workflow - can't find anything. point me in right direction? download facebook sdk first. http://developers.facebook.com/ios/ then use following code: facebook* facebook = [[facebook alloc] initwithappid:@"your_facebook_app_id" anddelegate:self]; nsmutabledictionary* params = [nsmutabledictionary dictionarywithobjectsandkeys: @"my title"

How to check the filesize of ImageView in android> -

in android app. trying upload image server. need filesize smaller 1mb. if have imageview object, how can programtically check size smaller 1mb? thanks bitmapdrawable bmpdrawable = imgview.getdrawable(); bitmap bmp = bmpdrawable.getbitmap(); bytearrayoutputstream out = new bytearrayoutputstream(); bmp.compress(bitmap.compressformatjpeg, 100, out); int size = out.count; if( out.count > 1024 *1024 * 1024 ) { // greater 1 mb } // use bitmap size using bitmapfacotry.options class // size depend on how compress image , send, can idea getting image width , size , caluclate pixels used. jpeg size varies according image, use io stream write file jpeg , see number of bytes in it.

perl - Regular expression to replace a word with another word on the different line unix -

let a,b,c,d,e,f words input file a "\t" b c "\t" d e "\t" f etc... output file: b "\t" c d "\t" e f "\t" etc... replace word word b 1 same line , replace word b word c next line. wise other lines. any sed/awk/perl oneliner accomplish that? one way awk without regex: awk ' begin { fs=ofs="\t" } nr==1 { last=$nf; next } { last=last fs $1; print last; last=$nf} end { print $nf }' file

javascript - Click on an anchor not working -

i trying click on anchor, shows type error .. not function. here code: file_browser_callback: function(field_name, url, type, win) { win.document.getelementbyid("media").onclick(); win.document.getelementbyid(field_name).value = 'window.send_to_editor'; }, why doing this i using tinymce editor, , want use file_browser_callback . there anchor #media in document open thickbox , after selecting image in thick box send callback send_to_editor , so want value send_to_editor , set win.document.getelementbyid(field_name).value now getting error: typeerror: win.document.getelementbyid(...).onclick not function please dont suggest jquery code, need pure javascript (tinymce init dont support jquery) when event has been bound addeventlistener , running onclick() won't work (as still null ) you try following: var clickevent = document.createevent("mouseevent"); clickevent.initmouseevent("click", true, t

iphone - Add UINavigationController inside UIViewController -

i have uiviewcontroller uitoolbar (on bottom) , want add uinavigationcontroller uinavigationbar inside. uinavigationcontroller not displayed. myviewcontroller.m : - (void)viewdidload { [super viewdidload]; int toolbarheight = 44; uitoolbar *toolbar = [[uitoolbar alloc] initwithframe:cgrectmake(0, [self.view bounds].size.height-toolbarheight, [self.view bounds].size.width, toolbarheight)]; uibarbuttonitem *button = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemrefresh target:nil action:nil]; toolbar.items = @[button]; [self.view addsubview:toolbar]; mynavigationcontroller *mynav = [[mynavigationcontroller alloc] init]; [self addchildviewcontroller:mynav]; } adding view controller child view controller isn't enough. need add navigation controller's view subview of container view controller's view. [mynav willmovetoparentviewcontroller:self]; mynav.view.frame = navframe; //set frame or constra

CSS3 Media Query not affecting class width -

i'm working css media queries responsive web design. keep them organized , easy access, i'm declaring of media queries @ top of css document, this: * {margin:0 auto; padding: 0;} body {margin: 0; padding: 0; font: normal 100% helvetica, arial, sans-serif; color: #fff; background: url(../img/defaultnav.jpg); background-repeat: repeat-x;} h1 {font-size: 5.75em; font-weight: 800; text-align: center} h2 {font-size: 2.5em; font-weight: 300; text-align: center; line-height: 50px;} h3 {font-size: 2.5em; font-weight: 100; line-height:50px; color: #666;} h4 {font-size: 1.25em; font-weight: 100; color: #999; margin-top: 10px; margin-bottom:18px;} p {font-size: 1em; color: #999;} {color: #999; text-decoration: none;} a:hover {text-decoration: underline;} @media screen , (min-width: 1700px) { h1 {font-size: 6.2em;} h2 h3 {font-size: 3.5em;} h4 {font-size: 2.5em;}

normalization - Normalizing line endings in a git repository with many branches -

we converted subversion repository git repository using atlassian stash's import subversion tool. part seems have worked though .gitattributes generated seem leave desired. it created file 7503 entries text diffs unset, text files. shear number of entries result of each file being explicitly listed rather using pattern matching. to fix created local non-tracking branch off of master called add-gitattributes . within here modified default .gitattributes file looks this: https://gist.github.com/anonymous/6049144 , committed changes add-gitattributes . i in process of going through process of normalizing line endings in our repository described in how-to-normalize-working-tree-line-endings-in-git . lot of files (5000+) modified according git status , expected. however, branched master dozen or branches, branches have branches. how normalize line endings of of these branches? can merge git-attributes branch master , update (merge) other branches? new files added in other

javascript - Jquery datatable alignment issue - Firefox -

Image
i have datatable in popup window(dialog).this datatable values getting search button.so each button click table getting lesser width in firefox, ie working good. please advise how fix issue ? i'm controlling datatable width through below code. <div id="table_container" style="width : 630px">

return - Line breaks in text expansion -

i'm noob having tough time expaning multiline paragraph when use `n comand isn't recognizing in msgbox works fine script: ::a:: msgbox, line1 `nline2 `nline 3 produces message box saying : line 1 line 2 line 3 but ::a::line 1 `nline 2 `nline 3 produces: line1line2line3 what doing wrong?? thanks

java - Signed applet write file in server -

i'm trying save file signed applet server. found mix answer when try google it, of them saying cannot done since applet running in client/local machine. of them post sample code not working me. appreciated if 1 advice on this. link references highly appreciated. applets live there own sandbox, require special permission perform operations, read or write disk of client machine. remember, applets execute within context of client machine, guests , need follow house rules. reference - here

crc16 - Conversion issues In VBA Excel- Why HFFF is giving -1 in long and how to resolve it -

i using vb in excel , creating macro crc16 bit calculation. when take values lookup table above 8000 ffff, giving negative numbers. got know numbers below range positive , numbers in range(8000-ffff) give negative result has converted. came across few functions these dont solve purpose is possible conversion using simple function can correct result. hffff gives -1 long variable want 65535. i have used functions given here http://support.microsoft.com/kb/161304 not give me correct result when pass hex value hffff. hexadecimal constants signed. described in vba spec: http://msdn.microsoft.com/en-us/library/ee199514.aspx there 2 ways around issue: 1) use literal decimal 2) use ampersand type hint &hffff&

python socket.error: [Errno 98] Address already in use -

when setup application.py, shows socket.error: [errno 98] address in use. traceback (most recent call last): file "application.py", line 121, in <module> main() file "application.py", line 117, in main http_server.listen(options.port) file "/usr/local/lib/python2.7/site-packages/tornado-3.1-py2.7.egg/tornado/tcpserver.py", line 117, in listen sockets = bind_sockets(port, address=address) file "/usr/local/lib/python2.7/site-packages/tornado-3.1-py2.7.egg/tornado/netutil.py", line 90, in bind_sockets sock.bind(sockaddr) file "/usr/local/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) socket.error: [errno 98] address in use there process listening on port. might find out process using following command: $ lsof -i :8000 or change tornado app's port. tornado's error info not explicitly on this.

download - Python FTPLIB error 530 Permission Denied -

i've tried script below: import os ftplib import ftp ftp = ftp("ftpsite","myuser", "mypass") ftp.login() ftp.retrlines("list") ftp.cwd("folderone") ftp.cwd("subfolder") listing = [] ftp.retrlines("list", listing.append) words = listing[0].split(none, 8) filename = words[-1].lstrip() #download file local_filename = os.path.join(r"c:\example", file) lf = open(local_filename, "wb") ftp.retrbinary("retr " + filename, lf.write, 8*1024) lf.close() but everytime run script, says: traceback (most recent call last): file "c:\user\desktop\sample\ex.py", line 4, in <module> ftp = ftp("ftpsite", "myuser", "mypass") file "c:\python27\lib\ftplib.py", line 119, in __init__ self.login(user, passwd, acct) file "c:\python27\lib\ftplib.py", line 387, in login resp = self.sendcmd('user ' + user) f

c# - How to get the selected checkboxes which are dynamically generated using Jquery -

hi have page consists of dynamically generated checkboxes using razor code. need selected checkboxes using jquery. if there simple jquery achieve means suggest me. you can check box status (checked/unchecked) in jquery this $('[type="checkbox"]').each(function(){ alert($(this).is(":checked")) });

c# - ASP Web Forms Scaffolding -

i testing out new scaffolding ability in vs2013 webforms. have model class reason not generating fields of related data. here's class: public class staffavaliability { [key] [scaffoldcolumn(false)] public int staffavaliabilityid { get; set; } public int staffmemberid { get; set; } [enumdatatype(typeof(award)), display(name = "award rate")] public virtual award awardid { get; set; } [enumdatatype(typeof(daysoftheweek)), display(name = "day")] public daysoftheweek day { get; set; } public datetime shiftstart { get; set; } public datetime shiftend { get; set; } public string staffavaliabilitynotes { get; set; } } public enum daysoftheweek { monday, tuesday, wednesday, thursday, friday, saturday, sunday } here wanting award id's award table , have them generated in drop down. any appreciated, first go @ using scaffolding , i've gotta sounds massive timesaver!

Google ads in Wordpress -

i made new theme in wordpress before year. , updating per requirement. i have used navayan subscribe in system. , google ads in place(frontend) , other place too(middle of page). don't know coming from. have never used google ads in clients website. can check this page on right hand side. thanks in advance. it looks me ads coming widgets. go appearance > widgets , check there. if not there, check code inside sidebar.php file going appearance > editor , open sidebar. you can disable plugins see if plugin cause ads. if still no luck check other php pages malicius code in theme looking encrypted php code looks this: eval(gzinflate(base64_decode('80jnycl...

Filtering on foreign key relationship - Django -

i want find number of articles specific user has created articlehistory records. models this: class article(models.model): """the basic entity of app.)""" documentid = models.charfield(blank=true, max_length=1000) cowcode = models.integerfield(blank=true, null=true) pubdate = models.datefield(default=datetime.datetime.today) headline = models.charfield(blank=true, max_length=1500) source = models.charfield(blank=true, max_length=5000) text = models.textfield(blank=true, max_length=1000000) assignments = models.manytomanyfield(assignment) class meta: ordering = ['pubdate'] def __unicode__(self): return self.headline class articlehistory(models.model): """(modelname description)""" article = models.foreignkey(article, related_name='article history') coder = models.foreignkey(user, related_name='article history') last_u

how to use liipimaginebundle filterset in twig -

i have following filterset in config file , problem using different filter in twig liip_imagine: filter_sets: my_thumb: quality: 75 filters: thumbnail: { size: [120, 90], mode: outbound } relative_resize: { scale: 0.5 } # transforms 50x40 125x100 relative_resize: { scale: 1.5 } # transforms 50x40 125x100 crop: { start: [10, 20], size: [120, 90] } if there 1 filter this, <img src="{{ asset(['images/', news.picpath]|join| imagine_filter('my_thumb')) }}" alt="{{ news.title }} image not found" class="large" /> but not know how use it. in config hane 1 filter set named my_thumb. if want more filters should separate them in config this: iip_imagine: filter_sets: my_thumb: quality: 75 filters: thumbnail: { size: [120, 90], mode: outbound } my_half_scale_resizer: qualit

linux - How to send email and store log file from a single cronjob? -

i have cronjob: * * * * * root echo 'blabla' it easy 1 :) now, send email when cronjob done, store log in log file. i tryed this: * * * * * root echo 'blabla' | mail -s "cron report" test@example.com > /test/test.log 2>&1 the email sent , test.log file created, test.log file empty. any idea why? this because redirecting output of echo mail there nothing write log file. result, log file empty. if want write output of echo log file , send mail , use tee shown below: echo 'blabla' 2>&1 | tee /test/test.log | mail -s "cron report" test@example.com

java - i have loaded liferay in eclipse while deploying err msg -

i'm new liferay. i've added liferay eclipse java ee ide : version: indigo service release 2: liferay tomcat server liferay home page opened up... i've created new portlet in liferay print " hello " portlet name: " portel_exp1 " but via deploying portlet i've got err msg given below.... build failed f:\liferay-plugins-sdk-6.1.1\liferay-plugins-sdk-6.1.1\build-common-plugin.xml:651: following error occurred while executing line: f:\liferay-plugins-sdk-6.1.1\liferay-plugins-sdk-6.1.1\build-common.xml:95: java.lang.unsupportedclassversionerror: com/sun/tools/javac/main : unsupported major.minor version 51.0 to compile new version (in eclipse) go window -> preferences -> java - > inside java select compiler - > check compiler compliance level(select appropriate level i.e 1.6) hth

android - Fix Navigation Drawer Title change on orientation change? -

when orientation changed on app, title in action bar changes title of fragment selected in nav drawer title of app. the navigation drawer example app retains it's title on orientation change because it's fragment subclass of main activity, , has line of code getactivity().settitle(planet); now i'm bit newbie wouldn't know how retain title, , implement code, can guys help? just in case of wanna see, here subclass planetfragment public static class planetfragment extends fragment { public static final string arg_planet_number = "planet_number"; public planetfragment() { // empty constructor required fragment subclasses } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_planet, container, false); int = getarguments().getint(arg_planet_number); string planet = getresources()

php - CodeIgniter Mailing loop -

i ask whether has tried send mails loop lets 1k rows. make mailing list , send mails in loop each email address in table. or there better solution ? thanks external (like mailchimp) easy , better way go. if yourself, read on. create table called 'mails_to_send', or whatever, email address, subject , body columns (and id , possible attachments, etc). then create php script loops through x mails, sorted oldest first (id asc), x high number, not high won't hit php execution time limits. loop through x records, , send each mail (all necessary info in table). if want regularly: set cron job every y (every hour, or every 10 minutes, number amount of emails need send lower amount of emails can send way). forget it. can create admin function create newsletters, or whatever.

SD Card storage vs Android System storage -

this purely design problem. when building video capturing application android storage should allow app store captured data ?.if have faced when building app let let know storage choice decided use. sd card or system storage pros (sd card perspective) -the app not using system storage good. -swapping of saved data easy between 1 android device another. cons (sd card perspective) -not android users have sd card.nor fair ask user have sd card using application..right ? i suggest option should dynamic , not fixed. below of opinion/suggestions you. 1) why don't ask user input storage prefers. can via dialog box in app starts(may once, or par requirement) lets user choose this going use phones :) if not agree 1st here more suggestions 2) mentioned app video capturing feature , implies need high/long storage volume. suggest go sd-card. not android users have sd card.nor fair ask user have sd card using application..right ? 3) neither there lot

oracle - Avoid Duplicate records while inserting in MS SQL Server 2008 from a java program -

i working on functionality supposed fetch data oracle database , insert mssql server 2008 database using java programming.(i know there other alternatives oracle golden gate,linked server.but asked do). able fetch data oracle server , insert sql server. issue redunduncy. i.e duplicate records inserted whenever trigger or run program, supposed every 6,12,24 hours. don't want happen. how can avoid source database has different connection , target database different connection. following code . iwould in working around avoid duplicate data inserted. /*to retrieve data oracle database , insert sql server*/ import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.statement; import java.util.properties; public class states { public static void main(string[] args) { string statecode, statename; try { class.forname("oracle.jdbc.driver.oracledriver").newinstance(); class.forname(&

How to secure a database using web services? -

now application connected database server in same lan , performs selects , inserts. database moved remote location accessible throughout internet. performance degradation addressed reducing number of operations db. not possible use vpn or configure access-in rules based on client ip on firewall of net database server moved. seems me necessary create database front end in order protect it. suppose 1 way achieve goal create web service. are there easier alternatives? i'm new web services: should run glassfish server while client c# application. read bit securing web service i'm confused. 1 method found in internet use glassfish built-in authentication mechanism , configure web.xml limiting access web service url group of users. it seems easy approach, there drawbacks? is easy use type of authentication in c# client? other existing web services wants parameter key in request. key compared valid ones , if check successful request accepted. is approach more secure pr

javascript - How to cancel getUserMedia indicator after recording -

i'm using recorder.js , getusermedia audio recording in browser. when starting recording, user given "allow site use microphone" prompt, , once click allow, chrome adds indicator onto tab's favicon show recording: recording indicator http://ubuntuone.com/1nbkbmc9va313wewtv03kz my issue indicator never goes away, after application has stopped recording. basically, i'd revoke own recording permissions. possible? when generate new mediastream object getusermedia call, contains mediastreamtrack object. calling mediastream.getaudiotracks() should return sequence represents snapshot of mediastreamtrack objects in stream kind "audio" . same thing applies when calling mediastream.getvideotracks() retrieve video track objects. according spec, looks can revoke given permissions app calling mediastreamtrack.stop() on audio track object. source: media capture , stream api spec

php - short array of links using bit.ly api -

i have found bit.ly api short links in php, need make loop, shortened array of links... so, example, have array: array ( [0] => http://longlink.com/1.php [1] => http://longlink.com/2.php [2] => http://longlink.com/3.php [3] => http://longlink.com/4.php [4] => http://longlink.com/5.php ) and need short new array this: array ( [0] => http://bit.ly/... [1] => http://bit.ly/... [2] => http://bit.ly/... [3] => http://bit.ly/... [4] => http://bit.ly/... ) i have included bitty api ( here ) , usnig php code, can short 1 link $bitly = new bitly('username', 'apikey'); echo $bitly->shorten('http://longlink.com/1.php'); but can tell me, how short array? thanks! <?php $urls = array ( 'http://longlink.com/1.php', 'http://longlink.com/2.php', 'http://longlink.com/3.php', 'http://longlink.com/4.php', 'http://longlink.com

Why does this C++ code compile? What does it do? -

this question has answer here: uses of c comma operator [duplicate] 20 answers i had problem when accidentally deleted method name. code went from bool bret = methodname(pdata, poutfilename); to bool bret = (pdata, poutfilename); but still compiled? code do? mean? seems return true, case (even if pdata null)? any ideas welcome! it "comma operator" evaluates first operand , discards result, , evaluates second operand , returns value (and type).

Amazon EC2 Load Testing -

i designing aws deployment solution new dynamic website project. have acquired ec2 instance testing environment. need on how do load testing on ec2 instance determine how many http requests can safely handle... p.s. new aws platform. thanks... redline offers ec2 load testing solution automate distribution of load tests on own ec2 instances.

ASP.NET c# error 404.15 when submitting a form -

i have created form in asp.net webforms every time try , submit form following error. the length of query string request exceeds configured maxquerystringlength value. i have tried increasing value cannot seem submit. this query string form creating http://localhost:3819/accidentreportform.aspx?__eventtarget=&__eventargument=&__viewstate=%2fwepdwukmtkwndy0nte1mw9kfgjmd2qwagidd2qwagibd2qwdaifdxapfgyedurhdgfuzxh0rmllbgqfbe5hbwuedkrhdgfwywx1zuzpzwxkbqroyw1lhgtfiurhdgfcb3vuzgdkebufedxtzwxly3qgu3viamvjdd4qsmfzb24gvmvhcm5jb21izq1ccnvjzsbiyxj0bgv5dvnhcmfoiehhd2tpbnmltgvhbm5lifbvcnqvbqaqsmfzb24gvmvhcm5jb21izq1ccnvjzsbiyxj0bgv5dvnhcmfoiehhd2tpbnmltgvhbm5lifbvcnqukwmfz2dnz2dkzaipdxbkdxyfzgibagicawieagucbgihaggccqikagscdainag4cdwiqahecegitahqcfqiwahccgaizahocgwicah0chhyfeaubmqubmwcqbqeybqeyzxafatmfatnneaubnaubngcqbqe1bqe1zxafatyfatzneaubnwubn2cqbqe4bqe4zxafatkfatlneaucmtafajewzxafajexbqixmwcqbqixmgucmtjneaucmtmfajezzxafaje0bqixngcqbqixnqucmtvneaucmtyfaje2zxafaje3bqixn2cq

if statement - PHP form validation error T_String error -

what's wrong code i'm getting error unexpected t_string.. on line 7 if(!$query) { die("unable enter database"); } elseif header("location:/peach mansions/confirm.php"); } else { echo 'a required field missing'; } ?> elseif header("location:/peach mansions/confirm.php"); } should be elseif (your_condition) { header("location:/peach mansions/confirm.php"); }

bash - Linux Shell .sh, Search Database -

i'm quite new shell bash scripts , hitting wall command first search database , report on entries not correct. the database should holding entry a,b,c only way can find use, if shell report using x, y. the problem x, y keep changing. here's example of have currently. mailaddr="me@yahoo.com" # database table entry x , add txt file find /var/lib/mysql -type f -name '*configuration.myd' -print0 | xargs -0 grep -il 'x' > /root/output_search_results1.txt # database table entry y , add txt file find /var/lib/mysql -type f -name '*configuration.myd' -print0 | xargs -0 grep -il 'y' > /root/output_search_results2.txt # if x file populated email it. if [ -s /root/example_search_results1.txt ] mutt -s "which database list example x" $mailaddr < /root/example_search_results1.txt rm -f /root/example_search_results1.txt fi # if y file populated email it. if [ -s /root/example_search_results2.t

wpf - Setting Focusable On RadTreeViewItem does not Follow the Default Foucable Behaviour -

in telerik radtreeview want of treeviewitems unselectable until previous steps completed. in background have boolean property isselectable binded treeviewitem focusable property. before when using windows treeview control focusable property made treeviewitems unselected until previous steps completed default behaviour in windows control. after converting telerik radtreeview control can select items focusable property set false , treeviewitem highlighted on hovering on item. there way can make work on setting radtreeviewitem focusable property false respective radtreeviewitems not selectable , shouldn’t highlight on mouse on default focus behaviour? following snippet example demonstrate issue focusable property focusable false category1 can selected , highlighted. thanks. <telerik:radtreeview x:name="radtreeview"> <telerik:radtreeviewitem header="category1" focusable="false"> <telerik:radtreeviewitem header="pro

java - android.view.WindowManager$BadTokenException: Unable to add window — token null is not valid -

i error whenever try start window class. using separate class, , not method within game class, cause need disable button on popup window. calling class button. code works fine if use within game class, not in separate class. here code: public class popup_pogresno extends activity implements onclicklistener{ private popupwindow pwindow; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); layoutinflater layoutinflater = (layoutinflater)popup_pogresno.this .getsystemservice(layout_inflater_service); view popupview = layoutinflater.inflate(r.layout.popup, null); pwindow = new popupwindow(popupview, 300, 170, true); button btndismiss = (button)popupview.findviewbyid(r.id.bpopupok); btndismiss.setonclicklistener(new button.onclicklistener(){ public void onclick(view v) {

java - Extend hsqldb to understand another dialect -

i'd test our dao objects junit, hsqldb , dbunit. unfortunately our proprietary database supports keywords in queries not supported hsqldb default. example 'browse access' @ end of search query search isolation level 'transaction_read_uncommitted': select * user user_id = 'test' browse access; how handle this? write dialect hsqldb? wrap driver? adapting queries , software possible, not preferred solution. regards, boskop

MYSQL QUERY LEFT JOIN SHOW ALL DATA FROM ONE TABLE -

select a.code, b.note, c.number (a left join b on a.code = b.code left join c on a.code = c.number ) c.id = b.id need show results combined 3 tables, results show data table b reported if data isn't real table c. table a.code 1 2 3 table b.code 1 2 3 table b.note pippo paperino pluto table c.number 1 ideally there should 1 result showing 1 1 pippo but in results shown: 1 1 pippo 1 1 paperino 1 1 pluto how can real data? select a.code, b.note, c.number inner join b on a.code = b.code inner join c on a.code = c.number no need cluse

java - How to do for each in Struts 2 -

i trying build slider web page in html. gets values arraylist(named testlist) struts action. , want display 6 values list @ time in pattern.for ex: if array of size 26, {0,1,2,3,4,5} {6,7,8,9,10,11} {11,12,13,14,15} .. , on upto {24,25} ,rest values if null ok. something each loops: for(i=0;i<size;i+6){} but values list in pattern : {0,1,2,3,4,5} {1,2,3,4,5,6} {2,3,4,5,6,7} .. which because index(#status.index)iterates in following pattern {0,1,2,3...} want index increment 6 everytime instead of 0 1 2 etc. i added step="6" , not working. here sample of code below: <ul class="slider"> <s:iterator step="6" status="status" value="testlist" > <li> <!-- first slot of data --> <div class="rightsubcontainer"> <s:iterator value="testlist[#status.index]" > <table >