Posts

Showing posts from February, 2011

c# - MVC 4 @Html.DropDownListFor() not passing model values to dropdown -

i new mvc , trying test application feet wet. part of application generate form drop down box. use @html.dropdownlistfor() generate this, , on create form drop down works fine. when go edit form model value not passing drop down. selectlist item public static string[] onofflist() { var ret = new string[] { "on", "off" }; return ret; } form code @html.dropdownlistfor(model => model.servicecondition, new selectlist(onoffdropdownhelper.onofflist())) for instance assume model.servicecondition = "off". for reason whenever call form dropdown value "on", seems ignoring model value. i have tried this @html.dropdownlistfor(model => model.servicecondition, new selectlist(onoffdropdownhelper.onofflist(), "off")) to mandate "off" value, still coming "on" selected value in drop down. i reiterate, know model value "off", , created identical "create" for

asp classic - Mixing ASP.NET pages with ASP Pages in windows server 2003 IIS -

i've got lot of classic asp pages in production on windows server 2003 64-bit machine. i've got .net on there working. i'm starting move asp ajax pages (pages receive ajax calls classic asp) asp.net/c# take advantage of business/data/logging layer i've got set there in c#. i've figured on securing aspx pages way of "token" create in database in asp , pass aspx page, uses validate it's legit call , destroys it. my big question - aside making aspx pages, need compile app same site asp site? assumed i'd - deploy there alongside asp classic pages, , call aspx individually needed. is strategy sound? need special performance or configuration make asp classic , asp.net coexist well? thanks - migration has been bear because of extreme asp classic dependency. it work fine. i've seen on several sites. put them in same directory. your biggest issue asp , asp.net pages each have own session , application variables won't shared

php - Improving while coding -

i need check if monthly contract exist , if signed. improve code because seems heavy it's time switch pdo , maybe can rewrite things speed script basically have table 2 columns 1st column have date reference, 2013/jan, 2013/fev ... , 2nd column display check if document exist , have signature. here code. there way improve? // query db // contract $contract = array(); $query1 = mysql_query("select * contracts ic_id='28'"); while ($row = mysql_fetch_assoc($query1)) { $contract[] = $row['month']; } $signature = array(); $query1 = mysql_query("select * contracts ic_id='28'"); while ($row = mysql_fetch_assoc($query1)) { $signature[] = $row['sign']; } // start , end date $startyear = '2012'; $startmonth = '12'; $endyear = '2013'; $endmonth = '12'; $startdate = strtotime("$startyear/$startmonth/01"); $end

php - Multiple sending of email with attachment - repost -

i re-posting because no 1 answered previous post. i trying send emails multiple recipients respective pdf files attached. successful sending emails multiple recipient recipients receive multiple emails. number of emails received recipient number of email addresses stored in database. the second problem have encountered attachment sent recipients same file. scenario should this: recipient should have email attached pdf a, recipient b pdf b, on , fort. those pdf's have file names correspond unique control number each recipient has. e.g. recipient has control number 1234, pdf named 1234.pdf. i tried wile loop in $ctrl_no = mysql_result($ctrl, 0) gives error saying memory limit of server has reached. hope solve 2 problems. $input = addslashes($_post['dep']); $email = "select email_address student y y.center = '$input'"; if ($p_address=mysql

Optimization of PHP -

hello i've got php code in project $idlist = array() // code // code while ($row = mysql_fetch_array($res)) { $roid=$row['id']; $roroom=$row['room']; $ro24=$row['24.09']; $ro25=$row['25.09']; $ro26=$row['26.09']; $ro27=$row['27.09']; $ro28=$row['28.09']; $ro29=$row['29.09']; $ro30=$row['30.09']; $ro01=$row['01.10']; $ro02=$row['02.10']; $ro03=$row['03.10']; $ro04=$row['04.10']; $ro05=$row['05.10']; $ro06=$row['06.10']; $ro07=$row['07.10']; if (in_array($ro24, $idlist)) { } else { array_push($idlist, $ro24); } if (in_array($ro25, $idlist)) { } else { array_push($idlist, $ro25); } if (in_array($ro26, $idlist)) { } else { array_push($idlist, $ro26); } if (in_array($ro27, $idlist)) { } else { array_push($idlist, $ro27); } if (in_array($ro28, $idlist)) { } else { array_push($idlist, $ro28); } if (in_array($ro29, $idlist)) { } else { array_push($idlist, $r

javascript - jQuery - Sticky header that shrinks when scrolling down -

i wonder how make sticky header shrink(with animation) when scroll down page , goes normal state when page scrolled top. here 2 examples clearify: http://themenectar.com/demo/salient/ http://www.kriesi.at/themes/enfold/ i part make fixed, how should shrink header when user scrolls down? thanks ton this should looking using jquery. $(function(){ $('#header_nav').data('size','big'); }); $(window).scroll(function(){ if($(document).scrolltop() > 0) { if($('#header_nav').data('size') == 'big') { $('#header_nav').data('size','small'); $('#header_nav').stop().animate({ height:'40px' },600); } } else { if($('#header_nav').data('size') == 'small') { $('#header_nav').data('size','big'); $('#header_nav').stop().animate({ height:'100px

