Thursday, 15 September 2011

css - framesets and frame in SAS changing the height -



css - framesets and frame in SAS changing the height -

i updating , old site using framesets. in right 70% column attempting forcefulness height accommodate drop downwards menu. reason when give frame id , height ignored. ideas why may happening? in sas environment, , i've never seen utilize use framesets.

<frameset cols="30%, 70%"> <frame src="left"> <frame src="right" id="betall"> </frameset>

a html frameset cannot used display on screen. it's placeholder split windows in multiple frames. frameset consists of 2 columns both 100% of height viewport.

if want add together drop downwards menu, need add together html-file contains displayed content. in illustration either left or right.

css height frame sas frameset

java - First characters being lost when reading from InputStream -



java - First characters being lost when reading from InputStream -

i have next code:

public class interface { public void exec(){ seek { _inputstream.read(); bufferedreader br = new bufferedreader( new inputstreamreader( _inputstream )); system.out.println( br.readline() ); } grab (ioexception e) { } } public void setinputstream( inputstream inputstream ){ _inputstream = inputstream; } private inputstream _inputstream; } public class run { public static void main(string[] args) { interface ui = new interface(); ui.setinputstream( new bytearrayinputstream( "2 4 n".getbytes( charset.defaultcharset() ) ) ); ui.exec(); } }

whenever run code though, printed out

" 4 n"

the first character has been lost. happening stream , can prevent it?

_inputstream.read();

consumes 1 character doesn't go bufferedreader. discarded character yourself. delete line , should fine.

java stream

algorithm - Directed maximum weighted bipartite matching allowing sharing of start/end vertices -



algorithm - Directed maximum weighted bipartite matching allowing sharing of start/end vertices -

let g (u u v, e) weighted directed bipartite graph (i.e. u , v 2 sets of nodes of bipartite graph , e contains directed weighted edges u v or v u). here example:

in case:

u = {a,b,c} v = {d,e,f} e = {(a->e,7), (b->d,1), (c->e,3), (f->a,9)}

definition: directionalmatching (i made term create things clearer): set of directed edges may share start or end vertices. is, if u->v , u'->v' both belong directionalmatching v /= u' , v' /= u may u = u' or v = v'.

my question: how efficiently find directionalmatching, defined above, bipartite directional weighted graph maximizes sum of weights of edges?

by efficiently, mean polynomial complexity or faster, know how implement naive brute forcefulness approach.

in illustration above maximum weighted directionalmatching is: {f->a,c->e,b->d}, value of 13.

formally demonstrating equivalence of problem other known problem in graph theory valuable.

thanks!

note 1: question based on maximum weighted bipartite matching _with_ directed edges relaxation allowed edges in matching share origin or destination. since relaxation makes big difference, created independent question.

note 2: maximum weight matching. cardinality (how many edges present) , number of vertices covered matching irrelevant right result. maximum weight matters.

note 2: during research solve problem found paper, think helpful others trying find solution: alternating cycles , paths in edge-coloured multigraphs: survey

note 3: in case helps, can think of graph equivalent 2-edge coloured undirected bipartite multigraph. problem formulation turn into: find set of edges without colour-alternating paths or cycles has maximum weight sum.

note 4: suspect problem might np-hard, not experienced reductions haven't managed prove yet.

yet example:

imagine had

4 vertices: {u1, u2} {v1, v2}

4 edges: {u1->v1, u1->v2, u2->v1, v2->u2}

then, regardless of weights, u1->v2 , v2->u2 cannot in same directionalmatching, neither can v2->u2 , u2->v1. u1->v1 , u1->v2 can, , can u1->v1 , u2->v1.

define new undirected graph g' g follows.

g' has node (a, b) weight w each directed border (a, b) weight w in g g' has undirected border ((a, b),(b, c)) if (a, b) , (b, c) both directed edges in g

http://en.wikipedia.org/wiki/line_graph#line_digraphs

now find maximal (weighted) independent vertex set in g'.

http://en.wikipedia.org/wiki/vertex_independent_set

edit: stuff after point works if of border weights same - when border weights have different values more hard problem (google "maximum weight independent vertex set" possible algorithms)

typically np-hard problem. however, g' bipartite graph -- contains cycles. finding maximal (weighted) independent vertex set in bipartite graph not np-hard.

the algorithm run on g' follows.

find connected components of g', h_1, h_2, ..., h_k for each h_i 2-coloring (say reddish , blue) of nodes. cookbook approach here depth-first search on h_i alternating colors. simple approach color each vertex in h_i based on whether corresponding border in g goes u v (red) or v u (blue). the 2 options nodes select h_i either reddish nodes or bluish nodes. take colored node set higher weight. example, reddish node set has weight equal h_i.nodes.where(node => node.color == red).sum(node => node.w). phone call higher-weight node set n_i. your maximal weighted independent vertex set union(n_1, n_2, ..., n_k).

since each vertex in g' corresponds 1 of directed edges in g, have maximal directionalmatching.

algorithm graph complexity-theory matching

vb.net - Using RS utility to deploy report using database driven directories -



vb.net - Using RS utility to deploy report using database driven directories -

i trying utilize rs utility on vb.net script deploy study loop through table has list of reports, folders, datasources, linked reports, roles , on. possible phone call rs utility within vb.net code or add together libraries enable sqlconnection in vb code? have 2008 r2 sql server.

in terms of rs utility, don't have many options. books online:

you not declare namespaces within script file. scripting environment makes several useful microsoft .net framework namespaces available you: system.web.services, system.web.services.protocols, system.xml, , system.io.

see format reporting services script file.

so in sense can't reading table database, if that's intention. read config file perhaps, these no real alternative extend utility's functionality.

your other alternative interact study server web service straight in own code , not utilize rs utility.

vb.net reporting-services

wpf - Silverlight - Find Controls by Name (string) -



wpf - Silverlight - Find Controls by Name (string) -

i serach way find controls string property:

private void animationcallback(string objectname, string value) { }

is possible find command in animation callback method property "objectname"?? (e.g. ellipse1)

the command should become color in status value property. type of command unknown.

thank you

if method defined in type derived frameworkelement, findname method should want.

wpf silverlight silverlight-4.0 silverlight-5.0

asp.net - How can I write a unit test against a WebPartBase class and mock out the controls? -



asp.net - How can I write a unit test against a WebPartBase class and mock out the controls? -

i have bunch of webpartbase classes i'm trying invoke method on. of methods phone call controls on ui. want stub out controls somehow exception doesn't thrown when attempting set values on them. know of way this? fine if initialized i'm not sure how initialize them without running web server.

my test code looks this. intializeonadd() method on kpiwebpartbase , kpiwebpartbase inherits webpartbase.

[testmethod] public void invokeallwidgets() { var user = new user("adminqaphi"); user.customerid = testconfig.clientid; var classes = typeof(kpiwebpartbase) .assembly .gettypes() .where(t => t.issubclassof(typeof(kpiwebpartbase)) && !t.isabstract ); foreach (var c in classes) { console.writeline(c.name); var instance = (kpiwebpartbase)activator.createinstance(c); foreach (var billingmetric in enum.getvalues(typeof(billingmetric))) { instance.currentuser = user; instance.billingmetric = (billingmetric)billingmetric; if (instance startendkpiwebpartbase) { var startendkpi = (startendkpiwebpartbase)instance; startendkpi.startdate = new datetime(2007, 1, 1); startendkpi.enddate = new datetime(2008, 1, 1); } instance.initializeonadd(); } } }

i create interfaces them (if possible) , utilize moq create mocks or stubs external dependencies.

what behavior invokeallwidgets() test?

response comment: think should mock database well, test "internal" logic of code(unit). otherwise en testing database, , guess not want to. , if phone call database, happens if info in changes? fail tests? if think doing integration tests , not unit tests. in unit test seek mock external dependencies , test own logic (what can go wrong?). if code don't allow test like, alter it!

asp.net unit-testing tdd web-parts

How would I replicate this input text effect where they're almost a merged box in CSS/HTML? -



How would I replicate this input text effect where they're almost a merged box in CSS/HTML? -

saw image on dribbble. how create effect in css? i'm referring 2 input fields beingness merged , having not-full-width divider between them.

something this:

#inputwrap { border: 1px solid #aaa; background: #fff; width: 180px; padding: 10px; margin: 20px; } #inputwrap input { border: none; width: 160px; padding: 5px 10px; outline: none; } #inputwrap input:first-child { border-bottom: 1px solid #aaa; }

http://jsfiddle.net/2thfg/

html css

rtp - How to send rtcp bye message using Java Media Framework (JMF)? -



rtp - How to send rtcp bye message using Java Media Framework (JMF)? -

i using java application set sip session nuance speech server using jain sip java api. prepared scheme recognition setting sending mrcp commands get_params, set-params, define grammar & recognize using mrcp4j api.

then used jmf api set rtp & rtcp session speech server send sound recognition. server has received sound won't recognize until has received rtcp bye.

but problem not able end rtp session using rtcp bye not able figure out method in jmf documentation.

it helpful if guide me on that. have attached code rtp session.

link jmf api documentation here

