Monday, 15 March 2010

ef code first - Call custom function in EF LINQ query Where clause -



ef code first - Call custom function in EF LINQ query Where clause -

env: ef6 + code first

i want able phone call custom function in clause of linq query

so line:

var activestaff = repo.staff.where(s => s.enddate == null || s.enddate.value > datetime.today);

becomes:

var activestaff = repo.staff.where(s => myedmfunctions.iscurrentstaff(s));

this have tried,

public class mycontext : dbcontext { protected override void onmodelcreating(dbmodelbuilder modelbuilder) { modelbuilder.conventions.add(new mycustomconvention()); } } public class mycustomconvention : iconceptualmodelconvention<edmmodel> { public void apply(edmmodel item, dbmodel model) { var booltype = primitivetype.getedmprimitivetype(primitivetypekind.boolean); var stafftype = item.entitytypes.single(e => e.name == "staff"); var payload = new edmfunctionpayload { parametertypesemantics = parametertypesemantics.allowimplicitconversion, iscomposable = true, isniladic = false, isbuiltin = false, isaggregate = false, isfromprovidermanifest = true, parameters = new[] { functionparameter.create("staff", stafftype, parametermode.in) }, returnparameters = new[] { functionparameter.create("returntype", booltype, parametermode.returnvalue) } }; var function = edmfunction.create("iscurrentstaff", "my.core.data", dataspace.cspace, payload, null); item.additem(function); } } public static class myedmfunctions { [dbfunction("my.core.data", "iscurrentstaff")] public static bool iscurrentstaff(staff s) { homecoming s.enddate == null || s.enddate > datetime.today; } }

but i'm getting "specified method not supported." error entityframework's internal ctreegenerator class (after decompilation)

public override dbexpression visit(newrecordop op, node n) { throw new notsupportedexception(); }

can please confirm if there no way phone call custom function in clause?

i know it's possible create stored procedure , map in model. there way write in c#?

thanks.

just reply own question:

i'm going follow thread create andalso look solve problem.

extension method in clause in linq entities

linq ef-code-first code-first entity-framework-6

javascript - How to handle flow of different events in nested buttons of jQuery mobile listview elements? -



javascript - How to handle flow of different events in nested buttons of jQuery mobile listview elements? -

in jquery mobile have listview button-functionality. within every single list-button have different additional buttons in jsbin or code:

<ul data-role="listview"> <li> <div class="infos"> <h3 class="ui-li-heading">acura</h3> <p class="li-info ui-li-desc">model-description</p> </div> <div class="buttons" data-role="controlgroup" data-type="horizontal"> <a data-role="button" data-mini="true" id="button_yes">yes</a> <a data-role="button" data-mini="true" id="button_no">no</a> </div> </li> </ul>

i need have next functionality in construct:

click on listbutton (li-element in listview) toggles active state click on 'inner buttons' trigger seperate methods (not toggling active state of parent li-button) taphold on listbutton (li-element) shows/hides additional buttons

my current js-construct is