c++ - object inheritance virtual function run fail error -

shape *shape[100];//global scope square sqr;//global scope void inputdata() { int len,width; cout << "enter length"; cin >> len; cout << "enter width"; cin >> width; square sqr(len,width); shape[0] = &sqr; //----> if shape[0]->computearea(); here works fine. } void computearea() { shape[0]->computearea(); // --> run fail error } shape parent class , square sub-class. both have computearea(); when code reach computearea() having weird run fail error. program terminate without giving me errors me find , fix it...it show run fail , stop program. the program able run , show ->computearea() if code within inputdata() when separate it, fail run properly. solution this? this square square sqr(len,width); is instance local scope of inputdata . once leave scope, left dangling pointer in shape[0] . if want set global sqr , need sqr = square(len,width); you should find solution doesn't rely on global

ios - Adding a new build rule to parse all rtf files -

Image
xcode includes flexible build rules system. documentation non-existant however. a project working on ios 5 , ios 6 includes rtf file. ios 6, can convert rtf file archived nsattributedstring object, load @ runtimeand display directly uitextview. ios 5, can't (without lot of work in core text...) want text without style info. i wrote command line tool, rtftodata takes rtf file input , generates .txt file , .data file (where .data file contains version of styled text project knows how use.) here syntax of command line tool: rtftodata [-o] source_path [destination_path] -o (optional) overwite existing files source_path (required) path source rtf file (must have extension "rtf" or "rtf" destination_directory (optional.) writes output files source file directory if no destination specified destination_directory must exist if specified. i want set project can add .rtf files sources (with "add target" checkbox not checked.) wa

javascript - How to use jquery in a string? -

using jquery, how can search through string of html code, example: <script type="text/javascript"> alert($('#t','<span id="t">d</span>').html()); </script> i expect d in alert, undefined... does know how this? actually use ajax request html string of page. if try paste string in tag, current page gets messed up. wanted search through given string. the context parameter context within jquery search. i.e. @ child elements of context not @ context itself. works: alert($('#t','<span><span id="t">d</span></span>').html()); i'm not quite sure you're trying there though. have element, no need search it. example never applied real world problem.

iphone - Documentation about iOS autocorrect -

im writing paper spell correction ios , wonder if there's available documentation apple how ios handles user input in form of validation , generate possible word thinks user going type? in short terms: wonder can find documentation behind auto correct in ios , how works. thanks. here note 2 apple patents involving autocorrect. they involve using timing , geometry, parts of speech, , contextual lookup.

javascript - Syntax highlighting Markdown on a webpage -

i writing basic markdown editor , wish markdown syntax highlighted. there seem plenty of resources on how have code within markdown highlighted, want markdown itself syntax highlighted. there existing javascript/jquery libraries doing so? if not, place start crafting own? highlight.js seems support markdown syntax.

image processing - Normalized cuts with Matlab 2013a -

i using normalized cuts package http://www.cis.upenn.edu/~jshi/software/ncut_9.zip (on windows 7) this used work fine matlab2010a. have upgraded matlab2013a (32 bit student version) , following error: error using arpackc expect 2 output arguments error in eigs_new (line 240) arpackc( aupdfun, ido, ... error in ncut (line 83) [vbar,s,convergence] = eigs_new(@mex_w_times_x_symmetric,size(p,1),nbeigenvalues,'la',options,tril(p)); error in ncutw (line 9) [ncuteigenvectors,ncuteigenvalues] = ncut(w,nbcluster); error in ncutimage (line 18) [ncutdiscrete,ncuteigenvectors,ncuteigenvalues] = ncutw(w,nbsegments); error in demoncutimage (line 25) [seglabel,ncutdiscrete,ncuteigenvectors,ncuteigenvalues,w,imageedges]= ncutimage(i,nbsegments); obviously new_eigs() function in ncuts incompatible arpack version in latest matlab. does know of workaround this? normalised uses modified version of matlab's eigs() function. why can't use matlab's built-in

c# - Force authentification when connecting to Facebook app -

to access facebook app use : https://graph.facebook.com/oauth/authorize?client_id=<app id>&redirect_uri=http://www.facebook.com/connect/login_success.html&type=user_agent&display=popup the problem have if navigate address before access token has expired, former user stay connected , facebook authentification page not shown. so question : how can sure navigate authentification page ? and question : possible clear previous email or phone on authentification page ? thanks help. answer first question : var fb = new facebookclient(); var logouurl = fb.getlogouturl(new { access_token = _accesstoken, next = "https://www.facebook.com/connect/login_success.html" }); webbrowser.navigate(logouturl); http://blog.prabir.me/post/facebook-csharp-sdk-writing-your-first-facebook-application-v6.aspx

