Saturday, 15 August 2015

web api - TcpListener in Webapi using C# -



web api - TcpListener in Webapi using C# -

is there sample code or startup documentation running threads in webapi project. have grouping 1 client devices , want them (group 1) communicate webapi using tcp communication , have grouping 2 client devices , want them (group 2) communicate webapi using http get/posts. how can that?

i discourage doing that. webapi projects (selfhosted excluded) controlled iis application pool. means project can closed/restarted @ time.

in other words: can not guarantee tcp listener keeps running in iis project.

it sounds more want utilize websockets communicate users.

c# web-api tcplistener

html - Browser mis-interpreting '&not' in URL -



html - Browser mis-interpreting '&not' in URL -

apparently if url containing text &not used part of field property, many browsers interpret '¬'. html code:

<a href="#" onclick="window.location='http://www.example.com?some_param=1&notify=true';">click here</a>

will rendered as:

<a href="#" onclick="window.location='http://www.example.com?some_param=1¬ify=true';">click here</a>

i found couple of alternatives substituting &not &%6eot, or posting form instead of getting parameterized url. posts aren't welcome alternative , substitution admittedly hack - need deal other mutual tokens &cent, &curren, &pound, &sect, &copy, &reg... (list taken here).

surely out there has improve solution this?

element attributes interpreted html parser, must escape & characters &amp;. works of time if don't, in cases (such yours) have "right" or won't work.

html browser html-parsing

javascript - backbone template won't stay in html -



javascript - backbone template won't stay in html -

so have backbone template i'm inserting in html:

<div class = "outside of template"> <script id="persontemplate" type="text/template"> <div class="view1"> <input class="toggle" type="checkbox"> <input class="view" style="border:none;" value="<%= name %> <%= age %> - <%= occupation %>"> <a class = "destroy" /> </div> </script> </div>

but when run script/ open page, output of template appear underneath

<div class = "outside of template"></div>

so how can create template contents remain within html div or table or whatever element?

your template appears between div element. that's issue right there.

it has be:

<div class = "outside of template"></div> <script id="persontemplate" type="text/template"> <div class="view1"> <input class="toggle" type="checkbox"> <input class="view" style="border:none;" value="<%= name %> <%= age %> - <%= occupation %>"> <a class = "destroy" /> </div> </script>

javascript html templates backbone.js

linux - Searching standard commands for a string -



linux - Searching standard commands for a string -

i'm trying list standard commands contain string. i'm told echo $path help i'm not sure how... advice? in advance!

try this:

find `echo $path | tr : ' ' ` | grep foo

where "foo" string you're interested in.

and if want ignore case, utilize -i flag grep:

find `echo $path | tr : ' ' ` | grep -i foo

linux unix

Rails 3 basic validation not working with :prompt or :include_blank? -



Rails 3 basic validation not working with :prompt or :include_blank? -

i have next code in view:

<%= f.select :user_id, user_all_select_options, :include_blank => '--select name-----' %>

it displays list of users --select name----- @ top. when user doesn't select name list , leaves --select name----- selected errors because user_id blank.

for reference helper method code looks this:

def user_all_select_options user.all.map{ |user| [user.name, user.id] } end

my model follows:

class parcel < activerecord::base attr_accessible :parcel, :received_at, :received_by, :chilled, :courier, :location, :passed_to, :user_id, :user, :content, :localip validates :user_id, :presence => true belongs_to :user end

for reason validation doesn't appear running, if select user drop downwards , add together validation other field input application correctly shows user message stating field incorrectly empty.

interestingly if leave select drop downwards --select name----- , maintain additional validation, exception thrown. doesn't prompt missing fields errors.

