Posts

Showing posts from July, 2010

php - Symfony2 Why template rendered like string? -

Image
i use service menu render , other menu features. when render menu, instead html menu receive menu string. why happens? i have service. services: ad_backend.menu: class: adbackendbundle\services\menuservice arguments: [@doctrine.orm.entity_manager, @twig] namespace adbackendbundle\services; use doctrine\orm\entitymanager; class menuservice { private $em; private $twig; public function __construct(entitymanager $em, \twig_environment $twig) { $this->em = $em; $this->twig = $twig; } public function getmenulist() { return $this->em->getrepository('adbackendbundle:admenu')->findall(); } public function rendermenubyid($id) { $links = $this->em->getrepository('adbackendbundle:admenu')->getlinksbymenuid($id); return $this->twig->render('adbackendbundle:menu:menu-template.html.twig', array( 'links' =>

cakephp - How to prevent showing/receiving untranslated content? -

this distance cell public function display() { $this->loadmodel('distances'); $distances = $this->distances->find('all',[ 'order' => 'distances.id asc', ])->toarray(); $this->set('distances',$distances); }} problem, if content not yet translated , stored in db, original untranslated content displayed on page. how prevent this, , show translated content in current language? the onlytranslated option this unfortunately not documented yet, translate behavior supports onlytranslated option, cause records found translation in current locale exists. so simle enabling option, either in configuration when loading behavior: $this->addbehavior('translate', [ 'onlytranslated' => true, // ... ]); or on fly: $this->distances->behaviors()->get('translate')->config('onlytranslated', true); however, work when current locale no

java - What should I insert between <tag-class></tag-class> tags in .tld file? -

i've got problem. don't know should put between tags <tag-class></tag-class> . i'm trying simple webapp , i'd use (in jsp pages) own tag. and second thing uri tags don't work (i think can somehow related <tag-class> tags). program in intellij idea , highlights me bug (about uri tags). <?xml version="1.0" encoding="iso-8859-1"?> <taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" version="2.1"> <tlib-version>1.2</tlib-version> <short-name>randomtags</short-name> <function> <name>test</name> <function-class>mypackage.person</function-class> <function-signature>int methodfortldtesting()&

matplotlib - Plotting three lists as a surface plot in python using mplot3d -

Image
i have 3 lists, x , y , z . each piece of data associated index. x = [1,1,1,1,2,2,2,2,3,3,3,3] y = [1,4,5,6,1,4,5,6,1,4,5,6] z = [2,6,3,6,2,7,4,6,2,4,2,3] the x , y lists contain 3 or 4 unique values - each combination of x , y unique , has associated z value. i need produce surface plot using .plot_surface . know need create meshgrid this, don't know how produce given have lists containing duplicate data, , maintaining integrity z list crucial. use tri_surf works straight away, not quite need. i'm using mplot3d library of course. given scattered nature of data set, i'd suggest tri_surf . since you're saying "it not quite [you] need", other option create meshgrid , interpolate input points scipy.interpolate.griddata . import numpy np import scipy.interpolate interp import matplotlib.pyplot plt mpl_toolkits.mplot3d import axes3d x = [1,1,1,1,2,2,2,2,3,3,3,3] y = [1,4,5,6,1,4,5,6,1,4,5,6] z = [2,6,3,6,2,7,4,6,2,4,2,3] plotx,ploty, = n

unix - Python script to sum values from ls -l output -

from other post read output of ls -l , filter bytes of files in dir. but, want put values list (array) , total sum of elements. i tried create list b , print sum(b). but, when want create list, memoryerror. situation now: import subprocess import csv process = subprocess.popen(['ls', '-l',], stdout=subprocess.pipe) stdout, stderr = process.communicate() reader = csv.dictreader(stdout.decode('ascii').splitlines(), delimiter = ' ', skipinitialspace=true, fieldnames= ['owner','date','dir','priv','bytes','field2', 'field3', 'field4', 'field5']) issues start here for row in reader: = row['bytes'] b = [int(a)] in b: b.append(i) continue print(b) output: traceback (most recent call last): file "script2.py", line 13, in <module> b.append(i) memoryerror any how put 1 list elements , sum appreciated. thanks!

php - How to sort an empty array? -

how sort empty array using foreach loop output these 25 numbers in order? example outcome be: 1 1 1 1 1 2 2 2 2 3 3 3 3 3 4 4 4 4 <?php $array = array(); for($counter = 0; $counter <=25; $counter++){ $die = rand(1, 10); $int[$counter] = $die; echo " $die "; } sort($die); foreach ($die $value) { echo '<option value="'.$value.'">'.$value.'</option>'; } ?> <?php $array = array(); ($i = 0; $i <=25; $i++) { echo $array[] = rand(1, 10); } sort($array); foreach ($array $value) { echo '<option value="'.$value.'">'.$value.'</option>'; }

java - Playframework : Access named cache in Global Settings -

i'm following documentation here , trying implement named cache in play (java) project. have beforestart method defined below in global class: public class global extends globalsettings { @inject @namedcache("system-cache") cacheapi cache; @override public void beforestart(application app) { ... ... cache.set("test", "test"); //throws nullpointerexception } however, seems dependency injection not work global object. can access default cache using: import play.cache.cache; .... public class global extends globalsettings { public void beforestart(application app) { cache.set("test", "test"); //this works } } how access named cache in globalsettings class? you need use eager singleton - allow inject whatever want, , have run app starting up. from documentation : globalsettings.beforestart , globalsettings.onstart: needs happen on start should happening in

unity3d - How to increase frames per second in low poly simple game? -

Image
i'm struggling performance in unity. created simple game scene. low poly. 2 light sources, 1 directional 1 point, have standard shader alberdo , occlusion texture set (this few 3d objects in scene) the issue is, expecting fps around 60 29ish.. what things have consider regarding performance in scenario? frutstating since very, simple scene see images: in quality settings, mentioned hamza, set shadow resolution medium setting , set v sync count "dont sync".

javascript - IE not taking my onClick, any suggestions? -

i have pretty simple function seems work fine in chrome, firefox, , safari, in ie it's breaking. i'm trying load windows 8 web app, i've read, uses more forgiving version of ie10 output. say have <div> (or <a> href ...i've tried well) so: <div onclick="showsection('mytemplate.html');"></div> this function: function showsection(loca) { $("#optionview").show(); $("#bookmenu").hide(); $("#optionview").load('settings/'+loca); $("#settingsbutton").attr("onclick","showsettingsmain();"); } why wouldn't work in ie? a better option, since using jquery, not use inline event handlers. instead, use html: <div id="main_div"></div> and use javascript: $(document).ready(function () { $("#main_div").on("click", function () { showsection("mytemplate.html");

sql - Output a field by matching data in fields in Table 1 to both data in fields and fields themselves in Table 2 in Access -

gist: how output data stored in table 2 field x each row in table 1 matching table 1 field table 2 field , table 1 field b corresponding field (b, c, d, e, etc.) in table 2? this might nauseatingly simple feel free skip through of if feel i'm over-backgrounding! usage case: i inherited access database tracks individual sales trips conducted employees of contractors company has hired conduct sales. company has negotiated single hourly rate employees of each contractor given sales account @ our company. i have 2 access tables: 1. salestrips contains instances of sales trips conducted employees of contractors. format (relevant fields only): tripid sales account contractor employee hours contracted 1 800 earthco maurice 10 2 800 windco wade 36 3 900 fireco don 17 4 800 fireco sherry 52 2. contracts

java - What could cause InvocationTargetException and ClassCastException: -

i have fxml interface: sample.fxm l controlled samplecontroller.java , displays 3 textfields , it's supposed add data database, yet i'm facing 2 exceptions, 1 invocationtargetexception , other classcastexception, i'll post log below. ps: in controller class, i'm initializing problem object defined in entity package, along dao containing add method. sample.fxml : http://pastebin.com/yvc2zuvg problemdao.java : http://pastebin.com/gufb3jnd problem: http://pastebin.com/4xeksznw samplecontroller.java : package gui; import entity.problem; import dao.problemdao; import java.net.url; import java.sql.date; import java.text.dateformat; import java.text.simpledateformat; import java.util.calendar; import java.util.resourcebundle; import javafx.event.actionevent; import javafx.fxml.fxml; import javafx.fxml.initializable; import javafx.scene.control.button; import javafx.scene.control.*; /** * fxml controller class * * @author h4dh */ public class samplecontro

How is the window scale set/calculated in the TCP/IP implementation of the Linux kernel? -

can point out exact location in kernel source tree , exact algorithm of how window scale of tcp packet calculated/set in linux kernel? most other tcp options ttl , window buffer size seem directly hardcoded in kernel. the window scale of tcp packet isn't calculated @ all. tcp packets don't have window scales. connections have window scales, , fixed when connection completed, based on size of socket receive buffer , possibly system defaults, in such way 16 bit value shifted scale can encompass entire socket receive buffer.

javascript - Changing all colors on the page with JS -

i'm trying make simple color switcher site js. issue being site has 2 possible style sheets, making little more difficult. i have: $(document).ready(function () { $('*').filter(function() { return $(this).css('background-color') == "rgb(101, 31, 255)" }).css('background-color', '#33b5e5') $('*').filter(function() { return $(this).css('border-color') == "rgb(101, 31, 255)" }).css('border-color', '#33b5e5') $('*').filter(function() { return $(this).css('color') == "rgb(101, 31, 255)" }).css('border-color', '#33b5e5') }); which hideous , horrible, iterates through elements can have color, , replaces other. issue being i'd have rerun not every page change, every single time div loaded, insane. is there better way of changing of color 1 in style sheet color 2? can use jquery add or remove specific class body on click eve

ios - Initiating UITalbleViewController in the code -

i have uitableviewcontroller in storyboard in there 3 cell on label in middle on each. instance if user clicks on first cell label in show tableview list of items selecting item previous tableview , item name should printed in place of label. #import <uikit/uikit.h> @interface carselectcelltableviewcell : uitableviewcell @property (weak, nonatomic) iboutlet uilabel *carmake; @property (weak, nonatomic) iboutlet uilabel *carmodel; @property (weak, nonatomic) iboutlet uilabel *carrego; @property (weak, nonatomic) iboutlet uilabel *caryear; //the below label labels in cells. @property (weak, nonatomic) iboutlet uilabel *carselected; @property (weak, nonatomic) iboutlet uilabel *location; @property (weak, nonatomic) iboutlet uilabel *service; @end #import "bookservice.h" #import <parse/parse.h> #import "carselectcelltableviewcell.h" @interface bookservice () @end @implementation bookservice @synthesize tableview; - (void)viewdidload { [su

java - How to cascade parent entity when persisting child in bidirectional -

i have child class called producto looks this: @entity public class producto implements serializable { @id @generatedvalue(strategy = generationtype.auto) private int id; @notnull(message = "por favor ingrese un valor") private string nombre; @notnull(message = "por favor ingrese un valor") @column(length = 140) private string descripcion; @notnull(message = "por favor ingrese un valor") private double precio; @notnull(message = "por favor ingrese un valor") private string imagen1; @notnull(message = "por favor ingrese un valor") private string imagen2; @notnull(message = "por favor ingrese un valor") private string imagen3; private int megusta; private int nomegusta; @onetomany(cascade = cascadetype.all, fetch = fetchtype.eager, orphanremoval = true) @joincolumn(name = "comentario_producto", referencedcolumnname = "id

ruby on rails - iOS Push Notification connection.write error -

whenever try sending push notification rails server using gem houston, gives me error: nomethoderror (undefined method `gsub' nil:nilclass): app/controllers/api/v1/messages_controller.rb:77:in `create' it points on line: connection.write(notification.message) notification.message string value. i don't know causing since occurs on notification sending code itself. so figured out. stupid error passed wrong , came out nil. should have passed in connection.write( msg_notification .message) instead of connection.write( notification .message) .

javascript - Multi-page Applications with Meteor/React -

i new meteor/react , trying figure out how create multi-page application. i'm getting confused how routing work. want have multiple html files that, depending on happens on one, cause 1 rendered. example, i'm on main.html , click button -> , should cause secondary.html render on screen. hit button on secondary.html -> , directs me tertiary.html. however, whenever launch application, html files rendered @ once (something meteor automatically guess). i've been trying work flowrouter. or advice appreciated!! i'm getting confortable iron:router package, can see documentation here : https://atmospherejs.com/iron/router have on options can add visiting documentation... but still, how implement easiest way : router.route("/mycustomroute",function(){ this.render("/mycustomtemplate") } by doing this, allow application have multiples routes :) however, flowrouter option (maybe better) same "logic of code" behind :) h

c# - How to Write a Data Trigger based on Hascode of a Control in WPF -

i'm having property hashcodevalue . based on hashcode in hashcodevalue property need change visibility of control using datatrigger. the wpf xaml source code: <style targettype="{x:type datagridcolumnheader}" x:key="dummyfilterdatagridcolumnheader"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type datagridcolumnheader}"> <button content="super i" visibility="collapsed" /> <button content="super ii" visibility="collapsed" /> <button content="super iii" visibility="collapsed" /> <controltemplate.triggers> <datatrigger property="{binding hashcodevalue}" value="???"> <setter targetname="button" property="visibility" value="visible&

javascript - convert Millisecond to Date and Date to Millisecond -

i want convert date millisecond per follow converted. var d = new date(1454911465467) \\ output : mon feb 08 2016 11:34:25 gmt+0530 (ist) now want convert using output millisecond. var d = new date('mon feb 08 2016 11:34:25 gmt+0530 (ist)').gettime() \\output : 1454911465000 expected output : 1454911465467 is way convert these type of millisecond? milliseconds not specified in 'mon feb 08 2016 11:34:25 gmt+0530 (ist)'. date precision here down seconds. hence 467 milliseconds missed in second result. you can check e.g. var originaldate = new date(1454911465467); var clonneddate = new date(originaldate.getfullyear(), originaldate.getmonth(), originaldate.getdate(), originaldate.gethours(), originaldate.getminutes(), originaldate.getseconds(), originaldate.getmilliseconds()); document.write(clonneddate.gettime());

DB2, SQL query to SUM 2 columns -

i need add columns in row. table data id col1 col2 1 10 20 2 11 20 3 12 20 result expected id sum 1 30 2 31 3 32 i tried sum(col1 + col2) , gives sum of columns together. sum() aggregating function (one give single result group of rows), not algebraic one: want addition (the mathematical sum) of 2 columns: select id, col1 + col2 sum mytable

struct - Casting errors in malloc for "char" array in C language -

code read bmp image using struct variables , struct array. kindly suggest me correct way typecasting malloc(errors listed below code): #include<stdio.h> #include<stdlib.h> typedef struct bands{ /* .bmp image store pixel colors in "bgr" sequence */ unsigned char b,g,r; //in 24bit bmp, need use 8bit datatype each color }bands; int main() { file *bmpimage; //ptr read image file file *redpix,*greenpix,*bluepix; //ptr create band/color wise file unsigned short pix_x=223,pix_y=197; /*pix_x: no. of pixels in row, pix_y: no. of pixels in column of input image*/ unsigned short n_pix=pix_x*pix_y; /*variable count total no. of pixels*/ bmpimage=fopen("blocks223x197.bmp","r"); //24 bit bmpimage redpix=fopen("redpixels.txt","w"); greenpix=fopen("greenpixels.txt","w"); bluepix=fopen("bluepixels.txt","w"); /* define pointer memory block,'*readbuffer', has 'n_pix' no. o

javascript - Dynamically change JSP page content without buttons -

i've written code dynamically fills drop down list sql database. next, need change content of page depending on user selection in real-time (no buttons), perhaps show label, or show drop down list gets it's values sql db depending on previous selection etc.. here code <%@ page import="java.sql.*" %> <%resultset resultset = null; connection conn;%> <html> <% try { class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver").newinstance(); conn = drivermanager.getconnection("jdbc:sqlserver://desktop-o708f3g\\sqlexpress;databasename=master", "user", "pswd"); statement statement = conn.createstatement(); resultset = statement.executequery("select * rtable"); %> <h1> drop down list</h1> <select name="projectname"> <% while (resultset.next()) {%> <option><%= resultset.getstring(

python - Ftp upload file in directory structure per /year/month/day -

i'm using following function upload files , structure per week day , what i'm looking adjust here change directory structure per year/month/day example /incoming/2016/02/08/filename if dir or sub dir not exits create upload which method should use switch per week day deep dir structure per year/month/day def dir_today (): """ function determine directory today """ week = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'] day = week[datetime.today().weekday()] return day def ftp_upload (ifn): """" ftp upload function. destination file appended date , timecode received meta data""" src = "%s/%s" % (src_loc,ifn) try: create_time = get_meta(ifn) except: create_time = datetime.now().strftime("vid_%y-%m-%d_t_%h-%m-%s")

How to convert double value to two byte array in c# -

i developing windows forms application. have double value 1.5.that value need convert 2 byte array. when converting using bitconverter.getbytes, getting 8 bytes of data. please refer code below. double d = 1.5; byte[] array = bitconverter.getbytes(d); double 8 byte value, if have arbitrary double there's no hope you; however, if have restrictions , e.g. value in [0..100] range , has @ 2 digits after decimal point, can encode it: // presuming source in [0..100] @ 2 digit after decimal point double source = 1.5; // short 2 byte value short encoded = (short) (source * 100 + 0.5); byte[] array = bitconvertor.getbytes(encoded); // decode double double decoded = encoded / 100.0;

c# - Simultaneous Downloads -

i trying build mobile app (ios , windows) downloads list of audio files remote server. is there criteria 1 needs consider before using different threads downloading files concurrently. (basically need download 7 files concurrently.) i found in case of ios there parameter "nsoperationqueuedefaultmaxconcurrentoperationcount" decides count of concurrent operations allowed. there other parameter need consider while developing ios/windows kindly guide me , newbie mobile development. regards robert interestingly here states nsoperationqueuedefaultmaxconcurrentoperationcount maximum number of download operations managed kernel @ runtime, value can change dynamically through application usage. imagine should download not possible however, exception thrown, handle. on windowsphone 8 maximum limit 6 active requests @ 1 time here . for windowsphone 8.1 / uwp use backgrounddownloader , , let manage things you. there reported limit of 5 simultan

algorithm - Count number of intervals containing another interval? -

Image
given 2 lists each containing n intervals (subset of number line), each interval form of start point , endpoint. how many pairs of these intervals 1 list contains intervals list? for example: if list {(1,7), (2,9)} , list b {(3,6), (5,8)} then count of pairs has interval contains interval in b 3 pairs: (1,7),(3,6) (2,9)(3,6) (2,9)(5,8) the goal shoot o(n log n). my algorithm sort x-coordinate first , take 1 list. sort list y-coordinate , count inversions between 2 lists. question why work? insight appreciated. the way have i'm visualizing in following geometric fashion (where each intersection of lines count of num inversion): note: i'm not sure how go checking inversions in list of list. trying approach give o(n log n). if there other approaches happy hear suggestions. i'll answer first question why solution inversion works. firstly, i'll clarify 1 thing. shouldn't count inversions (intersections of lines) these occur between element

scala - How do I use Squeryl's KeyedEntity? -

the information find relating keyedentity was: objects extend keyedentity[k] k numeric type have id field assigned newly created primary key value (the mechanism generating keys specific each databaseadaptor). how apply when keyed object immutable? isn't impossible object have id field assigned newly created primary key value? i assume supposed override abstract id method inside keyedentity on object in order return key of object. how squeryl find out field use key when it's writing database? i'm using squeryl 9.5 if matters. can't find documentation on these issues. in 0.95, squeryl field id or in case of compositekey , function named id . so, either of these definitions work: case class mytable(val id:long, ...) extends keyedentity[long] case class mytable(val field1:long, val field2:string, ...) extends keyedentity[compositekey2[long, string]] { def id = compositekey(field1, field2) } if using single field, looks db field named id , or

javascript - Node.JS - How to perform verfication on a dynamic file name in JS? -

i've tried used in "split()" in order ignore dynamic string inside file name , perform verification on fixed value "schedule" , return response pass test. describe('frontage - calendar test cases', function() { var fs = require('fs'); var splitfilename = "schedule" var filename = 'c:\\automation\\tests\\downloaded\\' + splitfilename.split(); it('new app - calendar - print calendar', function(){ $$("button.font-xs.md-button.ng-scope.md-ink-ripple.gray-btn").get(1).click(); browser.driver.wait(function() { return fs.existssync(filename); }, 30000); }); }); the error failures: 1) test cases pull - frontage sanity testing frontage - calendar test cases new app - calendar - print calendar message: error: wait timed out after 30000ms stacktrace: error: wait timed out after 30000ms @ c:\automation\npm\node_modules\protractor\node_mo

performance - Python - Exclude contents of one file from another / removing duplicate lines amongst two files -

first off, i'm using python 2.7.9 ..... now, i'm trying find efficient way compare lines of 1 text file (file a) lines of text file (file b) , write lines unique file new file (file a\b). actually i've written short script this, beyond slow... need script able handle files of 70mb(each, a&b), unthinkable 'bad' boy: import string naked = string.strip kiss = ''.join def main(): list1 = raw_input("enter name of .txt-file clean!\n") list2 = raw_input("enter name of .txt-file exclude!\n") action(list1, list2) raw_input("done!\npress [enter] exit!") def action(list1, list2): f = open(kiss([list1, '.txt']), "r") g = open(kiss([list2, '.txt']), "r") h = open(kiss([list1, '_without_', list2, '.txt']), "w") h_w = h.write reset = g.seek found = false in f: found = [true j in g if naked(i) == naked(j)] if n

What is the best approach for solving sporadic Oracle performance problems on large systems? -

i have case specific query on complex view on large database @ customer site runs fast (4 or 5 seconds), , slow (7 minutes). view used summarise customer database activity in last couple of minutes, , typically produces less 1000 rows. only once have been able reproduce problem, connecting customer database , running query use. other times have tried reproduce problem has run fast, during peak periods of user activity. the query runs fast on customer testing database, has sporadic performance problem on production database. the production database produces thousands of transactions every hour , has many users. test database not. i suspect problem related else happening on system, rather view itself, don't know how test or prove that, or start looking. what might be? concurrency issues? .. view used read data, never writing. i havent included code view doubt help. any suggestions might or might find reason sporadic performance issues , fix it?

javascript - Include bootstrap in my HTML page -

i have simple line of code. starting in doing javascript coding cannot make work. can please tell me why? <html> <head> <script src="bootstrap.min.js"></script> <title>my website</title> </head> <body> <p>this example of paragraph.</p> <button type="button" class="btn btn-danger">danger daw!</button> </body> </html> the bootstrap not appearing on page. bootsrap has javascript, css , optional theme. getting started link on bootstrap site have following code include them you. if hosting files yourself, update paths files. <!-- latest compiled , minified css --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mtjoasx8j1au+a5wdvnpi2lkffwweaa8hdddjzlplegxhjvme1fgjwpgmkzs7" crossorigin="anonymous"> <!-- opti

Android custom layout as navigation drawer -

Image
i trying build standard simple navigation drawer have many elements using arrayadapter when click on element need load html webview inside drawer, possible somehow? i building such layou t that: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_new_order" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:context=".baseactivity"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <include layout="@layout/app_bar" /> <framelayout xmlns:android="http://schemas.an

HDFS command to find the specific record in a text file based on text / word -

i have text file in hdfs, need find record(s) containing specific text word. for example: 1,sam,22,developer 1,any,38,manager 1,mike,30,technicallead 1,john,32,sm 1,alice,34,manager i need find records manager text. what command records based on manager text.

android - how to display position based image for following code? -

i have following code. when click on image in grid view particular image should display in activity. how can that? this activity class:: public class productsactivity extends activity { protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.grid_view); gridview gridview = (gridview) findviewbyid(r.id.gridview); gridview.setadapter(new myadapter(this)); gridview.setonitemclicklistener(new adapterview.onitemclicklistener() { public void onitemclick(adapterview<?> parent, view v, int position, long id) { // 'mactivity' parameter activity object, can send current activity. intent = new intent(getapplicationcontext(), mobiledisplayactivity.class); i.putextra("positionid",position); startactivity(i); } }); } how can change adapter class achieve requirement. ithink problem in getview() . this adapter

How can i get inverted coma instead of apostrophe in wordpress content frontend -

i write inverted comma on admin tinymce editor on frontend displays apostrophe when use: the_content(); but when use echo get_the_content(); it display inverted comma. and when use $content=get_the_content(); $content=apply_filters( 'the_content', $content ); echo $content = str_replace(']]>', ']]&gt;', $content); it again display apostrophe instead of inverted comma. i try replace apostrophe comma using str_replace("’", "'", $content); it doesn't work. suggestions? i have tried one <?php $content = get_the_content(); $content = apply_filters( 'the_content', $content ); $content = str_replace(']]>', ']]&gt;', $content); $content = html_entity_decode($content);//added code echo $content = str_replace("’", "'", $content); ?> adding $content = html_entity_decode($content); this code works me. still did

c# - Dynamicaly add buttons to asp table cell without deleting the cells text -

i have asp.table cells contains text , following function add buttons cells button btnactiv = new button(); btnactiv.id = y.tostring(); btnactiv.text = "dept " + dr_depts["code_dept"].tostring() + "(" + nbr + " )"; cell.controls.add(btnactiv); the buttons added , works fine text of cells gets deleted after add buttons how can add butoons , keep text please ? first dynamically create table cell , add text , button it: tablecell commentcell = new tablecell(); label lblcomment = new label(); lblcomment.text = "text remain in cell." commentcell.controls.add(lblcomment); button btnactiv = new button(); btnactiv.id = y.tostring(); btnactiv.text = "dept " + dr_depts["code_dept"].tostring() + "(" + nbr + " )"; commentcell.controls.add(btnactiv);

html - Can you execute two javascript functions with one submit button -

i have 2 different option boxes in form , 2 different scripts pull data on click how execute both scripts or not work? <input class="form-control" type="button" onclick="fun() && fun2()" value="submit"> yes, make it <input class="form-control" type="button" onclick="fun(); fun2();" value="submit"> or can call 1 function call both of them <input class="form-control" type="button" onclick="fun();" value="submit"> function fun() { fun1(); fun2(); }

How to show Blurred image before downloading(like in whatsapp) in ios? -

i making chat application image sending , downloading. want animation in whatsapp. so, how show blurred image? image downloaded server. please me. scale image down small size 8x8 pixels. send data client. should not more 4 * 8 * 8 = 256 b or 0.25 kb in size, sending client not problem no matter how slow client's connection speed is. then scale received 8x8 image resolution of preview box (for example 256x256). shouldn't need upsample 8x8 image if preview box uiimageview (see link below). downsampling , successive upsampling of image "blurs" image. to understand how can resample/rescale image in ios, check this link . (i can't in performing task ios, since not ios developer.)

python - Importing modules from nested folder -

this question has answer here: import module relative path 20 answers i have folder structure main_folder | |--done | | | |--test1 | |--__init__.py | |---check.py __init__.py: class tries(object): def __init__(self): print "test" check.py: from done.test1 import tries tries() error: --------------------------------------------------------------------------- importerror traceback (most recent call last) <ipython-input-8-10953298e1df> in <module>() ----> 1 done.test1 import tries importerror: no module named done.test1 i not able import modules nested folder. there way this. edit: after salva's answer changed structure . ├── check.py |--__init__.py(no content) └── done ├── __init__.py(no content) └── test1 └── __init__.py <-- files contains tries class

java - Reading zipped vs unzipped files into memory -

i have single file, delivered .zip, , want read memory. zipped 50 mb , unzipped 700mb. wondering if should unzip file first , read or if makes no difference , can read data zip file directly. in case of normal file use inputstreamreader wrapped around fileinputstream . for zip file use java.util.zipfile inputstream zipentry , again wrap inputstreamreader around it. in end work inputstreamreader in both cases. i tried test it, locally can't read such large file without running out of memory. on server process runs more processes interfering couldn't quite tell if there difference. does know, if 1 of options uses more memory other ot question of design, way use? greetings, uwe the difference small performance hit unzipping file. in both cases inputstreamreader read unpacked 700 mb file. the next question should ask, why need read large file memory? necessary? maybe can process line line without holding lines in memory.

MS Access VBA - system crashing during do until loop -

i'm trying calculate number of days between 2 dates on form, excluding weekends. however, system keeps crashing every time runs until loop. can spot might going wrong within code below? thanks help! private sub total_text_click() dim v_weekendcount integer dim v_date date dim dateone date dim datetwo date v_date = me.startdate_text.value v_weekendcount = 0 until v_date = me.enddate_text.value if day(v_date) = vbsaturday or day(v_date) = vbsunday v_weekendcount = v_weekendcount + 1 v_date = v_date + 1 end if loop dateone = me.startdate_text.value datetwo = me.enddate_text.value me.total_text.value = datediff("d", dateone, datetwo) - v_weekendcount end sub you had in mind: do until v_date = datevalue(me.enddate_text.value) if weekday(v_date) = vbsaturday or weekday(v_date) = vbsunday v_weekendcount = v_weekendcount + 1 end if v_date = v_date + 1 loop

python - If statement 'not working' despite conditions being true -

currently going through bin file full of hex data process, match i'm using try , find group of 3 hex bytes in file aren't working correctly. values identical not printing string i've got set confirm match, @ present i'm trying match first 3 bytes know works etc. code follows: match1 = "\\x00\\n\\x00" print ("match1 ="+match1) if bytedata == match1: print ("byte string 030791 found!") elif bytedata == match1: print ("byte string 050791 found!") exit() the value of bytedata '\x00\n\x00' script ignores , moves exit statement. file being opened follows : file = open('file.bin', 'rb') while true: byte = file.read(3) when printing value of byte reports "\x00\n\x00" have ideas why match isn't working properly? match1 not contain 3 bytes. contains 10: >>> match1 = "\\x00\\n\\x00" >>> len(match1) 10 you escaped escape sequences, \\x00 four

jasper reports - Number Formatting in iReport -

Image
can body me giving pattern number? here problem. i wanted display number "30.00", eventhough had set pattern 2 decimal points not displayting result as"30.00" instead showing result "30". and 1 note field pattern shoeing button "resetdefault". there problem button this. can 1 please solve problem. ireport has bad habit of not changing pattern on jrxml when open , press ok (your format default). change , change back, press ok , ready go. if tired of ireport, can set pattern directly in jrxml: example <textfield pattern="###0.00;-###0.00"> <reportelement x="100" y="0" width="100" height="20" uuid="1fccff95-408c-4364-b003-c691fefdde62"/> <textelement textalignment="right" verticalalignment="middle"/> <textfieldexpression><![cdata[$f{mynumber}]]></textfieldexpression> </textfield>