// send sound info // create rtp manager rtpmanager rtpmanager = rtpmanager.newinstance(); // create local endpoint local interface on local port int port = integer.parseint(rtpport);; sessionaddress localaddress = new sessionaddress(); inetaddress ip = inetaddress.getbyname("hydhtc284704d"); localaddress.setcontrolhostaddress(ip); localaddress.setcontrolport(24501); localaddress.setdatahostaddress(ip); localaddress.setdataport(24500); // initialize rtpmanager rtpmanager.initialize(localaddress); //rtpmanager.initialize(rtpconnector); // specify remote endpoint of unicast session inetaddress ipaddress = inetaddress.getbyname("hydhtc227033d"); sessionaddress remoteaddress = new sessionaddress(ipaddress, port, ipaddress, port + 1); //system.out.println(remoteaddress); // open connection rtpmanager.addtarget(remoteaddress); rtpmanager.addsendstreamlistener(new sendstreamlistener() { @override public void update(sendstreamevent arg0) { //system.out.println("send stream event: " + arg0.getsource()); system.out.println("number of bytes transmitted: " + arg0.getsendstream().getsourcetransmissionstats().getbytestransmitted()); system.out.println("sender report: " + arg0.getsendstream().getsenderreport()); } }); rtpmanager.addreceivestreamlistener(new receivestreamlistener() { @override public void update(receivestreamevent arg0) { // todo auto-generated method stub } }); file audiofile = new file("c:\\users\\bhanu_verma\\desktop\\eclipse\\one.wav"); processor processor= manager.createprocessor(audiofile.touri().tourl()); processor.configure(); // block until processor has been configured while (processor.getstate() != processor.configured) { } processor.setcontentdescriptor(new contentdescriptor(contentdescriptor.raw_rtp)); trackcontrol track[] = processor.gettrackcontrols(); //contentdescriptor cd = new contentdescriptor(contentdescriptor.raw_rtp); //processor.setcontentdescriptor(cd); boolean encodingok = false; // go through tracks , seek programme 1 of them // output ulaw data. (int = 0; < track.length; i++) { if (!encodingok && track[i] instanceof formatcontrol) { if (((formatcontrol)track[i]).setformat(new audioformat(audioformat.ulaw_rtp,8000,8,1)) == null) { track[i].setenabled(false); } else { encodingok = true; } } else { // not set track ulaw, disable track[i].setenabled(false); } } // @ point, have determined can send out ulaw info or not. // realize processor if (encodingok) { processor.realize(); // block until realized. while (processor.getstate() != processor.realized) { } // output datasource of processor , exit if fail datasource dataoutput = processor.getdataoutput(); // create send stream output info source of processor , start sendstream sendstream = rtpmanager.createsendstream(dataoutput,0); sendstream.start(); system.out.println("starting processor" + "\n"); processor.start(); while(processor.getstate()== processor.started) { system.out.println("sending audio.."); } system.out.println("processor started , sound sent server"); wait(2000); // waiting sound given server // close connection if no longer needed. rtpmanager.removetarget(remoteaddress, "client disconnected."); // phone call dispose @ end of life-cycle of rtpmanager // prepared garbage-collected. rtpmanager.dispose();

well there no such explicit method sending rtcp bye using jmf. instead jmf internally sends rtcp bye when close sendstream.

please notice closing , stopping sendstream different. closing stream removes session whereas stopping sendstream stops info transmission. send rtcp bye stop processor , close sendstream when done sending media. send rtcp bye add together these 2 lines code.

processor.stop(); //processor needs stopped before closing sendstream sendstream.close();

java rtp jmf rtcp

datagrid - Kendo UI Grid Data with List (evolve to DataTable) -



datagrid - Kendo UI Grid Data with List<T> (evolve to DataTable) -

i'm using kendo ui , have problem ...

i want utilize grid display data.

