Posts

Showing posts from April, 2011

android - How to create a clickable Listview and go to new page where the user can add items within the list -

i guidance on how create clickable listview , go new page user can add items within list creating list, , want user able create multiple lists, , tap list, , enter multiple items within list. thanks. update - added .java code reference. may explain have implemented far better text above. public class actionbarmenudemoactivity extends sherlocklistactivity { private static final string[] items = { }; private arraylist<string> words = null; @override public void oncreate(bundle icicle) { super.oncreate(icicle); initadapter(); registerforcontextmenu(getlistview()); } @override public boolean oncreateoptionsmenu(menu menu) { new menuinflater(this).inflate(r.menu.option, menu); edittext add = null; if (build.version.sdk_int >= build.version_codes.honeycomb) { view v = menu.finditem(r.id.add).getactionview(); if (v != null) { add = (edittext) v.findviewbyid(r.id.title); } } if (add != null) { ...

OpenCV: Searching for pixels along single-pixel branches -

Image
i'm trying find neat way of storing separate "branches" in binary image. little animation explains it: as go along branches need collect pixel indices makes single-pixel wide branch. when hit junction point should split , store new branches. one way of going maybe create 3x3 subregion, find out if there white pixels inside it, move accordingly, create junction point if there more two. store previous subregion 1 can use making sure don't move regions scanned. it's bit tricky figure out how go though. i need reorder pixels based on "line/curve" hierarchy. part of application redraw figures, internally works creating lines between points hence need have them "ordered". i don't know if apply in case should take @ cv::findcontour. vector of points ordered. http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html

php - ErrorException: Warning: Header may not contain more than a single header, new line detected -

i having trouble redirecting after function sends emails! function is: public function emailaction($emails, $url) { foreach($emails $email) { $message = \swift_message::newinstance() ->setsubject('updates in symfony blog') ->setfrom(array('blog@symfonyblog.com' => 'symfony blog')) ->setto($email["email"]) ->setbody( $this->renderview( 'newsblogbundle:default:email.txt.twig', array('url' => $url) ) ) ; $this->get('mailer')->send($message); } return $this->redirect($this->newpostaction()); //return $this->redirect($this->generateurl('newsblogbundle_homepage')); } it sends emails ok, when redirecting, gives error: errorexception: warning: header may not contain more single header, new line detected in c:\path\to\webr...

orchardcms - Orchard CMS - Text visible on every page & editable in CMS -

i add in top right of every page - contact phone & email link. they styled uniquely on page css - based on containing div's class. what best practice way make visible on every page - , editable in cms? would have have html markup editable (the client non technical)? thanks. you want add html widget on default layer. can give custom classes etc. , style within theme.

How to supply command line argument to perl script through Java -

i running perl script through java. code shown below. try { process p = runtime.getruntime().exec("perl 2.pl"); bufferedreader br = new bufferedreader( new inputstreamreader(p.getinputstream())); system.out.println(br.readline()); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } my perl script in such way when run directly through command line ask me supply input file. question how supply file name perl script through java? if don't want add command line argument script (which cleaner , more robust) need write script's stdin. this snippet should work (test.java): import java.io.*; public class test { public static void main(string[] args) { processbuilder pb = new processbuilder("perl", "test.pl"); try { process p=pb.start(); bufferedreader stdout = new bufferedreader( new input...

java - Linking renderer that displays a jComboBox to a cell in the jTable -

the problem is, when user clicks on cell style of line, , chooses 1 of 4 options , after clicks on other cell line style, after that, other cell displays line style, choosen in previous selected cell. how to, make line style unique every cell (different line styles in different cells) in "line style" column? cells in "line colour" column works fine , implemented similarly. here sscce: main class: import javax.swing.jframe; public class panelmain { public static void main(string[] args) { string[] tab = { "abc", "cde", "efg" }; panel panel = new panel(tab); jframe frame = new jframe(); frame.add(panel); frame.setvisible(true); } } panel: import java.awt.basicstroke; import java.awt.color; import java.awt.dimension; import javax.swing.jpanel; import javax.swing.jscrollpane; import javax.swing.jtable; import javax.swing.table.abstracttablemodel; @suppresswarnings("serial...

php - joomla user registered through CB is not assigned to k2 user group -

in 1 of joomla 2.5 site using community builder registration form.when registration completed user clicked confirmation link in email, user not assigned k2 user group. i set k2 user group in k2 parameters->advanced setting->select default k2 user group new registrations dropdown new registered user assigned group. but it's not working.i have required plugins enabled while searching through google.com solution any solutions , suggestions experts welcome. i came across when searching similar problem: gavick's facebook login didn't assign k2 usergroup. suspect solution same. edit: /plugins/users/k2/k2.php replace in function "onloginuser": // user id $db = jfactory::getdbo(); $db->setquery("select id #__users username = ".$db->quote($user['username'])); $id = $db->loadresult(); with: // user id $db = jfactory::getdbo(); $db->setquery("...

javascript - How to generate input field in tr dynamically using jquery -

i have got task create input field clicking button. <table> <tr> <th> name </th> <th> age </th> </tr> <tr> <td> nithin </td> <td> 24 </td> </tr> </table> <button id="btn">add row</button> on click of button want display textbox allow users add content table. how can done? edit:- want consider above td.it must generate based on above td count explanation first of all, let me explain use of innerhtml instead of .append() : performance . jsfiddle solution add following html code under button #btn : html <div id="addrow"> <input type="text" id="name" value="" /> <input type="text" id="age" value="" /> <button id="c...

c# - WCF web service is too busy -

i have problem busy wcf service through clients can connect , consume it. below error , stack trace on server configuration , attributes of class. error message , stacktrace: the http service located @ https://my.web.service.com/service/service.svc unavailable. because service busy or because no endpoint found listening @ specified address. please ensure address correct , try accessing service again later.exst: server stack trace: @ system.servicemodel.channels.httpchannelutilities.processgetresponsewebexception(webexception webexception, httpwebrequest request, httpabortreason abortreason) @ system.servicemodel.channels.httpchannelfactory`1.httprequestchannel.httpchannelrequest.waitforreply(timespan timeout) @ system.servicemodel.channels.requestchannel.request(message message, timespan timeout) @ system.servicemodel.channels.securitychannelfactory`1.securityrequestchannel.request(message message, timespan timeout) @ system.servicemodel.security.securitysessi...

sql server - Two sql if statements -

i want run through 2 if statements in sql. if's 2 different conditions, example: if (@user == 'bob') begin select * table id = 1 end if (@animal == 'cat') begin select * table id = 50 end what want rows 1 if first condition correct or 1 , 50 if both conditions met. fails @ second if statement, there keyword need add? i recommend single statement: select * table (@user = 'bob' , id = 1) or (@animal= 'cat' , id = 50)

c# - Using Url.Action in javascript -

i trying use url.action method correctly generate required url ajax call i'm running problems when trying build routevalues, here's problem line of code: var url = @url.action("viewfile", "default", new { itemid = $(this).data("itemid") }); as can see, i'm trying assign result of jquery $(this).data("itemid") itemid in routevalues. is there way using razor syntax allow code compile? you confusing client side server side. try this: var url = '@url.action("viewfile", "default")?itemid=' + $(this).data("itemid"); when write @ razor view engine, writing instruction process on server side @ end of command. in case want add parameter in url comes javascript, so, concat on client side value url generated @url helper. ps: assuming using default route tables.

asp.net - Not able to remove a Generic List object in c# -

sessionresponselist objclientsessionresponselist = new sessionresponselist(); objclientsessionresponselist.qid = convert.toint32(session["questionnumber"]); objclientsessionresponselist.qanswer = session["currentanswer"].tostring(); objsessionresponselist = (list<sessionresponselist>)session["answers"]; if (objsessionresponselist.where(x=>x.qid == objclientsessionresponselist.qid && x.qanswer==objclientsessionresponselist.qanswer).count()>0) { objsessionresponselist.remove(objclientsessionresponselist); session["answers"] = objsessionresponselist; } // objsessionresponselist.remove(objclientsessionresponselist); //this isn't working tried values exact duplicate please help. public class sessionresponselist{ public int qid { get; set; } public string qanswer { get; set; } } instead of creating new instance should try getting instance list using firrstordefault , if found remove instanc...

Can I make a route that does not map to a URL in Ruby on Rails? -

i have bunch of routes in routes.rb this: post 'events/form1'=> 'events#form1', :as => 'events_form1' post 'events/form2'=> 'events#form2', :as => 'events_form2' post 'events/form3'=> 'events#form3', :as => 'events_form3' these controller actions process data forms. user never going need access these actions url wanted this: post 'events#form1' and then, in form, write <%= simple_form_for :something, :url => url_for{:controller => 'events', :action => 'form1'}, :method => "post" |f| %> this doesn't work because rails complains route invalid. possible have route without url? if not, how can clean routes file? the simple_form_for call still needs url, if users never use directly. you can kind of see in code itself, in 1 of options you're sending simple_form_for option url use: :url => url_for{:controller =...

rest - Why is aggregation function bad idea for RESTful? -

as title: why aggregation function bad idea restful? although know crud restful. for example, resource ' employee ', , client needs retrive sum of total ' salary ' of employees. shouldn't restful service provide such sum function? further question: if aggregation function bad restful, how can client sum of total salary? retrieve ' employee ' records , sum itself? i wouldn't exposing results of operations (i.e. aggregation function) resources in rest has considered bad. from restful webservices cookbook (o'reilly): one of common perceptions of rest’s architectural constraints apply resources “things” or “entities” in application domain. although may true in number of cases, scenarios involve processing functions challenge perception. it quite common treat processing function resource, , use http fetch representation containing output of processing function. can use query parameters supply inputs processing function. ...

android - Wrapping a StateListDrawable -

i have view, on set statelistdrawable (defines state_pressed , default state) background in xml. works fine, states displayed expected. i want programmatically draw on top of statelistdrawable , no matter in state is. this, created java class extends drawable , holds original background drawable; in ondraw first draws original drawable canvas , own additions. works, state of original drawable doesn't change. i can see setstate of custom drawable called stateset contains android.r.attr.state_pressed among other states. delegate call original drawable, there setstate returns false , state doesn't change. changes when pass stateset containing nothing android.r.attr.state_pressed . it seems if statelistdrawable somehow can announce statesets interested in , caller of setstate respecting that, although didn't find related in docs or android source. this setstate : @override public boolean setstate(int[] stateset) { boolean changed = super.setstate(...

VBA close access after all functions finished -

i have got vba running batch starts macro execute them, trying close down access once functions have finished making new function , placing "application.quit" closing application before functions have finished. anyone have ideas? thanks, simon edit: public function finish() application.quit end function put timer loop in code put db sleep , give time functions run. first, put under option compare or option explicit line in module (note: must in proper module, , not form's module): declare sub sleep lib "kernel32" (byval dwmilliseconds long) then function should this: public function finish() dim x integer x = 1 10 sleep 1000 doevents next x application.quit end function

php - Does setting a password on the postgres user mean that a password is required even when setting pg_hba.conf to trust? -

i have done of php/postgresql development under windows 7, migrating linux. have installed php , postgresql on debian wheezy, , having difficulty connecting postgresql database postgres user. found post on stackoverflow said following: template1=# alter user postgres password 'password'; initially, password, used empty string, didn't work. next used text string, allowed me connect via pg_connect(). after doing more research, found altering pg_hba.conf file , making postgres user trusted wanted do... on making change, still getting errors when password isn't supplied via pg_connect() postgres user, question is: does altering postgres user password cause pg_connect() require password when authentication method set trust? when connect via command line using: psql -u postgres i have no problems... problems begin when connecting via php using pg_connect(). pg_hba.conf file: local postgres trust local ...

javascript - jQuery Mobile Style is not applied -

i have below markup, injected dynamically. fieldcontain not styled. var markup = ''; markup += ('<div data-role="fieldcontain"><textarea cols="40" rows="4" name="" id="comment"></textarea></div><a data-role="button" href="#" id="updatecomment" data-theme="b">post comment</a>'); $('#fbcommentblock').empty().append(markup); dynamically added content must manually enhanced. every jquery mobile widget has unique function, example listview has method called: $('#listviewid').listview('refresh'); but because cant see appending use : $('#contentid').trigger('create'); to style dynamically added content added data-role="content" div tag. if want find more theme read blog article here . there find theme described in detail lot of working examples.

java - What does EntityManager.flush do and why do I need to use it? -

i have ejb saving object database. in example have seen, once data saved (entitymanager.persist) there call entitymanager.flush(); why need this? object saving not attached , not used later in method. in fact, once saved method returns , expect resources released. (the example code on remove call well.) if (somecondition) entitymanager.persist(unattachedentity); else { attachedentityobject.setid(unattachedentity.getid()); } entitymanager.flush(); a call entitymanager.flush(); force data persist in database entitymanager.persist() not (depending on how entitymanager configured : flushmodetype (auto or commit) default it's set auto , flush done automatically if it's set commit persitence of data underlying database delayed when transaction commited).

log4j - EJB cannot locate the log 4j in the classpath -

on 6.1, have ejb deployed in ear , ejb uses log4j. getting error while trying call ejb through remote client: caused by: java.lang.noclassdeffounderror: org.apache.log4j.priority @ java.lang.j9vminternals.verifyimpl(native method) @ java.lang.j9vminternals.verify(j9vminternals.java:69) @ java.lang.j9vminternals.initialize(j9vminternals.java:131) @ com.bmo.olbb.prs.integration.service.util.prsutil.<clinit>(prsutil.java:13) @ java.lang.j9vminternals.initializeimpl(native method) @ java.lang.j9vminternals.initialize(j9vminternals.java:196) ... 10 more caused by: java.lang.classnotfoundexception: org.apache.log4j.priority inside installedapps directroy, in ear folder, have ejb jar , log4j-1.2.15.jar. why getting this? otehr thing how can classnotfoundexception , noclassdeffounderror @ same time? did add log4j jar ejb jar's meta-inf/manifest.mf file? manifest-version: 1.0 class-path: log4j-1.2.15.jar

What's the right way to use different styles/scripts in Meteor depending on browser -

i'm using meteor build site has different css , scripts (jquery mobile) mobile devices desktop browsers. i'd able conditionally include these in head element based on user agent. i'm sure can dynamically injected dom, there meteor best practice kind of thing? i suggest adding browser specific class body element ( client/lib/environment.js ): if(navigator.useragent.indexof("trident/4")>-1) $("body").addclass("ie8"); i use less , have ie8.less file so: .ie8{ //override normal styles here - may have use !important } this doesnt meet goal of loading what's applicable each client, fit bill browser specific styles if files externally stored , using meteorite, maybe use https://atmosphere.meteor.com/package/external-file-loader detect , load needed scripts however, if store files in meteor app, they've been combined , sent browser

Save To Drive Button Doesn't Work -

i wrote simple file server in nodejs serve html page save drive button. html page served @ my_address:1337 , file saved served @ my_address:1338 . upon clicking save drive button, shows "starting download" long time displays failed download. xhr error . i thought due fact file being served different port decided same appengine app. page served @ http://sayodrive.appspot.com/index.html , file served @ http://sayodrive.appspot.com/drivefile.jsp , got same problem. then decided local java web application: same problem. tried changing content disposition attachment (to force download) didn't work either. frustrated, started googling , came across this page claims save drive button doesn't work. went official google drive sdk page , discovered example button doesn't work too. is bad dream? source: index.html <html> <head> <title>test: save drive</title> <!-- --> <link rel="canonical" href=...

file - PLIST seems correct, but execution shows no Results -

i wrote agent monitor critical system files: ag1-launchagents #!/bin/bash arg1=/system/library/launchagents fswatch $arg1 "growlnotify -n "fswatch" -m "fswatch:changed:$arg1" -s" i created same file 6 other directories monitor them seperately changes , print notifications via growlnotify. scripts works fine using command line. the next step autostart ag1-ag7 via *.plist file: <?xml version="1.0" encoding="utf-8"?> <!doctype plist public -//apple computer//dtd plist 1.0//en http://www.apple.com/dtds/propertylist-1.0.dtd > <plist version="1.0"> <dict> <key>label</key> <string>com.user.fswatch</string> <key>programarguments</key> <array> <string>/library/scripts/shell/ag1-launchagent.sh</string> <string>/library/scripts/shell/ag2-launchdaemons.sh</string> <string>/library/scripts/sh...

mysql - CONVERT_TZ not working -

we have script run through php myadmin, follows: update utilities_alert set date=convert_tz(date,'-06:00','00:00'); update utilities_update set date=convert_tz(date,'-06:00','00:00'); update utilities_assetlocation set start=convert_tz(start,'-06:00','00:00'); update utilities_assetlocation set end=convert_tz(end,'-06:00','00:00'); update utilities_idlelog set date=convert_tz(date,'-06:00','00:00'); it's not working , returning null values. came across this http://www.geeksengine.com/article/populate-time-zone-data-for-mysql.html , followed steps , no avail. there may bug in verb, spent time getting frustrated trying this. did work if used format. select convert_tz(timeseen, 'america/new_york','europe/london'); where timeseen datetime field. if have loaded timezone data say, should work.

c++ - C++11 constructor overload resolution and initialiser_lists: clang++ and g++ disagree -

i have small piece of c++11 code g++ (4.7 or 4.8) refuses compile claiming call constructor b2 b2a(x, {p(y)}) ambiguous. clang++ happy code, refuses compile b2 b2b(x, {{p(y)}}) g++ happy compile! both compilers happy b1 constructor either {...} or {{...}} argument. can c++ language lawyer explain compiler correct (if either) , going on? code below: #include <initializer_list> using namespace std; class y {}; class x; template<class t> class p { public: p(t); }; template<class t> class { public: a(initializer_list<t>); }; class b1 { public: b1(const x&, const y &); b1(const x&, const a<y> &); }; class b2 { public: b2(const x &, const p<y> &); b2(const x &, const a<p<y>> &); }; int f(const x &x, const y y) { b1 b1a(x, {y}); b1 b1b(x, {{y}}); b2 b2a(x, {p<y>(y)}); b2 b2b(x, {{p<y>(y)}}); return 0; } and compiler errors, clang: $ cla...

jquery - Is it possible to make parseFloat from several textboxes? -

is possible read , handle numerical values 2 textboxes, using parsefloat? such code not work me. suspect problem somehow connected second textbox?! <div style="padding:10px;"> enter number 1: <input class="textbox" value=""/> </div> <div style="padding:10px;"> enter number 2: <input class="textbox2" value=""/> </div> <div> <button id="get">calculate</button> </div> <div> <h4>result: <label id="msg"></label></h4> </div> <script type="text/javascript"> $("button:#get").click(function () { var num1 = parsefloat($('input:textbox').val()); var num2 = parsefloat($('input:textbox2').val()); var result = ((num1 * num2)); $('#msg').html(result); }); </script> the problem selectors. $(document).on('click',...

vb.net - Implicit Line conversion feature in VS 2012 -

how disable implicit line conversions vb.net code written in visual studio 2012 ? this doesn't appear possible. disabling implicit line continuation

python - Changing the file name of a Sqlite3 database connection, while keeping keeping entire data -

i have like....: conn = sqlite3.connect(db_path) ... ... conn.close() my db_path ":memory:" or real path, how change "newfile.db" while keeping of data work. in short need go from :memory: a_new_path.db old_path.db new_path.db i know they're both 1 in same..... anyways, have no clue. skimmed through docs, without luck. maybe missed something. i don't know if helps, i'm trying implement file menu functions: open new(:memory:), open existing(existing file), save , save as. you cannot change file name of database. python's built-in database api not have mechanism copy databases; have copy file itself, not possible in-memory databases. if use apsw instead, can use backup api .

xcode - Why am I getting this incorrect "unused variable" message? -

my code looks this: -(void)setguidisplaymode:(id)mode { // constrain inputs if ( [mode intvalue] < 3 && [mode intvalue] > -1 ) { guidisplaymode=[mode intvalue]; } else { guidisplaymode=0; } nsstring *titles[3]={ @"narg", @"fubar", @"eep"}; [mview[0] setvalue:titles[guidisplaymode] forkey:@"inputtitle"]; } when build in xcode 4.6.3 using apple llvm compiler 4.2, "unused entity issue" "unused variable 'titles'" warning incorrect. when @ compiler output, there no warning there, apparently warning coming post-compilation "indexing" xcode does. since warning isn't coming compiler, there can it? known xcode bug? thanks, chris

carousel - How do I create a popup Jquery-mobile window with multiple pages that can be swiped through -

i trying create popup control area on tablet interface, , experienced programmer, have never done web based programming before in serious way. i have black bar (will status information) when tapped pushes overlay on bottom 40% of screen. within want have several pages of information can paged through swiping horizontally number of pages being dependent on add-ons have been installed. each page web pages controls can dragged main portion of page, or input controls entering or updating information. i use jquery-mobile ability have multiple pages loaded , switch between them in popup there isn't loading wait. update of input , data done ajax-json call responses. i running problems trying figure out how carousel of web pages, few carousel js libraries have tried seem work oddly popup/swipe interface. any recomendations on best way this, or examples of trying do? thanks - robert are looking swipe libraries? http://jgestures.codeplex.com/ http://labs.rampinte...

html - CSS diaplay inline-block top aligment -

Image
i have few divs want display separate boxes in 2 columns. html: <div class="short-desk"> <p>box 1</p> </div> <div class="short-desk"> <p>box 2</p> </div> ... css: .short-desk { display: inline-block; width: 42%; height: 180px; border:1px solid #000; } result: i tried use css diaplay:inline-block property, there problem alignment: 2 boxes in 1 row not on same level. actually working ok small text inside, but, when put little bit longer text, level changes , doesn't match each other. see demo here: http://jsfiddle.net/zur4ik/tugup/1/ how can fix this? actually, inadvertently placed solution in question title. adding style definition seems give intended behaviour: .short-desk { vertical-align:top; } here's updated jsfiddle . if isn't looking for, let me know , i'll happy further!

amazon dynamodb - Not finding the usual QueryRequest.withKeyConditions() method(Dynamo DB) -

i new dynamo db. i'm using amazon ddb documentation implement query method. trying similar example provided(the replies thread example). i not able find 'withkeyconditionsmethod' under queryrequest. i'm missing? if using older version of api (in java package com.amazonaws.services.dynamodb.model ) syntax little different, , have use withrangekeycondition . here's queryrequest class older version, can see how it's deprecated: http://docs.aws.amazon.com/awsjavasdk/latest/javadoc/com/amazonaws/services/dynamodb/model/queryrequest.html if using newer version of api (which should, in java package com.amazonaws.services.dynamodbv2.model , see queryrequest has withkeyconditions method, shown here: http://docs.aws.amazon.com/awsjavasdk/latest/javadoc/com/amazonaws/services/dynamodbv2/model/queryrequest.html

ruby - Twilio: Finding the SID of a call or a conference -

i having trouble find sid of call or conference once created. i need these parameters, in order modify live call, or kick participant conference. starting basic example (i'm coding in ruby) : //paramaters\ require 'twilio-ruby' account_sid = '//myaccount#' auth_token = '//myauthtoken' creating call : @client = twilio::rest::client.new account_sid, auth_token call = @client.account.calls.create({:from => '//outgoing#', :to => '//incoming#', :method => 'get'}) puts call.sid then hangup part : @hangup = @client.account.calls.get("callsid") @call.update(:status => 'completed') puts @call.direction so can see, execute second part (hangup), need have sid of call created in order modify later (either redirect it, put in conference, or hang up.) puts call.sid should outputting sid console. if need use later, can assign variable inst...

SQL Server Stored Procedure Combining 2 table results -

i have 2 tables: customertransaction id (int auto int) customername (varchar) customernumber (int) date (date) weeklyamount (int) customers : customername (varchar) customernumber (int) customertype (int) customerdate (date) this database not normalized, , can not change it. customername , need do: i need result show 1 table of information customers each row matches customer number. in customertransaction , merely grouping of total sums per customername of amount. i using: select customernumber, sum (weeklyamount) total customers.records group customernumber; to sum of each customernumber . problem can not include customername in group by. name of customers change on time. told grab data customers , result above , match customernumbers the problem not know stored procedure. know how done? need rows matched. select customernumber, sum (weeklyamount) total customers.records group customernumber; what customers.records ? that...

c# - Looping through children controls inside Updatepanel -

i have written method loops through properties of object , maps them controls have same name (or prefix + name). issue have controls inside update panel (drop down lists change when different option selected) not being found when running through method. read this , adapted method below accommodate that, still not find controls inside update panel. controls have ids , runat="server". public static void mapobjecttopage(this object obj, control parent, string prefix = "") { type type = obj.gettype(); dictionary<string, propertyinfo> props = type.getproperties(bindingflags.public | bindingflags.instance).todictionary(info => prefix + info.name.tolower()); controlcollection thecontrols = parent updatepanel ? ((updatepanel)parent).contenttemplatecontainer.controls : parent.controls; foreach (control c in thecontrols) { if (props.keys.contains(c.clientid.tolower()) && props[c.clientid.tolower()].getvalue(obj, null) !=...

cryptography - How does this message splitting work? -

i have been trying reverse engineer various encryption algorithms in compiled code recently, , came upon code. part of rsa algorithm. i've noted key size small encrypt/decrypt data it's supposed (in case int ), code splits message 2 pieces, , encrypt/decrypt each, sum them together. i've pulled segments of code splits , joins message, , experimented it. appears numerical values uses dependent on n modulus. so, scheme, , how work? uint n = 32437; uint origval = 12345; uint newval = 0; (int = 0; < 2; ++i) { ulong num = (ulong)origval * 43827549; //uint num2 = ((origval - (uint)(num >> 32)) / 2 + (uint)(num >> 32)) >> 14; uint num2 = (origval + (uint)(num >> 32)) / 32768; origval -= num2 * n; // rsa encrypt/decrypt here newval *= n; newval += origval; origval = num2; } // put newval origval, reverse origval = newval; newval = 0; (int = 0; < 2; ++i) { ulong num = (ulong)origval * 4382754...

c# - menucommandservice with basicdesignerloader -

i'm working on project user can add/edit controls surface described here here everything works fine editing , saving. i'm using basicdesignerloader instead of codedomdesignerloader since not want generate vb or c# code rather load , save xml. for reason, menucommandservice not work basicdesignerloader. it'll work fine though if change codedomdesignerloader xml part gets quirky. has found way able use menucommandservice while under basicdesignerloader? thanks in advance. i'm working on similar project , start microsoft sample. http://support.microsoft.com/default.aspx?scid=kb;en-us;813808 serialize in xml not use basicdesignerloader (it implements designerloader inheriting designerloader). after fixes on contextmenu works fine (main bug chaching last context menu). actually, in implementation of designerloader there several service registrations. in basicdesignerloader something's missing...

hyperlink - How can I open links in the background? -

i have little coding knowledge outside of html appreciate time , patience. i not looking write code me, push in right direction. my website works sending customers third party website. have been provided several links plant cookie in users browser when click on it. i make 3 or 4 links open in background (so cookie planted) without user seeing these websites open. does have suggestions how this? tried using <div id="follow-links" style="display: none;"> <iframe name="1" src="link1" width="1" height="1"> <iframe name="2" src="link2" width="1" height="1"> <iframe name="3" src="link3" width="1" height="1"> </div> but didn't seem work. i apologize again inexperience , appreciate , advice no matter how big or small. :)

Uploading files via php in drupal -

i trying user upload file , save file server using php. code works on non-drupal website not on drupal. here code: <?php if ($_files["file"]["error"] > 0) { echo "return code: " . $_files["file"]["error"] . "<br>"; } else { echo "upload: " . $_files["file"]["name"] . "<br>"; echo "type: " . $_files["file"]["type"] . "<br>"; echo "size: " . ($_files["file"]["size"] / 1024) . " kb<br>"; echo "temp file: " . $_files["file"]["tmp_name"] . "<br>"; if (file_exists("upload/" . $_files["file"]["name"])) { echo $_files["file"]["name"] . " exists. "; } else { move_uploaded_file($_files["file"][...

Apache-POI field formating -

how specify if information numeric? it.mopid field suppose numeric field comes through text. thoughts this? cellmopid.setcellvalue(it.mopid) cellstartdate.setcellvalue("" + it.som) you have change cell type, like: cell.setcelltype(cell.cell_type_numeric); http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/cell.html apache poi - number integer

github - Git short cut for adding, commiting and pushing to a remote repo -

is possible run following commands @ once: 1. git add . 2. git commit -m "message" 3. git push orgin/master i know the first 2 can sort of joined this: git commit -am "message" i want push remote after committing locally without having go through these steps. imho possible, if you programmer contributing you using 1 local repository push changes remote and takes away flexibility , power git gives you. if so, you can use 'alias' so can job. $ gitfunction() { > git add . > git commit -m "$1" > git push origin } $ alias git-all="gitfunction" $ git-all 'commit message' //will you. or add .git/config file. [alias] sync = "!sync() { git add . && git commit -m \"$1\" && git push $2; }; sync" later can use $git sync 'commit message' remote_repo but shouldn't doing this!! why? though off topic, love quote principle of su...

c++ - Measuring performance/throughput of fast code ignoring processor speed? -

is there way write "tool" analyse produced x86 assembly language c/c++ program , measure performance in such way, wouldnt matter if ran on 1ghz or 3ghz processor? i thinking more along lines of instruction throughput? how write such tool? possible? i'm pretty sure has equivalent halting problem, in case can't done. things such branch prediction, memory accesses, , memory caching change performance irrespective of speed of cpu upon program run.

objective c - XCode 4 - .xib icon is grayed out -

what mean when icon greyed out in file tree viewer? my main problem trying navigate view view on button click method. - (ibaction) organizemeetingbuttonpressed:(id)sender { organizemeetingviewcontroller *viewcontroller = [[organizemeetingviewcontroller alloc] initwithnibname:@"organizemeetingview" bundle:nil]; [self.navigationcontroller pushviewcontroller:viewcontroller animated:yes]; } this written in controller1 trying access controller 2 (organizemeetingviewcontroller). believe error in xcode connections actual view. hence question greyed out icon

javascript - document.getElementById() returns NULL getting value from DropDownList -

i have code: <td style="text-align: center;"> <asp:dropdownlist id="ddloprep" runat="server" width="70px"> <asp:listitem value="1">1</asp:listitem> <asp:listitem value="2">2</asp:listitem> <asp:listitem value="3">3</asp:listitem> </asp:dropdownlist> </td> now want show confirmation msg selected value in ddloprep: <asp:button id="btnrelease" runat="server" text="release" width="130px" onclientclick="return confirmrelease();" onclick="btnrelease_click" /> <script type="text/javascript"> function confirmrelease() { var oprep = document.getelementbyid("ddloprep"); return confirm('are sure want release configuration: oprep: ' + oprep ...

PHP Including a file based on pathinfo - security concern? -

i redirecting page requests through file called index.php looks @ url visitor requested , sees if there template file match. for example, http://www.website.com/contact route index.php script , should check see if file /var/html/template/contact.tpl exists , include if does. my concern regards security , null characters, dots , slashes, etc. kind of filter need applying code below or use of pathinfo , directory prefix enough? don't want able maliciously include files outside of designated template directory. <?php define ('templates', '/var/html/templates'); $page = pathinfo ($_server['request_uri'], pathinfo_filename); if (file_exists (templates . '/' . $page . '.tpl')) { include (templates . '/' . $page . '.tpl'); } else { header ('http/1.0 404 not found'); echo 'sorry page not found'; } ?> to 100% safe, make list of allowed pages , check it's in array before re...

c++ - Converting polygon coordinates from Double to Long for use with Clipper library -

i have 2 polygons vertices stored double coordinates. i'd find intersecting area of these polygons, i'm looking @ clipper library (c++ version). problem is, clipper works integer math (it uses long type). is there way can safely transform both polygons same scale factor, convert coordinates longs, perform intersection algorithm clipper, , scale resulting intersection polygon down same factor, , convert double without loss of precision? i can't quite head around how that. you can use simple multiplier convert between two: /* using power-of-two because representable , makes scaling operation (not rounding!) lossless. value 1024 preserves 3 decimal digits. */ double const scale = 1024.0; // representable range double const min_value = std::numeric_limits<long>::min() / scale; double const max_value = std::numeric_limits<long>::max() / scale; long to_long(double v) { if(v < 0) { if(v < min_value) throw out_of_r...

gmaps4rails - Google-Maps-for-Rails Direction Wiki Explaination Needed -

hi working on trash bin/recycling bin location application using google maps rails. i have recyclingbin.rb model address attributes, enough put markers on map can displayed using gem. believe gem converts model , attributes json data. i trying implement feature can input location , direction nearest marker. i have looked @ wiki , https://github.com/apneadiving/google-maps-for-rails/wiki/direction am suppose put in view ? { "data" => { "from" => "paris, france", "to" => "toulon, france" } } }) %> with embedded location now? understand can pass options reference google. the wiki quite short, can give me quick explanation ? the wiki need more work. have simple app working shows directions on map location (pre-defined) location <%= gmaps("map_options" => {"zoom" => 14}, "markers" => { "data" => @json }, "direction" => ...

stress testing - How to Load Test a Web Service From a Text File of URLs -

i working on load testing web service request of form: get http://host/my/app/some-data where some-data string serves input logic behind service. have 1 million urls random values some-data , , want try simulate load 1m urls. get http://host/my/app/some-data_1 http://host/my/app/some-data_2 ... http://host/my/app/some-data_1e6 i dont know how , have not made substantial progress towards goal. how do this? that's pretty trivial task load testing software, i'm curious why haven't had success. didn't mention level of load trying test - if looking high level of concurrency, may rule out many of tools. so: i'd start researching load testing tools can handle level of concurrency need , within budget.

xml - Is it possible to dynamically specify the location of an external entities file? -

i have generic xml snippets need use different entities files depending on context (project) using in. don't want copy/paste them on place, duplicating code. xml entities don't propagate xincluded elements , it's not possible dynamically specify location either (which, well, wouldn't work same reason entities don't propagate). what feasible way feed different entity files generic xml snippet, depending on context, works all/most xml tools? depends on processing environment. many xml parsers allow specify entityresolver or xmlresolver callback process , resolve external entity references. layered on top of this, find parsers or other utilities support oasis catalogs, allow define indirections entity references in xml catalog file. personally, prefer not use entity references kind of application, use custom markup instead. (some people prefer xlink/xinclude, prefer roll own.) it's easy process links/transclusions using xslt. particular benefit i...