var taptimer, istaphold = false; var onlistbuttonclick = function($target){ console.log('clicked li'); if($target.hasclass('active')){ $target.removeclass('active'); } else{ $target.addclass('active'); } }; var toggleshowhidebuttons = function(){ if($('.buttons').is(':visible')){ $('.buttons').hide(); } else{ $('.buttons').show(); } }; var onmobiledevicevmouseupdown = function(event){ var $target = $(event.currenttarget); if(event.type === 'vmousedown') { console.log('down'); taptimer = settimeout(function () { istaphold = true; console.log('this taphold'); toggleshowhidebuttons(); }, 1000); } else if (event.type === 'vmouseup'){ console.log('up'); cleartimeout(taptimer); if (!istaphold) { //this tap, not tap-hold onlistbuttonclick($target); console.log('this click'); } istaphold = false; } event.preventdefault(); event.stopimmediatepropagation(); }; var onyesbuttonclick = function(event){ console.log('clicked yes'); event.preventdefault(); event.stopimmediatepropagation(); }; var onnobuttonclick = function(event){ console.log('clicked no'); event.preventdefault(); event.stopimmediatepropagation(); }; $('ul li').on('vmousedown vmouseup', onmobiledevicevmouseupdown); $('#button_yes').on('vclick', onyesbuttonclick); $('#button_no').on('vclick', onnobuttonclick);

at moment problem can't click on inner buttons without triggering activation-toggle of parent listbutton. there way realize behaviour in different way?

thnx!

javascript jquery jquery-mobile javascript-events taphold

Multiple Forms on one Ruby page using Rails 4 -



Multiple Forms on one Ruby page using Rails 4 -

i'm building little app let's post recipes , micro posts. on homepage logged in user see 2 forms 1 posting recipe 1 posting micro post. problem: 1 of forms working seems other post handled wrong controller.

i found several related stackoverflow questions regarding topic (one suggesting utilize javascript, 1 solution based on :namespace in form_for helper) didn't seem work or intended other setups.

the views (.haml): home

=provide(:title, 'home') - if signed_in? .row %aside.span4 %section =render 'shared/user_info' %section =render 'shared/recipe_form' %section =render 'shared/micropost_form'

partial 1: recipe form

%h3 add together recipe = form_for(@recipe) |f| = render 'shared/error_messages', object: f.object =f.label :name =f.text_field :name .field =f.text_area :content, placeholder: 'compose new recipe...' =f.submit('post recipe', class:'btn btn-large btn-primary')

partial 2: micropost form

%h3 add together micropost = form_for(@micropost) |f| = render 'shared/error_messages', object: f.object .field =f.text_area :content, placeholder: 'compose new micropost...' =f.submit('post micropost', class:'btn btn-large btn-primary')

the error partial (.erb):

<% if object.errors.any? %> <div id="error_explanation"> <div class="alert alert-error"> form contains <%= pluralize(object.errors.count, "error") %>. </div> <ul> <% object.errors.full_messages.each |msg| %> <li>* <%= msg %></li> <% end %> </ul> </div> <% end %>

controller:

class micropostscontroller < applicationcontroller before_action :signed_in_user def create @micropost = current_user.microposts.build(micropost_params) if @micropost.save flash[:success] = 'micropost created!' redirect_to root_url else render 'static_pages/home' end end private def micropost_params params.require(:micropost).permit(:content) end end

the controller recipes same.

routes excerpt:

resources :microposts, only: [:create, :destroy] resources :recipes, only: [:create, :destroy]

both forms work; when fill them right values; leaving field blanc still gives error; seems go wrong error partial...

when submitting blanco recipe; see screen: here

is there way working?

my guess rendering f.object twice, , instead rendering lastly one. alter loop variable name in 1 of partials render partial don't grab it.

form_for(@recipes) |fr| form_for(@microposts) |fm|

the render partials seems happening before end tags.

ruby-on-rails ruby forms

Where should trigger for nextval on insert reside: in schema or in form? -



Where should trigger for nextval on insert reside: in schema or in form? -

i want insert record table (inkpen) via oracle form , want utilize trigger create next inkpen_id.

create trigger inkpen_trigger_1 before insert on inkpen each row begin select inpken_id.nextval :new.pen_id dual; end;

questions:

where should trigger reside: in schema or in form?

if part of schema can form phone call it?

i'm thinking should part of schema because may necessary insert record outside form , nextval logic in place.

my dba says need imbed trigger logic form.

i'm asking because don't have rights create trigger can test , dba hesitant create me.

for it's worth, here's fiddle trigger logic

you can set in pre-insert trigger of block table inkpen in form.

triggers insert oracle11g oracleforms

sql - Does OpenJPA support Where In Select queries? -



sql - Does OpenJPA support Where In Select queries? -

so have query follows trying run on db2 using openjpa:

@namedquery(name="getstuff", query = "select mtl.final, mtl.entity " + "from mct mct, mtl mtl " + "where ~~~~~~~~~~~~~~~ " + "and ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " + "and ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " + "and ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " + "and ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " + "and ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + "and ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " + "and ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " + "and ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " + "and mct.ctotpk.label in ( select mccp.ccppk.cplc " + "from mccp mccp mccp.ccppk.clc = '#my string#')")

i can rid of in select statements (bottom 2 lines) , run. can't figure out what's wrong bottom 2 lines.

whenever run though db2 error: db2 sql error: sqlcode=-199, sqlstate=42601, sqlerrmc=for;and or having grouping intersect order ) fetch except minus union, driver=3.61.75

when looked error found "illegal utilize of keyword" don't know else do. there alternative in select seek out? help.

sql db2 openjpa

cordova - Android In-app billing purchase - Item not found -



cordova - Android In-app billing purchase - Item not found -

i have implemented in-app billing v3 plugin phonegap. when purchase item, google play returns following

the item attempting purchase not found

this setup issue somewhere, can't find problem.

this have done far:

item created on google play , active price queried item id same 1 on google play uploaded apk in alpha channel ( tried beta channel), in 'draft in alpha' status waited few hours ( 48h! ) used different gmail business relationship test purchase test business relationship email address in licence white list also created google grouping , added test user in it tested app on 2 differents devices apk signed , uploaded google play. same version installed on device tried managed , unmanaged products purchased item android.test.purchased works the billing key in configuration same 1 on google play google play version on device: 4.8.20

here stack have logcat, unusual error @ end, not sure if related:

d/cordovalog(32254): file:///android_asset/www/plugins/com.smartmobilesoftware.inappbilling/www/inappbilling.js: line 6 : inappbilling[js]: setup ok i/web console(32254): inappbilling[js]: setup ok:6 d/cordova_billing(32254): init start d/cordova_billing(32254): creating iab helper. d/cordova_billing(32254): starting setup. d/iabhelper(32254): starting in-app billing setup. w/pluginmanager(32254): thread warning: exec() phone call inappbillingplugin.init blocked main thread 21ms. plugin should utilize cordovainterface.getthreadpool(). d/iabhelper(32254): billing service connected. d/iabhelper(32254): checking in-app billing 3 support. d/finsky (32296): [2476] inappbillingutils.getpreferredaccount: com.montreal.deps: business relationship first business relationship - [sdkny9otgbrmmwdfmof3ygfedja] d/iabhelper(32254): in-app billing version 3 supported com.montreal.deps d/finsky (32296): [2451] inappbillingutils.getpreferredaccount: com.montreal.deps: business relationship first business relationship - [sdkny9otgbrmmwdfmof3ygfedja] d/iabhelper(32254): subscriptions available. d/cordova_billing(32254): setup finished. d/cordova_billing(32254): setup successful. querying inventory. d/iabhelper(32254): starting async operation: refresh inventory d/iabhelper(32254): querying owned items, item type: inapp d/iabhelper(32254): bundle name: com.montreal.deps d/iabhelper(32254): calling getpurchases continuation token: null d/finsky (32296): [2450] inappbillingutils.getpreferredaccount: com.montreal.deps: business relationship first business relationship - [sdkny9otgbrmmwdfmof3ygfedja] d/finsky (32296): [2450] inappbillingutils.getpreferredaccount: com.montreal.deps: business relationship first business relationship - [sdkny9otgbrmmwdfmof3ygfedja] d/iabhelper(32254): owned items response: 0 d/iabhelper(32254): continuation token: null d/iabhelper(32254): querying sku details. d/iabhelper(32254): queryprices: nil because there no skus. d/iabhelper(32254): querying owned items, item type: subs d/iabhelper(32254): bundle name: com.montreal.deps d/iabhelper(32254): calling getpurchases continuation token: null d/finsky (32296): [2476] inappbillingutils.getpreferredaccount: com.montreal.deps: business relationship first business relationship - [sdkny9otgbrmmwdfmof3ygfedja] d/finsky (32296): [2476] inappbillingutils.getpreferredaccount: com.montreal.deps: business relationship first business relationship - [sdkny9otgbrmmwdfmof3ygfedja] d/iabhelper(32254): owned items response: 0 d/iabhelper(32254): continuation token: null d/iabhelper(32254): querying sku details. d/iabhelper(32254): queryprices: nil because there no skus. d/iabhelper(32254): ending async operation: refresh inventory d/cordova_billing(32254): within mgotinventorylistener d/cordova_billing(32254): query inventory successful. d/cordovalog(32254): file:///android_asset/www/plugins/com.smartmobilesoftware.inappbilling/www/inappbilling.js: line 6 : inappbilling[js]: purchase called! i/web console(32254): inappbilling[js]: purchase called!:6 d/iabhelper(32254): starting async operation: launchpurchaseflow d/iabhelper(32254): constructing purchase intent deps.item.test, item type: inapp d/finsky (32296): [2451] inappbillingutils.getpreferredaccount: com.montreal.deps: business relationship first business relationship - [sdkny9otgbrmmwdfmof3ygfedja] d/finsky (32296): [2451] inappbillingutils.getpreferredaccount: com.montreal.deps: business relationship first business relationship - [sdkny9otgbrmmwdfmof3ygfedja] d/finsky (32296): [2451] inappbillingutils.getpreferredaccount: com.montreal.deps: business relationship first business relationship - [sdkny9otgbrmmwdfmof3ygfedja] d/iabhelper(32254): launching purchase intent deps.item.test. request code: 10001 w/pluginmanager(32254): thread warning: exec() phone call inappbillingplugin.buy blocked main thread 28ms. plugin should utilize cordovainterface.getthreadpool(). d/cordovaactivity(32254): paused application! d/cordovawebview(32254): handle pause d/firewallpolicy( 2119): geturlfilterenabled(true) d/firewallpolicy( 2119): isurlblocked - policy disabled d/webview (32254): loadurlimpl: called d/webcore (32254): core loadurl: called d/webkit (32254): firewall not null d/firewallpolicy( 2119): geturlfilterenabled(true) d/firewallpolicy( 2119): isurlblocked - policy disabled d/webkit (32254): euler: isurlblocked = false d/firewallpolicy( 2119): geturlfilterenabled(true) d/firewallpolicy( 2119): isurlblocked - policy disabled i/clipboardserviceex( 2119): send intent dismiss clipboard dialog within hidecurrentinputlocked() ! d/windowmanager( 2119): phonewindowmanager: focuschangedlw d/keyguardviewmediator( 2119): sethidden false d/cordovalog(32254): file:///android_asset/www/app/js/controllers/payment.js: line 12 : response payment i/web console(32254): response payment:12 d/cordovalog(32254): file:///android_asset/www/app/js/controllers/payment.js: line 13 : ok i/web console(32254): ok:13 d/finsky (32296): [1] carrierparamsaction.createcarrierbillingparameters: carrier billing config null. device not targeted dcb 2. e/finsky (32296): [2472] filebasedkeyvaluestore.delete: effort delete 'paramsopt-pzzx02i69kntndglqg' failed!

many if find problem have been fighting few days now.

apks in draft status no longer work testing in-app billing. need release in alpha or beta channel.

reference: http://developer.android.com/google/play/billing/billing_testing.html#draft_apps

android cordova in-app-purchase in-app-billing

sql - Mapping many-to-many relationship -



sql - Mapping many-to-many relationship -

i have many-to-many relationship :

customer, product, customer_product column quantity

i want map them hibernate question :

what loose if map them 2 one-to-many ? customer_product have 1 primary key (id_customer_product) , not composite primary key (id_product + id_customer)

customer entity:

@entity @table(name = "customer", catalog = "xx") public class client implements java.io.serializable { @onetomany(fetch = fetchtype.lazy, mappedby = "customer") private set customer_product = new hashset<customer_product>(0); }

product entity:

@entity @table(name = "product", catalog = "xx") public class client implements java.io.serializable { @onetomany(fetch = fetchtype.lazy, mappedby = "product") private set customer_product = new hashset<customer_product>(0); }

customer_product entity:

@entity @table(name = "customer_product", catalog = "xx") public class customer_product implements java.io.serializable { @id @generatedvalue(strategy = identity) @column(name = "id_customer_product") private integer id_customer_product; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "id_customer") private client customer; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "id_product") private product product; }

or have create answer , create composite primary key.

first, is client product? looks standard sales order model.

don't create simple many-to-many relationship. utilize one-to-many on both sides. you're on right track, though don't see quantity field anywhere.

a client hasmany customerproducts. product hasmany customerproducts. customerproduct belongsto client , belongsto product.

if want utilize auto-generated id field, primary key. can add together unique constraint on (customer,product) if don't want duplicate lines client , product.

sql database hibernate jpa

c++ - Where shall I put the main.cpp in Visual Studio? Into the Resources or into the Sources Folder? -



c++ - Where shall I put the main.cpp in Visual Studio? Into the Resources or into the Sources Folder? -

the titles contains question.

in general tell me difference between 2 folder?

c++ visual-studio

javascript - Is there an official order for JSDoc tags in documentation? -



javascript - Is there an official order for JSDoc tags in documentation? -

i documenting javascript api. next google style guide found nil order of tags.

i document variable this:

/** * @description radius of circle * @private * @memberof circle * @type {number} * @default */ circle.prototype._radius = 1;

as can see, write tags using own order, 1 find intuitive.

here same documentation tags ordered alphabetically:

/** * @default * @description radius of circle * @memberof circle * @private * @type {number} */ circle.prototype._radius = 1;

despite, having defined order (alphabetically), find bit confusing, because messes natural order of comments. why looking way write tags specific official order.

is there official order these tags?

thanks

there's no official order jsdoc tags. tend set more general tags first, followed more specific tags, similar first example.

in general, jsdoc doesn't care tag order, there few notable exceptions:

any text before first tag used description. can provide description @desc (or @description) tag, did in example. when utilize @param tag document function parameters, parameters must utilize same order function signature.

javascript tags order jsdoc google-style-guide

No data returned though I'm in Deezer country -



No data returned though I'm in Deezer country -

i'm building wepp app sweden. , want access deezer api search music. have registered app , premium user.

but still when run queries server on godaddy doesn't work. server in sweden works same code.

is there way info on godaddy server or need move server in sweden?

if server located in or country deezer's not live yet, won't results.

you can work around issue passing access_token parameter request. if access_token associated premium+ user registered in deezer live country (e.g. italy example), request take user country associated token account. therefore, homecoming results. above workaround isn't working free users.

deezer

java - Serve static content on Jetty, that are resources on WEB-INF/lib libraries? -



java - Serve static content on Jetty, that are resources on WEB-INF/lib libraries? -

for project i'm working on (using jetty 9), i'm interested in setting defaultservlet on web.xml , serve static content. particularity want deploy war file, packages modules of application in individual jars included in /web-inf/lib. on 1 of these jars packaging static content resource directory, should configured base of operations of files defaultservlet on war's webxml.

so far have in war's web-inf/web.xml

<servlet> <servlet-name>dashboard</servlet-name> <servlet-class>org.eclipse.jetty.servlet.defaultservlet</servlet-class> <init-param> <param-name>org.eclipse.jetty.servlet.default.resourcebase</param-name> <param-value>classpath:/static/</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>dashboard</servlet-name> <url-pattern>/dashboard</url-pattern> </servlet-mapping> </servlet>

inside war, web-inf/lib/dashboard.jar's construction is:

/ /static/index.html /meta-inf

ideally access /dashboard/index.html

i know next config wrong, transmits think should possible, i.e. set base of operations of content served of defaultservlet "classpath path", embedded in 1 of war's jar...

<init-param> <param-name>org.eclipse.jetty.servlet.default.resourcebase</param-name> <param-value>classpath:/static/</param-value> </init-param>

any experts out there can provide hint on how can work ?

thanks

java servlets jar jetty war

c# - How to display certain selected words bolder in asp:hyperlink text -



c# - How to display certain selected words bolder in asp:hyperlink text -

i have asp:repeater command on .aspx , in code behind binding datasource collection of type keyvaluepair[]<literal,string>. choosing literal surround selected words in literal text <strong> or <b> html tag. succeeded in doing not finding way display literal text in asp:hyperlink's text part of asp:repeater

my .aspx code follow:

<asp:repeater id="replinks" runat="server"> <itemtemplate> <div onclick="window.open('<%# ((keyvaluepair<literal,string>)container.dataitem).value %>','_blank');"> <div> <asp:hyperlink id="hyperlink1" runat="server" navigateurl="<%# ((keyvaluepair<literal,string>)container.dataitem).value %>" text="<%#((keyvaluepair<literal,string>)container.dataitem).key.text %>" font-size='large' forecolor='blue' font-names="open sans" cssclass="linkstyle" /> <br /> </div> </div> </itemtemplate> </asp:repeater>

i need help on how display .key.text part in asp:hyperlink.

i added keyvaluepair follow:

char[] seperator = { ' ' }; string[] explodedstring = results1[index].key.split(seperator); list<string> query= new list<string>(textbox1.text.trim().tolowerinvariant().split(seperator,stringsplitoptions.removeemptyentries)); (int = 0; < explodedstring.length; i++) { if (query.contains(explodedstring[i].tolowerinvariant()) == true) { explodedstring[i] = "<strong>" + explodedstring[i] + "<strong>"; } } literal temp = new literal(); temp.text = explodedstring.tostring(); trycurrentwindow[index] = new keyvaluepair<literal, string>(temp, results1[index].value);

here trycurrentwindow keyvaluepair[] , explodedstring[] text string splitted '' char want modify , query[] list of keywords

problem:

you not closing <strong> tag </strong>.

you doing tostring() string[] array.

updated line:

explodedstring[i] = "<strong>" + explodedstring[i] + "</strong>";

also alter below code:

literal temp = new literal(); temp.text = explodedstring.tostring();

with this:

literal temp = new literal(); temp.text = string.join(" ", explodedstring);

as indexes modified in string[] array. required bring together array modified string[] array.

updated code snippet:

char[] seperator = { ' ' }; string[] explodedstring = results1[index].key.split(seperator); list<string> query= new list<string>(textbox1.text.trim().tolowerinvariant().split(seperator,stringsplitoptions.removeemptyentries)); (int = 0; < explodedstring.length; i++) { if (query.contains(explodedstring[i].tolowerinvariant()) == true) { explodedstring[i] = "<strong>" + explodedstring[i] + "</strong>"; //changed } } literal temp = new literal(); temp.text = string.join(" ", explodedstring); //changed trycurrentwindow[index] = new keyvaluepair<literal, string>(temp, results1[index].value);

c# asp.net hyperlink

Hide a radio button visibility once it is clicked for the whole project in C# for a Windows Phone 8 application -



Hide a radio button visibility once it is clicked for the whole project in C# for a Windows Phone 8 application -

i have code :

if (rb1.ischecked.value) { navigationservice.navigate(new uri("/enterque.xaml?chkd=" + rb1.ischecked, urikind.relative)); this.rb1.visibility = visibility.collapsed; }

when rb1 checked collapse visibility on coming page. when navigate same page 1 time again via mainpage 1 time again visible ??

is rb1.visibility having local scope ?

you can take 1 visibility variable in app.xaml.cs file n hold value state visibility in application.

declaration:

public static visibility radvisibility = visibility.collapsed;

use:

rb1.visibility = app.radvisibility;

declare in app.xaml.cs

public static visibility radvisibility = visibility.visible;

mainpage.cs:

if (rb1.ischecked.value) { app.radvisibility = visibility.collapsed; this.rb1.visibility = app.radvisibility; navigationservice.navigate(new uri("/enterque.xaml?chkd=" + rb1.ischecked,urikind.relative)); } protected override void onnavigatedto(navigationeventargs e) { this.rb1.visibility = app.radvisibility; }

c# windows windows-phone-8 navigation radio-button

java - Show image from database. Getting net.sf.jasperreports.engine.JRException: Image read failed -



java - Show image from database. Getting net.sf.jasperreports.engine.JRException: Image read failed -

i'm trying pull image binary info database , insert jasper reports report.

using jaspersoft studio, read in field , alter it's type java.awt.image. then, add together image element study , alter look ${attr1_icon} when seek compile, get:

net.sf.jasperreports.engine.jrexception: net.sf.jasperreports.engine.jrexception: unable value field 'attr1_icon' of class 'java.awt.image' @ com.jaspersoft.studio.editor.preview.view.control.reportcontroler.fillreport(reportcontroler.java:482) @ com.jaspersoft.studio.editor.preview.view.control.reportcontroler.access$18(reportcontroler.java:457) @ com.jaspersoft.studio.editor.preview.view.control.reportcontroler$4.run(reportcontroler.java:347) @ org.eclipse.core.internal.jobs.worker.run(worker.java:54) caused by: net.sf.jasperreports.engine.jrexception: unable value field 'attr1_icon' of class 'java.awt.image' @ net.sf.jasperreports.engine.jrresultsetdatasource.getfieldvalue(jrresultsetdatasource.java:319) @ net.sf.jasperreports.engine.fill.jrfilldataset.setoldvalues(jrfilldataset.java:1356) @ net.sf.jasperreports.engine.fill.jrfilldataset.next(jrfilldataset.java:1257) @ net.sf.jasperreports.engine.fill.jrfilldataset.next(jrfilldataset.java:1233) @ net.sf.jasperreports.engine.fill.jrbasefiller.next(jrbasefiller.java:1577) @ net.sf.jasperreports.engine.fill.jrverticalfiller.fillreport(jrverticalfiller.java:149) @ net.sf.jasperreports.engine.fill.jrbasefiller.fill(jrbasefiller.java:932) @ net.sf.jasperreports.engine.fill.basefillhandle$reportfiller.run(basefillhandle.java:120) @ java.lang.thread.run(unknown source) caused by: net.sf.jasperreports.engine.jrexception: image read failed. @ net.sf.jasperreports.engine.util.jrjdk14imagereader.readimage(jrjdk14imagereader.java:73) @ net.sf.jasperreports.engine.util.jrimageloader.loadawtimagefrombytes(jrimageloader.java:167) @ net.sf.jasperreports.engine.jrresultsetdatasource.getfieldvalue(jrresultsetdatasource.java:309) caused by: net.sf.jasperreports.engine.jrexception: image read failed. @ net.sf.jasperreports.engine.util.jrjdk14imagereader.readimage(jrjdk14imagereader.java:73) @ net.sf.jasperreports.engine.util.jrimageloader.loadawtimagefrombytes(jrimageloader.java:167) @ net.sf.jasperreports.engine.jrresultsetdatasource.getfieldvalue(jrresultsetdatasource.java:309)

the source code caused exception comes here in jrjdk14imagereader.java:

public image readimage(byte[] bytes) throws jrexception { inputstream bais = new bytearrayinputstream(bytes); image image = null; seek { image = imageio.read(bais); } grab (exception e) { throw new jrexception(e); } { seek { bais.close(); } grab (ioexception e) { } } if (image == null) { throw new jrexception("image read failed."); // line 73 } homecoming image; }

so, can see image null. don't understand why. i've verified info there. if alter info type string , add together normal text field, prints binary data. so, don't think it's null because passed in info null.

from javadoc:

returns bufferedimage result of decoding supplied inputstream imagereader chosen automatically among registered. inputstream wrapped in imageinputstream. if no registered imagereader claims able read resulting stream, null returned.

so guess there no registered imagereader? how prepare through jaspersoft studio?

edit: i've tried using java.io.inputstream class type suggested here results in same error. kind of. big difference that, in jaspersoft studio, can set image show blank if there error. if utilize java.awt.image, setting nothing. still error , study doesn't build. if utilize java.io.inputstream, study build, image blank. if switch on error reporting, similar stack trace, it's not quite same:

net.sf.jasperreports.engine.jrruntimeexception: net.sf.jasperreports.engine.jrexception: image read failed. @ net.sf.jasperreports.engine.export.draw.printdrawvisitor.visit(printdrawvisitor.java:143) @ net.sf.jasperreports.engine.export.draw.printdrawvisitor.visit(printdrawvisitor.java:1) @ net.sf.jasperreports.engine.fill.jrtemplateprintimage.accept(jrtemplateprintimage.java:451) @ net.sf.jasperreports.engine.export.draw.framedrawer.draw(framedrawer.java:251) @ net.sf.jasperreports.engine.export.draw.framedrawer.draw(framedrawer.java:199) @ net.sf.jasperreports.engine.export.jrgraphics2dexporter.exportpage(jrgraphics2dexporter.java:273) @ net.sf.jasperreports.engine.export.jrgraphics2dexporter.exportreporttographics2d(jrgraphics2dexporter.java:246) @ net.sf.jasperreports.engine.export.jrgraphics2dexporter.exportreport(jrgraphics2dexporter.java:184) @ net.sf.jasperreports.eclipse.viewer.viewercanvas.renderpage(viewercanvas.java:369) @ net.sf.jasperreports.eclipse.viewer.viewercanvas.refresh(viewercanvas.java:344) @ net.sf.jasperreports.eclipse.viewer.viewercanvas$2.viewerstatechanged(viewercanvas.java:118) @ net.sf.jasperreports.eclipse.viewer.reportviewer.fireviewermodelchanged(reportviewer.java:383) @ net.sf.jasperreports.eclipse.viewer.reportviewer.setpageindex(reportviewer.java:297) @ com.jaspersoft.studio.editor.preview.view.report.swt.swtviewer.setjrprint(swtviewer.java:125) @ com.jaspersoft.studio.editor.preview.view.report.swt.swtviewer.setjrprint(swtviewer.java:112) @ com.jaspersoft.studio.editor.preview.previewjrprint.switchrightview(previewjrprint.java:226) @ com.jaspersoft.studio.editor.preview.previewcontainer.switchrightview(previewcontainer.java:247) @ com.jaspersoft.studio.editor.preview.previewjrprint$3.switchview(previewjrprint.java:194) @ com.jaspersoft.studio.editor.preview.previewjrprint$1.run(previewjrprint.java:153) @ org.eclipse.swt.widgets.runnablelock.run(runnablelock.java:35) @ org.eclipse.swt.widgets.synchronizer.runasyncmessages(synchronizer.java:135) @ org.eclipse.swt.widgets.display.runasyncmessages(display.java:4144) @ org.eclipse.swt.widgets.display.readanddispatch(display.java:3761) @ org.eclipse.ui.internal.workbench.runeventloop(workbench.java:2701) @ org.eclipse.ui.internal.workbench.runui(workbench.java:2665) @ org.eclipse.ui.internal.workbench.access$4(workbench.java:2499) @ org.eclipse.ui.internal.workbench$7.run(workbench.java:679) @ org.eclipse.core.databinding.observable.realm.runwithdefault(realm.java:332) @ org.eclipse.ui.internal.workbench.createandrunworkbench(workbench.java:668) @ org.eclipse.ui.platformui.createandrunworkbench(platformui.java:149) @ com.jaspersoft.studio.rcp.intro.application.start(application.java:97) @ org.eclipse.equinox.internal.app.eclipseapphandle.run(eclipseapphandle.java:196) @ org.eclipse.core.runtime.internal.adaptor.eclipseapplauncher.runapplication(eclipseapplauncher.java:110) @ org.eclipse.core.runtime.internal.adaptor.eclipseapplauncher.start(eclipseapplauncher.java:79) @ org.eclipse.core.runtime.adaptor.eclipsestarter.run(eclipsestarter.java:353) @ org.eclipse.core.runtime.adaptor.eclipsestarter.run(eclipsestarter.java:180) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.eclipse.equinox.launcher.main.invokeframework(main.java:629) @ org.eclipse.equinox.launcher.main.basicrun(main.java:584) @ org.eclipse.equinox.launcher.main.run(main.java:1438) caused by: net.sf.jasperreports.engine.jrexception: image read failed. @ net.sf.jasperreports.engine.util.jrjdk14imagereader.readimage(jrjdk14imagereader.java:73) @ net.sf.jasperreports.engine.util.jrimageloader.loadawtimagefrombytes(jrimageloader.java:167) @ net.sf.jasperreports.engine.jrimagerenderer.getimage(jrimagerenderer.java:407) @ net.sf.jasperreports.engine.jrimagerenderer.getdimension(jrimagerenderer.java:482) @ net.sf.jasperreports.engine.renderableutil.getonerrorrendererfordimension(renderableutil.java:264) @ net.sf.jasperreports.engine.export.draw.imagedrawer.draw(imagedrawer.java:116) @ net.sf.jasperreports.engine.export.draw.printdrawvisitor.visit(printdrawvisitor.java:134)

though, can see, root cause still comes jrjdk14imagereader.java line 73.

some other info might useful:

the info stored in database long binary (using sybase). image base64 encoded.

this issue blocking me finishing project, deadline approaching pretty fast. help great.

edit 2: updated version of jaspersoft studio 5.5 5.6, did nothing.

as well, look tried javax.imageio.imageio.read($f{attr1_icon}) not produce error, image blank.

even though posted in issue, overlooked fact image base64 encoded, meaning string. is, value couldn't used jasper, had decoded. can done 1 of 2 ways:

change look to:

new java.io.bytearrayinputstream(javax.xml.datatypeconverter.parsebase64binary($f{imagefield}))

or convert string binary in info base. in sybase, that's base64_decode function. 1 time converted, can alter type java.io.inputstream , it'll work.

java image jasper-reports

java - Why my input is showing one thread executing after another thread, not at the same time? -



java - Why my input is showing one thread executing after another thread, not at the same time? -

i researched concept of thread , saw have code run in 2 processes @ same time. heres code though

public class connor extends thread{ public void run() { for(int i=0; i< 10; ++){ system.out.println("hello " + i); } public static void main(string[] args){ connor runner1 = new connor(); connor runner2 = new connor(); runner1.start(); runner2.start(); } }

and output http://imgur.com/yazqgal

it seems 2 threads start off @ same time(separate processes, indicated 2 leading 0s) 1 executes (1-9) , other executes (1-9). arent suppose interweave (1,1,2,2,...) bc threads both print console. researched , saw start right method utilize tells thread class execute run method in thread? can explain why im getting output?

say have 10 errands need , sis has 10 errands needs do, , have 1 car. bring auto after each errand , switch drivers? of course of study not. absurdly inefficient. each thread needs output stream. absurd interleave them tightly.

java multithreading

Record count in Access report does export to Excel -



Record count in Access report does export to Excel -

i have access 2010 study has lines record count in grouping footer. when export excel record counts missing. clues?

thanks, george

it's because "record count" part of access interface, , not part of actual data.

if need count of records, have export seperately, or add together cell excel count you.

ms-access-2010

html - How to count number of Flash objects on a webpage -



html - How to count number of Flash objects on a webpage -

i wondering possible tags flash objects are:

i have read @ these links in either embed or object tags: http://www.w3.org/wiki/html/elements/embed http://www.w3.org/wiki/html/elements/object

after doing research, appears there several ways place flash on website

<object type="application/x-shockwave-flash"> <video controls src="http://video.example.com/vids/315981"> <a href="http://video.example.com/vids/315981">view video</a>. </video> </object> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"> <object type="application/x-shockwave-flash" data="mycontent.swf"> </object> </object> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"> <embed type="application/x-shockwave-flash"> </embed> </object>

am missing way embed flash video? want comprehensive in taking care of cases.

note, classid seems obsolete field, still need take business relationship older websites.

the tag recognized net explorer, while firefox , chrome utilize tag render flash, e.g.

<object width="150" height="150" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"> <param name="movie" value="/aspnet-ajax/editor/img/userdir/marketing/asp_ajax_banner.swf"> <param name="play" value="true"> <param name="quality" value="high"> <param name="wmode" value="transparent"> <param name="loop" value="false"> <param name="menu" value="false"><embed src="/aspnet-ajax/editor/img/userdir/marketing/asp_ajax_banner.swf" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" wmode="transparent" loop="false" menu="false" height="150" width="150"></object>

as can see object tag has classid attribute show object of type flash. embed tag has type property specified object of type application/x-shockwave-flash. similarities between both tags wmode, quality, loop attributes , film , src values containing location swf file. these strings in custom code.

html html5 flash

c# - passing value from Knockoutjs dropdownlist to SQL MVC5 -



c# - passing value from Knockoutjs dropdownlist to SQL MVC5 -

ok have kocokout array populating dropdownlist

var idddl = (from c in db.idlists select new id { id = c.id, id = c.id}).toarray(); var idlist = html.raw(jsonconvert.serializeobject(viewbag.idddl));

i have form submit button

the drop downs bind select.

<div class="form-group" style="padding-top: 0px"> @html.labelfor(m => m.id, new { @class = "col-md-2 control-label" }) <div class="col-md-10"> <select id="idddl" data-bind="options: list, optionstext: 'id'"></select> </div> </div> <input type="submit" class="btn btn-default" value="create" />

on count/register controller have added these register model , added them new applicationuser()

var user = new applicationuser() { username = model.email, email = model.email, clubtype = model.clubtype, userauthoritylevel = model.authtype, clubid = model.clubid };

and registerviewmodel had these added

[display(name = "id")] public string id { get; set; } [display(name = "type ")] public string type { get; set; } [display(name = "authority level ")] public string authtype { get; set; }

i know missing that's maybe simple help welcome, ps sorry poor english language skills

use optionsvalue bind selected item:

<select id="idddl" data-bind="options: list, optionstext: 'id', optionsvalue: 'selectedid'"></select>

c# javascript asp.net sql knockout.js

asp.net mvc - Turning off ASP MVC resizing -



asp.net mvc - Turning off ASP MVC resizing -

the default template/project used mvc 4/5 web application re-sizes according screen size. if on tablet or phone re-size text/layout when manually re-size screen. there easy way turn off or have create new project own css? template remain @ fixed width.

mvc5 templates used bootstrap. bootstrap page: how disable page responsiveness

omit viewport mentioned in css docs. in razor layout remove: "<meta name="viewport" content="width=device-width, initial-scale=1.0">"

override width on .container each grid tier single width, illustration width: 970px !important; sure comes after default bootstrap css. can optionally avoid !important media queries or selector-fu.

if using navbars, remove navbar collapsing , expanding behavior. for grid layouts, utilize .col-xs-* classes in add-on to, or in place of, medium/large ones. don't worry, extra-small device grid scales resolutions.

asp.net-mvc css3 asp.net-mvc-5

sql - Update throws "Invalid column name" when the query doesn't mention that column -



sql - Update throws "Invalid column name" when the query doesn't mention that column -

i have stored procedure simple update on table:

alter procedure [dbo].[sp_updatemodel] ( @status int, @name nvarchar(127), -- ... omited brevity ... @tourlink nvarchar(256), @original_id int ) update dbo.models set status = @status, name = @name, -- ... omited brevity ... tourlink = @tourlink (id = @original_id)

(omited portions of procedure more parameter definitions , updates, nil fancy)

this procedure worked fine until added new column underlying table dbo.models called tourlinkcoverimage of type nvarchar(256). field nullable, shouldn't need include in update statement (it's updated separately in procedure.)

i can set value of column , query it's value successfully, procedure above throws next error:

msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'. msg 207, level 16, state 1, line 1 invalid column name 'tourlinkcoverimage'.

why procedure throw error? how can prepare it?

check trigger on table. guess 1 exists , it's doing form of insert target table.

"triggers voodoo code; update value, , lights go off in building next door" - richard campbell, pass presentation, 2008

sql sql-server-2008 tsql stored-procedures sql-update

events - How to override javascript method and call from class? -



events - How to override javascript method and call from class? -

excuse title i'm not sure called (maybe events?):

i have created class use:

function cls_something() { this.notify('hello'); }

now person using class creates method called 'notify' (as instructed me) in order hear notifications , perform own custom code using param pass:

var = new cls_something(); something.notify = function(message) { console.log('the notification ' + message); }

how phone call method within class give him notification message?

fiddle

i'm trying accomplish this...

websocket = new websocket("ws://localhost:10000"); websocket.onopen = function(e) { console.log('you connected'); } websocket.onmessage = function(e) { console.log('omg wtf ffs, there error: ' + e.msg); }

you can phone call this.notify("message"); you'd want check see if it's defined first, though.

edit 1:

ok, problem here you're calling function straight constructor, before it's defined. if needs defined in constructor, pass function parameter.

function cls_something(notifyfunction) { notifyfunction('hello'); }

edit 2:

just we're clear, can have user of class define functions later, if you'd like. can't run them straight constructor, obviously. if run them constructor, need defined before hand.

say class

function cls_something() { this.somefunctionthatisrunlater = function() { this.notify('hello'); } }

then client can write

var = new cls_something(); something.notify = function(message) { console.log('the notification ' + message); }

then, when client calls

something.somefunctionthatisrunlater();

notify called.

javascript events triggers

apache pig - How to change a particular column value for certain number of rows in Pig latin -



apache pig - How to change a particular column value for certain number of rows in Pig latin -

i have a pig file 10000 rows. there quick way can alter value of column first 1000 rows ?

use each , limit operations accomplish effect.

apache-pig

Pass parameters to a Java Applet from Java Program -



Pass parameters to a Java Applet from Java Program -

i want alter os.name property before invoking applet.

(using appletviewer -j-dos.name=windows on linux raises lot of exceptions, understandably so)

so, figured i'll utilize system.setproperty() set os name in java programme (i.e. jvm on starting have right os name, applet won't) , invoke applet there (by calling it's init() function)

the issue don't know how pass parameters applet (the ones i'd using param html tag for.)?

any ideas?

i think might possible implementing appletstub interface, i'm not sure how implement other methods (apart getparameter).

you can browse source code of appletviewer openjdk ideas, or reuse code purposes. however, possible display applet in less code that, if don't need features of oracle's appletviewer. found this 1 ian f. darwin, or post sandeep sharma seems stripped-down version.

java parameters applet

SQL PIVOT, JOIN, and aggregate function to generate report -



SQL PIVOT, JOIN, and aggregate function to generate report -

i working on creating study incorporate info across 4 different tables. question, have consolidated info 2 tables , stuck trying figure out how create study using pivot.

the study hold top 5 strengths of employee based on clifton strengthsfinder assessment.

this table names of clifton strengths (34 rows total):

as mentioned, each employee has 5 strengths:

i utilize pivot generate table this:

with twist, don't need team name row, should column. count @ bottom , themes @ top (executing, influencing, etc) can ignored.

the columns of table i'm trying output personfk, personname, teamname, achiever, arranger, etc... (34 strengths) , each row of table values (personfk, name, team, 1 if person has strength, 0 otherwise). this table should sql, not excel (sorry, best illustration have on hand without spending hr learning how utilize paint or something).

i'm not familiar aggregate functions, , getting more complex sql queries..

interesting. pivot requires aggregate function build 1-5 values, you'll have rewrite inner query union, , utilize max() throwaway aggregate function (throwaway because every record should unique, max, min, sum, etc. should homecoming same value:

select * #newblah ( select personfk, 1 strengthindex, strength1 strength blah union select personfk, 2 strengthindex, strength2 strength blah union select personfk, 3 strengthindex, strength3 strength blah union select personfk, 4 strengthindex, strength4 strength blah union select personfk, 5 strengthindex, strength5 strength blah )

then

select personfk, [achiever], [activator], [adaptability], [analytical], [belief] ..... ( select personfk, strengthindex, strength #newblah ) pivotsource pivot ( max(strengthindex) strength in ([achiever], [activator], [adaptability], [analytical], [belief] ..... ) ) mypivot;

the result of query should able joined other tables person name, strength category, , team name, i'll leave you. don't have first bring together temporary table -- subselect inline, done in 1 sql query, seems painful if can avoid it.

sql pivot unpivot

asp.net mvc - Fluent validation in Nop commerce - alphanumeric only -



asp.net mvc - Fluent validation in Nop commerce - alphanumeric only -

i'm trying create zip / postal code field in nop commerce 2.65 alphanumeric field. i've edited file addressvalidator.cs in nop.web admin folder next line:

rulefor(x => x.zippostalcode) .matches(@"^[0-9a-za-z ]+$") .withmessage("numbers , letters please.");

i've compiled , uploaded nopadmin.dll nothing, it's validation not there.

is code wrong or uploading wrong file?

i've tested code , works fine. presume forgot re-build nop.admin project 1 time modified. note solution has 2 "addressvalidator" classes. please ensure modified required one

asp.net-mvc nopcommerce fluentvalidation

c++ - Compiler error initializing std::array of structs with clang -



c++ - Compiler error initializing std::array of structs with clang -

i have code:

std::array<jninativemethod, 26> methods = { { "nativecreate", "(ljava/lang/string;)j", reinterpret_cast<void*>(&nativecreate) }, { "nativedestroy", "(j)v", reinterpret_cast<void*>(&nativedestroy) }, ... { "nativetoggledebug", "(j)v", reinterpret_cast<void*>(&nativetoggledebug) }} };

that trying compile android ndks clang 3.4 compiler.

however code gives me error:

jni/jni.cpp:252:9: error: excess elements in struct initializer { "nativedestroy", "(j)v", reinterpret_cast<void*>(&nativedestroy) }, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

unless add together set of braces:

std::array<jninativemethod, 26> methods = {{ { "nativecreate", "(ljava/lang/string;)j", reinterpret_cast<void*>(&nativecreate) }, { "nativedestroy", "(j)v", reinterpret_cast<void*>(&nativedestroy) }, ... { "nativetoggledebug", "(j)v", reinterpret_cast<void*>(&nativetoggledebug) }} }};

this seems unusual me after finding give-and-take visual c++: http://social.msdn.microsoft.com/forums/vstudio/en-us/e5ad8fa5-c9e8-4328-a7fa-af7a47ce2492/initialising-a-stdarray-of-structs

i want know if wrong c++11 syntax, or defect in clang 3.4.

is related bug mentioned in initializing simple structs using initializer lists clang

std::array aggregate class containing array; need 2 pairs of braces, 1 around class fellow member initialiser(s), , 1 around array element initialiser(s).

i believe c++14 relax requirement, allowing nested array elements initialised outer initialser list.

c++ c++11 compiler-errors clang stdarray

How do I enable code highlighting in Visual Studio's Performance Analyzer window? -



How do I enable code highlighting in Visual Studio's Performance Analyzer window? -

after run desktop c# project using visual studio 2013's "instrumented" profiling, none of code highlighted in performance analyzer's function code view window shown in screenshot below.

what can seek create visual studio show performance of each line of code la http://stuartjames.info/journal/visual-studio-12-performance-analysis.aspx?

performance visual-studio-2013

Neo4j csv cypher import -



Neo4j csv cypher import -

im trying import csv files disk cypher commands shown in tutorial, im getting "couldn't load external resourse at: externalresourcefailure. there "roadmap" importing csv in windows files? give thanks in advance!

it work if path "file:///c:/myfile.csv"

neo4j

php - Multidimensional Key/Value Array into MySQL Table -



php - Multidimensional Key/Value Array into MySQL Table -

alright, i've never done before. not professional, know how mysql works. know way around php improve still beginner stages. have method in mind go it.

however, before waste 2+ hours learning did wrong, thought i'd inquire here first how guys it. im starting (relatively) little array , working big stuff when understood well.

array: http://pastebin.com/g8ryxtp5

so.. mysql? right initial thought create table , looking right now:

<?php include "login.php"; include "createdb.php"; $con = mysqli_connect($mysql_host, $mysql_user, $mysql_pass, $mysql_table) or die("some error occurred during connection " . mysqli_error($con)); /*$sql = "create table career ( id int not null auto_increment primary key, username varchar(32), password varchar(32), battletag varchar(32), part varchar(2) ) ";*/ $sql = "create table career ( id int not null auto_increment primary key, battletag varchar(32), lastheroplayed varchar(32), lastupdated varchar(32), monsters varchar(32), elites varchar(32), hardcoremonsters varchar(32), barbarian varchar(32), crusader varchar(32), demon-hunter varchar(32), monk varchar(32), witch-doctor varchar(32), wizard varchar(32), paragonlevel varchar(32), paragonlevelhardcore varchar(32), h1name varchar(32), h1id varchar(32), h1level varchar(32), h1hardcore varchar(32), h1gender varchar(32), h1dead varchar(32), h1class varchar(32), h1last-updated varchar(32), h2name varchar(32), h2id varchar(32), h2level varchar(32), h2hardcore varchar(32), h2gender varchar(32), h2dead varchar(32), h2class varchar(32), h2last-updated varchar(32), h3name varchar(32), h3id varchar(32), h3level varchar(32), h3hardcore varchar(32), h3gender varchar(32), h3dead varchar(32), h3class varchar(32), h3last-updated varchar(32), h4name varchar(32), h4id varchar(32), h4level varchar(32), h4hardcore varchar(32), h4gender varchar(32), h4dead varchar(32), h4class varchar(32), h4last-updated varchar(32), h5name varchar(32), h5id varchar(32), h5level varchar(32), h5hardcore varchar(32), h5gender varchar(32), h5dead varchar(32), h5class varchar(32), h5last-updated varchar(32), h6name varchar(32), h6id varchar(32), h6level varchar(32), h6hardcore varchar(32), h6gender varchar(32), h6dead varchar(32), h6class varchar(32), h6last-updated varchar(32), h7name varchar(32), h7id varchar(32), h7level varchar(32), h7hardcore varchar(32), h7gender varchar(32), h7dead varchar(32), h7class varchar(32), h7last-updated varchar(32), h8name varchar(32), h8id varchar(32), h8level varchar(32), h8hardcore varchar(32), h8gender varchar(32), h8dead varchar(32), h8class varchar(32), h8last-updated varchar(32), h9name varchar(32), h9id varchar(32), h9level varchar(32), h9hardcore varchar(32), h9gender varchar(32), h9dead varchar(32), h9class varchar(32), h9last-updated varchar(32), h10name varchar(32), h10id varchar(32), h10level varchar(32), h10hardcore varchar(32), h10gender varchar(32), h10dead varchar(32), h10class varchar(32), h10last-updated varchar(32), h11name varchar(32), h11id varchar(32), h11level varchar(32), h11hardcore varchar(32), h11gender varchar(32), h11dead varchar(32), h11class varchar(32), h11last-updated varchar(32), h12name varchar(32), h12id varchar(32), h12level varchar(32), h12hardcore varchar(32), h12gender varchar(32), h12dead varchar(32), h12class varchar(32), h12last-updated varchar(32), "; if (mysqli_query($con,$sql)) { echo "table 'career' created successfully!<br>"; } else { echo "error creating table: " . mysqli_error($con)."<br>"; } mysqli_query($con, $sql);

after table created going php/mysql magic (basically learning go) array->parse->push mysql ?

thanks insight. should not doing/how should going this?

edit: okay think maybe can create 1 table still, , include defining career var "battletag" each hero separately (along vital info need each hero). think work improve had.

$sql = "create table heros ( id int not null auto_increment primary key, battletag varchar(64) , name varchar(32), id int, level int, hardcore bool, gender bool, dead bool, class varchar(32), last-updated timestamp "; $sql2 = "create table career ( id int not null auto_increment primary key, battletag varchar(64), lastheroplayed varchar(32), lastupdated timestamp, monsters int, elites int, hardcoremonsters int, barbarian double(4,3), crusader double(4,3), demon-hunter double(4,3), monk double(4,3), witch-doctor double(4,3), wizard double(4,3), paragonlevel int, paragonlevelhardcore int ";

from 1 12...

h12name varchar(32), h12id varchar(32), h12level varchar(32), h12hardcore varchar(32), h12gender varchar(32), h12dead varchar(32), h12class varchar(32), h12last-updated varchar(32),

below can 1 column "game_name" still can add....

$sql = "create table career ( id int not null auto_increment primary key, battletag varchar(32), lastheroplayed varchar(32), lastupdated varchar(32), monsters varchar(32), elites varchar(32), hardcoremonsters varchar(32), barbarian varchar(32), crusader varchar(32), demon-hunter varchar(32), monk varchar(32), witch-doctor varchar(32), wizard varchar(32), paragonlevel varchar(32), paragonlevelhardcore varchar(32),

i suggest create table this...or can create 2 bring together table 1 game , 1 hnn...

name_game varchar(150) hname varchar(32), hid varchar(32), hlevel varchar(32), hhardcore varchar(32), hgender varchar(32), hdead varchar(32), hclass varchar(32), hlast-updated varchar(32),

redundant set in 1 table..............

php mysql arrays multidimensional-array

javascript - Access JSTL variable define in a jsp inside AJAX call -



javascript - Access JSTL variable define in a jsp inside AJAX call -

i got jsp file define jstl variable (form value) :

<c:set var="idetape" value="${etapeform.etape.idetape}" scope="page"/> <c:set var="idcontact" value="${etapeform.etape.idcontact}" scope="page"/> <c:set var="numerodossierfoa" value="${etapeform.dossier.numerodossier}" scope="page"/> <script type="text/javascript" src=myfile.js"/>"></script>

in myfile.js file, need utilize these variable got error tell me undefined.

i utilize these variables in ajax phone call :

var request = $.ajax({ type: "post", url: "/myurl/" + numerodossier + "/" + idcontact + "/" + idetape, cache: false });

where wrong ?

jsp variables cannot used within javascript file since jsp server side , js client side

try this:

<input id="idetape" value="${etapeform.etape.idetape}" type="hidden"/>

in js:

$("#idetape").val();

javascript jquery jsp

Python: appending to a base class list/tuple member -



Python: appending to a base class list/tuple member -

i asked question moment ago , couldn't think of pythonic solution thought i'd throw out here improve viewpoint.

what best way extend base of operations class variable tuple/list etc in super class?

the next works...

class baseclass(object): some_class_member = (1, 2, 3, 4, 5,) class anotherclass(baseclass): some_class_member = baseclass.some_class_member + (6, 7,) = baseclass() a.some_class_member # (1, 2, 3, 4, 5) b = anotherclass() b.some_class_member # (1, 2, 3, 4, 5, 6, 7)

but doesn't seem pythonic have reference baseclass name have update if name changed. there improve way go this?

baseclass in baseclass.some_class_member not mean super of anotherclass. just

baseclass.some_class_member. can access without instantiation.

>>> baseclass.some_class_member (1, 2, 3, 4, 5)

if purpose access value without instantiation, simple reply no. however, access value after instantiation.

how about?

class anotherclass(baseclass): def __init__(self): self.some_class_member += (6, 7,)

python

javascript - Is there a Bootstrap class for things to disappear on mobile only? -



javascript - Is there a Bootstrap class for things to disappear on mobile only? -

.sr-only css class of bootstrap library used create things disappear on computer screens only. there opposite class create things disappear on mobiles only?

i know there several workarounds using javascript scripts. these acceptable if , if there no opposite.

bootstrap responsive utilities handle this: http://getbootstrap.com/css/#responsive-utilities

hide on little screens screens (less 768px):

class="hidden-xs"

show on little , little screens (less 992px):

class="visible-xs visible-sm"

javascript html css twitter-bootstrap

android - How to check if view inside a dialog is focused? -



android - How to check if view inside a dialog is focused? -

i have alert dialog box 2 searchview widgets this:

layout file:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <searchview android:id="@+id/sourcesearchview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:iconifiedbydefault="false" > </searchview> <searchview android:id="@+id/destinationsearchview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:iconifiedbydefault="false"> </searchview> </linearlayout>

and in below code inflated layout dialog:

layoutinflater minflater = (layoutinflater)mcontext.getsystemservice(context.layout_inflater_service); view mview = minflater.inflate(r.layout.search_layout,null); msourcesearchview = (searchview)mview.findviewbyid(r.id.sourcesearchview); mdestinationsearchview = (searchview)mview.findviewbyid(r.id.destinationsearchview); msourcesearchview.setquery(mcurrentlocation, false); mbuilder = new alertdialog.builder(new contextthemewrapper(mcontext, android.r.style.theme_devicedefault_dialog)); mbuilder.setview(mview); malertdialog = mbuilder.create(); malertdialog.requestwindowfeature(window.feature_no_title); malertdialog.setcancelable(false);

my question: how check if 1 searchview focused , same other. tried returns null

malertdialog.getwindow().getcurrentfocus().isfocused()

you can utilize view.onfocuschangelistener :

msourcesearchview.setonfocuschangelistener(new onfocuschangelistener() { @override public void onfocuschange(view view, boolean hasfocus) { if(hasfocus){ //do }else{ //something else } } });

if dont want utilize listener can use

msourcesearchview.isfocused();

the docs. hope helps :)

android android-alertdialog

queue - How to discard some number of messages in rabbitmQ -



queue - How to discard some number of messages in rabbitmQ -

i have utilize case need info queue on exchange dont have command on. usecase queue messages constantly. wonder if in rabbitmq or using/writing plugin can discard 90% of messages @ time before saving them local datastore. reason i'm not capable of storing messages 10% of it. 1 way in application so. wonder if there way on rabbitmq level.

just wonder if have thoughts/solutions on this.

if don't have command of exchange, you're pretty much limited doing in app.

you can bulk-reject messages using nack - here's help page: http://www.rabbitmq.com/nack.html

queue rabbitmq rabbitmq-shovel

sql - Count Of Distinct Characters In Column -



sql - Count Of Distinct Characters In Column -

say have next info set

column1 (varchar(50 or something)) elias sails pails plane games

what i'd produce column next set:

letter count e 3 l 4 3 5 s 5 , on...

one solution thought of combining strings single string, , count each instance of letter in string, feels sloppy.

this more exercise of curiosity else, but, there way count of distinct letters in dataset sql?

i creating table of letters similar to:

create table tblletter ( letter varchar(1) ); insert tblletter ([letter]) values ('a'), ('b'), ('c'), ('d'); -- etc

then bring together letters table info letter:

select l.letter, count(n.col) total tblletter l inner bring together names n on n.col '%'+l.letter+'%' grouping l.letter;

see sql fiddle demo. give result:

| letter | total | |--------|-------| | | 5 | | e | 3 | | g | 1 | | | 3 | | l | 4 | | m | 1 | | p | 2 | | s | 4 |

sql sql-server count distinct-values

javascript - Split number and string from the value using java script or regex -



javascript - Split number and string from the value using java script or regex -

i have value "4.66lb"

and want separate "4.66" , "lb" using regex.

i tried below code, separates number "4,66"!! want both values 4.66 , lb.

var text = "4.66lb"; var regex = /(\d+)/g; alert(text.match(/(\d+)/g));

have seek with:

var res = text.match(/(\d+(?:\.\d+)?)(\d+)/);

res[1] contains 4.66 res[2] contains lb

in order match 4/5lb, use:

var res = text.match(/(\d+(?:[.\/]\d+)?)(\d+)/);

javascript regex string numbers

android - GCM register return empty reg id -



android - GCM register return empty reg id -

i'm trying force notification application , in origin stage-registration. next code give empty id in register()...probably have not much thought on gcm...what's going on?

private class backgroundregister extends asynctask<void,void,string>{ @override protected string doinbackground(void... params) { // todo auto-generated method stub string regid = ""; googlecloudmessaging gcm = googlecloudmessaging.getinstance(activity); seek { regid = gcm.register(project_id); log.d("reg id", regid+""); if (regid == null || regid.isempty()){ homecoming ""; } else { storeregistrationid(regid); log.d("register", getregid()+" registered"); } } grab (ioexception e) { // todo auto-generated grab block e.printstacktrace(); } homecoming regid; } }

android google-cloud-messaging

c# - Border on label when using transparency key -



c# - Border on label when using transparency key -

i have winform (with transparency key) create transparent. when add together label, "fushia" border around label. aware because of there no "set" background control. there way remove "border".

the form set background fuchsia (transparency key fuchsia) , label set transparent. tried painting panel same results.

what missing?

how looks, http://oi62.tinypic.com/2wq9z7c.jpg

public class clabel : label { protected override createparams createparams { { createparams parms = base.createparams; parms.exstyle |= 0x20; homecoming parms; } } public clabel() { this.setstyle(controlstyles.opaque, true); this.setstyle(controlstyles.optimizeddoublebuffer, false); } protected override void onpaintbackground(painteventargs e) { // null } graphicspath getstringpath(rectanglef rect, stringformat format) { graphicspath path = new graphicspath(); path.addstring(this.text, this.font.fontfamily, (int)font.style, this.font.size, rect, format); homecoming path; } protected override void onpaint(painteventargs e) { rectanglef rect = this.clientrectangle; font font = this.font; stringformat format = stringformat.genericdefault; using (graphicspath path = getstringpath(rect, format)) { smoothingmode sm = e.graphics.smoothingmode; e.graphics.smoothingmode = smoothingmode.antialias; brush b = new solidbrush(color.white); e.graphics.fillpath(b, path); e.graphics.drawpath(pens.black, path); b.dispose(); } } } public partial class dy : form { protected override createparams createparams { { createparams cp = base.createparams; cp.exstyle |= 0x02000000; cp.exstyle |= 0x80; homecoming cp; } } public dy() { initializecomponent(); setstyle(controlstyles.userpaint, true); setstyle(controlstyles.allpaintinginwmpaint, true); setstyle(controlstyles.doublebuffer, true); setstyle(controlstyles.userpaint, true); setstyle(controlstyles.supportstransparentbackcolor, true); this.startposition = formstartposition.manual; // here add together label clabel p = new clabel{ location = new point(768, 702), text = "25", autosize = false, size = new size(50,50), textalign = contentalignment.middlecenter, backcolor = color.transparent, forecolor = color.white, borderstyle = borderstyle.none, font = new font("segoe ui", 30, fontstyle.bold) }; } }

looks anti-aliasing artefacts.

you can seek change

e.graphics.textrenderinghint = system.drawing.text.textrenderinghint.antialias;

to

e.graphics.textrenderinghint = system.drawing.text.textrenderinghint.singlebitperpixel;

or can set anti-aliasing off:

e.graphics.smoothingmode = system.drawing.drawing2d.smoothingmode.none;

edit: have moved out of comments, may help folks:

here little extra on aa-artefacts..

aa create pixels interpolate , result in pixels miss transparency key color.

obviously go away if no aa used; if 1 needs smoothing little trick may help improve result:

usually transparencykey accomplished crass color fuchsia or hotpink. these used, they're not cutting holes, when shine through semitransparent aa pixel obnoxious. if use less irritating color effect can unobtrusive.

you need create sure not using elsewhere. pick color color.fromargb(255, r,g,b) picking 3 unique values won't utilize elsewhere blend in both foreground , more of import background. low saturation , depending on graphics, medium brightness help..

black or neutral grayness not choices if blend well, because used often. picking e.g. black argb(255, 7, 11, 5) has chance blend without beingness used in graphics , cutting holes in output.

the best result when can utilize somthing close background color. if can't forsee trick more not fail, though..

c# winforms

Eclipse error - Can't find Maven installation -



Eclipse error - Can't find Maven installation -

i have been using maven in eclipse (with m2e) fine, until when renamed 1 of folders on hard drive maven installed.

the folder renamed computer local computerlocal

after renaming folder received next error in eclipse when attempted maven build:

can't find maven installation c:\computer local\apache-maven-3.0.4

which of course of study makes perfect sense.

the problem when re-named folder on installation directory path it's original name kept receiving same error before:

can't find maven installation c:\computer local\apache-maven-3.0.4

when copy-past directory path error explorer window finds directory fine.

so i'd know can find configuration in eclipse can see path maven installation beingness used? perhaps there can re-set or re-configure it?

eclipse maven m2eclipse m2e

sql - MySQL select all rows from table with distinct ID using newest timestamp -



sql - MySQL select all rows from table with distinct ID using newest timestamp -

basically,

id status timestamp 1 0 2 1 1 bad 2

i want have

id status timestamp 2 1 1 bad 2

returned me.

this because want know recent status of ids in table. i've tried naive like:

select * my_tbl grouping id order 'timestamp' desc;

but won't work, idea? i'm sure it's simple cannot figure out :/

try .. bring together much faster sub query.

select t1.* table t1 left bring together table t2 on t2.id=t1.id , t2.timestamp > t1.timestamp t2.id null.

mysql sql

How to convert members of a matrix in a specific constrains value in MATLAB? -



How to convert members of a matrix in a specific constrains value in MATLAB? -

if

a = 1 2 3 3.5 5 6 6.25 8 9 9.75 11 12 13 14 15

how possible switch numbers in specific constrains, smaller part of constrain?

in other word, if b=min(a) & c=b+threshold

b<a<c => a=b.

it means, in example, let's assume threshold=3. "a" should alter matrix min(a):min(a)+threshold =[min(a)]. procedure should go on lastly array of "a"matrix adding each time amount of threshold. result should this:

a= 1 1 1 1 5 5 5 5 9 9 9 9 13 13 13

i guess found solution that. sorry if couldn't explain improve intention , mislead you. here code:

a = [1 2 3 3.5 5 6 6.25 8 9 9.75 11 12 13 14 15]'; b = min(a); threshold=4; c=b; i=1:size(a,1) c =c+threshold; a((a > b & < c)) = b; b=b+threshold; if c==max(a); break end end

p.s. threshold alter "threshold=4" instead of "3"

matlab matrix constraints

java - setOnClickListeners() crashes my app -



java - setOnClickListeners() crashes my app -

this question has reply here:

what null pointer exception, , how prepare it? 12 answers nullpointerexception accessing views in oncreate() 8 answers

so created new project via eclipse adt , app won't run, here useful info it. grateful if you'd solve it.

protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); if (savedinstancestate == null) { getsupportfragmentmanager().begintransaction() .add(r.id.container, new placeholderfragment()) .commit(); } final textview reply = (textview) findviewbyid(r.id.textview1); button askbutton = (button) findviewbyid(r.id.button1); askbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub answer.settext("veik"); } }); }

this part of mainactivity.java edited, here edited part of xml file:

<button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:text="button" />

and lastly, message of logcat:

06-19 00:04:56.740: d/androidruntime(7026): shutting downwards vm 06-19 00:04:56.740: w/dalvikvm(7026): threadid=1: thread exiting uncaught exception (group=0x41760ba8) 06-19 00:04:56.740: e/androidruntime(7026): fatal exception: main 06-19 00:04:56.740: e/androidruntime(7026): process: com.example.babyplease, pid: 7026 06-19 00:04:56.740: e/androidruntime(7026): java.lang.runtimeexception: unable start activity componentinfo{com.example.babyplease/com.example.babyplease.mainactivity}: java.lang.nullpointerexception 06-19 00:04:56.740: e/androidruntime(7026): @ android.app.activitythread.performlaunchactivity(activitythread.java:2198) 06-19 00:04:56.740: e/androidruntime(7026): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2248) 06-19 00:04:56.740: e/androidruntime(7026): @ android.app.activitythread.access$800(activitythread.java:138) 06-19 00:04:56.740: e/androidruntime(7026): @ android.app.activitythread$h.handlemessage(activitythread.java:1199) 06-19 00:04:56.740: e/androidruntime(7026): @ android.os.handler.dispatchmessage(handler.java:102) 06-19 00:04:56.740: e/androidruntime(7026): @ android.os.looper.loop(looper.java:136) 06-19 00:04:56.740: e/androidruntime(7026): @ android.app.activitythread.main(activitythread.java:5050) 06-19 00:04:56.740: e/androidruntime(7026): @ java.lang.reflect.method.invokenative(native method) 06-19 00:04:56.740: e/androidruntime(7026): @ java.lang.reflect.method.invoke(method.java:515) 06-19 00:04:56.740: e/androidruntime(7026): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:789) 06-19 00:04:56.740: e/androidruntime(7026): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:605) 06-19 00:04:56.740: e/androidruntime(7026): @ dalvik.system.nativestart.main(native method) 06-19 00:04:56.740: e/androidruntime(7026): caused by: java.lang.nullpointerexception 06-19 00:04:56.740: e/androidruntime(7026): @ com.example.babyplease.mainactivity.oncreate(mainactivity.java:31) 06-19 00:04:56.740: e/androidruntime(7026): @ android.app.activity.performcreate(activity.java:5241) 06-19 00:04:56.740: e/androidruntime(7026): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1087) 06-19 00:04:56.740: e/androidruntime(7026): @ android.app.activitythread.performlaunchactivity(activitythread.java:2162) 06-19 00:04:56.740: e/androidruntime(7026): ... 11 more 06-19 00:04:59.365: i/process(7026): sending signal. pid: 7026 sig: 9

sorry if there much text, i'm confused why doesn't work.

there no textview defined in xml id textview1.

you need add together textview widget resolve nullpointerexception.

<textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true"/>

java android adt

Receive push notifications from APNS to Titanium (iOS) App without using Appcelerator Cloudpush (ACS)? -



Receive push notifications from APNS to Titanium (iOS) App without using Appcelerator Cloudpush (ACS)? -

i'm responsible initial release of app ios , android. developer started work has left company , left incomplete titanium application finish.

once app finished not plan go on using titanium.

we need add together force notifications app.

we have enabled android force notifications using standard gcm force servers using http://iamyellow.net/post/40100981563/gcm-appcelerator-titanium-module or https://marketplace.appcelerator.com/apps/5165#!overview

does know of guide utilize apns connects straight apple servers , not require sending notification payload via acs?

thanks

the first step device token apple have register force notifications, find in detail here

the process follows saving token database , using send force notifications, blog explains best.

hope helps.

ios titanium apple-push-notifications

Content block shortcode plugin for Wordpress 3.9.x theme -



Content block shortcode plugin for Wordpress 3.9.x theme -

i developing custom shortcode wordpress 3.9.x plugin code doesn't work properly. code should alter based on parameter media="image" or media="video" , css class should add together based on parameter position="left" or position="right".

if image, value path image url. if, video, value path youtube embed code url.

any help?

shortcodes below:

[contentblock class="gray" position="left" media="video" path="....youtube video link...."]video[/contentblock] [contentblock class="gray" position="left" media="image" path="....image url...." alt="alter text" ]image[/contentblock]

code below:

function contentposfun( $atts, $content = null ) { extract( shortcode_atts( array( "class" => '', "path" => '', "alt" => '', "contentpos" => '', //left, right "contentleft" => '', "mediaright" => '', "mediatype" => '', // image, video "isimage" => '', "isvideo" => '', "imgcenter" => '', ), $atts, 'contentblock' ) ); if($contentpos == "left"){ $mediaright = " col-md-push-7 "; $contentleft = " col-md-upll-5 "; } else { $mediaright = " "; $contentleft = " "; } if($mediatype == "image"){ $imgcenter = ' img_center'; $mediatype .= ' <img src="' .$path. '" alt="'.$alt.'" class="img-responsive"' . ' />'; } else { $mediatype .= ' <div class="flex-video widescreen"><iframe width="560" height="315" src="' .$path. '" frameborder="0" allowfullscreen></iframe></div>'; } homecoming '<div class="container-fluid '.$class.'"> <div class="row"> <div class="container full_height"> <div class="row full_height relative"> <div class="col-md-5' .$imgcenter. '' .$mediaright.'">' .$mediatype. '</div> <div class="col-md-7'.$contentleft.'full_height absolute "> <div class="table full_height"> <div class="table-row full_height"> <div class="table-cell full_height valign_middle">' .do_shortcode($content). '</div> </div> </div> </div> </div> </div> </div> </div>'; } add_shortcode( 'contentblock', 'contentposfun' );

the shortcode attributes used in actual shortcode , ones have used in function different. attribute names should same in order work.

following sample code :

// add together shortcode function video_embed_shortcode( $atts, $content = "" ) { // attributes extract( shortcode_atts( array( 'src' => '', 'width' => '', 'height' => '', ), $atts ) ); // code homecoming '<embed src="' . $src . '" width="' . $width . '" height="' . $height . '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true">' . $content; } add_shortcode( 'video_embed', 'video_embed_shortcode' );

shortcode above :

[video_embed src="" width="" height=""]content[/video_embed]

wordpress shortcode

ember.js - Script tags in ember handlebars template -



ember.js - Script tags in ember handlebars template -

i include github gist in ember handlebars template. however, gists come in form of script tags , these not seem work when within template. clear gist entered text area , persisted via firebase. upon viewing article gist not display. know escaping in template e.g. {{{body}}} not work.

any suggestions of how create script tags render/fire within templates much appreciated.

there no possibility of getting script tags execute within htmlbars templates unfortunately. far know, there no way around - there alternative approaches, depending on needs.

one potential approach inject script dynamically during didinsertelement hook using 1 of methods described here: how dynamically insert <script> tag via jquery after page load?

this not recommend doing regularly, there special circumstances cannot done conventional means, one.

ember.js

leaflet remove layer from event -



leaflet remove layer from event -

please help me! it's simple code:

var сluster = new l.markerclustergroup(); сluster.addto(map); var obj = l.marker([56.34265, 30.523397]); сluster.addlayer(obj);

why code:

сluster.removelayer(obj);

successfully removes obj cluster, this:

obj.on('click', function(){ сluster.removelayer(obj); });

don't removes on click

try:

сluster.on('click', function (a) { сluster.removelayer(a.layer); });

events leaflet layer

javascript - Dynamically create nested CSS -



javascript - Dynamically create nested CSS -

i want create kind of 'scope' in css, css in particular style tag effect specific html node.

simpler: want this:

<style id="style1"> .foo { color: red; } .bar { color: green; } </style> <style id="style2"> .dor { color: blue; } </style>

dynamically turn this:

<style id="style1"> #scope1 .foo { color: red; } #scope1 .bar { color: green; } </style> <style id="style2"> .dor { color: blue; } </style>

with php or javascript (preferably using jquery)

is there simple way of doing this?

i don't know of specifically, suggest looking sass/scss. provides similar way of nesting css (and much more)

eg.

#style1 { .foo { color: red; } .bar { color: green; } } #style2 { .dor { color: blue; } }

javascript php css scope

PHP Prevent multiple MySQL Connections -



PHP Prevent multiple MySQL Connections -

i have big procedural style php/mysql website, splitted many different files. within each file, include dbconn.php, ensure, db connection available.

it looks likes this:

index.php

<?php include_once ('header.php'); include_once ('nav.php'); include_once ('content.php'); include_once ('sidebar.php'); include_once ('footer.php'); ?>

and within each of these files phone call several other files via include_once. in total come 30 different files.

every file starts with:

include_once($_server['document_root'].'/dbconn.php');

since i'm using include_once, dbconn.php should not loaded more once, next php warning.

php warning: mysqli_connect(): (hy000/1226): user 'username' has exceeded 'max_user_connections' resource (current value: 20) in /var/www/html/dbconn.php on line 10

my dbconn.php looks this:

<?php $host = "localhost"; $user = "username"; $pass = "password"; $db = "dbname"; if(!mysqli_thread_id($con)){ $con = mysqli_connect($host, $user, $pass, $db); mysqli_set_charset($con, 'utf8'); } unset($host,$user,$pass,$db); ?>

so there double check. if there open mysql connection, file should basicly nothing.

what doing wrong? why php warning , how cut down amount of mysql connections?

basically, it's not different calls single page leading problem. it's fact have multiple open connections @ moment.

make sure close connections after have served purpose.

also, seek avoid kind of construction have, have db related stuff included in 1 file , include 1 time on page.

php mysql mysql-connect php-include

c++ - Compile time with clang on Linux vs. Mac OSX -



c++ - Compile time with clang on Linux vs. Mac OSX -

i'm working on cross-platform project using c++11, boost, qt , smaller libraries.

testing build on mac osx realized clang takes 66% of time compared clang on linux mint 17 on same machine. qmake based debug build (-j8) same settings.

the versions different:

clang: 3.4 boost: 1.55.0 qt: 5.3 vs 5.2.1

switching libc++ on linux made no difference.

where huge difference in compile time come from? can accomplish same speed on linux?

clang built 64-bit amd64 on os x, might 32-bit x86 depending on mint build. 64 vs. 32-bit can have effect on compiler performance.

c++ linux osx c++11

Serial Number in PHP-MySQL Pagination -



Serial Number in PHP-MySQL Pagination -

i using simple php-mysql pagination , utilize serial number records. purpose utilize next code,

$serial = 1; $sql= mysql_query("select * table limit $limit"); while($row = mysql_fetch_array($sql)) { $s_num = $serial++; $name = $row['name']; echo $s_num . $name."<br>"; }

now problem serial number start 1 in every page in pagination while need 11-20 in 2nd page, 21-30 in 3rd page , on.

add $page var $_get.

$serial = ($page * $limit) + 1; $sql = mysql_query("select * table limit ".($page * $limit).", $limit"); while($row = mysql_fetch_array($sql)) { $s_num = $serial++; $name = $row['name']; echo $s_num . $name."<br>"; }

this right variable page.should start 0.... other wise serial number start 11....

php mysql pagination

javascript - how to maintain div fixed on viewport -



javascript - how to maintain div fixed on viewport -

i have fixed div on screen (#mydiv) , fixed @ 0px viewport 1000px height, screen size 1280 x 800 px , document height 1600px;

so i'm loosing 200px div height, how can calculate top position show while im scrolling? , top:0 when scroll again?

if want div @ position:0 on top of page still scrollable when scroll downwards looking @ setting div to:

position:absolute; top:0;

to note divs positioned in absolute take position respectivly closes ancestor not have static position (its value default if dont specify position property it).

if reason cant or dont want have div in absolute position, can calculate offset of page , alter position of div accordingly, assuming using jquery:

$( window ).scroll(function() { $( "#mydiv" ).css({ top: -$(document).offset().top }) });

this create div#mydiv move , downwards along document, assuming initial position fixed @ top:0

i utilize css solution (absolute position) instead of javascript one. allow browser thing rather setting code eat resources needlessly.

javascript jquery

html - Rotating the view within an image, not the image itself? -



html - Rotating the view within an image, not the image itself? -

i've been trying recreate banner www.reddit.com/r/atheism no luck

so far i'm here (fiddle show: http://jsfiddle.net/rbhyc/):

#masthead { background: url('http://d.thumbs.redditmedia.com/p622s0lrdyrkofo3.png') no-repeat scroll 0% 0% #000; margin-bottom: 5%; padding: 1%; text-align: center; -webkit-animation:rotate 900s linear infinite; -moz-animation:rotate 900s linear infinite; animation:rotate 900s linear infinite; } @-ms-keyframes rotate { { -ms-transform: rotate(0deg); } { -ms-transform: rotate(360deg); }} @-moz-keyframes rotate { { -moz-transform: rotate(0deg); } { -moz-transform: rotate(360deg); }} @-webkit-keyframes rotate { { -webkit-transform: rotate(0deg); } { -webkit-transform: rotate(360deg); }}

but right it's banner moving, not 'view'.. know how maintain in place , rotate within image?

you can't rotate 'view' of image, image itself. desired effect need container crop rotating image.

the html

<div class="banner"> <img class="image" src="http://d.thumbs.redditmedia.com/p622s0lrdyrkofo3.png" alt="" width="1000" height="500"> </div>

the css container

.banner { position: relative; background: #000; width: 100%; height: 200px; overflow: hidden; }

the fiddle

html css transform

MySQL set No Null for all columns -



MySQL set No Null for all columns -

is there way set columns "not null" in table? on gameserver have lots of tables , oclumns "null" , need them "not null". can help me? thinking help me

update player set * = not null;

but wont work.

try that

alter table player modify your_column int(11) not null;

if int int if varchar varchar , on

mysql

raspberry pi - running two subprocesses simultaneously from python module -



raspberry pi - running two subprocesses simultaneously from python module -

i trying execute 2 sub-processes @ same time python module on raspberry pi. sec process has wait first 1 finish before starts wondering if there way have both of them started @ same time. info beingness read in gives line every 5 seconds, , 2 .sh programs not take more sec each finish. if have suggestions on how or if there work around appreciated. code below:

f = open("testv1.txt", "a") import serial import subprocess ser = serial.serial('/dev/ttyacm0', 115200) while 1: x= ser.readline() subprocess.call(['./camera1.sh'],shell=true) subprocess.call(['./camera2.sh'],shell=true) print(x) f.write(str(x))

so changed code does:

cam1 = subprocess.popen("./camera1.sh") cam2 = subprocess.popen("./camera2.sh")

but getting next errors:

traceback (most recent phone call last): file "/home/pi/desktop/doyle/capturev1/testv1.py", line 7, in <module> cam1 = subprocess.popen("./camera1.sh") file "/usr/lib/python2.7/subprocess.py", line 679, in __init__ errread, errwrite) file "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child raise child_exception oserror: [errno 8] exec format error

any other suggestions on how prepare it?

you need utilize popen constructor execute kid programme in new process. in way can have 2 threads doing @ same time.

try like:

###somecode cam1 = subprocess.popen("./camera1.sh") cam2 = subprocess.popen("./camera2.sh") ###othercode

be careful manage threads correctly. after call, it's thing check if kid processes have terminated whith method poll() or wait:

cam1.wait() #wait until kid terminates cam1.poll() #return status of kid process.

python-2.7 raspberry-pi

unable to get tile push notification in windows phone 8 from azure notification hub -



unable to get tile push notification in windows phone 8 from azure notification hub -

i written code send force notification windows phone 8 azure notification hub. able send toast notification windows phone 8 , windows phone 8 able notification . when sending tile notification, sending tile notification successfully, windows phone 8 not getting tile notification.

i used bindtoshelltile , bindtoshelltoast @ time of getting channel uri , after doing registration channel uri , checked idcappush_notification capabilities in windowsphone porject manifest allow force notification.

below code bind device tile , toast.

public void getnotificationchannel() { /// holds force channel created or found. httpnotificationchannel pushchannel; // name of our force channel. string channelname = "toastchannel"; // seek find force channel. pushchannel = httpnotificationchannel.find(channelname); // if channel not found, create new connection force service. if (pushchannel == null) { pushchannel = new httpnotificationchannel(channelname); // register events before attempting open channel. pushchannel.channeluriupdated += new eventhandler<notificationchannelurieventargs>(pushchannel_channeluriupdated); pushchannel.erroroccurred += new eventhandler<notificationchannelerroreventargs>(pushchannel_erroroccurred); // register notification if need receive notifications while application running. pushchannel.shelltoastnotificationreceived += new eventhandler<notificationeventargs>(pushchannel_shelltoastnotificationreceived); pushchannel.open(); // bind new channel toast , tile notifications. pushchannel.bindtoshelltoast(); pushchannel.bindtoshelltile(); } else { // channel open, register events. pushchannel.channeluriupdated += new eventhandler<notificationchannelurieventargs>(pushchannel_channeluriupdated); pushchannel.erroroccurred += new eventhandler<notificationchannelerroreventargs>(pushchannel_erroroccurred); // register notification if need receive notifications while application running. pushchannel.shelltoastnotificationreceived += new eventhandler<notificationeventargs>(pushchannel_shelltoastnotificationreceived); // display uri testing purposes. normally, uri passed web service @ point. system.diagnostics.debug.writeline(pushchannel.channeluri.tostring()); //messagebox.show(string.format("channel uri {0}", // pushchannel.channeluri.tostring())); } }

below code sued registered device in notification hub.

// notification tois nil channel uri private static async void windowsphoneregistrations(string notificationtoken) { seek { var notificationhub = getnotificationhubclient(); // wil retunr notification hub client using notificationconnectionstring // , hub path var windowsphoneregistrationdescription = await notificationhub.creatempnsnativeregistrationasync(); } grab (exception ex) { throw; } }

below code sending tile notification

private static async void sendwindowsphone8toastnotification() { seek { string windowsphone8toastfinaltemplate = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<wp:notification xmlns:wp=\"wpnotification\" version=\"2.0\">" + "<wp:tile id=\"txt1\" template=\"iconictile\">" + "<wp:smalliconimage>http://flyosity.com/images/_blogentries/networkicon/step2.png</wp:smalliconimage>" + "<wp:iconimage>http://flyosity.com/images/_blogentries/networkicon/step2.png</wp:iconimage>" + "<wp:widecontent1 >this sample</wp:widecontent1>" + "<wp:count >1</wp:count>" + "<wp:title >good</wp:title>" + "</wp:tile>" + "</wp:notification>"; var notificationhub = getnotificationhubclient(); notificationoutcome n = await notificationhub.sendmpnsnativenotificationasync(httputility.htmlencode(windowsphone8toastfinaltemplate)); } grab (exception ex) { throw; } }

i able send tile notification notification hubs out exceptions , getting status notification hub after sending . device not getting tile notification.

what missed out or did error somewhere in code tile notification in windows phone 8. please help.

azure windows-phone-8 push-notification mpns