responsive design - Common CSS Media Queries Break Points -

i working on responsive web site css media queries. is following organization devices? phone, ipad (landscape & portrait), desktop , laptop, large screen what common media queries break-point values? i planning use following breakpoints: 320: smartphone portrait 481: smartphone landscape 641 or 768 ???: ipad portrait ??? 961: ipad landscape / small laptop ??? 1025: desktop , laptop 1281: wide screen what think? have few doubts ??? points. rather try target @media rules @ specific devices, arguably more practical base them on particular layout instead. is, gradually narrow desktop browser window , observe natural breakpoints content. it's different every site. long design flows @ each browser width, should work pretty reliably on screen size (and there lots , lots of them out there.)

Using php and mysql with jquery bMap -

for university project creating website helps find golf courses around ireland & n.ireland. have done using bmap - jquery , google maps. can choose county sidebar , shown on map. have used following code this: $(document).ready(function(){ $("#map").bmap({ mapzoom: 8, mapcenter:[53.65115, -8.81104], mapsidebar:"sidebar", //id of div use sidebar markers:{"data":[ {"lat":"54.66625","lng":"-6.28647","title":"county antrim","rnd":"1","body":"there 38 golf clubs in county antrim, <a href='counties/antrim.html'>view here</a>"}, {"lat":"54.29401","lng":"-6.66592","title":"county armagh","rnd":"1","body":"there 8 golf clubs in county armagh, <a href='counties/armag

php - .htaccess php_value display_errors settings breaks with error 500 -

i installed new xampp version 1.8.1 windows apache 2.4.3 , php 5.4.7. none of sites working, returning http error 500 (internal server error). traced reason .htaccess line php_value display_errors off when comment it, site works. have other php_value command's works fine eq. php_value error_reporting -1 . google solution, people php must loaded dynamic shared object (dso) aka. apache module. in case (httpd-xampp.conf): loadfile "/xampp/php/php5ts.dll" loadmodule php5_module "/xampp/php/php5apache2_4.dll" so not creating problem. i prefer solution keeps php_value display_errors off inside .htaccess file sake of other people team. pls help == new development == after commenting unrelated parts of .htaccess file using mod_expires.c , badly writen, aka. correct way put in if example: <ifmodule mod_expires.c> expiresactive on <filesmatch "\.(gif|jpg|jpeg|tif|tiff|bmp|png|js|css|ico)$"> expiresdefault &q

django - AttributeError: 'Socket' object has no attribute 'recv' -

i'm trying example( https://github.com/sontek/django-tictactoe/tree/master/small_tictactoe ) gevent-socketio running, but strange error: internal server error: /socket.io/1/websocket/49318546715 traceback (most recent call last): file "/users/user/envs/echtzeit/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response response = callback(request, *callback_args, **callback_kwargs) file "/users/user/envs/echtzeit/small_tictactoe/apps/core/views.py", line 37, in socketio message = socketio.recv() attributeerror: 'socket' object has no attribute 'recv' but found socketio.recv() used in other examples documentations well... this example 2 year old. since api changed.as can see there no recv method exist. can check method exists here :

c - FreeRTOS - Stack corruption on STM32F4 -

i having problems think stack corruption of error of configuration while running freertos on stm32f407 target. i have looked @ freertos stack corruption on stm32f4 gcc got no there. the application runs 2 tasks , relies on 1 can interrupt. workflow follows: the 2 tasks, network_task , app_task created along 2 queues, raw_msg_queue , app_msg_queue. can interrupt set up. the network_task has highest priority , starts waiting on raw_msg_queue, indefinitely. the app_task next , starts waiting on app_msg_queue. the can interrupt triggers because of external event, adding can message raw_msg_queue. the network_task wakes up, process message, adds processed message app_msg_queue , continues wait on raw_msg_queue. the app_task wakes , hard fault. the thing have wrapped calls app_task makes xqueuereceive in 2 steps because of end-user convenience , portability. app_task total function chain calls network_receive(..) -> os_queue_receive(..) -> xqueuereceive(..). works w

php - Classes - require conflict in constructor -

i'm coding wordpress plugin , i'm not sure regarding function name conflict.. i have file named test_handling.php contains following content : function testing() { echo 'test'; } i included file in class constructor (file named testcls.class.php ) : class testcls { function __construct() { require_once('test_handling.php'); testing(); } function otherfunction() { testing(); } // ... } in case, know if testing() function available in testcls class, or can create conflicts if other wp plugin has function same name ? even same name, functions have different scope if defined class method. make call regular function following: testing(); and result be: 'test' the class method need instance of class or statically called. call method class need following formats: $class->test(); or otherplugin::test(); to sum up, function test different if defined class method. then, not have conf

C# Inheritance, adding new methods -

ok i've been searching while trying find anwer question difficult phrase asking here. i'm inheriting class like class (int a, int b, int c) public a(int a, int b, int c) { } class b : public b(int a, int b, int c) base: (a, b, c) public void blah(int something) { } why can't , : b classb = new b(1,2,3); classb.blah(4); instead have do public virtual void blah(int something) { } in class a, in class b: public override void blah(int something) { //method used in b not a. } so though have no intention of ever using method in class still have declare virtual? if i'm inheriting class c : b what? have declare stuff in c? your assumption has no meaning, @ least as understood. consider following example: public class base {} public class derived : base { public void derivedspecificmethod() { } } if derived d = new derived(); //as specify in code example d.derivedspecificmethod(); //you can this. the virtual may need

java - How to get the board without maximize then minimize -

i try make board game in java have problem in board must maximize minimize window wanted board make class of square takes color , position , 1 board package eg.edu.guc.loa.gui; import java.awt.borderlayout; import java.awt.color; import java.awt.component; import java.awt.gridlayout; import javax.swing.jframe; import javax.swing.jpanel; public class boardgui extends jframe { public boardgui() { setsize(600, 600); setvisible(true); getcontentpane().setlayout(new gridlayout(8,8)); jpanel [][]board= new jpanel[8][8]; for(int i=0;i<8;i++) { for(int j=0;j<8;j++) { if(i%2==0) { if(j%2==0) { board[i][j]=new square(color.black,0); add(board[i][j],borderlayout.center); } else { if(j%2!=0)

c# - Seeding Many to Many EF Code First Relationship -

there few other posts on topic saw not able correct answer yet (my own fault sure) want seed database , have set many many relationship, can't figure out how seed second entity first entities id. var users = new list<user>() { new user() { id = 1, firstname = "clark", lastname = "kent" }, new user() { id = 2, firstname = "lex", lastname = "luther" } }; users.foreach(p => context.users.add(p)); var messages = new list<message>() { new message() { id = 1, senderid = 2, recipients = new list<user> { id = 2, id = 3} // <<< problem here } } messages.foreach(p => context.messages.add(p));

java - Creating muti user access login form -

i have created login form system have created. have 1 user access login meaning 1 login whole system. here want , want have multiple user logins such doctor , nurse , admin . there should restrictions well, such if user logged in doctor or nurse, user can view details , else if user has logged in admin , user can access part in system. here have done far:- private void btnenteractionperformed(java.awt.event.actionevent evt) { string password=new string (txtpassword.getpassword()); //method password password field string username=txtusername.gettext(); if(username.equals("admin") && password.equals("admin123")) { joptionpane.showmessagedialog(frame,"welcome system","welcome",joptionpane.information_message); main_menu enter=new main_menu(); enter.setvisible(true); close(); } else { joptionpane.showmessagedialog(frame,"wrong use

What indexes are created when indexing a document in elasticsearch -

if create first document of it's type, or put mapping, index created each field? obviously if set "index" "analyzed" or "not analyzed" field indexed. is there way store field can retrieved never searched by? imagine save lot of space? if set "no" save space? will still able search this, take more time, or totally unsearchable? is there way make field indexed after documents inserted , change mind? for example, might have mapping: { "book":{"properties":{ "title":{"type":"string", "index":"not_analyzed"}, "shelf":{"type":"long","index":"no"} }}} so want able search title, retrieve shelf book on index:no indeed not create index field, saves space. once you've done can't search particular field anymore. perhaps useful in context know aboutthe _source field, returned default , in

c# - Pulling string from xml -

the xml coming url , need pull string "n0014e1" it. not sure why code not working. put try block around , "data root level invalid" xml: <obj is="c2g:network " xsi:schemalocation="http://obix.org/ns/schema/1.0/obi/xsd" href="http://192.168.2.230/obix/config/"> <ref name="n0014e1" is="c2g:local c2g:node"xsi:schemalocation="http://obix.org/ns/sc/1.0/obix/xsd" href="n0014e1/"></ref> </obj> c# code: public static string nodepath = "http://" + mainclass.ipaddress + obixpath; public static void xmldata() { xmldocument nodevalue = new xmldocument(); nodevalue.loadxml(nodepath); var nodes = nodevalue.selectnodes(nodepath); foreach (xmlnode node in nodes) { httpcontext.current.response.write(node.selectsinglenode("//ref name").value); console.writeline(node.value);

java - How to check if an imageview has an image in it and skip over the image to the next imageview -

kinda hangman how skip on imageview if in , check see if in trying check imageview if there image in it code final boolean imagethere = mimageview17.setbackgroundresource(null); public void image6(){ randomnumber(); final int thisletter = currentletter; final boolean imagethere = mimageview17.setbackgroundresource(null); mimageview6 = (imageview) findviewbyid(r.id.imageview6); mimageview6.setimageresource(thisletter); mimageview6.bringtofront(); mimageview17 = (imageview)findviewbyid(r.id.imageview17); mimageview6.setonclicklistener(new onclicklistener() { public void onclick(view v) { // todo auto-generated method stub if (imagethere == false) { mimageview17.setimageresource(thisletter); mimageview17.bringtofront(); mimageview6.setimageresource(r.drawable.whitespace); } else { mimageview18.setimageresource(thislet

android - Localization of mobile apps - Any resources available for the basics? -

i have ios app intend localize bunch of languages @ point. instead of going translation service , translate scratch, wonder if there resources basics translated? resources such open source localized strings (does exist?), databases, web services (not google translate doesn't work languages , technology terms). in case, don't have many sentences, it's more question of single words. imagine words such below translated mobile apps: camera roll, cancel, delete, double-tap, swipe, notification, home, share, ok etc. ray has examples . and apple you can use translating services such this one and jkublcek wrote decent translater use google's api auto translation.

Grails Pagination -

hello im tedious question! trying table paginate. there 12 users in table. here controller function def listduplicates(params) { def result = user.getallwithduplicateids() def totaldupcount = result.size() /*sout troubleshooting */ system.out.println("duplicate:" + result.id + " " + result.username) params.max = math.min(params.max ? params.int('max') : 10, 100) return [resultlist: result, totaldupcount: totaldupcount, params:params ] } here view <div> <fieldset class="warningfieldset"> <h1 style="color: red" align="center"> <g:message code="duplicate ids" /> </h1> <p style="color: red; margin-left: 20px;">duplicate ids found!</p> <table> <thead> <tr>

html - Prevent automatic line breaks in a <code> tag -

Image
i have html code tag, wrapped in in pre tag fixed width , getting ugly automatic line breaks: what want achieve is, text not automatically broken on spaces, when add white-space: nowrap code element, whole thing collapses single line, \n , \r characters ignored well: does have idea how prevent automatic line breaks, keep intended line breaks? the problem caused twitter bootstrap. whatever reason, added following styles code tag: white-space:pre; white-space:pre-wrap; word-break:break-all; word-wrap:break-word; by overwriting styles with: white-space: pre; word-break: normal; word-wrap: normal; the problem fixed.

c# - Does Creating a Variable to hold a cast Save Overhead -

when need save big list of custom objects between postbacks on asp.net project, save them in session variable, cast them list<> in property this public partial class mypage : page { private list<mystorageobject> mylist { {return (list<mystorageobject>) session["mysessionstring"]; } set { session["mysessionstring"] = value; } } } then put list of objects in there, , call in later postback. think pretty standard way make objects last longer page lifecycle. but question is, when i'm using list more once, i'm going few things it, can't think every time access it, it's casting object list<> if create variable looks it's avoiding casting. private void dostuffwithmylist() { var x = mylist; //assuming i'm going call list 20 times in method x.first(); // more efficient / cleaner mylist.first(); // this?

looking for excel formula combining columns and rows -

imagine spreadsheet 4 columns: b c d if b column equal d column, want in column result of column c example: if b2 equal d2, a2 value should c2 value if not equal should show empty or false or something i have uploaded sample spreadsheet what formula use? in cell a2 , put: =if(b2=d2,c2,false) and fill down other rows. the logic should simple enough understand. , can type in else instead of false if want. edit: as per amendment of problem: first move column d before column c (meaning email in column c , log in column d) in cell a2, put formula =vlookup(b2,c:d,2,0) fill formula down.

c++ - Is it safe to use *virtual* multiple inheritance if QObject is being derived from DIRECTLY? -

i understand in general, multiple inheritance qobject -derived classes (even virtual multiple inheritance) not supported in qt. i understand reason (i think) in virtual inheritance case, qt classes not themselves virtually inherit qobject . example, if attempt derive class virtually both qwidget , qthread , placing virtual inheritance in irrelevant place in inheritance chain , still wind 2 qobject instances. i therefore think safe, , supported in qt, use virtual inheritance qt class being derived qobject itself. i have: class top : public qobject {}; class left : public virtual top {}; class right : public virtual top {}; class bottom : public left, public right {}; // safe, , supported qt? note instances of bottom have 1 instance of top (and hence 1 instance of qobject ), seems rationale avoiding multiple inheritance in qt (even virtual multiple inheritance) not apply here. the above construct nonetheless results in qt compiler warning class bottom inherits

java - How to fetch text from image properly in android? -

how fetch text image in android ? i able fetch text image using textreact api not able fetch text properly. if commercial library fine me. image taken gallery , camera not fetch text properly. please me out examples

C++ Program Finding Prime Numbers and Timing itself -

i trying write c++ program finds n prime numbers , times itself. have done in 5 other languages using logic. reason, code nothing. using code blocks compiler. causes code not work , how can fix it? not familiar c++ trivial. #include <iostream> #include <math.h> int main(){ int n=10; int b=new int[n]; int c=0; int d=2; while(c<n){ bool e=true; for(int i=0;i<c;i++){ if(d<sqrt(b[i])){ break; } if(d%b[i]==0){ e=false; break; } } if(e){ b[c]=d; c++; } d++; } for(int i=0;i<c;i++){ cout << b[i]+"\n" << endl; } } several issues: int b=new int[n]; //^^compile error should be int* b=new int[n]; //also need initialize array b meanwhile: if (d<sqrt(b[i])) you should initialize b before try access it. besides:

.net - How can I use VB.Net extension methods in a C# project -

i have legacy vb.net class library includes extension methods, 1 of this: namespace extensions public module ormextensions <extension()> public function todomainobjectcollection(byref objects ormcollection(of ormobject)) domainobjectcollection return objects.asqueryable().todomainobjectcollection() end function <extension()> public function todomainobjectcollection(byref objects iqueryable(of ormobject)) domainobjectcollection dim doc new domainobjectcollection() each o in objects doc.add(o.todomainobject()) next return doc end function end module end namespace to use these extensions in vb have import extensions.ormextensions. have project, in c# depends on vb 1 extensions , can't them work. ormextensions isn't available , using namespace vbproject.extensions doesn't make extensions available. there multiple projects d

iOS adding a view of view controller but it's Not fully flushed to top -

Image
i added view of view controller using [self.view addsubview view controller.view]; but picture indicates, it's flushed top. the underneath view controller has navigation bar. you need position new view controller's view specifying frame. otherwise don't expect, now. depending on want, be: controller.view.frame = self.view.bounds; this overlap current vc's view new vc's view. or change necessary depending on need.

c# - Net Reflector decompile issue - wrong method names etc -

hello try restore 1 of old app's source code, tried via netreflector 8.1, but when use method / vars names weird , incorrect for example: this.nvbptlvr7r.text = this.bvtcveqn3(kaynak, nmpb2ikg5edu0xemxh.bmn4lte8g(0x42e0)); this.csdp2d34j2.text = this.bvtcveqn3(kaynak, nmpb2ikg5edu0xemxh.bmn4lte8g(0x42f2)); this.c0cpfuprih.text = this.bvtcveqn3(kaynak, nmpb2ikg5edu0xemxh.bmn4lte8g(0x4304)); or namespace h23cirhhe5guvo7a9d { internal class cqlh4hg00c9e7mhrh7 { // fields public list<5pfk6qigkyftupujua> gokvp6hjp; public timer xusnodrer; private 2saegvzw9xglqyur6y xywugpmko; anyone have idea why happening? , how can solve it? the code has been obfuscated, can find replace on methods , classes know name of. outside of have knowledge no other options, why backups , offsite storage critical.

Play video with transparent background IOS -

this question has answer here: iphone sdk - how play video transparency? 8 answers i play video transparent background. thing information found on internet "how make video background transparent", background of video transparent, need make background of player transparent. how do that? tried this: nsstring *resourcepath = [[nsbundle mainbundle] pathforresource:@"new project 5" oftype:@"m4v"]; nslog(@"%@",resourcepath); nsurl *url = [nsurl fileurlwithpath:resourcepath]; nslog(@"%@",url); movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:url]; movieplayer.shouldautoplay=yes; movieplayer.controlstyle = mpmoviecontrolstylenone; [movieplayer setfullscreen:no animated:yes]; [self.view addsubview:movieplayer.view]; movieplayer.view.frame = cgrectmake(200, 600, 400, 300); [movieplayer play]; movieplayer

shell - Prevent a command in a shellscript from being executed inside another shellscript -

i invoking shellscript inside shellscript, , invoked 1 has command delete folder, don't want executed, this $ rm ../temp -rf is there way prevent command being executed without changing invoked script contents? you can define alias in script: alias rm='echo safe' by default aliases work in interactive shells, must change behaviour with: shopt -s expand_aliases in script , source other script (the 1 cannot change): source the_other_script.sh or . the_other_script.sh this work unless other script runs rm in sub-shell. another, safer method create own rm command nothing (or prints out argument know what's going on), put directory , put directory first 1 in path environment variable (korn shell syntax): $ export path=/path/to/your/dummy/rm/replacement:$path

installation - Laravel former bundle -

i'm trying install former bundle in laravel 3 , try out. following installation instructions until got point: now laravel 3 doesn't automatically checkout composer dependencies, you'll have go bundles/former folder , composer install (after i'll leave guys alone, promise). forgive ignorance, i'm not sure here? did try cd bundles/former , tried: $ php artisan bundle:install composer to no avail. got following error: could not open input file: artisan again forgive ignorance i'm relatively new laravel. if 1 tell me how bundle installed great full. composer not laravel bundle , not able install placing artisan command. and , have run commands of artisan root of laravel project. note : check if there file artisan.php in current directory. that's easiest way know in right place or not. and former. you have install composer first . know , work composer , can try nettuts tutorial . after follow instructions given in former b

python - What is the difference between web server component and web server? - No framework -

now bear me please. i'll explain beginning briefly. 8 months ago, worked in web project python, used no framework (from scratch). limited myself implement views , templates, pass of months became curious made research. now i'm checking wsgi , how make "do-it-yourself" frameworks. i'm bit curious things. when in project 8 months ago, used web server, remember in web there "web server" component too. the component tornado web server, , other server nginx. now, what's difference between 1 , other server? and if component (tornado or one) not thing need deployment, else need? to clarify: tornado python web framework , asynchronous networking library. that's own definition, not mine. ( https://pypi.python.org/pypi/tornado ) tornado can function web server well. python web development frameworks don't function web server - need bootstrapped onto library development work. others can function web server, don't recommen

python - Common substring of length k -

i'm trying write function gets 2 strings , integer 'k' , returns common substring of both strings of length k. (if there more 1, returns 1 @ random). there alot of algorithms online checks longest common substring found none checks k-length substring. i think hash tables correct way if want optimized couldn't quite it. i write function checks if there more 1 k-length sequence in list. here got: def repeat(st, k): in range(len(st) - k + 1): j in range(i + 1, len(st) - k + 1): if st[i : + k] == st[j : j + k]: return st[i : + k] return false i appreciate this... :/ simple version this: def common_substr(a, b, k): substr in (a[i:i+k] in range(len(a)-k+1)): if substr in b: return substr i guess large input strings (e. g. megabytes of text) , large k might inefficient , building hashes of possible substrings of length k can improve speed: def common_substr(a, b, k): substrs = set(a[i:i+k] i

Using variables to populate PHP arrays -

for php, possible this: array( $designationvar => $datavar ); with idea being can dynamically create array based on values present yes why not , equivalent this $arr = array(); $arr[$keyname] = $value; in case $arr = array(); $arr[$designationvar] = $datavar;

java - Selenium automatically accepting alerts -

does know how disable this? or how text alerts have been automatically accepted? this code needs work, driver.findelement(by.xpath("//button[text() = \"edit\"]")).click();//causes page alert() alert alert = driver.switchto().alert(); alert.accept(); return alert.gettext(); but instead gives error no alert present (warning: server did not provide stacktrace information) command duration or timeout: 2.14 seconds i using ff 20 selenium 2.32 just other day i've answered similar it's still fresh. reason code failing if alert not shown time code processed fail. thankfully , guys selenium webdriver have wait implemented it. code simple doing this: string alerttext = ""; webdriverwait wait = new webdriverwait(driver, 5); // wait maximum of 5 seconds, everytime wait used driver.findelement(by.xpath("//button[text() = \"edit\"]")).click();//causes page alert() wait.until(expectedconditions.alertispresent()); /

android - Rotating an image, angle by angle, and waiting for refresh -

i'm trying rotate image full rotation, small angle-increment @ time. each proceeding rotation should begin after previous rotation has been displayed. how fast rotation happens means nothing me - long each rotation displayed it's fine me. means can practically considered "too fast". i've tried few different approaches this. have working solution below (something along these lines, @ least - i've been playing code, might not compilable). handler handler instance , of code below located in body of activity class i'm starting from. rotationincrement 0.36, we're "rotating" image 1000 times posting new runnable ui-thread each time previous rotation finished. public void start(view view) { mainactivity.rotation=0; imageview.setscaletype(scaletype.matrix); handler.post(new rotationrunnable()); } public class rotationrunnable implements runnable { @override public void run() { mainact

javascript - IE7 z-index wrong order -

check jsfiddle . in ie7 code in jsfiddle above displays dropdown (.sboptions) under next selectbox element (.sbholder) . .sboptions has z-index: 100; still displayed under .sbholder . this works fine in browsers except ie7, idea how solve this? there error in ie7: without setting z-index , long haslayout set true, stacking context assigned positioned element. width , height of .sbholder such haslayout triggers. therefore, second .sbholder @ top. ie7 changes rule to: .sbholder { position: relative; width: 130px; height: 30px; display: block; margin-bottom: 20px; z-index: 0; /* ! */ } this ruins plan increase .sboptions z-index since .sboptions catched irregular stacking context of .sbholder. i've got solution ie <=7 in 1 .sboptions dropped down @ time. come scratch? let's hope so! have go: http://jsfiddle.net/hrubx/ the irregular stacking context produced if required: li:hover { position: relative; }

asp.net - UpdatePanel sometimes refreshing entire page -

even though using update panel, entire page refreshed, , can't figure out why. (edited take account jason p's answer.) masterpage code: <form runat="server" id="form1"> <asp:scriptmanager id="scriptmanager1" runat="server" enablepartialrendering="true" /> <h1>title</h1> <asp:updatepanel id="updatepanel1" runat="server" updatemode="conditional" childrenastriggers="true"> <contenttemplate> <ul class="letterlinks"> <asp:repeater runat="server" id="letter_repeater"> <itemtemplate> <li id='<%#eval("letter")%>'> <asp:linkbutton runat="server" id="updatelink" text="my text"

json - How to integrate a jQuery mobile to a backend system -

so have searched on place , vague information, think it's pretty straightforward question. i have built pure jquery mobile app, hardcoded data. have backend database. if want integrate app database, know have abstract using php or similar deliver json objects. the hard part me how parse json objects jquery app. am right path? can point me quick example how parse json object inside jquery mobile doesn't involve read whole documentation? thanks!

iphone - Changing base url depending on preprocessor macro value -

i have project few schemes, 1 ea, staged, , production. i want able set base url based on build configuration running. #if defined production #define base_url [nsurl urlwithstring:@"https://example.production.com/"] #elif defined staged #define base_url [nsurl urlwithstring:@"http://example.staged.com/"] #else #define base_url [nsurl urlwithstring:@"https://example.ea.com/"] #endif is there way set preprocessor macros in order define values of production , staged, i'm guessing it's somewhere in build settings of target. , best way it? i store urls in nsobject class (aptly named urlhub) class methods so; +(nsstring *)login { nsstring *url; if (developmentmode) { url = @"https://dev.mycoolwebservice/api/login"; } else { url = @"https://mycoolwebservice/api/login"; } return url; } then wherever need use url can grab easily; #import "urlhub.h" nsstring *url

How can I send Unicode characters (16 bit) with Serial port in Delphi 2010? -

i have problem in delphi 2010. send pc unicode (16 bits) characters printer serial port (com port). use tciacomport component in d2010. for example: ciacomport1.open := true; \\i open port data := #$0002 + unicodestring(Ж) + #$0003; ciacomport1.sendstr(parancs); //i send data device if printer characterset ascii characters arrive, ciril character '?' on printer screen. if printer characterset unicode characters not arrive printer. an unicode character represented in 2 bytes. how can decompose unicode character byte byte? example #$0002? , how can send strings byte byte comport? function? under windows (check os how open , write comm ports), use following function write unicodestring comm port: bear in mind port have setup correctly, baud rate, number of bits, etc. see device manager => comm ports function writetocommport(const sport:string; const soutput:unicodestring):boolean; var retw:dword; buff: pbyte; lenbuff:integer; fh:thandle; beg

jquery - Spring @MVC and the @RequestBody annotation with x-www-form-urlencoded data? -

i trying figure out why can't receive request jquery.ajax call when spring @controller handler method includes @requestbody annotation. consider following: html/javascript : <form id="foo" action="/baz"> <input name="bar"> </form> <script> $(function() { var $fooform = $('#foo'); $fooform.on('submit', function(evt) { evt.preventdefault(); $.ajax({ url: $fooform.action, data: $fooform.serialize(), datatype: 'json', type: 'post', success: function(data) { console.log(data); } }); }); }); </script> java : @requestmapping( value = "/baz", method = requestmethod.post, consumes = mediatype.application_form_urlencoded_value, produces = mediattype.application_json_value ) public @responsebody searchresults[] jqueryposthandler( @requestbody formdataobject formdata) { return this.searchse

how to binding gridview with data from two different tables C# -

how can binding gridview data 2 different tables? have 3 tables: players, playerteam , teams. gridview has next data: playerid, name, surname, ... table players, , teamid, teamname... table teams. table playerteam marge tables players , teams via ids. i'am using tableadapter solve problem. when want edit row in gridview, make changes in form (change data in textbox) , select team dropdownlist, can't save changes. using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; namespace rukomet { public partial class igracui : system.web.ui.page { dsigrac.tbligracrow igrac; dsklub.tblklubrow klub; protected void page_load(object sender, eventargs e) { if (this.ispostback) return; this.ucitajklub(); this.dohvatiigraca(); this.prikaziigracevepodatke(); } private void pokupipo

java - Desktop server and android client local connection -

i try connect windows desktop java server android client. i'm working cross-platform. desktop server , desktop client working fine same code, desktop server , android client has interesting problem. manifest permissions setted. desktop java server code serversocket serversocket = new serversocket(tcp_port); socket link = null; while(true) { link = serversocket.accept(); printwriter output = new printwriter(link.getoutputstream(),true); // flush true bufferedreader input = new bufferedreader(new inputstreamreader(link.getinputstream())); // step 1 password auth string message = input.readline(); // wait password if(message.equals(password)) { output.println("correct"); message = null; message = input.readline(); // wait udp port request if(message.equals("udp")) { output.println(udp_port+""); etc . . android client code socket link = null; link = new

foreign key relationship - ServiceStack Service structure for predominantly read-only UI -

i'm getting started servicestack , i've got i'm impressed has under bonnet , how easy use! i developing predominantly read-only application it. there updates database 3 or 4 times year rest of time solution displaying data on electronic information board (large touch screen monitor). the database structure normalised few foreign keyed tables , in mind think may best separate read api crud api. crud api can used create , modify relational data poco classes matching database tables. ensure read-only api flattens relational data few pocos spanning few db tables making data easier handle on read-only uis. i'm looking ideas , advice on whether separation of concerns wasted effort or if there better way of achieving need? has had similar thoughts / ideas? having developed similar read application (a gazetteer, updated quarterly/yearly) using servicestack went optimizing api reads, making use of built in caching: // cached responses has object