here record during error (this record when had validates presence check on location field:

{"utf8"=>"✓", "authenticity_token"=>"wm4kptoswp3xdv8uu4uasdadnszi9yfzmk=", "parcel"=>{"user_id"=>"", "received_by"=>"dan", "content"=>"", "chilled"=>"0", "courier"=>"", "location"=>"", "passed_to"=>"", "received_at(3i)"=>"9", "received_at(2i)"=>"2", "received_at(1i)"=>"2013", "received_at(4i)"=>"22", "received_at(5i)"=>"59"}, "commit"=>"receive parcel", "action"=>"create", "controller"=>"parcels"}

where should start looking? errors show when controller unless check against user.

the parcel controller create method looks this:

def create @parcel = parcel.new(params[:parcel]) @parcel.localip = request.env['remote_addr'] @parcel.received_by = @parcel.received_by.upcase unless @parcel.user.mobilenumber.blank? usermailer.parcel_notification(@parcel).deliver end respond_to |format| if @parcel.save format.html { redirect_to @parcel, notice: 'parcel created.' } format.json { render json: @parcel, status: :created, location: @parcel } else format.html { render action: "new" } format.json { render json: @parcel.errors, status: :unprocessable_entity } end end end

the reason why you're getting exception when don't select user line

unless @parcel.user.mobilenumber.blank?

since user_id not set, @parcel.user nil causes exception. suggest move within @parcel.save block.

def create @parcel = parcel.new(params[:parcel]) @parcel.localip = request.env['remote_addr'] @parcel.received_by = @parcel.received_by.upcase respond_to |format| if @parcel.save unless @parcel.user.mobilenumber.blank? usermailer.parcel_notification(@parcel).deliver end format.html { redirect_to @parcel, notice: 'parcel created.' } format.json { render json: @parcel, status: :created, location: @parcel } else format.html { render action: "new" } format.json { render json: @parcel.errors, status: :unprocessable_entity } end end end

ruby-on-rails-3 validation model controller

wordpress - Wrong og:image in the Facebook Open Graph -



wordpress - Wrong og:image in the Facebook Open Graph -

i did open graph on website , perfect.

but, homepage (front_page), facebook takes image of footer (?!)

in debug alright. how forcefulness facebook create og: image first image?

the code:

<?php if (have_posts()):while(have_posts()):the_post(); endwhile; endif;?> <!-- default values --> <meta property="fb:app_id" content="my id" /> <!-- if page home --> <?php if (is_front_page()) { ?> <meta property="og:title" content="name" /> <meta property="og:type" content="article" /> <meta property="og:url" content="http://www.com/"/> <meta property="og:image" content="http://www.com/wp-content/uploads/2013/02/thumbface.jpg" /> <?php } ?> <!-- if page content page --> <?php if (is_single()) { ?> <meta property="og:title" content="<?php single_post_title(''); ?>" /> <meta property="og:type" content="article" /> <meta property="og:url" content="<?php the_permalink() ?>"/> <meta property="og:description" content="<?php echo strip_tags(get_the_content($post->id)); ?>" /> <meta property="og:image" content="<?php $fbthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $post->id ), 'facebook-thumb' ); echo $fbthumb[0]; ?>" /> <!-- if page others --> <?php } else { ?> <meta property="og:site_name" content="<?php bloginfo('name'); ?>" /> <meta property="og:description" content="<?php bloginfo('description'); ?>" /> <meta property="og:image" content="http://www.com/wp-content/uploads/2013/02/thumbface.jpg" /> <?php } ?>

and sorry bad english

debug url on facebook's debug tool. there's possibility url has been cached facebook though image right one. using linter delete cache, , utilize presently available tags on page.

facebook wordpress opengraph

How do I loop a portfolio return calculation for multiple periods in matlab? -



How do I loop a portfolio return calculation for multiple periods in matlab? -

i have next data/sets (simplified version create illustration clear):

3*10 matrix of stocks identified number given period (3 stocks (my portfolio) in rows * 10 days (in columns) named indexbest. 10*10 matrix of returns each period each security in universe named dailyret (my universe of stocks 10).

i want create loop able calculate sum returns of each portfolio each period 1 matrix ideally 1*10 or 10*1 (returns * date or vice versa).

i have done single period portfolio, see below: want able automate process instead of doing 10* on each portfolio each period. please help!

portfolio_1_l= indexbest(:,1); %helps me portfolio constituents period 1 (3 stocks basically). returns_1_l= dailyret(portfolio_1(:,1));%to calculate returns of portfolio period 1 have referenced extraction of returns portfolio constituents. sum_ret_port_1_l=sum(returns_1_l); %sum homecoming of portfolio period 1

how loop process other 9 periods?

use for loop , utilize index variable in place of hardcoded 1 in illustration code. index output store result each day.

for day = 1:10 portfolio_1_l = indexbest(:,day); returns_1_l = dailyret(portfolio_1_l); sum_ret_port_1_l(day) = sum(returns_1_l); end

matlab loops finance portfolio

ASP.Net MVC Bundles and Minification -



ASP.Net MVC Bundles and Minification -

when moving development production environment have run problems way in javascript files beingness minified. seems not minify properly, , have been looking around find way not minify specific bundle.

public static void registerbundles(bundlecollection _bundles) { _bundles.add(new scriptbundle("~/bundles/tonotminify").include( "~/scripts/xxxxxx.js" )); _bundles.add(new scriptbundle("~/bundles/tominify").include( "~/scripts/yyyyy.js" )); etc..

this basic layout in bundle config class. want find way in have of bundles minified, apart first one. possible? far solution have found accomplish similar turn off minification globally.

you have couple of options, can either replace utilize of scriptbundle bundle in example:

_bundles.add(new bundle("~/bundles/tonotminify").include( "~/scripts/xxxxxx.js" ));

.. or disable transformations on newly created bundle, so:

var nominify = new scriptbundle("~/bundles/tonotminify").include( "~/scripts/xxxxxx.js" ); nominify.transforms.clear(); _bundles.add(nominify);

obviously first solution much prettier :)

asp.net-mvc asp.net-mvc-4

php - Difficulties retrieving image file with file_get_content -



php - Difficulties retrieving image file with file_get_content -

i'm trying fetch image path , fopen corresponding image in tmp directory, page displays empty img placeholder pic. in advance

public function getimage($path) { if($result = $this->db->prepare("select filename trips filename=?")) { $result->bind_param('s', $path); $result->execute(); $result->bind_result($filename); if($result->fetch()) { header("content-type: image/jpeg"); if(!file_exists("c:/xampp/htdocs/webshop/public/img/content/" . $filename)) { imagefilter($image, img_filter_grayscale); imagejpeg($image, "c:/xampp/htdocs/webshop/public/img/content/" . $filename); } else { $image = imagecreatefromjpeg("c:/xampp/htdocs/webshop/public/img/content/" . $filename); } imagejpeg($image); } else { echo "error"; } } else { echo "table retrieve failed: (" . $this->db->error . ") " .$this->db->error; } var_dump($img); homecoming $image; }

php string file-get-contents image-uploading

My javascript popup shows for a split second if there's a cookie -



My javascript popup shows for a split second if there's a cookie -

i have no clue i'm doing wrong. works shows popup split second. timeout alternative better? part problem? i'm little new javascript don't know for.

<script language="javascript" type="text/javascript"> /** create html cookie , set expiry day. **/ function createcookie(name,value,days) { var date = new date(); date.settime(date.gettime()+(days*24*60*60*1000)); var expires = date.togmtstring(); document.cookie = name+"="+value+"; expires="+expires+"; path=/"; } /** check if cookie has been created. **/ function readcookie(name) { var flag = 0; var dcmntcookie = document.cookie.split(';'); for(var i=0;i < dcmntcookie.length;i++) { var ck = dcmntcookie[i]; while (ck.charat(0)==' ') { ck = ck.substring(1,ck.length); } if(ck) { cparts = ck.split('='); if (cparts[0] == name) flag=1; } } if(flag) { homecoming true; } else { homecoming false; } } /** check if cookie exists else create new one. **/ function checkcookie(name) { if (readcookie(name)) { document.getelementbyid('google').style.display = "none"; document.getelementbyid('google').style.visibility = "hidden"; } else createcookie(name,"cookie 4 day",1); } </script> <script type="text/javascript"> function closethisdiv() { var opendiv = document.getelementbyid('google'); opendiv.style.display = 'none'; } </script> <body onload="checkcookie('mycookie')"

if goal have element id="google" hidden origin of page display (so never shows), should add together css rule loads in head section this:

#google {display: none;}

or, should add together style element html itself:

<div id="google" style="display:none"></div>

as code written, sounds doing supposed to. waits entire document loaded (including images) , hides element id="google". means item show briefly while page loading , code hide it.

if can't modify css or html google object , you're trying hide possible javascript , google object nowadays in html of page (not added programmatically), can this:

<body> other html here <script> // script executes right before /body tag checkcookie("mycookie") </script> </body>

this @ to the lowest degree not wait images load before hiding it.

javascript cookies popup

ajax - How to get a file(pdf) via json API call? -



ajax - How to get a file(pdf) via json API call? -

my search reply keeps getting interfered because of pdf keyword.

i'm trying fetch document via api call. see below:

(function($) { // handles opening notes list page displaydocument = function(documentpath) { console.log("reached displaydocument"); var callapi = documentpath; console.log(callapi); var documentreq = $.ajax({ beforesend: function() { showloader(); }, url: callapi, datatype: 'json', contenttype: 'application/pdf', headers: { authorization: 'token ' + authtoken } }); documentreq.success(function(data) { console.log("got resume " + data); }); documentreq.error(function(data) { console.log("failed resume " + json.stringify(data)); }); }; })(jquery);

i 200 ok back, request goes "error".

documentreq.error function starts spitting out this:

failed resume {"readystate":4,"responsetext":"%pdf-1.4\r\n%����\r\n1 0 obj\r\n<<\r\n/type /catalog\r\n/pages 2 0 r\r\n>>\r\nendobj\r\n3 0 obj\r\n<<\r\n/creationdate (d:20060515092800)\r\n/author (aaronb)\r\n/creator (ikon communications)\r\n/producer (ikon communications)\r\n/title (aaron w)\r\n>>\r\nendobj\r\n2 0 obj\r\n<<\r\n/type /pages\r\n/kids [4 0 r 5 0 r]\r\n/count 2\r\n/resources <<>>\r\n\r\n/mediabox [.00 .00 595.00 842.00]\r\n>>\r\nendobj\r\n4 0 obj\r\n<<\r\n/count 1\r\n/type /pages\r\n/kids [6 0 r]\r\n/parent 2 0 r\r\n/mediabox [.00 .00 612.00 792.00]\r\n>>\r\nendobj\r\n5 0 obj\r\n<<\r\n/count 1\r\n/type /pages\r\n/kids [7 0 r]\r\n/parent 2 0 r\r\n/mediabox [.00 .00 612.00 792.00]\r\n>>\r\nendobj\r\n6 0 obj\r\n<<\r\n/type /page\r\n/parent 4 0 r\r\n/contents [8 0 r]\r\n/resources <<\r\n/procset [/pdf /imageb /imagec /imagei /text]\r\n/xobject <<\r\n/ed12522b-184c-403b-ba19-aba6d7723557 9 0 r\r\n>>\r\n\r\n>>\r\n\r\n>>\r\nendobj\r\n7 0 obj\r\n<<\r\n/type /page\r\n/parent 5 0 r

so figure i'm missing how handle document itself, compared normal json phone call key: "value"s

any thoughts? or directions?

cheers in advance

ajax json api get

entity framework - Does ASP .Net MVC have anything similar to Java's [Transient] attribute? -



entity framework - Does ASP .Net MVC have anything similar to Java's [Transient] attribute? -

as title says, there way in asp .net mvc (4) mark models property "transient" i.e. not persist database.

i looking create model of info stored in external system, need store reference of record in scheme , fetch info external scheme when needed. able using attributes or need implement sort of view model?

as part of name of language, think best practice include in viewmodel, populate when grab info @ first in controller, , not when go controller save it.

the thing comes close you're describing notmapped attribute entity framework know not create column field or persist database it. typically used properties precalculated (i.e. want quick way inquire sum total of 3 of fields).

entity-framework transient

testing - Is supertest compatible with express.js 2.5.8? -



testing - Is supertest compatible with express.js 2.5.8? -

i using express.js version 2.5.8 (from legacy code) , looking test route loading using supertest. having issue server running, not stopping. run tests using jasmine-node, indicates assertion succeeds. however, console shows process still running.

var request = require('supertest') , express = require('express'); describe('example test', function() { var app; beforeeach(function() { app = express.createserver(); app.configure(function() { app.set('port', process.env.port || 3000); app.use(express.logger('dev')); app.use(express.bodyparser()); app.use(express.methodoverride()); }); app.get('/', function(req, res){ res.send(200); }); }); it('index should homecoming 200', function(done) { request(app) .get('/') .expect(200) .end(function(err, res) { expect(err).tobe(null); done(); }); }); });

this illustration adapted 1 using express.js 3.x.x. assumption express server behaves differently, leading not closing when request terminates within test. uncertain how right issue.

the server still running because aren't closing anywhere. add together app.close() end(function(){}) stop express server. if want exit node utilize process.exit().

testing express jasmine jasmine-node supertest

Magento : add a button to the edit product page accessible to a specific resource acl -



Magento : add a button to the edit product page accessible to a specific resource acl -

i tried override block mage_adminhtml_block_catalog_product_edit , create button "delete_cache_product" way:

protected function _preparelayout() { parent::_preparelayout(); $this->_product = $this->getproduct(); $this->setchild('delete_cache_product', $this->getlayout()->createblock('adminhtml/widget_button') ->setdata(array( 'label' => mage::helper('catalog')->__('delete cache'), 'onclick' => 'confirmsetlocation(\''.mage::helper('catalog')->__('are sure?').'\', \''.$this->getdeletecacheproducturl().'\')', 'title' => mage::helper('catalog')->__('delete product cache?') )) ); homecoming $this; }

the problem how can associate resource acl button users have access such resources can see button???

create custom admin module acl then

if(mage::getsingleton('admin/session')->isallowed('admin/custommodulename')){ $this->setchild('delete_cache_product', $this->getlayout()->createblock('adminhtml/widget_button') ->setdata(array( 'label' => mage::helper('catalog')->__('delete cache'), 'onclick' => 'confirmsetlocation(\''.mage::helper('catalog')->__('are sure?').'\', \''.$this->getdeletecacheproducturl().'\')', 'title' => mage::helper('catalog')->__('delete product cache?') )) ); }

see http://alanstorm.com/magento_acl_authentication

magento button admin acl product

generics - Why Java PriorityQueue does not enforce a Comparable Object -



generics - Why Java PriorityQueue<T> does not enforce a Comparable Object -

why priorityqueue in java defined as,

priorityqueue<t>

and not as,

priorityqueue<t extends comparable<? super t>

it rather gives classcastexception @ runtime if not queue objects of type comparable. (and if not using custom comparator).

why not grab @ compile time?

it's done can still utilize priority queue objects not implement comparable interface. in such cases supply own custom comparator , works.

this increases usability of class, @ minimal no cost. behavior well-documented in javadoc.

java generics collections priority-queue

visual c++ - Voip sample Application Error -> The application was unable to start correctly (0xc000007b) -



visual c++ - Voip sample Application Error -> The application was unable to start correctly (0xc000007b) -

i upgrade 32 bit sample voip application 64 bit. after upgrade application .exe file give problem:

the application unable start correctly (0xc000007b)

my pc 64 bit. , build in 64 bit

i realize late you, looking @ question, problem have mixture of 32-bit , 64-bit components (dlls) loaded @ start-up. since app built 64-bit, still have 32-bit dlls scheme attempts load in process , fails (since 32-bit modules cannot loaded in 64-bit process).

visual-c++ voip

Can't get csv from Highcharts -



Can't get csv from Highcharts -

i want create possible download csv-file highchart ... in example.

link jsfiddle

i've tried implement it, doesnt work in code .... reason? i want alert csv! later want implement can download ...

here code:

<script language="javascript" type="text/javascript" src="../js/jquery-1.8.3.js"> </script> <script language="javascript" type="text/javascript" src="../js/jquery-ui-1.9.2.custom.js"</script> <script src="../js/highcharts.js "></script> <script src="../js/exporting.js "></script> <script src="../js/exporting.src.js "></script> <link rel="stylesheet" href="../css/jquery-ui-1.9.2.custom.css" type="text/css" /> <script type="text/javascript"> (function (highcharts) { var each = highcharts.each; highcharts.chart.prototype.getcsv = function () { var xaxis = this.xaxis[0], columns = [], line, csv = "", row, col; if (xaxis.categories) { columns.push(xaxis.categories); columns[0].unshift(""); } each (this.series, function (series) { columns.push(series.ydata); columns[columns.length - 1].unshift(series.name); }); // transform columns csv (row = 0; row < columns[0].length; row++) { line = []; (col = 0; col < columns.length; col++) { line.push(columns[col][row]); } csv += line.join(',') + '\n'; } homecoming csv; }; }(highcharts)); $(function () { $(document).ready(function() { chart = new highcharts.chart({ chart: { renderto: 'container', type: 'pie' , }, title: { text: 'top 5 powerfulness consumer overall' }, yaxis: { title: { text: ' ', } }, legend: { enabled: false }, series: [{ name: 'work', data:[1,2,3,4,5] }], }); }); }); $('#getcsv').click(function () { alert(chart.getcsv()); }); </script> </head> <body> <div id="container"></div> <button id="getcsv" > alert </button> </body> </html>

your code working:

for download cvs add together code block:

highcharts.getoptions().exporting.buttons.exportbutton.menuitems.push({ text: 'download csv', onclick: function () { highcharts.post('http://www.highcharts.com/studies/csv-export/csv.php', { csv: this.getcsv() }); } });

your code demo

highcharts

ruby - Idiomatic Rails way to put a micropost's textbox and submit button, avoiding the "render 'form'" scaffold code? -



ruby - Idiomatic Rails way to put a micropost's textbox and submit button, avoiding the "render 'form'" scaffold code? -

i've been trying ruby + rails today.

after creating standard user , micropost model, view , controllers, wanted add together page 1 could, beingness user, add together new micropost.

up moment, there's no authentication going on, i'd happy have page 1 user id via url, having thing in form text box 1 type out micropost add together site.

i've wired routing needed:

match 'users/new_micropost/:user_id' => 'users#new_micropost'

as controller's code:

def new_micropost @user = user.find(params[:user_id]) @micropost = micropost.new #still not sure end

i've re-create pasted microposts/new.html.erb file new file named users/new_micropost.html.erb:

<h1>new <%= @user.name %>'s micropost</h1> #added thingy <%= render 'form' %> <%= link_to 'back', users_path %>

what best way replace idiomatic way replace <%= render 'form' %> print textbox asking me what's micropost want post on site plus submit button?

thanks

for form create own, passing in @micropost variable, like:

<%= form_for @micropost |f| %> <%= f.text_area :body, :size => "60x12" %> <%= f.submit "post" %> <% end %>

have @ these guides more info. might need create separate create action in controller action.

also, if want microposts associated users you'll need add together following:

class user < activerecord::base has_many :microposts, :dependent => :destroy end class micropost < activerecord::base belongs_to :user end

then alter new , create actions like:

def new_micropost @user = user.find(params[:user_id]) @micropost = @user.microposts.build end def create_micropost @user = user.find(params[:user_id]) @micropost = @user.microposts.build(params[:micropost]) if @micropost.save redirect_to some_path else render 'new_micropost' end end

click here read more associations.

note might have update form submit right controller: <%= form_for @micropost, url: create_micropost_path(@user.id) |f| %>

ruby-on-rails ruby ruby-on-rails-3

How can I "pipe" input from one guard to another? -



How can I "pipe" input from one guard to another? -

i'm trying out guard, , write handlebars templates using haml. there way "pipe" output of guard-haml guard-handlebars (i.e. have 2 guards operate on same file)? or perhaps, there guard plugin can both steps?

cobbled solution using guard-shell. fundamental problem guard-handlebars expects it's input files end in ".handlebars" , there no configuration alternative alter that. rather patch guard-handlebars, used guard-shell rename files after guard-haml had processed them. here resulting code in guardfile:

guard 'haml', :input => 'src/templates', :output => 'public/js/templates/html' watch %r{^.+(\.hbs\.haml)$} end guard :shell watch %r{^public/js/templates/html/.+(\.hbs\.html)$} |m| path = m[0] new_path = path.gsub(/\.hbs\.html$/, '.handlebars') `mv #{path} #{new_path}` end end guard 'handlebars', :input => 'public/js/templates/html', :output => 'public/js/templates' watch %r{^.+(\.handlebars)$} end

guard

iphone - Nav Bar disappearing on popviewcontroller -



iphone - Nav Bar disappearing on popviewcontroller -

on 1 of views, when button pressed phone call view splitviewcontroller. if splitviewcontroller called via 1 of these buttons have special objects add together view. nav bar items, cancel button. view can accessed elsewhere , these items not needed why there special condition.

however, when user done , pop viewcontroller previous screen selected, nav bar disappears on screen. not setting hidden nor doing unusual nav bar. adding splitviewcontroller popping back.

some code..

//declare split screen vc splitscreenviewcontroller *split = [[splitscreenviewcontroller alloc] init]; //set flag vc coming button, need nav bar items [split setisfrombutton:yes]; [self.navigationcontroller pushviewcontroller:split animated:yes];

now phone call simply...

- (void)cancelselectionbtnclicked { [self.navigationcontroller popviewcontrolleranimated:yes]; }

and when view returns, nav bar gone.

any ideas?

edit should noted exact same thing done elsewhere same way(as far can tell) , nav bar visible on return.

in viewcontroller's viewwillappear can 1 time again create navigationbar visible.

- (void)viewwillappear:(bool)animated { [self.navigationcontroller setnavigationbarhidden:no]; }

iphone ios objective-c xcode ipad

c# - GC.KeepAlive() and System.Timers.Timer -



c# - GC.KeepAlive() and System.Timers.Timer -

i have declered system.timers.timer object in class level , created in constructor.started timer in method.

in elapsed event handler enabled property set false , excute code , 1 time again enabled set true.

i getting elapsed events each intervel. problem aftre time elapsed stoped.

i suspecting timer object collected gc @ momment enabled property set false in elapsed event hanler eventhadler.

so want timer object set maintain alive.

where should declare gc.keepalive(timer) in project?

if timer declared @ class level, it's not beingness collected automatically gc, because doesn't go out of scope. , setting enabled false can't cause behavior describe. problem somewhere else.

i suspect exception in event handler. system.timers.timer swallows exceptions occur in event handler, meaning if exception escapes event handler, you'll never know it.

i suspect code written similar this:

mytimer.enabled = false; // stuff here mytimer.enabled = true;

if exception thrown during "do stuff here", exception escapes handler, timer never gets re-enabled, , timer code swallows exception never know happened.

you should write event handler this:

mytimer.enabled = false; seek { // stuff here } grab (exception ex) { // handle exceptions } { mytimer.enabled = true; }

you want grab specific exceptions--the ones know how handle. catching exceptions above bad practice.

c# garbage-collection

Trying to delete white space in Facebook Like box -



Trying to delete white space in Facebook Like box -

i working on client's website , decided add together "facebook box" (example). working in facebook developers page. joomla developer (2.5x platform) trying figure out how delete white space title of box way downwards pictures are... suggestions on how or need go facebook right this??

i tried re-size height, 1 time did create smaller, cutting off pictures.

your help in matter appreciated.

edit: ok, stack overflow not understand urls you'll have re-create , paste or utilize short link.

that's frame, short link: http://on.fb.me/152cjgh

http://www.facebook.com/plugins/likebox.php?api_key=&locale=en_us&sdk=joey&channel=http%3a%2f%2fstatic.ak.facebook.com%2fconnect%2fxd_arbiter.php%3fversion%3d18%23cb%3df108e873a75ab52%26origin%3dhttp%253a%252f%252fwww.ordwaybuildingsupply.com%252ff211d31607a9c7e%26domain%3dwww.ordwaybuildingsupply.com%26relation%3dparent.parent&height=558&header=false&show_faces=true&stream=true&width=200&href=http%3a%2f%2fwww.facebook.com%2fhome.php%3fclk_loc%3d5%23!%2fobs75%3ffref%3dts&colorscheme=light

the big white space stream alter values you're requesting, namely

remove &stream=true

and alter &height=558 &height=300 or something

http://on.fb.me/152co4e > http://www.facebook.com/plugins/likebox.php?api_key=&locale=en_us&sdk=joey&channel=http%3a%2f%2fstatic.ak.facebook.com%2fconnect%2fxd_arbiter.php%3fversion%3d18%23cb%3df108e873a75ab52%26origin%3dhttp%253a%252f%252fwww.ordwaybuildingsupply.com%252ff211d31607a9c7e%26domain%3dwww.ordwaybuildingsupply.com%26relation%3dparent.parent&height=300&header=false&show_faces=true&width=200&href=http%3a%2f%2fwww.facebook.com%2fhome.php%3fclk_loc%3d5%23!%2fobs75%3ffref%3dts&colorscheme=light

facebook like

php - How to perform a count in a loop -



php - How to perform a count in a loop -

foreach ($arrquestionid $key=>$question) { ?> <div class='lt-container'> <p><strong>question <span id="quesnum"></span>:</strong></p> </div> <?php } ?>

in code above have while loop displays question :. want in between question , : want include count number every time question appears, contains count number next below:

question 1: question 2: question 3: ...

how can done?

create variable , increment in foreach.

like:

$s = 1; foreach($value $text) { echo "question #".$s." :".$text; $s++; }

php html

java - How to get the value of a String from other class to a class in Android? -



java - How to get the value of a String from other class to a class in Android? -

my code goes this, created constructor. , want access string homepage.java login.php. android gives me error "access constructor not allowed".. doing wrong? pls help. homepage.java

public class homepage extends activity { private button clbtn; private button bcbtn; private button atbtn; public string ip=""; homepage() { this.ip = "http://111.111.11.1/sp/"; } public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.home_page); } }

login.java

public class login extends activity { private edittext etfacno; private edittext etpassword; private button loginbtn; homepage getip = new homepage(); string url = getip.ip; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.login_page); . . . . . httpclient httpclient = new defaulthttpclient(); httppost request = new httppost(url+"loginteacher.php"); } }

http://docs.oracle.com/javase/tutorial/java/javaoo/accesscontrol.html

you've declared constructor homepage no modifier. means classes in same bundle can phone call why you're getting error.

homepage() { ...

make public

public homepage() { ...

java android constructor

html - CSS element class - Height differs based on content, how to fix? -



html - CSS element class - Height differs based on content, how to fix? -

im having issue css. check website @ http://yourdesigns.nl/ssi/index.php

as can see have 3-column row @ center of index page. each column has border gives "box-like" feeling. problem that, 1 time content of box lesser other, box gets smaller in height.

my goal give boxes same height , know possible adding height property class of box elements, content grabbed database, if client updates content, may possible boxes bigger fixed height value of class results in content overlapping border/boxes.

how can boxes of same height, without giving fixed height value in css?

thanks in advance,

michael

if want maintain box heights equal , prevent overflow set height , overflow properties in css box class:

.boxes { height:500px; overflow: hidden; text-overflow:ellipsis; // ends text block "..." - css3 no ie7/ie8 back upwards }

if want boxes re-size dynamically based on largest box utilize jqery:

$(document).ready(function () { var largestbox = math.max($('#box1').height(),$('#box2').height(),$('#box3').height()); $('.boxes').height(largestbox ); });

here's jsfiddle demonstrating jqery option: http://jsfiddle.net/ejpsw/

html css frontend

core data - How to get the managed object from selected annotation -



core data - How to get the managed object from selected annotation -

i have model: event, have loaded annotation view mapview, how event managed object selected annotation, can force view controller display event's info. viewforannotation part:

- (mkannotationview *)mapview:(mkmapview *)amapview viewforannotation:(id <mkannotation>)annotation { if([annotation class] == mkuserlocation.class) { //userlocation = annotation; homecoming nil; } revclusterpin *pin = (revclusterpin *)annotation; mkannotationview *annview; annview = [amapview dequeuereusableannotationviewwithidentifier:@"pin"]; if( !annview ) annview = [[mkannotationview alloc] initwithannotation:annotation reuseidentifier:@"pin"]; annview.image = [uiimage imagenamed:@"pinpoint.png"]; annview.canshowcallout = yes; uibutton *rightbutton = [uibutton buttonwithtype:uibuttontypedetaildisclosure]; [rightbutton addtarget:self action:@selector(displayviewcontroller:) forcontrolevents:uicontroleventtouchupinside]; annview.rightcalloutaccessoryview = rightbutton; annview.calloutoffset = cgpointmake(-6.0, 0.0); } homecoming annview; }

and rightcalloutaccessoryview displayviewcontroller part :

- (void)displayviewcontroller:(id)sender { annotation *annotation = [self.mapview selectedannotations][0]; eventsviewcontroller *eventsvc = [[eventsviewcontroller alloc] init]; eventsvc.event = ??? [self.navigationcontroller pushviewcontroller:eventsvc animated:yes]; }

how managed object annotation *annotation = [self.mapview selectedannotations][0] ? if declare event in annotation, what?

the class annotation own not? contain property holding event? if not should.

if remove custom selector you've assigned rightbutton , you've set delegates correctly should phone call function

- (void)mapview:(mkmapview *)map annotationview:(mkannotationview *)view calloutaccessorycontroltapped:(uicontrol *)control { revclusterpin *annotation = (revclusterpin *)view.annotation; eventsviewcontroller *eventsvc = [[eventsviewcontroller alloc] init]; eventsvc.event = annotation.event; [self.navigationcontroller pushviewcontroller:eventsvc animated:yes]; }

core-data annotations mkmapview cllocationmanager

javascript - jQuery to trigger submitting of different forms based on input being all numbers or just letters -



javascript - jQuery to trigger submitting of different forms based on input being all numbers or just letters -

i've been trying hours. either 1 of forms works or none @ all. can't form function or submit function anything. disables whole thing , doesn't submit. help appreciated.

basically have 2 forms want submit based on entry in first form's input field, "s-webref".

if "s-webref" has input numbers, submit first form: "property-webref-search".

if not, submit sec form "property-search".

my first form (located on top):

<form name="property-webref-search" id="property-webref-search" method="get" action="<?php bloginfo('url'); ?>/"> <input type="text" class="text webref" id="s-webref" name="s" value="<?php _e('Ä°lan no veya arama', 'woothemes'); ?>" onfocus="if (this.value == '<?php _e('Ä°lan no veya arama', 'woothemes'); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Ä°lan no veya arama', 'woothemes'); ?>';}" /> <input type="submit" class="submit button" name="property-search-webref-submit" id="property-search-webref-submit" value="<?php _e('ara', 'woothemes'); ?>" /> </form>

my sec form:

<form name="property-search" id="property-search" method="get" action="<?php bloginfo('url'); ?>/"> <input type="text" class="main-query text" id="s-main" name="s" value="<?php if ( $keyword != '' ) { echo $keyword; } else { _e('arama...', 'woothemes'); } ?>" onfocus="if (this.value == '<?php _e('arama...', 'woothemes') ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('arama...', 'woothemes') ?>';}" /> <input class="view-button" type="submit" value="<?php _e('ara', 'woothemes') ?>" name="property-search-submit" /> </form>

this javascript used makes form not work @ all:

$('#property-search-webref-submit').click(function() { var searcherz = $("input#s-webref").val(); if(searcherz.match(/^\d+$/)) { $('form#property-webref-search').submit(); } else { $('form#property-search').submit(); }});

the form submitting, not preventing default action of submit button:

$('#property-search-webref-submit').click(function(e) { e.preventdefault(); var searcherz = $("#s-webref").val(); if( /^\d+$/.test(searcherz) ) { $('#property-webref-search').get(0).submit(); } else { $('#property-search').get(0).submit(); } });

javascript jquery html forms submit

actionscript 3 - Restrict max speed in tweenmax -



actionscript 3 - Restrict max speed in tweenmax -

i'm developing game in flash , need move movie-clips in wrap-round way across screen. m using tweenmax.to() function provided greensock. function takes 'time' , 'distance' parameters , applies accleration , deaccleration motion itself.

however takes max-speed of motion beyond want. there way set max-speed motion well?

i not think can command acceleration manually, slow speed downwards can either set higher value of time: say, from

tweenmax.to(mc, 2, {x:65, y:117});

to

tweenmax.to(mc, 4, {x:65, y:117});

or utilize type of easing - every of them contains own set of acceleration. there lot of them, seek find appropriate one.

there interactive demo, seek playing different easing functions.

actionscript-3 greensock

java - UDP socket programming(extracting the data, storing it in a string) -



java - UDP socket programming(extracting the data, storing it in a string) -

i learning tcp , udp socket programming java, 1 of books reading networking class has next line:

datagrampacket receivedpacket = new datagrampacket(receivedata, receivedata.length); string modifiedsentence = new string(receivedpacket.getdata());

where receivedpacked datagrampacket type object , modifiedsentence stores returned server. receivedpacket.getdata() converts packet bytes string in case before storing it.

my question why create object of string , storing/passing converted packet rather using following:

string modifiedsentence = receivedpacket.getdata();

would not work? thought in java impractical create object of string class.

datagrampacket.getdata() returns byte array not string. need convert string assign string.

java sockets tcp network-programming udp

image - setting the 50% of original picture width and height using css -



image - setting the 50% of original picture width and height using css -

is there way of setting 50% of original image width , height using css? illustration have code:

<img src="http://content.captive-portal.com/files/ign/movie-news/content/2b.jpg">

i don't specify width , height in html, want 50% of original height , width. can utilize css that?

this doesn't work:

img{width:50%; height:50%}

is there way overcome this? thanks

you can scale image described here: css image resize percentage of itself?

img {-webkit-transform: scale(0.5); /* saf3.1+, chrome */ -moz-transform: scale(0.5); /* ff3.5+ */ -ms-transform: scale(0.5); /* ie9 */ -o-transform: scale(0.5); /* opera 10.5+ */ transform: scale(0.5); /* ie6–ie9 */ filter: progid:dximagetransform.microsoft.matrix(m11=0.9999619230641713, m12=-0.008726535498373935, m21=0.008726535498373935, m22=0.9999619230641713,sizingmethod='auto expand');}​

css image image-processing

php - MySQL Query line, 3 highest values? -



php - MySQL Query line, 3 highest values? -

i creating blog , have decided order blog id, because want display 3 on homepage , of them in blog. anyhow thats not problem straight point need help mysql query.

say illustration have next id's in database: 1 2 3 4 5 6 7 8 9 10.

i want show 3, newest 3 8, 9 10. dont know how i'd query please inquire query line mysql please?

i know stupid question have found illustration of mean talking adding 2 numbers together? need 1 number placed in order.

anyhow, guys!

you can sort id, descending. place post highest id @ start of result set. can utilize limit homecoming 3 results (i.e. latest 3).

select `post_id` `tblname` order `post_id` desc limit 3

php mysql

c# - Dynamically convert String Dictionary into Strong Typed Class Using AutoMapper -



c# - Dynamically convert String Dictionary into Strong Typed Class Using AutoMapper -

i have been searching couple of days, , have not found reply yet. case is, want fill class properties formatted string.

example :

class name : country property name : countrycode ,countryname value : 'mal' , 'malaysia'

the string : countrycode=ina&countryname=malaysia

what want type of class dynamically evaluated. utilize automapper, , code :

public class converttotype<t> { public t fillclass(string expression) { dictionary<string, string> varlist = new dictionary<string,string>(); string[] _arrayofexpression = expression.split('&'); foreach (string item in _arrayofexpression) { string _prop = item.split('=')[0]; string _val = item.split('=')[1]; if(!string.isnullorempty(_val)) varlist.add(_prop, _val); } var user = mapper.map<dictionary<string, string>, t>(varlist); homecoming user; } } country info = new country(); converttotype<country> _countryconverter = new converttotype<country>(); info = _countryconverter.fillclass(model);

with code, got error :

missing type map configuration or unsupported mapping

is there other way, or should code be?

many solution

c# asp.net-mvc automapper

visual studio - Relative paths to DLL's for the built app -



visual studio - Relative paths to DLL's for the built app -

i wonder if it's possible create this...

i have project in vs2012 uses 2 referenced vs projects (dlls beingness created during compilation) , other dlls (external libraries etc.). want clean compilation , place dlls in 2 folders: e.g. internals , externals.

how create possible? problem compiled .exe app file wants dlls placed in main folder (near it) - if needs load library dll crashes...

i tried find in web, ppl inquire copying dlls reference folders output folder. that's not want do:/

ok, have found solution. need add together new item app.config , specify privatepaths:

<?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatepath="internalsfolder;externalsfolder" /> </assemblybinding> </runtime> </configuration>

visual-studio reference visual-studio-2012 relative-path

version control - How can i work with SVN if not every one in group are -



version control - How can i work with SVN if not every one in group are -

i have tried setting logical way of using subversion (or other vcs i've played more svn).

let me start explaining problem, few coworkers needs changing our customers websites on daily basis, customers can alter files via "admin panel" on website. files generated on servers, logfile, export/import data, sitemaps etc.

we working on ftp, , maintain kind of file history create .bak.revision#.php files almost unmanagable. on top of using netbeans ide, requires local copies of files.

to start project need sync changed files client (or worst case download total project) (which can take forever).

i enjoy working netbeans, end using notepad++ instead.

i set pretty nice way of working svn post-commit hook exports project http folder way can update on local copy, create changes , commit -done-

but don't want overwrite files might have been changed on server, illustration customers css-file can create changes themselves.

so thought cannot 1 have problem, how work svn if not in team does? (in case customers)

i may able utilize svn:ignore on files guess?

(this test environment) post commit hook simple; svn export file:///svn/repo/live /var/www/html/ --force

edit plausible solution into, if create pre-commit, or improve ?pre-update? hook import overwrite files in repo, solve problem, not?

nvm import runs commit. commit , pre commit not work well, since create endless loop

kindest regards iesus

most logical , technical way in case (but not easiest) be

converting site tree working re-create of mutual (with netbeans) repository - require install subversion on server , post-install tricks, thus: ssh root-access host commit direct changes on site repo crontab job|special button in admin panel changing post-commit hook, which, in case, have update server's wc after commit "foreign" host

more exotic way: subversion (for users - behind scene)

everybody utilize subversion (directly) or indirectly - nobody touch files on site changes repository stored (as export) on site, happens now

for developers way alter nothing. technically mediocre customers you suggest, prepare , configure easysvn (and, therefore, assembla's repository) - they'll local folder (or tree), changes in (automagically) synced related repository (reverse direction work - background updates repo delivered wc). ssh or ftp tools of assembla space transfer changes site (automatically on commit or on demand hand)

svn version-control web

javascript - Jquery/Json - How can I get the last in this JSON object? -



javascript - Jquery/Json - How can I get the last <P> in this JSON object? -

the usual .last or :last jquery selectors not doing me. have object content.object has html in

<p> item 1 </p> <p> item 2 </p> <p> item 3 </p>

i have tried

var lastitem = $(content.object).find('p:last');

and

var lastitem = $(content.object).find('p').last();

but these aren't doing trick , maintain getting errors. how can text in lastly

?

the find method wont work because within same depth p tags

if json object looks this

var content = { object: '<p>item 1</p><p>item 2</p><p>item 3</p>' };

you can access lastly p so:

var lastitem = $( content.object ).last();

javascript jquery json

override - Can a static method be overriden in C#? -



override - Can a static method be overriden in C#? -

i told static methods implicitly final, hence can't overriden. true?

1) can give improve illustration of overriding static method?

2) , if static methods class methods, real utilize of having them?

(1) static methods cannot overridden, can hidden using 'new' keyword. overriding methods means reference base of operations type , want phone call derived method. since static's part of type , aren't subject vtable lookups doesn't create sense.

e.g. statics cannot do:

public class foo { public virtual void bar() { ... } } public class bar : foo { public override void bar() { ... } } // use: foo foo = new bar(); // create instance foo.bar(); // calls bar::bar

because statics don't work on instances, specify foo.bar or bar.bar explicitly. overriding has no meaning here (try expressing in code...).

(2) there different usages static methods. example, it's beingness used in singleton pattern single instance of type. illustration 'static void main', main access point in program.

basically utilize them whenever don't want or cannot create object instance before using it. example, when static method creates object.

[update]

a simple hiding example:

public class statictest { public static void foo() { console.writeline("foo 1"); } public static void bar() { console.writeline("bar 1"); } } public class statictest2 : statictest { public new static void foo() { console.writeline("foo 2"); } public static void some() { foo(); bar(); } // print foo 2, bar 1 } public class teststatic { static void main(string[] args) { statictest2.foo(); statictest2.some(); statictest.foo(); console.readline(); } }

note if create classes static, cannot this. static classes have derive object.

the main difference between , inheritance compiler can determine @ compile-time method phone call when using static. if have instances of objects, need @ runtime (which called vtable lookup).

c# override static-methods final

c++ - simple unique STL container -



c++ - simple unique STL container -

is there unique container such std::list simple functionality (push,pop,clear, etc.) , not sorted order unlike std::set, or maybe need extend std::list , add together own push_unique method )) ?

the stl supposed provide efficient containers.

a container not allow duplicates needs back upwards fast lookup determine whether value want nowadays in collection or not.

std::set keeps item sorted in red-black tree, allows o(log(n)) lookup, insertion, , removal.

std::unsorted_set allows constant-time lookup, insertion, , removal, need provide hash function udt types, need take care of issues such rehashing, cause iterator invalidation, , not have defined order items (not insertion order).

if want utilize simple collection such std::vector without allowing duplicates, need provide own adapter.

however, still can't figure out why have problems sorted container such std::set if, say, order doesn't matter you.

c++ stl

java - JBoss EAP6 Connection to external HornetQ Implementation doesn't work, but does with JBoss 7.1.1 -



java - JBoss EAP6 Connection to external HornetQ Implementation doesn't work, but does with JBoss 7.1.1 -

i trialing jboss eap6.

however have scheme solution has been implementated using jboss 7.1.1. , external hornetq 2.1.14 implementation. works jboss 7.1.1, eap 6 doesn't connect hornetq.

i running localhost. case doesn't work, or missing , configuration wrong?

hornetq configuration:

hornetq-beans.xml

<?xml version="1.0" encoding="utf-8"?> <deployment xmlns="urn:jboss:bean-deployer:2.0"> <bean name="naming" class="org.jnp.server.namingbeanimpl"/> <!-- jndi server. disable if don't want jndi --> <bean name="jndiserver" class="org.jnp.server.main"> <property name="naminginfo"> <inject bean="naming"/> </property> <property name="port">${jnp.port:1099}</property> <property name="bindaddress">${jnp.host:localhost}</property> <property name="rmiport">${jnp.rmiport:1098}</property> <property name="rmibindaddress">${jnp.host:localhost}</property> </bean> <!-- mbean server --> <bean name="mbeanserver" class="javax.management.mbeanserver"> <constructor factoryclass="java.lang.management.managementfactory" factorymethod="getplatformmbeanserver"/> </bean> <!-- core configuration --> <bean name="configuration" class="org.hornetq.core.config.impl.fileconfiguration"> </bean> <!-- security manager --> <bean name="hornetqsecuritymanager" class="org.hornetq.spi.core.security.hornetqsecuritymanagerimpl"> <start ignored="true"/> <stop ignored="true"/> </bean> <!-- core server --> <bean name="hornetqserver" class="org.hornetq.core.server.impl.hornetqserverimpl"> <constructor> <parameter> <inject bean="configuration"/> </parameter> <parameter> <inject bean="mbeanserver"/> </parameter> <parameter> <inject bean="hornetqsecuritymanager"/> </parameter> </constructor> <start ignored="true"/> <stop ignored="true"/> </bean> <!-- jms server --> <bean name="jmsservermanager" class="org.hornetq.jms.server.impl.jmsservermanagerimpl"> <constructor> <parameter> <inject bean="hornetqserver"/> </parameter> </constructor> </bean> </deployment>

hornetq-configuration.xml

<configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="urn:hornetq /schema/hornetq-configuration.xsd"> <clustered>true</clustered> <paging-directory>${data.dir:../data}/node-a/paging</paging-directory> <bindings-directory>${data.dir:../data}/node-a/bindings</bindings-directory> <journal-directory>${data.dir:../data}/node-a/journal</journal-directory> <journal-min-files>10</journal-min-files> <large-messages-directory>${data.dir:../data}/node-a/large-messages</large-messages-directory> <connectors> <connector name="netty"> <factory-class>org.hornetq.core.remoting.impl.netty.nettyconnectorfactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:localhost}"/> <param key="port" value="${hornetq.remoting.netty.port:5445}"/> </connector> <connector name="netty-throughput"> <factory-class>org.hornetq.core.remoting.impl.netty.nettyconnectorfactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:localhost}"/> <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/> <param key="batch-delay" value="50"/> </connector> </connectors> <acceptors> <acceptor name="netty"> <factory-class>org.hornetq.core.remoting.impl.netty.nettyacceptorfactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:localhost}"/> <param key="port" value="${hornetq.remoting.netty.port:5445}"/> </acceptor> <acceptor name="netty-throughput"> <factory-class>org.hornetq.core.remoting.impl.netty.nettyacceptorfactory</factory-class> <param key="host" value="${hornetq.remoting.netty.host:localhost}"/> <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/> <param key="batch-delay" value="50"/> <param key="direct-deliver" value="false"/> </acceptor> </acceptors> <broadcast-groups> <broadcast-group name="bg-group1"> <group-address>231.7.7.7</group-address> <group-port>9876</group-port> <broadcast-period>5000</broadcast-period> <connector-ref>netty</connector-ref> </broadcast-group> </broadcast-groups> <discovery-groups> <discovery-group name="dg-group1"> <group-address>231.7.7.7</group-address> <group-port>9876</group-port> <refresh-timeout>10000</refresh-timeout> </discovery-group> </discovery-groups> <cluster-connections> <cluster-connection name="my-cluster"> <address>jms</address> <connector-ref>netty</connector-ref> <retry-interval>500</retry-interval> <forward-when-no-consumers>true</forward-when-no-consumers> <max-hops>1</max-hops> <discovery-group-ref discovery-group-name="dg-group1"/> </cluster-connection> </cluster-connections> <security-settings> <security-setting match="#"> <permission type="createnondurablequeue" roles="guest"/> <permission type="deletenondurablequeue" roles="guest"/> <permission type="consume" roles="guest"/> <permission type="send" roles="guest"/> </security-setting> </security-settings> <address-settings> <!--default grab all--> <address-setting match="#"> <dead-letter-address>jms.queue.dlq</dead-letter-address> <expiry-address>jms.queue.expiryqueue</expiry-address> <redelivery-delay>0</redelivery-delay> <max-size-bytes>10485760</max-size-bytes> <message-counter-history-day-limit>10</message-counter-history-day-limit> <address-full-policy>block</address-full-policy> <redistribution-delay>1000</redistribution-delay> </address-setting> </address-settings> </configuration>

jboss eap 6 configuration

standalone-ha.xml

key parts of file below:

<extensions> <extension module="org.jboss.as.clustering.infinispan"/> <extension module="org.jboss.as.clustering.jgroups"/> <extension module="org.jboss.as.configadmin"/> <extension module="org.jboss.as.connector"/> <extension module="org.jboss.as.deployment-scanner"/> <extension module="org.jboss.as.ee"/> <extension module="org.jboss.as.ejb3"/> <extension module="org.jboss.as.jaxrs"/> <extension module="org.jboss.as.jdr"/> <extension module="org.jboss.as.jmx"/> <extension module="org.jboss.as.jpa"/> <extension module="org.jboss.as.logging"/> <extension module="org.jboss.as.mail"/> <extension module="org.jboss.as.modcluster"/> <extension module="org.jboss.as.naming"/> <extension module="org.jboss.as.osgi"/> <extension module="org.jboss.as.pojo"/> <extension module="org.jboss.as.remoting"/> <extension module="org.jboss.as.sar"/> <extension module="org.jboss.as.security"/> <extension module="org.jboss.as.threads"/> <extension module="org.jboss.as.transactions"/> <extension module="org.jboss.as.web"/> <extension module="org.jboss.as.webservices"/> <extension module="org.jboss.as.weld"/> <extension module="org.jboss.snowdrop"/> </extensions> <interfaces> <interface name="management"> <inet-address value="${jboss.bind.address.management:127.0.0.1}"/> </interface> <interface name="public"> <inet-address value="${jboss.bind.address:127.0.0.1}"/> </interface> <interface name="unsecure"> <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/> </interface> </interfaces> <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}"> <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/> <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/> <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/> <socket-binding name="ajp" port="8009"/> <socket-binding name="http" port="8080"/> <socket-binding name="https" port="8443"/> <socket-binding name="jgroups-diagnostics" port="0" multicast-address="224.0.75.75" multicast-port="7500"/> <socket-binding name="jgroups-mping" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/> <socket-binding name="jgroups-tcp" port="7600"/> <socket-binding name="jgroups-tcp-fd" port="57600"/> <socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/> <socket-binding name="jgroups-udp-fd" port="54200"/> <socket-binding name="modcluster" port="0" multicast-address="224.0.1.105" multicast-port="23364"/> <socket-binding name="osgi-http" interface="management" port="8090"/> <socket-binding name="remoting" port="4447"/> <socket-binding name="txn-recovery-environment" port="4712"/> <socket-binding name="txn-status-manager" port="4713"/> <outbound-socket-binding name="mail-smtp"> <remote-destination host="localhost" port="25"/> </outbound-socket-binding> </socket-binding-group>

that won't compatible.. newer library can't talk older server.

up hornetq 2.2, wouldn't back upwards different versions @ on protocol, , started taking care of compatibility after 2.2... you're trying accomplish won't work.

java spring jboss jms hornetq

Can I intercept Entity Framework when it loads data from the database? -



Can I intercept Entity Framework when it loads data from the database? -

we have multi-layered application, repositories based on (home-grown) genericrepository base of operations class (where t entity in model), exposes methods such getcontext(), getobjectset() , on. allow repositories inherit access context, need phone call include(), passing info through wcf service, need load related entities eagerly.

all of our entities implement interface has active bool property, , want intercept execution of query, , filter on active property, query returns entities set true.

can done? in lightswitch, built on ef, there event can capture gets fired right downwards in depths of query execution, , allows sort of filtering. can't find in ef allows this.

anyone ideas? thanks

in ef 5, include extension method on iqueryable, can this:

var query = dbset.where( o => o.isactive ).include( ... )

that means, don't have homecoming dbset<t> generic repository - should ok homecoming iqueryable<t>.

if meets requirements, can add together where clause generic repository method:

partial class genericrepository<t> { public iqueryable<t> query( bool includeinactive = false ) { homecoming ctx.set<t>().where( o => includeinactive || o.isactive ); } }

entity-framework

iphone - UITableViewCell getting reused -



iphone - UITableViewCell getting reused -

i have uitableview called symptomtable ...and there remedytable when uiswitch on in remedytable display uiimage on symptomtableviewcell highlight uiswitch on cell . when switch on in remedytable of first symptom displaying uiswitch cell getting reused , image showing in other symptomtableview cell well. can help me out this?

-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { if (tableview==symptomstableview) { ppsymptomtablecell *cell; static nsstring *cellidentifier=@"cellidentifier"; cell=[tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell==nil) { cell=[[ppsymptomtablecell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; cell.selectionstyle=uitableviewcellselectionstylenone; } int symptomidselected; symptomidselected = [[[mainsymptarray objectatindex:indexpath.row]objectforkey:@"symptid"]intvalue]; nslog(@"%d",[[activenotificationdictionary objectforkey:[nsnumber numberwithint:symptomidselected]]intvalue]); (int = 0; i<activenotificationdictionary.count; i++) { if([[activenotificationdictionary objectforkey:[nsnumber numberwithint:symptomidselected]]intvalue] == symptomidselected) { cell.selectedcellimagedisplay.hidden=no; } else { cell.selectedcellimagedisplay.hidden=yes; } } nslog(@"end of symptoms cell row"); if (searching==yes) { cell.symptomcelllabel.text=[[searchsymptomsarray objectatindex:indexpath.row] objectforkey:@"symptname"]; cell.backgroundcolor=[uicolor clearcolor]; homecoming cell; } else { cell.backgroundcolor=[uicolor clearcolor]; nsarray *sectionarray=[mainindexdictionary objectforkey:[allkeysarray objectatindex:indexpath.section]]; cell.symptomcelllabel.text=[[sectionarray objectatindex:indexpath.row] objectforkey:@"symptindexname"]; homecoming cell; } }

here activenotification dictionary nsmutabledictionary contains value of remedyid particular symptomid. custom uitableviewcell symptomtable

- (id)initwithstyle:(uitableviewcellstyle)style reuseidentifier:(nsstring *)reuseidentifier { self = [super initwithstyle:style reuseidentifier:reuseidentifier]; if (self) { self.backgroundcolor = [uicolor clearcolor]; self.contentview.backgroundcolor = [uicolor clearcolor]; self.symptomcellimageview.contentmode=uiviewcontentmodescaletofill; selectedcellimagedisplay = [[uiimageview alloc]initwithimage:[uiimage imagenamed:@"selectedsymptomimage.png"]]; selectedcellimagedisplay.frame = cgrectmake(230.0, 8.0, 30.0, 30.0); selectedcellimagedisplay.hidden=yes; symptomcelllabel=[[uilabel alloc]initwithframe:cgrectmake(15.0,0.0 ,280.0,40.0)]; symptomcelllabel.font=[uifont fontwithname:@"rockwell" size:17]; symptomcelllabel.textcolor=[uicolor blackcolor]; symptomcelllabel.backgroundcolor=[uicolor clearcolor]; [self.contentview addsubview:symptomcelllabel]; [self.contentview addsubview:selectedcellimagedisplay]; // initialization code } homecoming self; }

the cell beingness reused because asked reused (dequeuereusablecellwithidentifier:). because cell can reused, must explicitly set all features of every cell, including presence or absence of switch , state.

iphone ios objective-c uitableview

javascript - How to disable trimming of inputs in AngularJS? -



javascript - How to disable trimming of inputs in AngularJS? -

i've found unusual behavior: angular trims model values default. , quick googling doesn't help me solve problem. i've found ng-no-trim directive proposals, ng-trim , on. nil works.

i've provided little snippet represents issue below.

class="lang-javascript prettyprint-override">function ctrl($scope) { $scope.text=''; $scope.$watch('text', function (newvalue) { console.log(newvalue); }); }

also seek snippet here.

i've added textarea in sync model text. doesn't react watching when add together new trailing spaces or break line new one.

what turn off behavior? thanks.

the directive in question new in 1.1.1; can see working using js bin snippet.

<textarea cols="30" rows="10" ng-model="text" ng-trim="false"></textarea>

javascript angularjs

c# - Changing dataset connectionstring at runtime vs2010 -



c# - Changing dataset connectionstring at runtime vs2010 -

i found solution must older version vs2010. know how vs2010? know?

http://www.csharpbydesign.com/2008/01/overriding-dataset-settings-co.html

let me explain little more detail.

i have c# generated dataset. how can alter connection string can utilize dataset (identically structured yet differently populated) database? has occur @ runtime not know server or database name @ compile time. using vs2010 , sql server 2008 r2 express

i think there no simple way , cannot alter connection-string programmatically entire dataset since it's set every tableadapter.

you need use/create partial class of tableadapter alter connection-string since connection property internal (if dal in different assembly). don't alter designer.cs file since recreated automatically after next alter on designer. create right-click dataset , chose "show code".

for illustration (assuming tableadapter named producttableadapter):

namespace windowsformsapplication1.dataset1tableadapters { public partial class producttableadapter { public string connectionstring { { homecoming connection.connectionstring; } set { connection.connectionstring = value; } } } }

now can alter easily:

var producttableadapter = new dataset1tableadapters.producttableadapter(); producttableadapter.connectionstring = someotherconnectionstring;

here's screesnhot of sample dataset , created file dataset1.cs:

c# sql dataset

github - Why do I get non-fast-forward error in git? -



github - Why do I get non-fast-forward error in git? -

i on no branch , person force stream, why when do

git force

i get:

! [rejected] master -> master (non-fast-forward) error: failed force refs 'https://github.com/dsak.git' prevent losing history, non-fast-forward updates rejected merge remote changes (e.g. 'git pull') before pushing again. see 'note fast-forwards' section of 'git force --help' details.

after perform git pull git push works fine.

no there wasn't commit on remote doesn't exist locally, vice versa right added files aren't in remote local

you might have same commits, sha1 must have differed somehow. can happen if did rebase of master @ point (including rebase --interactive, reorder or drop commits within master itself).

the other case when error message can pop while having same commits (and same sha1) when have conflicting tag (but don't think applies here).

git github

Is any semantically correct and syntactically correct C program an algorithm? -



Is any semantically correct and syntactically correct C program an algorithm? -

" algorithm defined finite sequence of operations whn executed accomplish specific task" definition. can syntactically , semantically right c programme algorithm?

my reply true, professor said reply false, did blockmate. counter illustration used was

while(1) { }

and

printf("%s","blahblah");

the infinite loop isn't semantically correct, while printf() accomplishes task algorithm. because can utilize loop , putchar() instead of printf();

so guys think right?

you tell professor improve stops splitting hair if doesn't know right terminology (so point, question doesn't create sense, anyway...).

an "algorithm" conceptually different program. reply to

is semantically right , syntactically right c programme algorithm?

is no, since programme not same algorithm - programme is... program. algorithm specific manifestation of solution of problem language-agnostic (i. e. can worded in quite generic way). programme language-dependent concrete implementation of algorithm (which is, in c, due "as-if" rule , compiler optimizations, need not same algorithm, it's required emulate it).

one more comment:

the infinite loop isn't semantically correct

well, is. of course of study 1 not solve halting problem, doesn't mean infinite loop "semantically incorrect". programme semantically wrong when else expect. unless expect programme else hanging when write while (1) { }, there's no problem.

whether concept of infinite loop considered algorithm question. generally, instruction sequence never terminates not considered algorithm, , that's professor talking about. according wikipedia:

more precisely, algorithm effective method expressed finite list of well-defined instructions calculating function.

(emphasis mine)

c algorithm data-structures

performance - Pre compiled views are not working -



performance - Pre compiled views are not working -

i trying utilize pre-compiled views performance, generated views , same in compile time , @ run time .edmx. before there mismtach of info provider default connection factory, .edmx take sqlclient provider default connection mill alter default connection mill other info provider situation overcome when commented out constructor of class inheriting dbcontext, after connection provder in .edmx file same specified in default connection mill in app.config. so, everthing same in compile time generated .edmx , runtime .edmx.

but when generating views @ compile time , using views optimize performance , next exception thrown, when phone call dbcontext.savechanges()

"the mapping , metadata info entitycontainer 'databasecontext' no longer matches info used create pre-generated views."

above exception suggests there mistmatch checked edmx , same. issue. or have been through this

pre-compiled view not affecting performance

as suggesting different assembly issues . so, case having project1 having few poco class , different project2 refers project1 , utilize poco classes of project1 , dbcontext class has been define in project2 , generating views project2, issue in advance helping

performance entity-framework reflection entity-framework-mapping

python - Why is it "array.include? object" and not "object.in? array"? -



python - Why is it "array.include? object" and not "object.in? array"? -

i discovered in python, can this:

array = [1, 2, 3, 4] if 3 in array: print("yep!")

then, thought myself: "mh, why different in ruby? if 3 in array more readable if array.include? 3." then, realized, ruby pure oop , approach keyword-based.

but still, wondering. if python approach not oop, why can't there another, shorter way in ruby more readable? when thinking, don't think "does list include element?", "is element in list?".

let's assume, next code possible:

array = [1, 2, 3, 4] if 3.in? array print "yep! end

i see turn-around list.method(element) element.method(list). so, wondering: which ruby principles/rules speak against above-metioned code?

edit: oops, wrote "keyboard-based" meant of course of study "keyword-based". emphasize this: not looking methods behave in? method; looking reasons why not implemented in ruby way.

which ruby principles/rules speak against above-metioned code?

it's not ruby principle, rather general oop principle of encapsulation: fixnum class should not need know arrays. however, because array's primary responsibility contain collections of objects, #in? or #include? falls under array's responsibility.

python ruby arrays coding-style

Trying to build and run Apache Kafka 0.8 against Scala 2.9.2 without success -



Trying to build and run Apache Kafka 0.8 against Scala 2.9.2 without success -

as stated in topic description, i'm trying kafka 0.8 running scala 2.9.2.

i able working version using quick start 0.8 (https://cwiki.apache.org/kafka/kafka-08-quick-start.html), compiled against scala 2.8.0 default.

i tried modify step

./sbt bundle

to

./sbt "++2.9.2 package"

it compiles without errors during start complains cannot find main class.

/tmp/kafka-8-test/kafka[0.8]$ bin/kafka-server-start.sh onfig/server1.properties error: not find or load main class kafka.kafka

any help highly appreciated.

the problem bin/kafka-server-start.sh script uses bin/kafka-run-class.sh execute generated jar file.

this script has hard-coded versions, need customize this:

... library=$(echo "$ivypath/org.scala-lang/scala-library/jars/scala-library-2.9.2.jar") classpath=$classpath:$library compiler=~$(echo "$ivypath/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.2.jar") classpath=$classpath:$compiler log4j=$(echo "$ivypath/log4j/log4j/jars/log4j-1.2.15.jar") classpath=$classpath:$log4j slf=$(echo "$ivypath/org.slf4j/slf4j-api/jars/slf4j-api-1.6.4.jar") classpath=$classpath:$slf zookeeper=$(echo "$ivypath/org.apache.zookeeper/zookeeper/jars/zookeeper-3.3.4.jar") classpath=$classpath:$zookeeper jopt=$(echo "$ivypath/net.sf.jopt-simple/jopt-simple/jars/jopt-simple-3.2.jar") classpath=$classpath:$jopt file in $base_dir/core/target/scala-2.9.2/*.jar; classpath=$classpath:$file done file in $base_dir/core/lib/*.jar; classpath=$classpath:$file done file in $base_dir/perf/target/scala-2.9.2/kafka*.jar; classpath=$classpath:$file done ...

scala apache-kafka

ios - How to stack text (Sentences) under the previous sentence in a text field? -



ios - How to stack text (Sentences) under the previous sentence in a text field? -

i big time nood. trying create app can not configure text field stack users text under previous text instead of running off right in never ending line. please help! need more code. set it??? witch file? thanks!

please holding me back!

you can set newline characters textview's text property:

self.textview.text = @"foo\nbar";

you'll 'foo' on first line , 'bar' on second.

ios uitextfield stack

actionscript 3 - AS3.0 if/else if evaluation behaviour for velocity control -



actionscript 3 - AS3.0 if/else if evaluation behaviour for velocity control -

sorry if obvious others, can't head around in actionscript 3.0 (huge n00b btw)

i have code controlling velocity:

public function keydownhandler(event:keyboardevent):void { if (event.keycode == keyboard.left) { vx = -5; } else if (event.keycode == keyboard.right) { vx = 5; } else if (event.keycode == keyboard.up) { vy = -5 } else if (event.keycode == keyboard.down) { vy = 5; } }

when run, if hold both left , sprite moves diagonally, fact 2 lastly conditionals (keyboard.up & keyboard.down) elseifs should prevent them beingness evaluated @ shouldnt it?

is able shed lite on behaviour?

when press both buttons flash fires 2 independent events each button. if want skip case, can create state flags (leftpressed, rightpressed, etc) each button, alter state in key handler , phone call check motion method according current states of each button.

actionscript-3 flash if-statement conditional velocity

php - Count Doctrine's iterate() Collection Result -



php - Count Doctrine's iterate() Collection Result -

having querybuilder result

$query = $em->createquery("select....");

fetching them iterate() method

http://doctrine-orm.readthedocs.org/en/2.0.x/reference/batch-processing.html

$objects = $query->iterate();

i able to

foreach ($objects $object) { $object = $object[0]; //do something.. $object->getobjectid(); ... }

but...

//after iterate() call, before foreach echo sizeof($objects); //or count($objects); //always "1", if have 10000 foreach loops

why , how fix?

$query->iterate() give iterator not countable. consider writing sec query count(result) you, or utilize paginator

php doctrine doctrine2

javascript - How to get image from slice image loaded on canvas? -



javascript - How to get image from slice image loaded on canvas? -

i have next code piece image. have next html code

<img id="imagen" src="original.png" > <canvas id="mycanvas" width="150" height="600"></canvas>

jquery code

$(document).ready(function() { var image = document.getelementbyid('imagen'); var canvas = document.getelementbyid('mycanvas'); var ctx = canvas.getcontext('2d'); image.onload = function() { ctx.drawimage(image, 0, 0, 50, image.height, 0, 0, 50, image.height); }; var = canvas.todataurl('image/jpeg'); console.log( ); });

now when tried sliced part, store on canvas variable when check i black image. can tell me why happened , how solve it? thanks.

you have draw canvas first before can drawing on canvas image, create sure canvas drawn image after canvas drawn to

image.onload = function() { ctx.drawimage(image, 0, 0, 50, image.height, 0, 0, 50, image.height); var = canvas.todataurl('image/jpeg'); console.log( ); };

javascript jquery image html5 canvas

html - jquery setTimeout or setInterval -



html - jquery setTimeout or setInterval -

i have below code if condition

if(oldmembership++ <= newmembership) { var digit; $('ul#indexsitecounterbottom').empty(); for(i = 0; < 9; i++) { if(membership.tostring()[i] == '_') { digit = '&nbsp;'; } else { digit = membership.tostring()[i]; } $('ul#indexsitecounterbottom').append('<li>'+digit+'</li>'); $('ul#indexsitecounterbottom li:nth-child(3n)').addclass('extra-margin'); } }

if 'if' status meet rest of code run.

i want able slow running of below code around 500ms each loop of 'if'.

i've tried set in setinterval , settimeout haven't used them before , 'if' status completed loops instantly.

how can add together setinterval or settimeout each 'if' loop delayed 500ms? 1 time 'if' status meet should drop out of timer/if condition.

thankyou much...

i think can resolve problem...

function execute_if_membership(){ settimeout(function(){ var digit; $('ul#indexsitecounterbottom').empty(); for(i = 0; < 9; i++) { if(membership.tostring()[i] == '_') { digit = '&nbsp;'; } else { digit = membership.tostring()[i]; } $('ul#indexsitecounterbottom').append('<li>'+digit+'</li>'); $('ul#indexsitecounterbottom li:nth-child(3n)').addclass('extra-margin'); } // execute 1 time again if needed if(oldmembership++ <= newmembership) {execute_if_membership();} else{ /* else? maybe phone call function */ } },500); } // execute first time if(oldmembership++ <= newmembership) {execute_if_membership();}

 

edit: code phone call function first time. function wait 500 ms , execute, in final of function, checks if need phone call time (loop) , if needed executes again. if want execute code after that, need set within else of condition, because if set code below, executed without wait. that's because settimeout , setinterval makes code asynchronous , continues execute code.

jquery html css

inotifypropertychanged - Suppress "Member is never assigned to" warning in C# -



inotifypropertychanged - Suppress "Member is never assigned to" warning in C# -

i have next code:

viewportviewmodel _trochoid; public viewportviewmodel trochoid { { homecoming _trochoid; } set { this.raiseandsetifchanged(value); } }

using reactiveui inpc support. compiler warning me trochoid never assigned , null. due magic raiseandsetifchanged performs through callermembername support, code work , compiler wrong.

how cleanly suppress these warnings in code?

how cleanly suppress these warnings in code

an alternative inappropriate assignment #pragma:

#pragma warning disable 0649 // assigned reflection viewportviewmodel _trochoid; #pragma warning restore 0649

that should work, , keeps ugliness @ place makes sense document - @ field declaration.

if have multiple fields handled in same way, set them in same "block" of disabled warnings, comment applicable of them.

whether view "clean" or not matter of taste, of course. think prefer assignments there side-effect of removing warnings.

c# inotifypropertychanged suppress-warnings reactiveui callermembername

javascript - how to clone a file input to another file input which is in hidden iframe -



javascript - how to clone a file input to another file input which is in hidden iframe -

i have form has file input element , when user selects file want set selected file file input in hidden iframe,

this form:

<form name="uploadform" > <input type="file" id="fileone" name="fileone" value="" /> <button type="button" id="attachement_upload" onclick="addfile()" >upload</button> </form> <iframe id="fileuploadframe" name="fileuploadframe" src="" style="display: none; border: 0; width: 0; height: 0;"> <form id="fileuploadform" name="fileuploadform" accept-charset="utf-8" target="fileuploadframe" enctype="multipart/form-data" encoding="multipart/form-data" method="post" action="cimtrek_regional_whseform_fileupload"> <input type="file" id="filetwo" name="filetwo" value="" /> </form> </iframe>

and java script :

function addfile(){ //this want clone fileone filetwo , submit form in iframe }

i have seen thing don't know how :

$(".inputfield1").change(function(){ var $this = $(this), $clone = $this.clone(); $this.after(clone).appendto(hiddenform); });

please help me done.

you can't (or shouldn't) able this. file input type, given has direct access user's file system, has special security restrictions. notably cannot set value of file input in javascript, allow things set ~/.ssh/id_rsa , steal of import info without user beingness aware. consequence, jquery shouldn't able clone file input because can't set value.

to work you'll have allow user click on file input in iframe, perhaps using css positioning tricks create seem part of page. alternatively, if users typically have more modern browsers, utilize file api , upload file ajax.

javascript jquery html5 file

objective c - How to add and move UIImages as a group -



objective c - How to add and move UIImages as a group -

i making board game , have question best way set in xcode.

i want able dynamically place pieces on board (each piece new image) , have user still able move board around. pieces need move board.

in storyboard have set uiimageview game board image , have given board custom class (extending uiimageview). figured add together pieces board through class , grouped same view board, didn't work.

so question more theoretical: best way set up? should add together pieces via main view controller, or through game model (an nsobject)? there way grouping new pieces (uiimages) board, can move together?

thanks in advance help.

since uiimageview subclass of uiview, can add together pieces board this:

[boardimageview addsubview:piece1];

then, when move board, of subviews of board move it.

note: default, won't able interact image view, create sure prepare that:

[boardimageview setuserinteractionenabled:yes]; // or set in storyboard/xib if using it.

objective-c model uiimageview uiimage

iphone - how to get first and last selected uibutton title on uiscrollview? -



iphone - how to get first and last selected uibutton title on uiscrollview? -

i creating multiple uibuttons (example- around 40 buttons) inuiscrollview` , want string first , lastly buttons selected (from -to)

you don't need tags , big array hold titles , match retrieve title. there easy way that.

just create 1 action method , connect buttons method.

then when user pressed button, action method called.

in method title of button , store in nsmutablearray. have got 2 titles after pressed 2 buttons.

- (ibaction)buttonpressed:(uibutton *)sender { [titlearray addobject:sender.titlelabel.text ]; }

iphone ios objective-c uiscrollview uibutton

java - Random Class not working on Android 4.1+ -



java - Random Class not working on Android 4.1+ -

this code using generate random set of numbers:

... public boolean placetreasure() { randomgen = new random(); int[] treasureloc = {0, 0}; while (treasureloc[0] < 2 || treasureloc[1] < 2) { treasureloc[0] = randomgen.nextint(rows - 2); treasureloc[1] = randomgen.nextint(columns - 2); system.out.println("" + treasureloc[0] + ", " + treasureloc[1]); } maze[treasureloc[0]][treasureloc[1]] = '*'; homecoming true; } ...

the funny thing works fine on before versions of android. far know, above 4.1 not run properly. gives me pairs of 0, 0. leads me believe either 4.1+ not back upwards random class, or else weird going on implementation. method works fine on before versions though, i'm not sure what's going on.

if has suggestions on alternate implementations of (i need generate random integers between 2 , rows or columns).

if has suggestions on alternate implementations of (i need generate random integers between 2 , rows or columns).

yes, simply:

int randomrow = randomgen.nextint(rows - 2) + 2; int randomcol = randomgen.nextint(columns - 2) + 2;

java android random

linq - Query that Groups Parent, then Child, when fetching from IQueryable -



linq - Query that Groups Parent, then Child, when fetching from IQueryable<GrandChild> -

lets imagine below our info model. want query toys have results returned such can next psuedo code.

foreach (var parent in parents) { console.writeline(parent.name); foreach (var kid in parent.children) { console.writeline(child.name); foreach (var toy in child.toys) { console.writeline(toy.name); } } }

the info model:

public class parent { public guid parentid { get; set; } public string name { get; set; } public icollection<child> children { get; set; } } public class kid { public guid childid { get; set; } public guid parentid { get; set; } public parent parent { get; set; } public string name { get; set; } public icollection<toy> toys { get; set; } } public class toy { public guid toyid { get; set; } public guid childid { get; set; } public kid child { get; set; } public string name { get; set; } public bool iscool { get; set; } }

i've tried doing grouping when seek iterate grouping see key doesn't have properties on can't parent.name or child.name.

thanks in advance.

you can do:

var query = p in parents c in p.children t in c.toys select new { parent = p.name, kid = c.name, toy = t.name } foreach (var in query) { // write values. }

in effect, uses selectmany.

edit

after comment, think you're looking not grouping. if you've got parent object in fact children grouped within of it, because each parent has own collection. maybe you're looking way populate collections? done by

var query = p in parents.include(x => x.children.select(c => c.toys));

linq linq-to-entities ef-code-first code-first