i've got list dll, dll works, can have informations , i've tested it. how can utilize info list (each log has type (message-error ...) , @ (02/05/2013 15:00) , message("hi i"m message")) ?

thanks answers

this class parse xml.

public class read { /// <summary> /// cette fonction va lire united nations fichier xml /// et renvoyer une liste de log /// </summary> /// <param name="path">chemin du fichier</param> /// <returns>on retourne la liste de logs</returns> public static list<log> loadxml(string path) { // on crée une nouvelle instance d'une liste de log list<log> liste = new list<log>(); /* on créer united nations using pour rendre la fermeture de notre flux implicite * à l'intérieur duquel on déclare united nations reader qui réalisera notre traitement * tant qu'il y aura quelque chose à lire */ xdocument doc = xdocument.load(path); var logresults = (from log in doc.descendants("log") select log).tolist(); foreach (xelement addlog in logresults) { string datecreation = addlog.attribute("at").value; type typelog = affectationtype(addlog.attribute("type").value); string message = addlog.value; string stack = null; if(addlog.element("stack")!=null) stack = addlog.element("stack").value; liste.add(new log(datetime.parse(datecreation),typelog,message,stack)); } // et on retourne finalement la liste homecoming liste; }

and each log like

public class log { /// <summary> /// permet de savoir à quelle heure le log été créé /// </summary> internal datetime at; /// <summary> /// permet de connaître le type du log /// cette variable est du type enum <c>type</c> /// </summary> internal type type; /// <summary> /// message de base of operations que possède n'importe quel log /// </summary> internal string exceptionmessage; /// <summary> /// s'il s'agit d'une exception, il y aura united nations stack d'exception /// </summary> internal string stackexception; /// <summary> /// message de l'innerexception liée /// </summary> internal string innermessage; /// <summary> /// stack de l'innerexception /// </summary> internal string stackinner;

my xml like

<?xml version="1.0" encoding="utf-8"?> <logs> <log at="05/02/2013 15:07:00" type="message">test</log> <log at="05/02/2013 15:07:00" type="exception">it's exception <stack> stack</stack></log> </logs>

i'd display

@ type message stack 05/02/2013 15:07:00 message test / 05/02/2013 15:07:00 exception it's ... , stack

list datagrid kendo-ui

Sorting lines by slope -



Sorting lines by slope -

is there function in of cgal packages sort lines (line_2) slope? or can recommend sorting algorithm considers degenerate cases vertical lines?

there's cgal::compare_slopes free function line_2 objects, , corresponding k::compare_slope_2 functor (which can extracted given instance k of k k.compare_slope_2_object()).

you can see in next example:

#include <algorithm> #include <iostream> #include <vector> #include <cgal/exact_predicates_inexact_constructions_kernel.h> typedef cgal::exact_predicates_inexact_constructions_kernel k; typedef typename k::line_2 line_2; struct slope_comparator { // k k; // slope_comparator (const k &k = k()) : k(k) {} bool operator() (const line_2 &l1, const line_2 &l2) const { homecoming (cgal::compare_slopes (l1, l2) < 0); // homecoming (k.compare_slope_2_object()(l1, l2) < 0); } }; int main () { std::vector< line_2 > l; l.push_back (line_2 ( 1., 1., 0.)); l.push_back (line_2 ( 1., -1., 0.)); l.push_back (line_2 ( 0., 1., 0.)); // vertical l.push_back (line_2 (1e-100, 1., 0.)); // vertical l.push_back (line_2 (1e-100, -1., 0.)); // vertical l.push_back (line_2 ( 0., -1., 1.)); // vertical l.push_back (line_2 (1e-100, 1., 2.)); // vertical l.push_back (line_2 (1e-100, -1., 3.)); // vertical l.push_back (line_2 ( 1., 0., 0.)); // horizontal l.push_back (line_2 ( 1., 1e-100, 0.)); // horizontal l.push_back (line_2 ( -1., 1e-100, 0.)); // horizontal l.push_back (line_2 ( -1., 0., 4.)); // horizontal l.push_back (line_2 ( -1., 1e-100, 5.)); // horizontal l.push_back (line_2 ( 1., 1e-100, 6.)); // horizontal std::cout << "insertion order:" << std::endl; (int = 0; < l.size(); ++i) std::cout << " " << l[i] << std::endl; std::sort (l.begin(), l.end(), slope_comparator()); std::cout << "sorted order:" << std::endl; (int = 0; < l.size(); ++i) std::cout << " " << l[i] << std::endl; }

note compare_slopes compares oriented lines, directions; if that's not want, have normalize lines (e.g. ensure y-coordinates positive).

sorting line computational-geometry cgal

AsyncTask is not cancelling the long running operation in android -



AsyncTask is not cancelling the long running operation in android -

i have download huge amount of info server. taking minimum 10 seconds download. here code download using asyntask class. , want cancel downloading operation unconditionally if user clicks on home button while downloading operation going on. problem is... i'am executing cancel() method not cancelling downloading operation. i'am seeing operation running in background in logcat view came out of application. want stop execution of doinbackground() method. please guide/help me.

on click of download button :

dwnldtask = new downloadtask (); dwnldtask.execute(server_url);

and here asynctask class :

class downloadtask extends asynctask<string, void, object>{ private object response = null; @override protected void onpreexecute() { super.onpreexecute(); displaying progress dialog on ui } @override protected object doinbackground(string... params) { try{ dataconnection dc = new dataconnection(); this.response = dc.connecttoserver(params[0]); if(iscancelled()){ homecoming null; } }catch (exception e) { if(iscancelled()){ homecoming null; } e.printstacktrace(); showtoastmsg(e.getmessage()); } homecoming this.response ; } @override protected void onpostexecute(object response) { super.onpostexecute(response); if(response != null ){ downloaded... go next activity } cancel progress dialog here } }

inside onpause()..

@override protected void onpause() { super.onpause(); if(dwnldtask != null && dwnldtask.getstatus() == asynctask.status.running){ dwnldtask.cancel(true); } cancel progress dialog if showing }

here method located in class named dataconnection...

public object connecttoserver(string url) throws exception{ httpget request = new httpget(url); request.addheader("accept","application/json"); httpresponse response = httpclient.execute(request); httpentity httpentity = response.getentity(); inputstream responseinputstream = httpentity.getcontent(); homecoming myutilobject.convertinputstreamtostring(responseinputstream); }

i agree ran - didn't write code of: myutilobject.convertinputstreamtostring im guessing loop there on inputstream buffer predefined size (maybe bufferedreader?) - in loop should check stop status of async thread - iscancelled() example.

the loop should stop if thread canceled, i.e.:

string line = ""; stringbuilder total = new stringbuilder(); bufferedreader rd = new bufferedreader(new inputstreamreader(is), 1024); while ((line = rd.readline()) != null && !iscancelled()) { total.append(line); }

android android-asynctask cancellation

ios - Getting the screen location of a cell from a UICollectionView -



ios - Getting the screen location of a cell from a UICollectionView -

this isn't much question explanation of how solve problem.

the first thing realize uicollectionview inherit uiscrollview - doing standard lookup scroll view's content best solution.

here's problem addressing:

i had uicollectionview had differing items in each cell - along differing types of cells. need selection of cell cause effect of image in cell appear expand , take on whole screen. how did expansion post.

the challenge getting cell's position on screen animating section have reference point start.

so, facilitate getting info - consider next code:

first note:

uicollectionview *picturescollectionview; drawingcell cell; // -> instanceof uicollectionviewcell custom items. // first, list of cells visible on screen - must every time // since items can change... critical fact. not go through // entire list of cells - collectionview indicates visible. note // there things watch out - visibles array not match indexpath.item // number - independent. latter item number overall cells, while // visibles array may have 2 entries - there not 1-to-1 mapping - maintain // in mind. nsarray *visibles = [self.picturescollectionview visiblecells]; // now, cycle through times , find 1 matches criteria. in // case, check cell indexpath passed matches cell's imageview... // indexpath passed in method phone call - note indexpath point // number in datasource particular item - crucial. (int i=0; i<visibles.count; i++) { drawingcell *cell = (drawingcell *)visibles[i]; if (cell.imageview.image == (uiimage *)images[indexpath.item]) { // @ point, we've found right cell - translation determine // it's location on current screen... getting contentoffset // collectionview subtracted cell's origin - , adding in (in case) // frame offset position of item wish animate (in case // imageview contained within custom collection cell... cgfloat relativex = cell.frame.origin.x - self.picturescollectionview.contentoffset.x + cell.imageview.frame.origin.x; cgfloat relativey = cell.frame.origin.y - self.picturescollectionview.contentoffset.y + cell.imageview.frame.origin.y; // have exact screen coordinates of imageview - since need // perform animations, save off in cgrect - in case, set size // size of imageview - doing flicker display // wanted grow selected image, coordinates of image // in cell , size displayed image... uiimageview *image = cell.imageview; // selectedcell cgrect that's global sake of code... selectedcell = cell.frame; selectedcell.origin.x = relativex; selectedcell.origin.y = relativey; selectedcell.size.width = cell.imageview.frame.size.width; selectedcell.size.height = cell.imageview.frame.size.height; } } // done. have coordinates , size of imageview wish animate , grow...

hopefully, helps other folks trying figure out how overlay on cell in exact position, etc...

-(void)collectionview:(uicollectionview *)cv didselectitematindexpath:(nsindexpath *)indexpath; { uicollectionviewlayoutattributes *attributes = [cv layoutattributesforitematindexpath:indexpath]; cgrect cellrect = attributes.frame; cgrect cellframeinsuperview = [cv convertrect:cellrect toview:[cv superview]]; nslog(@"%f",cellframeinsuperview.origin.x); }

it work me.you can seek yourself

ios uicollectionview uicollectionviewcell

python - How to use Flask-Security register view? -



python - How to use Flask-Security register view? -

has used flask-security extension authentication? how register view work?

http://packages.python.org/flask-security/customizing.html

i referring link above.

@app.route('/register', methods=['get']) def register(): homecoming render_template('security/register_user.html')

i don't want extend default class, want wrap default registration view in site layout did this.

{% extends "layout.html" %} {% block title %}upload{% endblock %} {% block body %} {% "security/_macros.html" import render_field_with_errors, render_field %} {% include "security/_messages.html" %} <h1>register</h1> <form action="{{ url_for_security('register') }}" method="post" name="register_user_form"> {{ register_user_form.hidden_tag() }} {{ render_field_with_errors(register_user_form.email) }} {{ render_field_with_errors(register_user_form.password) }} {% if register_user_form.password_confirm %} {{ render_field_with_errors(register_user_form.password_confirm) }} {% endif %} {{ render_field(register_user_form.submit) }} </form> {% include "security/_menu.html" %} {% endblock %}

and getting next error?

werkzeug.routing.builderror builderror: ('security.register', {}, none)

you don't need create view. default 1 included in flask-security. need enable in flask app config:

app = flask(__name__) app.config['security_registerable'] = true

with this, '/register' route should work. there configuration value alter url if desired:

app.config['security_register_url'] = '/create_account'

other flask-security configuration info can found here: http://pythonhosted.org/flask-security/configuration.html

python flask flask-extensions flask-security

ruby on rails - undefined method `role?' for nil:NilClass -



ruby on rails - undefined method `role?' for nil:NilClass -

i trying utilize cancan on rails application. followed same tutorial used on other project , got working. next set followed:

it seems when seek access application given

undefined method `role?' nil:nilclass

which points next line of application/layout.html.erb

<% if @user.role? :administrator %>

the problem @user not defined in every controller action, layout beingness rendered on every controller action, @user null. prepare this, check @user defined in if statement this:

<% if @user && @user.role?(:administrator) %>

ruby-on-rails cancan

c - Cross-compiling of kernel module for ARM architecture -



c - Cross-compiling of kernel module for ARM architecture -

i'm trying create .ko file arm linux x86 machine. tried next makefile:

1 obj-m +=helloworldtest_module.o 2 modules_install: 3 create arch=$(arch) cc=$(cross_compiler) -c /lib/modules/$(shell uname -r)/build m=$(pwd) modules 4 clean: 5 create -c /lib/modules/$(shell uname -r)/build m=$(pwd) clean

... got error on giving make -f makefile arch=arm cross_compiler=arm-linux-gnueabi-gcc in command prompt follows:

make arch=arm cc=arm-linux-gnueabi-gcc -c /lib/modules/3.2.0-29-generic/build m=/home/terenesas/sample modules make[1]: entering directory `/usr/src/linux-headers-3.2.0-29-generic' cc [m] /home/terenesas/sample/helloworldtest_module.o in file included /usr/src/linux-headers-3.2.0-29-generic/arch/arm/include/asm/types.h:4:0, include/linux/types.h:4, include/linux/list.h:4, include/linux/module.h:9, /home/terenesas/sample/helloworldtest_module.c:2: include/asm-generic/int-ll64.h:11:29: fatal error: asm/bitsperlong.h: no such file or directory compilation terminated. make[2]: *** [/home/terenesas/sample/helloworldtest_module.o] error 1 make[1]: *** [_module_/home/terenesas/sample] error 2 make[1]: leaving directory `/usr/src/linux-headers-3.2.0-29-generic' make: *** [modules_install] error 2

what did wrong?

shell uname -r means makefile build module host(x86) scheme , not arm.

you need specify source directory of arm kernel. may utilize next makefile cross-compile module.

makefile:

cc=$(cross_compile)gcc # if kernelrelease defined, we've been invoked # kernel build scheme , can utilize language. ifneq ($(kernelrelease),) obj-m := modulename.o # otherwise called straight command # line; invoke kernel build system. else kerneldir ?= /path/to/kernel/linux pwd := $(shell pwd) default: ${make} -c ${kernel_source} subdirs=${pwd} modules clean: ${make} -c ${kernel_source} subdirs=${pwd} clean endif

c linux makefile arm

android - How to handle deployment of white-labeled platform mobile apps? -



android - How to handle deployment of white-labeled platform mobile apps? -

i'm working on product deployed many different organizations (ideal scenario, dozens). each deployment of scheme (composed of native apps ios , android) involve following:

branding specific organization (i.e. new skin) integration organization's authentication scheme , user database some custom features depending on organization's needs

in other words, core functionality remain same across deployments, each instance different, hook different authentication systems, , have features enabled/disabled.

my question: best strategy managing our 2 mobile codebases (ios & android) in order minimize duplication , simplify deployment process?

the 3 solutions we're debating are:

create core library shared across instances (as sub-project/library project, or git submodule), , add together lean layer on top branding , configuration details.

maintain git branch core functionality, , create new branch each deployment contains additional code.

do totally different smarter person on stackoverflow suggests.

which sounds best you? in advance feedback!!

an approach consider dependency injection.

on android, if utilize dependency injection tool such square's dagger can create @module class provides , injects components application. way, maintain each white-label client's logic separate components, , @ compile time, specific component selected via reference in @module class.

this great way test applications , can avoid lot of boilerplate code.

there's great info in next talks given square:

dagger: fast dependency injector android , java

engineering elegance: secrets of square's stack

ios has similar frameworks, 1 beingness objection.

outside box options:

is requirement mobile client has speak straight white-label's servers? if not, may want consider using own servers proxy white-label's servers. move of business logic server, supporting of clients.

i don't have experience seemingly promising alternative j2objc in development @ google.

j2objc open-source command-line tool google translates java code objective-c ios (iphone/ipad) platform. tool enables java code part of ios application's build, no editing of generated files necessary. goal write app's non-ui code (such info access, or application logic) in java, shared web apps (using gwt), android apps, , ios apps.

android ios deployment maintenance

c++ - Why dlclose() must not be called from a signal handler? -



c++ - Why dlclose() must not be called from a signal handler? -

i have written user-space application in c interacts low-level linux kernel driver using plugin library plugin.so. open dll using dlopen(). have signal handler calls dlclose() when sigint received. after code review, got feedback comments dlclose() must not called signal handler. if yes, why so?

first of all, because dlclose() not listed in posix list of functions safe called in signal handler.

the reason lot of functions not listed there may things allocating memory etc. need things have race status signal handler. 1 illustration hold lock, when signal arrives in thread holds lock belonging malloc/dlclose or whatever, , phone call function, lock locked, never unlocked since thread in signal handler, , not executing "normally".

c++ c linux shared-libraries signals

function influence on already running function JavaScript -



function influence on already running function JavaScript -

so have function show me random number images css class. problem when running application twice , sec application alter images on first application, while random numbers dont show in sec application. thought because didn't have local variable, same problem or without global vars. utilize iframes, there must away work js ?

i created jsfiddle show problem, press run button twice , play dices you'll see problem. http://jsfiddle.net/dymond/gul9u/

and function creates classes.

function dicesides_func(nr){ // go dice-window-wrapper 1 time again // set in seporate functon var elementtoadddice=" dice-window-wrapper ", obj=this, // using here that's why it's called wiht dice,i=0,total=0; // dice in dice window // dicesides_func.call set right context if(nr) { while((" "+obj.classname+" ").indexof(elementtoadddice)==-1){ obj=obj.parentnode; } obj=obj.getelementsbytagname("ul")[2]; var dicessides = createelementwithclass('li',nr); obj.appendchild(dicessides); // calculate total (can in seporate function) dice = obj.getelementsbytagname("li"); } else { dice = document.getelementsbyclassname("dice"); } for(i=0;i<dice.length;i++){ total=total+getnumberforclass(dice[i].classname); } //alert(total); var wrapper = document.getelementsbyclassname("dice-toolbar-counter-wrapper")[0]; while (wrapper.haschildnodes()) { wrapper.removechild(wrapper.lastchild); } var ttl = total.tostring(); var arr = []; (var = 0;i<ttl.length;i++) { var digit = ttl[i]; var newelem = createelementwithclass('li',"side-" + ttl[i]); //alert(dice_toolbar_counter_wrapper_li) wrapper.appendchild(newelem); } }

javascript

ios - Dismiss keyboard of UISearchBar with gesture recogniser after returning from modal views -



ios - Dismiss keyboard of UISearchBar with gesture recogniser after returning from modal views -

i have implemented uisearchbar application. have created programatically , using in view controller (not tableview). works fine, problem having using gesture recogniser dismiss keyboard. want keyboard dismissed when user taps screen outside of keyboard.

i know there lot of solutions out there solve problem, have rather unique problem can't figure out @ moment. have used next code implement this.

i placed line within viewdidload method of viewcontroller:

[self.view addgesturerecognizer:[[uitapgesturerecognizer alloc] initwithtarget:search action:@selector(resignfirstresponder)]];

this method works fine normally, view controller presents views modally, has next structure:

viewcontroller - modally -> view2 -modally -> view3

when view 2 , 3 dismissed , viewcontroller, gesture recogniser no longer works. have same problem when trying solution found:

uigesturerecognizer* cancelgesture; - (void) backgroundtouched:(id)sender { [self.view endediting:yes]; } #pragma mark - uisearchbardelegate -(void)searchbartextdidbeginediting:(uisearchbar *)search { cancelgesture = [uitapgesturerecognizer new]; [cancelgesture addtarget:self action:@selector(backgroundtouched:)]; [self.view addgesturerecognizer:cancelgesture]; } -(void)searchbartextdidendediting:(uisearchbar *)search { if (cancelgesture) { [self.view removegesturerecognizer:cancelgesture]; } }

i added these main viewcontroller , 1 time again worked fine start with, after returning modal views gesture no longer worked.

any help appreciated please!

edit 1:

so while testing found similar effect beingness had when pressing search button on keyboard. utilize next code dismiss keyboard 1 time search has been pressed:

- (void) searchbarsearchbuttonclicked:(uisearchbar *)search { [search resignfirstresponder]; }

same effect here, works fine when first start app , searching, after coming screen modally presented view controllers pressing come in no longer dismisses keyboard.

edit 2:

i tried adding piece of code in searchbarsearchbuttonclicked delegate method:

- (void) searchbarsearchbuttonclicked:(uisearchbar *)search { if ([search isfirstresponder]) { [search resignfirstresponder]; nslog(@"text field first responder"); } else { [search becomefirstresponder]; [search resignfirstresponder]; nslog(@"text field not first responder"); } }

and both times prints text field first responder. after returning modal views , clicking search bar 1 time again still says first responder not dismiss odd. insight helpful, thanks.

instead of adding , removing gestures in -(void)searchbartextdidbeginediting:(uisearchbar *)search { , -(void)searchbartextdidendediting:(uisearchbar *)search { in viewwillappear' (add here) andviewdiddisappear' (remove here).

and assuming cancelgesture property retain attribute. while adding gesture instead

uitapgesturerecognizer *gesture = [uitapgesturerecognizer new]; [gesture addtarget:self action:@selector(backgroundtouched:)]; self.cancelgesture = gesture; [self.view addgesturerecognizer:self.cancelgesture];

and remember release cancelgesture in dealloc.

ios uigesturerecognizer uisearchbar uitapgesturerecognizer

ruby - How does the command-line option "W1" differ from "W0"? -



ruby - How does the command-line option "W1" differ from "W0"? -

from within ruby script, verbosity can tested value of $verbose global variable, can have 3 states:

nil in case verbosity level “0” (silence) false level “1” (medium); default true level “2” (verbose); verbose mode.

i started play code understand difference between them:

@ubuntu:~$ ruby -w0 -e 'a=10;a=10;@foo' @ubuntu:~$ ruby -w1 -e 'a=10;a=10;@foo' @ubuntu:~$ ruby -w2 -e 'a=10;a=10;@foo' -e:1: warning: perchance useless utilize of variable in void context -e:1: warning: instance variable @foo not initialized @ubuntu:~$

but not understand difference between w1 , w0. help me understand difference?

to see real difference, have print text on $stderr. i've made next alter on example:

ruby -w0 -e 'a=10;a=10;@foo;warn "hello"'

note running code w0 flag, nil appear in terminal when execute. now, if run w1, see "error" message generated kernel#warn:

ruby -w1 -e 'a=10;a=10;@foo;warn "hello"'

and finally, w2 show error , warnings generated interpreter.

ruby ruby-1.9.3

drop down menu - Yii combobox validation -



drop down menu - Yii combobox validation -

i developing yii framework

this part of view

echo chtml::dropdownlist('codcity', '',$citylist);

the dropdown filled in end, alternative that

<option value="xx">(select city)</option> <option value="rm">rome</option> <option value="fl">florence</option> ...

from validation viewpoint, first alternative (xx) not valid, while others valid in model have

public function rules() { homecoming array( ... array('codcity', 'compare', 'operator'=>'!=', 'comparevalue'=>'xx' , 'message'=>'please select city'), ... ); }

and validation rule apply codcity field.

unluckily, things not going suppose, , options validated 'good', bad 1 (xx)

any suggestions?

thank much

have @ http://www.yiiframework.com/doc/api/1.1/chtml#dropdownlist-detail

you can specfiy prompt option.

prompt: string, specifies prompt text shown first list option. value empty. note, prompt text not html-encoded.

drop-down-menu yii validation

mongodb - Mongo Vs Raven Evaluation -



mongodb - Mongo Vs Raven Evaluation -

i in process of evaluating nosql databases , finalised on two. ravendb , mongodb. 1 improve , why? help in writing more performance oriented queries.

raven's install base of operations smaller. when consider two, consider growth path. @ how mongodb , raven differ on shard keys. @ back upwards , community around product - these kick in 1 time have production critical issues. see if indexing strategy , map-reduce constructs satisfy utilize cases. @ storage , latency of largest collections , indexes. decide whether transaction model fits needs.

if application simple enough, abstraction on db layer should enable switch should alter mind. complex , robust application, i'd recommend proof of concept before full-prod commit.

mongodb ravendb mongodb-csharp

javascript - Multiple Collection Instances for a single view? -



javascript - Multiple Collection Instances for a single view? -

i'm working on app, in there 2 panels - left , right panel. left panel list of different items , when 1 of clicked right panel displays info item.

the right panel has same view, info differs.

how can achieved in backbone. currently, i'm creating instances of collection each item , passing view. instances having same data.

i'm new backbone , i've prepare myself.

if understand question correctly, can this. there should 3 objects, model,leftview , rightview. each of items in left panel, can instantiate leftview , model. , 1 time clicked on of leftviews, can instantiate rightview based on same model. can utilize same model rightview leftview having same data.

javascript backbone.js collections models

background - iOS Application is not resuming where it left off? -



background - iOS Application is not resuming where it left off? -

i facing above issue , unsure why happening or how prepare it. when app goes background , later reopened, starts initial view.

i show view shown when app dismissed - default ios apps.

can please explain why might happening , how can resolve it.

your app killed while in background free it's resources other tasks.

if applicable can opt utilize background mode app keeps running in background. possible if require location updates, play sound or interact bluetooth le devices.

by description it's more want implement state preservation , restoration (programmig guide)

even if app supports background execution, cannot run forever. @ point, scheme might need terminate app free memory current foreground app. however, user should never have care if app running or terminated. [...] state preservation scheme in uikit provides simple flexible infrastructure preserving , restoring state of app’s view controllers , views.

ios background resume

java - Get the final URL of a redirected request with unconventional scheme -



java - Get the final URL of a redirected request with unconventional scheme -

my code (below) tries final url returned server bit of redirecting. works fine long urls have http scheme. problem arises when want homecoming url different scheme. want, in situations, homecoming market:// url or other app launch schemes since android , want start intents them.

so gets me far retrieving final http url, when final url market:// throws exception seen (java.lang.illegalstateexception: scheme 'market' not registered), , geturi doesn't provide one, it'll provide whatever before that.

defaulthttpclient client = new defaulthttpclient(); httpcontext httpcontext = new basichttpcontext(); httpget httpget = new httpget(minitialurl); seek { client.execute(httpget, httpcontext); } grab (illegalstateexception e) { e.printstacktrace(); } // parse out final uri. httphost currenthost = (httphost) httpcontext.getattribute(executioncontext.http_target_host); httpurirequest req = (httpurirequest) httpcontext.getattribute(executioncontext.http_request); homecoming (req.geturi().isabsolute()) ? req.geturi().tostring() : (currenthost.touri() + req.geturi());

now, register market:// scheme, don't want hard-code beforehand valid schemes are, want take them , homecoming them whatever are.

any ideas? maybe i'm not taking right approach. (changing server behavior isn't alternative in case... i've got deal redirects.)

my hope can tell me how httpclient ignore scheme, or @ to the lowest degree preserve final uri tries access.

using httpurlconnection job works me. next of redirects stops without exception when target resource not http resource.

httpurlconnection connection = (httpurlconnection) new url(minitialurl).openconnection(); connection.setinstancefollowredirects(true); string location = connection.getheaderfield("location");

java http apache-commons-httpclient

Maximum number of states in State Pattern -



Maximum number of states in State Pattern -

i trying utilize state pattern , have question. state pattern designed situtations limited number of states this:

tcpstate: 1- tcpestablished 2- tcplisenting 3- tcpclosed etc.

or can used in cases hundreds of states illustration employee in employee attendance scheme employee have composite state of multiple components number of yearly vacations has in balance, number of hours should compensate month, state represent hourly salary rate depending on work load month, etc. each employee can have combination of multiple attributes considered state behavior.

at case there hundrerds of state objects, right thing do? how manage state objects naming? , if illustration 1 3rd of states share behavior method, , quarter shares behavior method etc. i.e. not states necisserly have unique behavior in it's methods. dont think copying implementation , pasting states have same behavior mutual method wise!

thank much.

there no defined maximum number of 'state' classes, if implement 'state' class every 'state' end massive code duplication, considered problem on own.

note 'state' in a combination of assigned values not same 'state' class in state pattern, implementation of set of abstract methods. misnomer if inquire me, 'state' should improve called 'behaviour' in pattern.

if can capture behaviour in limited set of 'state' classes (i.e. if can built limited number of lines of code, yes) can apply state pattern. mention, can apply state pattern multiple times, maintaining more 1 active states.

design-patterns state max composite

Use Dos commands to copy file and preserve date in file name -



Use Dos commands to copy file and preserve date in file name -

i'm having problem trying re-create , rename file using dos commands. have file of format myfile20130218 , want re-create , rename some_other_file_20130218.

i know can utilize copy source dest i'm having problem how isolate date , preserve it. cannot guarantee date today's date ruled out, source file same name.

i can run either series of commands or batch script, thing that having problem with, after find match need copy, using myfile????????, how can file names pull dates off them?

edit: clarification looking @ files in known directory, above, know format of file name, , checking specific directory it. process checks directory connectdirect file watcher, when file found matching myfile20130218 can fire off commands, don't know how check directory , name of file present.

something should work:

%oldname:~-8% extracts lastly 8 characters %oldname% appended new filename.

update: if can identify file external programme , phone call batch script file name

copyfile.cmd c:\path\to\myfile20130218

you this:

set oldname=%~nx1 set newname=%~dp1some_other_file_%oldname:~-8% re-create "%~f1" "%newname%"

update 2: if know folder , format phone call script folder

copyfile.cmd c:\folder

and this:

@echo off setlocal enabledelayedexpansion /f %%f in ( 'dir /b "%~f1" ^| findstr /r "myfile[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$"' ) ( set oldname=%~f1\%%f set newname=%~f1\my_other_name_!oldname:~-8! re-create "!oldname!" "!newname!" ) endlocal

edit: script breakdown.

setlocal enabledelayedexpansion enables variable expansion within loops , conditionals. for /f %%f in ('...') executes command between single quotes , loops on output of command. dir /b "%~f1" lists content of given directory (%~f1 expands total path of first argument passed script) in simple mode (no header, no summary). findstr /r "myfile[0-9]...[0-9]$" filters input strings end substring "myfile" followed 8 digits. circumflex before pipe (^|) escapes pipe, because otherwise take precedence on for command, split for command in half, resulting in invalid command-line. set oldname=%~f1\%%f assign total path matching file variable oldname. set newname=%~f1\my_other_name_!oldname:~-8! assign total path new filename ("my_other_name_" followed trailing 8 digits oldname) variable newname. copy "!oldname!" "!newname!" don't need explain this, i?

batch-file copy cmd

Wordpress: How to setup /blog/post-title permalink? -



Wordpress: How to setup /blog/post-title permalink? -

i have wp instance installed @ root. want set blog posts in tag or category (whichever best) such accessed via:

domain.tld/blog/post-title

this super easy, way can work 'category' (or other word) in permalink so:

domain.tld/category/blog/post-title

i'm sure dead simple. thoughts on how this?

if understand question properly, believe need go wp-admin => settings => permalinks , add together custom construction of

/%category%/%postname%/

wordpress

jquery - Determine width of an element -



jquery - Determine width of an element -

i have element need move screen when button clicked, , off screen when clicking again.

the problem not write specific width of box because not going same. thought code should it, i'm getting referenceerror saying "can't find variable: width". ideas how improve it?

var itemwidth = $("#about_box").css(width); console.log($("#about_box").width()); var itemout = false; $(document).ready(function() { $("#about").click(function(){ var value1 = 30; var value2 = -itemwidth; console.log(itemout); if (itemout == false) { $("#about_box").stop(); $("#about_box").animate({left: value1}, 350); itemout= true; } else { $("#about_box").stop() $("#about_box").animate({left: value2}, 150); itemout = false; } }); });

you should utilize 1 of these options:

$("#about_box").width() //element width $("#about_box").innerwidth() //element + padding width $("#about_box").outerwidth() //element + padding + border width

and utilize within $(document).ready handler, since before won't width dom not rendered yet.

jquery html

Matlab Audio processing -



Matlab Audio processing -

i've been assigned homework includes sound processing in matlab, got @ to the lowest degree 3 channels of different frequencies in song, , increment db output depending on channel. it's got work equalizer using 3 channels. biggest problem here getting frequency , magnitude values , save variables separated in channels (low, mid , high) frequencies.

read file using wavread specify filter using fdesign (fdesign help) need 3 filters lowpass, bandpass , high pass. (you may need decimate) use design design filter above specification. need specify & design thrice have 3 channels. can made function , wavread output can passed this. finally utilize filter command filter data. (again 3 filters) now have 3 outputs belong 3 frequencies. (use matlab help good)

ps: assume have signal processing toolbox.

matlab audio equalizer channels

ASP.NET MVC4 Tool to Produce Diagram Documentation for Views -



ASP.NET MVC4 Tool to Produce Diagram Documentation for Views -

we wondering if had ideas producing documentation / diagrams our asp.net mvc4 razor views?

in other words have created custom "widget" type scheme of shared components include on multiple views. keeping track of of @html.action , @html.partial calls various controllers or shared views can tricky remember.

are there tools out there can examine razor views , produce sort of diagram shows parts of view pointing areas / controllers / partial views?

it great if when alter request comes in @ diagram of page , know widgets beingness utilized , located in visual studio / code base. helpful new members team.

asp.net asp.net-mvc razor documentation diagrams

windows - Azure cloud service fails to run in development -



windows - Azure cloud service fails to run in development -

i have azure cloud service project running on windows 8 machine in visual studio 2012. has website , few ddl projects. solution checked team foundation server.

when run project in windows 7, starts emulator , works great.

when run project in windows 8, emulator starts, website never starts. visual studio 2012 has message bottom says next : programme '[4188] waiishost.exe: managed (v4.0.30319)' has exited code 0 (0x0). operation canceled.

how debug , work?

edit 14/04/2014 having same problem visual studio 2013.

windows azure

python - How to register new client on Instagram API -



python - How to register new client on Instagram API -

hi i'm trying create new client_id, don't have website. want client_id, learning purpose. when seek create new client, inquire following: application name: amb1s1_test description: learning how utilize instagram python

website: (don't know utilize since using home computer utilize intagram python api)

oauth redirect_uri: (i have no idea)

thanks

you can 'play around' without website. dikei's reply technically correct, can set homecoming url want if know looking for.

if set http://www.google.com homecoming uri, , signed in business relationship visited https://api.instagram.com/oauth/authorize/?client_id=client-id&redirect_uri=http://www.google.com&response_type=code

with client-id replaced application id, receive authorize request form instagram account. 1 time take returned google query string attached this: http://www.google.com?code=aabsdakjhsf1283789012asdbalksd

that code in query string (for short time-frame after authorisation) can used authorisation token user. can run of other fun things in api.

that's trick around not having homecoming url, , rest here: http://instagram.com/developer/authentication/

python instagram

jQuery Accordion Form Validation , Sub Selection -



jQuery Accordion Form Validation , Sub Selection -

i new jquery , finding hard implement accordion type form.

the form has selection box 3 selections. if 1 of selections selected more fields revealed. problem here when add together class="required" field hidden fields, regardless of if hidden or not still required.

my function @ moment consists of:

$(function() { $( "#myform" ).validate({ rules: { accordionfield: { required: true } }, ignore: [] }); });

and not sure how create fields appear after selection required, , not other hidden fields.

<div class="row"> <div id="radio"> <input type="radio" id="radio1" name="option" value="1" class="required"/><label for="radio1">optionone</label> <input type="radio" id="radio2" name="option" value="2" class="required" /><label for="radio2">optiontwo</label> <input type="radio" id="radio3" name="option" value="3" class="required" /><label for="radio3">optionone</label> </div> </div> // if radio 1 selected option2 displays, radio 2 option2 , on <div id="option1" class="desc" style="display: none;"> <input name="name" type="text" class="required"> </div> <div id="option2" class="desc" style="display: none;"> <input name="sonsname" type="text" class="required"> </div> <div id="option3" class="desc" style="display: none;"> <input name="daugtersname" type="text" class="required"> </div>

just sumarize, want 1 of fields name, sonsname, daugtersname required based on if take optionone, optiontwo, or alternative 3 in radio box.

jquery jquery-validate accordion

php - Get all information after URL question mark in Nginx -



php - Get all information after URL question mark in Nginx -

i attempting create page allows me visit www.example.com/create?453lk6m4y , create business relationship linked id through page createuser.php?id=453lk6m4y. issue i'm running if pass straight php script, request sets key 453lk6m4y , value nothing.

in other words, if visit url, page understands request

array ( [453lk6m4y] => )

i wanted rewrite url via nginx rewrites. have far:

rewrite ^/create(\?.*)?$ /createuser.php?id=$1 last; #user creation page

however, rewrite changes request reflect following:

array ( [id] => [453lk6m4y] => )

any ways rewrite url request reflect

array ( [id] => 453lk6m4y )

first i'm not sure if www.example.com/create?453lk6m4y valid url:

? defined separater between location , (get)parameters get parameters of of form <parameter>=<value>, & separator between different parameters

that said if @ http://wiki.nginx.org/httpcoremodule#variables you'll see standard variables available in nginx:

specifically $args-variable hold whole of parameters, i.e. after ? you have $arg_parameter-variables, access individual parameter values. (so if have url example.org/createuser.php?id=1234&page=abc have variable $arg_id value 1234 , variable $arg_page value abc)

php nginx

XAML TextBox inside Popup gets hidden by on screen keyboard -



XAML TextBox inside Popup gets hidden by on screen keyboard -

in metro application, have page total of textboxes laid out vertically within stackpanel. normally, when user clicks 1 of bottom textboxes, page automatically scrolls upwards focused textbox not obscured on screen keyboard.

but automatic scrolling doesn't seem happen if page displayed within popup. should create popups have same scrolling behavior normal pages?

you're right, popups don't automatically scroll when input pane appears because popups outside of root scroll viewer in main visual tree.

it sounds have rather complex ui within popup. might want consider whether can rework ui outside context of popup in metro-friendly way.

if want seek reposition popups when input pane shows, should able hook inputpane.showing event. have calculations , reset original offset when inputpane hides.

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.viewmanagement.inputpane.showing.aspx

xaml textbox popup winrt-xaml on-screen-keyboard

How to add parity bits on c# -



How to add parity bits on c# -

please help want c# come 1 time comes up

please come in 7-bit binary number:

0010011

your number parity bit is:

00100111

this code have come with, wrong please can right alright?

{ console.writeline("please come in 7- bit binary number"); string number = console.readline(); int count1 = 0; int count2 = 0; for(int = 0; < number.length; i++) { count1++; } else { count2++; } if (count1 < count2) console.writeline("your number parity bit "+ number+ "1"); } else { console.writeline("your number parity bit "+ number + "0"); } } }

}

thx in advance help

this should it:

console.writeline("please come in 7- bit binary number"); string number = console.readline(); int count = 0; for(int = 0; < number.length; i++) { if(number[i] == '1') { count++; } } console.writeline("your number parity bit "+ number + (count % 2).tostring());

i'd imagine beyond current level, should work:

console.writeline("please come in 7- bit binary number"); string number = console.readline(); string paritybit = (number.where(c => c == '1').count() % 2).tostring(); console.writeline("your number parity bit "+ number + paritybit);

c# parity

windows 8 - How can i Obfuscate a monogame windows8 metro app? -



windows 8 - How can i Obfuscate a monogame windows8 metro app? -

i have windows 8 metro game (using monogame) developed , plan submit windows 8 app store , wish obfuscate it. how can it? obfuscation cause runtime errors?

we utilize crypto obfuscator. has decent gui, great back upwards team, , importantly both visual studio integration , back upwards obfuscating windows 8 store apps.

windows-8 obfuscation monogame

.htaccess - Show index page for all links to folder -



.htaccess - Show index page for all links to folder -

i have folder named "keywords" website, such this: http://www.mysite.com/keywords/

in folder have index.php file. regardless of types in after folder, need index.php show. example, http://www.mysite.com/keywords/this-is-a-test should show index.php file's content without changing url.

everything i've tried seems fail - i'm working .htaccess in /keywords/ folder. regardless of set there seem maintain getting 404 error. help appreciated, i'm sure it's little , simple don't know how do.

this have:

rewriteengine on rewriterule - index.php [l]

the problem work when going links dash in them.

for example,

http://www.mysite.com/keywords/testing-this

does work. not work:

http://www.mysite.com/keywords/testingthis

any help appreciated.

rewriteengine on rewritebase / #make sure website located in root directory, if not have add together directory here... rewriterule ^keywords/testingthis$ /keywords/index.php$1 [l]

.htaccess

.net - Thread safe pattern for multiple properties -



.net - Thread safe pattern for multiple properties -

i have object has 15 properties of either string, decimal?, datetime? or int?. have collection of of class manipulated multiple threads. create sure values of objects' properties accessed (read/written) in thread safe manner, while writing to the lowest degree amount of code. there such way instead of using private backers , doing explicit lock in getter , setter of every single property? here have each property:

public class manyproperties { private object mlock = new object; private string _personname; public string personname { { lock (mlock){ homecoming _personname; } } set { lock (mlock){ _personname = value; } } } private string _beginamount; public decimal? beginamount { { lock (mlock){ homecoming _beginamount; } } set { lock (mlock){ _beginamount = value; } } } }

properties not work in isolation. having each property thread-safe doesn't help if can't right , valid pair etc of values. more appropriate approach create entire thing immutable, , allow caller snapshot:

public class manyproperties { private readonly string _personname; public string personname { { homecoming _personname; } } private readonly decimal? _beginamount; public decimal? beginamount { { homecoming _beginamount; } } public manyproperties(string personname, string decimal? beginamount) { _personname = personname; _beginamount = beginamount; } }

then:

var snapshot = whatever.properties; var name = snapshot.personname; ... var amount = snapshot.beginamount;

these always consistent. plus there 0 locks. reading / updating reference atomic, - no torn values.

the of import thing not do:

var name = whatever.properties.personname; ... var amount = whatever.properties.beginamount;

because here there no longer guarantee name , amount came same manyproperties instance: have swapped reference between 2 fetches.

.net multithreading properties thread-safety

Git checkout: "@{-N}" syntax -



Git checkout: "@{-N}" syntax -

i found section in git manpage, it's kind of obfuscated explaination:

as special case, "@{-n}" syntax n-th lastly branch checks out branch (instead of detaching). may specify - synonymous "@{-1}".

what mean?

it's saying if do:

git checkout @{-1}

you'll check out branch on before current branch have checked out. in addition, checks out by name, you'll on branch, rather checking out commit in detached head state. similarly, utilize git checkout @{-2} go "two branch changes ago", , forth.

git

Remote acces to mySQL with facebook -



Remote acces to mySQL with facebook -

i'm working in facebook app , want access mysql database. have installed xampp because has php, apache, mysql , others. need access mysql database app i've been looking how access in remote mode dond't found solution.

the general method acces mysql database php this: mysql_connect("localhost","user","password"); have been configured info base of operations without pass , take user name don't know set in first, 1 ip, general ip? how know server ip? if simple programme in localhost works good, if same in app have problem: error connecting database

in search of solution found have modify "my.ini" form mysql this: #bind-address="127.0.0.1" or bind-address = "0.0.0.0" have same problem.

if helps, i'm work heroku , git bash.

https://devcenter.heroku.com/articles/facebookhttps://devcenter.heroku.com/articles/facebook

thanks

in first part of mysql_connect function, can set in domain name server, e.g. mysql_connect( 'mysqlserver.com', 'user', 'pass' ); , should work (if have domain name it, is).

using ipconfig command on server give it's ip address. don't need alter of mysql settings except allowing remote access database.

mysql facebook

database - Allocate places according to distance -



database - Allocate places according to distance -

as over-simplified illustration have list of events have maximum attendance:

event | places =================== event_a | 1 event_b | 2 event_c | 1

and list of attendees distance events:

attendee | event_a dist | event_b dist | event_c dist ========================================================== attendee_1 | 12 | 15 | 12 attendee_2 | 11 | 15 | 11 attendee_3 | 10 | 11 | 12

can suggest simple method produce set of options providing best case allocations based on shortest total distance , on shortest mean distance?

i have info held in oracle spatial database, i'm open suggestions.

i understand problem follows:

each atendee should assigned 1 event each event has limit how many atendees assigned it underfull or empty events no problem each assignment between event , atendee corresponds given distance you want minimize overall distance assignments you might want print result not using sums using means

based on interpretation, suggest next algorithm:

create finish bipartite graph, nodes in partition a atendees , nodes in partition b places in events. every atendee corresponds 1 node, , every event corresponds many nodes has places. atendees connected event nodes distance border cost.

at point problem corresponds general assignment problem, “agents” corresponding event places, , “tasks” corresponding atendees. every atendee must covered, not every event place must used.

add dummy attendees allow perfect matching. sum places, subtract number of actual atendees. difference, create many atendee nodes, distance 0 event nodes.

by making both partitions equal in size, in domain of more mutual linear assignment problem.

use hungarian algorithm compute minimal cost assignment. perhaps can think of simplifications create utilize of fact have many equivalent nodes, i.e. places same event , dummy atendees.

all of should done in application code, not in info base. i'd rather tag algorithm. you'll need pull total cost matrix database provide costs edges.

database math

c - Check if pointer is null when not initialized -



c - Check if pointer is null when not initialized -

this question has reply here:

why aren't pointers initialized null default? 15 answers

is safe assume if statement work if variable uninitialized? assumption yes, have been told random bits of garbage in variable not mean check if null work.

void afunction () { char* somestr; if (somestr) { // } }

is safe assume if statement work if variable uninitialized?

no. reading uninitialized storage invokes undefined behavior. can't create safe assumptions code.

don't this!

c

python - Counting Inversions Using Merge Sort -



python - Counting Inversions Using Merge Sort -

i have made merge sort programme in python , running have modified count number of inversions involved , giving me error :

here's code:

def merge_list(left,right,c): result=[] i,j=0,0 while < len(left) , j < len(right): if left[i] < right[j]: result.append(left[i]) print "left result",result i=i+1 elif left[i] > right[j]: result.append(right[j]) print "right result",result j=j+1 if right[j] < left[i] , i<j: c=c+1 result=result+left[i:] result=result+right[j:] print "inversions: ",c homecoming result,c def sort_and_count(lis,count): if len(lis)<2: homecoming lis middle=len(lis) / 2 left,c1=sort_and_count(lis[:middle],count) print "left",left right,c2=sort_and_count(lis[middle:],count) print "right",right m,c=merge_list(left,right,count) c=c+c1+c2 homecoming m,c if __name__=="__main__": print "enter 6 elements: " i=0;lis=[];merge_lis=[];inv=0 while i<=5: x=int(raw_input()) lis.append(x) i=i+1 count=0 merge_lis,inv=sort_and_count(lis,count) print "sorted list is: ",merge_lis,inv

and traceback:

traceback (most recent phone call last): file "sort_and_count.py", line 53, in <module> merge_lis,inv=sort_and_count(lis,count) file "sort_and_count.py", line 31, in sort_and_count left,c1=sort_and_count(lis[:middle],count) file "sort_and_count.py", line 31, in sort_and_count left,c1=sort_and_count(lis[:middle],count) valueerror: need more 1 value unpack

where going wrong approach?

this line:

return lis

this problem, because expecting sort_and_count homecoming tuple containing 2 values, when returns 1 value have problem tuple unpacking in lines left,c1=sort_and_count(lis[:middle],count). line should homecoming 2 values, lastly line of method:

return m,c

python algorithm sorting mergesort

ruby - What is the lowest memory occupancy object that can be assigned to a variable? -



ruby - What is the lowest memory occupancy object that can be assigned to a variable? -

i want create hash i'm interested in keys. consequence, want values have smallest memory footprint possible. suitable object assign?

nil ? a short symbol :a ? something smaller?

the next applies official ruby implementation. other implementations may differ in regard.

nil, true, false , fixnums encoded within pointer @ c level, whereas other objects involve pointer points somewhere (so you'd have space consumption of pointer plus space points to). these objects ones smallest memory footprint.

of these, nil makes sense semantically.

ruby

Contact without account does not show for lookup value in force.com sites -



Contact without account does not show for lookup value in force.com sites -

i have created lookup field on custom object contact , used on visual forcefulness page. have used custom lookup page. in salesforce org works fine , display lookup value. when utilize page in sites lookup value doesnot show contact have no account. if contact have business relationship shown. have give permission site users.

please help me. urgent......

contacts without accounts private contacts, , can viewed record owner.

the solution create special business relationship record, phone call "orphanage". relate these orphan contacts account.

force.com sites

wireshark - What is RSSI value in 802.11 packet -



wireshark - What is RSSI value in 802.11 packet -

i see 2 values of ssi signal in 802.11 packet when viewed in wireshark. tot know 1 value right rssi value

information wireshark:

ssi signal: -40 dbm ssi noise: -100 dbm signal quality: 64 antenna: 0 ssi signal: 60 db

also note ssi signal(second time) ((ssi signal) - (ssi noise))

i confused 1 correct. wikipedia entry tells these implementation can vendor dependent. totally confused right value.

i see 2 values of ssi signal in 802.11 packet when viewed in wireshark

it sounds if driver 802.11 adapter used capture packet beingness weird , supplying both antenna signal strength in dbm , antenna strength in db. type of adapter that, , operating scheme machine on machine did capture running?

"dbm", link above indicates, decibels 1 milliwatt of power; "db", other link above indicates, decibels unspecified arbitrary point. dbm tells actual signal powerfulness @ antenna; db doesn't - can utilize db values compare other db values.

neither of "rssi" defined 802.11; rssi value arbitrary, it's more arbitrary - 802.11 doesn't measures, larger values correspond stronger signals, , values are vendor-dependent.

also note ssi signal(second time) ((ssi signal) - (ssi noise))

the author of driver adapter might not have read radiotap page "db antenna signal" value (linked above), , might have thought supposed signal-to-noise ratio, , calculated subtracting noise value signal value (decibels logarithmic scale, , quotient of 2 values difference between logarithms of values). ignore value, , utilize "ssi signal" indication of signal strength in milliwatts (-40 dbm = 100 nanowatts, @ to the lowest degree per table in the wikipedia article on dbm).

wireshark 802.11

c - Printing Uncommon Characters? -



c - Printing Uncommon Characters? -

basically have programme finds mutual character acsii table. , prints number of times character happened, ascii number, , "character". know easiest , computer science way of printing characters such newline "\n" or "\t". avoid typing out of characters if possible.

if need code allow me know! give thanks you!

you utilize caret notation, has simple mapping of non-printable ascii codes caret symbol '^' plus printable ascii character.

c ascii printf

group by - Ordering of grouped rows in mysql -



group by - Ordering of grouped rows in mysql -

select t1.item_id, t1.item, t1.created, t1.owner, t1.type, t1.fld, t2.tag items t1 inner bring together tagged t2 on t1.item_id = t2.item_id tag in ('how', 'jkas', 'bodor', 'zimp', 'ctuo', 'sjex', 'kek' ) grouping item_id order t1.created desc limit 0 , 100

how order items how many matches have in tag? went deep in manual , couldn't find reply , got lost in stuff don't understand.

you can utilize count , set results in subquery:

select * ( select t1.item_id, t1.item, t1.created, t1.owner, t1.type, t1.fld, t2.tag, count(distinct t2.tag) tagcount items t1 inner bring together tagged t2 on t1.item_id = t2.item_id tag in ('how', 'jkas', 'bodor', 'zimp', 'ctuo', 'sjex', 'kek') grouping item_id ) t order tagcount desc, created desc limit 0 , 100

mysql group-by sql-order-by

php - Replace HTML strings with spaces -



php - Replace HTML strings with spaces -

this question has reply here:

problem using strip_tags in php [duplicate] 1 reply strip_tags() … replace tags space rather deleting them 8 answers

does know how can replace html string spaces?

because if have this

<div>word1</div><div>word2</div>

when utilize strip_tags(), result is

word1word2

and need them separated space in order processed way should script.

you can utilize this:

preg_replace('/<[^>]*>/', ' ', $input);

but had best not have stray < characters in text.

also:

preg_replace('/ {2,}/', ' ', $input);

will collapse multiple spaces single space.

php html replace strip-tags

Raw socket in java -



Raw socket in java -

i pretty new java socket programming. had gone thorugh java deals net domain sockets , back upwards udp , tcp , raw ip protocols. want know java back upwards raw sockets without using 3rd party applications? if possible can help me little example? little advice greatful!

the available back upwards raw sockets in java standard library seems inetaddress.isreachable() may icmp ping if permitted. not much , not raw socket, 1 more protocol.

for other types of raw communication recommend utilize berkley sockets under linux (root rights required) through jni - based wrapper.

java sockets raw-sockets

javascript - jQuery height paragraph ready event after altering text -



javascript - jQuery height paragraph ready event after altering text -

i'm having issues fetching size of tag after altering containing text. have solution i'm far satisfied with. have (apologies coffeescript, ()=> means function(){})

@textfield = $('<'+tag+'></'+tag+'>') @textfield.html(text).delay(120).queue(()=> @textfield.ready(@ontextready) )

if remove delay, there's no height(), can't utilize window.load either, , @textfield.load seem absolutely nothing.

what thoughts on best practice solve this?

much appreciated

/ a

as far know elements don't have size until added dom. more think there issues size , display none. if interested in size , not in adding element dom suggest play visibility.

var $textfield = $('<div>').text("foo").css({ visibility: "hidden", position: "absolute", display: "block" }).appendto($("body")); var height = $textfield.height(); $textfield.remove(); alert(height);

javascript jquery events load ready

Azure Deployment Error: cannot find ClientPerfCountersInstaller.exe -



Azure Deployment Error: cannot find ClientPerfCountersInstaller.exe -

i tried setting preview cache azure on existing site , deployment, had abort due errors. since next error when seek , deploy azure...

cannot find file named approot\bin\microsoft.windowsazure.caching\clientperfcountersinstaller.exe

this file exist on disk, presuming approot base of operations folder asp project.

any ideas , help appreciated, banging head against wall currently!

found solution. servicedefinition.csdef file had new startup task had been created somehow during cache setup process. removing superfluous task resolved issue , cannot see downwards side or negative impact.

commented out line shown below...

<startup priority="-2"> <!--<task commandline="microsoft.windowsazure.caching\clientperfcountersinstaller.exe install" executioncontext="elevated" tasktype="simple" />--> </startup>

deployment azure

c++ - modifying the addition of two binary numbers in my code -



c++ - modifying the addition of two binary numbers in my code -

i trying add together binary numbers in programme im not happy have,my code adds binary numbers

1010 +1111

but want alter when come in binary number 100010001 should add together 1010 +1111 code automatically adds because of 2 arrays , values in array want come in binary number keybord , should above illustration code

int main() { int a[4]; int b[4]; int carry=0; int result[5]; a[0]=1; a[1]=0; a[2]=0; a[3]=1; b[0]=1; b[1]=1; b[2]=1; b[3]=1; for(int i=0; i<4; i++) { if(a[i]+b[i]+carry==3) { result[i]=1; carry=1; } if(a[i]+b[i]+carry==2) { result[i]=0; carry=1; } if(a[i]+b[i]+carry==1) { result[i]=1; carry=0; } if(a[i]+b[i]+carry==0) { result[i]=0; carry=0; } } result[4]=carry; for(int j=4; j>=0; j--) { cout<<result[j]; } cout<<endl; homecoming 0; }

im newbie many if there mistakes please right me , give me best advise in advance

well first thing see not starting @ right-most bit. add-on binary numbers same real base of operations 10 numbers in start @ right , work towards left, whatever bit have left, append origin of sum.

so yours:

9 + 15

1001 + 1111

i = 3 --> [][][][0] -->carry = 1

i = 2 --->[][][0][0] --->carry = 1

i = 1 --->[][0][0][0] --->carry = 1

i = 0 --->[1][0][0][0] --->carry = 1

oh noes ran out of space

so append carry front end of sum:

[1][1][0][0][0] ---> 24

c++

google chrome extension - Scroll bar in Hosted Apps -



google chrome extension - Scroll bar in Hosted Apps -

i'm working on packaged app chrome. it's launch page access info localstorage , output html. problem app launches in separate window (shell/panel) no scroll bars. how can bring scroll bar or launch tab? i'm aware of "launch": { "local_path": "app.html" } trick, depreciation. i'm using "background": { "scripts": ["background.js"] }

add appropriate overflow style html in css:

html { overflow: auto; }

(you might want utilize overflow-x or overflow-y depending on needs)

google-chrome-extension google-chrome-app

mysql - Ruby search on multiple fields -



mysql - Ruby search on multiple fields -

in rails app need search via field in table, main problem must so: if have choosen select field in view a, must search condition, if both , b , b... have:

controller

@pre_oils = oil.by_brand(params[:oilbrand]).by_oiloiliness(params[:oiloiliness]).by_structure(params[:oilstructure]).by_size(params[:oilsize])

model

def self.by_oiloiliness(oiloiliness) if oiloiliness where("description ?", "%#{oiloiliness}%") else scoped end end def self.by_brand(brand) if brand where("manufacturer ?", "%#{brand}%") else scoped end end def self.by_structure(structure) if construction #where("structure ?", "%#{structure}%") where("description ?", "%#{structure}%") else scoped end end def self.by_size(size) if size where("capacity ?", "#{size}") else scoped end end

but searching very strange, 1 time working, no.... bad? , how search such fields, wich choosen in view?

(also ruby 1.9.3 rails 3.2.8)

maybe fetching find on queries , split them , delete duplicates?

upd

oil = oil.brand_like(params[:oilbrand]) oil = oil.description_like(params[:oiloiliness]) oil = oil.description_like(params[:oilstructure]) oil = oil.capacity_eq(params[:oilsize])

upd2

@pre_oils = oil.search(:manufacturer_like => params[:oilbrand], :description_like => params[:oiloiliness], :description_like => params[:oilstructure], :capacity_eq => params[:oilsize])

for kind of things there many gems available. can go through gems meta_search, searchlogic perform search.

once install meta_search can this:

when have form fields following:

<%= f.text_filed :capacity_eq %> <%= f.text_field :description_like %>

you params this:

params => {"description_like" => "xyz", "capacity_eq" => "21"} oil.search(params) #to results

mysql ruby-on-rails ruby

iphone - SpeakHere sampe from Apple Can't record voice in Xcode 6.1 simulator but can record voice in 5.1, work in real device -



iphone - SpeakHere sampe from Apple Can't record voice in Xcode 6.1 simulator but can record voice in 5.1, work in real device -

i can't record sound using speakhere illustration app apple. when run app in simulator version 6.1 within xcode, starts normally,but when touch record button, level meter not move @ all, , sound file don't have voice inside, yes sound file existed. unusual thing when alter simulator version 5.1 , recording working, level meter working, when force play button, there no sound @ meter moving, check sound file playing 3rd party application, ok, version 5.1 simulator, can record , can't play, output error message like: error loading /system/library/extensions/applehda.kext/contents/plugins/applehdahalplugin.bundle/contents/macos/applehdahalplugin: dlopen(/system/library/extensions/applehda.kext/contents/plugins/applehdahalplugin.bundle/contents/macos/applehdahalplugin, 262): symbol not found: ___cfobjciscollectable

summary: machine mini mac, osx 10.8.2 usb headset mic.

in version 6.1 simulator, can't study , can't play.

in version 5.1 simulator, can study , can't play.

can has thought how prepare work in simulator? force speakhere sample application , work in 6.1 real device ( ipad).

iphone xcode ios4 simulator

c - Placing a preprocessor directive inside a string literal? -



c - Placing a preprocessor directive inside a string literal? -

i'm trying utilize #define define string literal (a filepath in case), cannot path #define'd element. in short, i'd this:

#define x /var/stuff #define y "x/stuff.txt"

to give me y "/var/stuff/stuff.txt". possible do? beforehand.

edit: alternatively, concat 2 literals one?

#define x "/var/stuff" #define y x"/stuff.txt"

not way have it, no -- macro replacement not happen within string literals.

you can, however, paste string pieces:

#define str(x) #x #define expand(x) str(x) #define x /var/stuff #define y expand(x) "/stuff.txt"

quick demo code this:

#include <iostream> int main(){ std::cout << y; }

c gcc preprocessor

c# - How store a large file into SQL Server 2008 and retrieve all of it? -



c# - How store a large file into SQL Server 2008 and retrieve all of it? -

my problem sql server database.

i stored info sql server table c# code:

internal static void saveautocadfileondatabase(string mapcode, byte[] dataelecmap, string dataelecmapname,byte[] datacivilmap, string datacivilmapname, byte[] dataarchimap, string dataarchimapname,byte[]datamechamap,string datamechamapname) { string sqlcommand = string.concat("insert autocadfiles values ('", mapcode, "' , ", "cast ('", dataelecmap, "' varbinary(max)),", " '", dataelecmapname, "' ", " , cast ('", datacivilmap, "' varbinary(max)) ,", " '", datacivilmapname, "' ", " , cast ('", dataarchimap, "' varbinary(max)) ,", " '", dataarchimapname, "' "," , cast ('", datamechamap, "' varbinary(max)) ,", " '", datamechamapname, "' ", ")"); executenonquery(sqlcommand); }

and retrieve code:

internal static datatable retrivemaps(string mapnumber, string maptype) { string s = maptype + "name"; string sqlcommand = string.concat("select ", maptype, " , ", s, " autocadfiles mapcode='",mapnumber, "'"); homecoming getbinaryfiles(sqlcommand); } private static datatable getbinaryfiles(string sqlcommand) { sqlconnection sqlconnction = null; datatable dt = new datatable(); sqlcommand sqlcom = getconnection(sqlcommand, ref sqlconnction); sqldatareader sdldr = sqlcom.executereader(); dt.load(sdldr); homecoming dt; }

i file datatable , save filesystem. stored file volume 0 byte

or 13 byte less stored file in database.

since you're retrieving single row @ time, simpler code work retrieving data:

string filename; byte[] fileread; sqlcommand command; sqlconnection connection = mygetsqlconnection(); connection.open(); command = new sqlcommand("select dataelecmapname autocadfiles mapcode = @mapnumber", connection); command.parameters.add("@mapnumber", sqldbtype.int).value = mapnumber; filename = (string)command.executescalar(); command.dispose(); command = new sqlcommand("select dataelecmap autocadfiles mapcode = @mapnumber", connection); command.parameters.add("@mapnumber", sqldbtype.int).value = mapnumber; fileread = (byte[])command.executescalar(); string temppath = myfunc.gettempdirectory(); filestream fs = new filestream(temppath + filename, filemode.create); fs.write(fileread, 0, fileread.length); system.diagnostics.process.start(temppath + filename); fs.close();

edit utilize code convert file:

public static byte[] convertfiletobytes(string location, ref string filename) { filestream fs = new filestream(location, filemode.open, fileaccess.read); binaryreader reader = new binaryreader(fs); byte[] info = reader.readbytes((int)fs.length); fs.close(); homecoming data; }

c# sql-server wpf sql-server-2008

how to combine function and string inside php echo -



how to combine function and string inside php echo -

can combine php function , string in same echo statement? currently, have code grabs photo's caption, shortens 25 characters or less, stopping @ nearest blank space can fit whole word.

echo substr($caption,0,strpos($caption,' ',25)); echo " ...";

example output: changes "this way long fit in foobar little area preview box" "this way long to..."

i'd able combine 'substr' , '...' same echo statement. tried following, didn't work:

echo "{substr($caption,0,strpos($caption,' ',25))} ...";

any ideas?

the , great this, , much faster ., has overhead of concatenating string.

echo substr($caption, 0, strpos($caption, ' ', 25)), '...';

edit: clarify, , sends strings, separated comma, echo, , equal separate line echo statments. dot operator performs concatenation. can utilize many commas want, i.e. echo strfunction1(), ' text ', strfunction2(), '...';

php string function echo

c - ROM variable not getting the defined value -



c - ROM variable not getting the defined value -

i'm working on developing software stack automotives based on renesas rl78 controller. getting straight problem, variables declared const(rom variables) not getting initialized defined value.

ex : const uint8 var_test = 1;

on other hand, global,static variables getting initialized.

is problem startup code? kindly suggest...

like other answers, const variable isn't placed rom section.

you need tell compiler/linker place it.

with iar toolchain it's like

#pragma set_const_page(constarea) const int myvariable1=42; const int myvariable2=4711; #pragma set_default_const_page

but debugger doesn't show right value problem, it's possible variable optimized. sure happens map file , (with debugger) @ assembly level done.

c embedded

html - How to make the check box checked by default when using check_box_tag? -



html - How to make the check box checked by default when using check_box_tag? -

= form_tag movies_path, :id => 'ratings_form', :method => :get include: - @all_ratings.each |rating| = rating - is_checked = (!@selected_ratings.nil? && @selected_ratings.include?(rating)) = check_box_tag "ratings[#{rating}]", is_checked, is_checked, {:id => "ratings_#{rating}"} = submit_tag 'refresh', :id => 'ratings_submit'

ref :- check_box_tag

change

check_box_tag "ratings[#{rating}]", is_checked, is_checked, {:id => "ratings_#{rating}"}

to

check_box_tag "ratings[#{rating}]", is_checked, true, {:id => "ratings_#{rating}"}

html ruby-on-rails haml