Posts

Showing posts from April, 2014

git merge - Reverting a git pull that's already been pushed -

i'm not sure if duplicate or not it's kind of 1 off scenario: i have "beta" branch, , started new "refactor" branch. i did bunch of code in "refactor" branch. i pulled latest changes beta refactor ( git checkout refactor && git pull origin beta ) my changes ready, checked out beta, , pulled changes refactor beta. ( git checkout beta && git pull origin refactor ) realized beta branch wasn't date, had git pull pull latest beta. now beta branch date, did git pull origin refactor ensure latest there (got auto-commit message refactor being merged beta). i pushed code :( so i'm realizing 2 things did wrong: in step 3, should have done git pull first had latest changesets in beta in step 3 also, realized should have called git merge refactor instead of git pull origin refactor (don't ask me why did this, it's monday , wanted awesome refactor code beta start testing). realize if had done both of th

python - Accessing Temp Directory On Tkinter -

im new in page , love answers nice job, of users, im new on python , wanna make print of dir in entry or label doesnt matter example: def directory(): os.listdir('/') files=stringvar() files.set(directory) entry=entry(root, textvariable=files).grid() obviously in tkinter, last code make "print" list of directories, make me list horizontal ',' each folder different, want vertical list on "entry" or "label", suppose later need scroll bar but, there no problem, , make same temporal folder on windows that... def directory(): os.listdir('%temp%') files=stringvar() files.set(directory) entry=entry(root, textvariable=files).grid() but %temp% doesnt works directly on python how can make listdir of folder? since displaying contents of directory going require multiple lines of text, 1 each item in it, have use a tk.label or tk.text widget since tk.entry can handle single line of text. in addition you'll

php - How to limit a post feed? -

i have php class grabs post rss feed this: 1-post title 2-post image 3-post description 4-post links original the problem post description long, need limit description few words. include_once(abspath . wpinc . '/feed.php'); $rss = fetch_feed(' rss url '); if (!is_wp_error( $rss ) ) : $maxitems = 1; $rss_items = $rss->get_items(0, $maxitems); endif; ?> <?php if ($maxitems == 0) echo 'no items'; else foreach ( $rss_items $item ) : ?> <div id="deals"> <b><a href="<?php echo clean($item->get_permalink()); ?>" rel="nofollow" target="_blank"><?php echo $item->get_title(); ?></a></b> <?php echo hapus(clean($item->get_content())); ?> <p style="text-align:center;bottom:0;"><a title="order <?php echo $item->get_title(); ?>" href="<?php echo clean($item->

ios - Tap Gesture to Hide Navigation Bar, Tab Bar, and Status Bar -

i trying implement tap gesture on web view hide/show navigation bar, tab bar, , status bar. have hiding/showing of navigation bar working fine , can hide status bar not show up. tab bar items hidden bar still there. can this? - (void)togglebars:(uitapgesturerecognizer *)gesture { [[uiapplication sharedapplication] setstatusbarhidden:yes withanimation:uistatusbaranimationslide]; bool statusbarhidden = yes; bool barshidden = self.navigationcontroller.navigationbar.hidden; [self.navigationcontroller setnavigationbarhidden:!barshidden animated:yes]; bool tabbarhidden = self.tabbarcontroller.tabbar.hidden; [self.tabbarcontroller.tabbar sethidden:!tabbarhidden]; } - (void)viewdidload { [super viewdidload]; // additional setup after loading view nib. uibarbuttonitem *systemaction = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemaction target:self action:@selector(showmenu)]; self.navigationitem.rightbarbuttonit

javascript - How to resize iframe to content with header on top? -

i'm trying create search engine type thing when load web page puts navigation bar above content. problem can't seem iframe resize content. i've tried multiple solutions didn't work. problem have iframe not move when header hides on scroll. here code, can @ my site web.php: <!doctype html> <html> <body class="web"> <div class="gridcontainer clearfix"> <?php include 'header.html' ?> <div id="web"> <script type="text/javascript"> function adjustiframe(id) { var frame = document.getelementbyid(id); var maxw = frame.scrollwidth; var minw = maxw; var frameh = 100; //iframe starting height frame.style.height = frameh + "px" whil

vb.net - Read a matrix from a binary file -

i'm trying read 2 matrix binary file (256x256x2) couldn't without iterating 256x256x2 times takes long. want check data , make sure it's corect (not zeros). have: dim msg string dim b(256 * 256 * 2) byte dim int32 dim reader new binaryreader(file.open(path, filemode.open)) b = reader.readbytes(b.length) = 0 b.length msg = msg & ", " & b(i) next textbox1.text = msg the data on matrix numbers (0-255). what's best way save data array, if possible format array[matrixno][row][column] because later need find specific values of array based on position. ps. i'm using old visual studio 2003 because that's have available. thanks edit: figured out taking long displaying bytes, problem solved! almost 2 years later, it's time take off unanswered list. the loop worked fine, problem printing every single value read instead of simpling saving variable. lesson learned (long ago): printing takes time .

ios - I'm creating a quiz game with 4 answers and I want to add score -

i'm creating quiz game 4 answers , want add score. every right answer worth 50 points , wrong answers -50 points. how do that? - (ibaction)bpressed1:(id)sender { if ([self.answer isequaltostring:@"a"]) { uialertview *message = [[uialertview alloc] initwithtitle:@"yes!" message:@"+50." delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; [message show]; [message release]; [self nextq]; }else{ uialertview *message = [[uialertview alloc] initwithtitle:@"no!" message:@"-50." delegate:nil cance

hql - Hibernate Criteria: Projection with TransferObject -

how convert hql code below hibernate criteria query? select new com.project.to.personto( person.firstname, person.lastname ) person person try below :- criteria criteria = session.createcriteria(person.class); criteria.setprojection(projections.projectionlist().add(projections.property("firstname"), "firstname") .add(projections.property("lastname"), "lastname")) .setresulttransformer(new aliastobeanresulttransformer(personto.class));

Dompdf Tempremental Behavior -

dompdf version: 0.5.1 - server php version: 5.x.x on client's website pdf generated fine when using safari on mac. when using other browser pdf won't download @ all. i wondering if common? the page have tested on is: http://www.jamesproperties.co.uk/propertydetails.php?ref=10493&prop=1&pmin=0&pmax=10000000&bmin=0&bmax=100&proptype=0&search=0&order=desc&page=1 then clicking 'print property details' (below gallery).

qt - How to store a QRect in Sqlite? -

i need store qrect in sqlite database. (i've searched around did not see on this) does qt/qsqlite automatically convert qrect qvariant , handle whatever decomposition needed or have myself , store origin , size values in 4 separate fields? if so, , generalize other qt data types, possible store qvector, qlist? define these (and qrect, etc.) blob types in table definitions? sqlite relational database , things cannot store c++ objects directly. actually c++ object model doesn't allow transparent persistence can try close using specialized tools or libraries. important point objects must designed support persistence. if don't need transparent persistence explicit store/retrieval of objects can pick serialization method (e.g. using single string, or using separate fields attributes). each method has pros , cons depending on want database (e.g. kind of searches or updates want do). something unfortunate c++ metaprogramming abilities poor (just little bett

PHP countdown with custom field in wordpress -

i want display days remaining till date specified in custom field inside of wordpress. custom field named bewerbungs_frist . i'm using code: <?php $days = ceil((strtotime("<?php the_field('bewerbungsfrist'); ?>") - time())/(60*60*24)); $s=''; if ($days!=1) { $s='s'; } echo $days. " days "; ?> as output -1500 days. can't right. can me out? i solved issue code: <p>bewerbungsfrist: <?php $date = datetime::createfromformat('ymd', get_field('bewerbungs_frist')); echo $date->format('d.m.y');?></p> noch <?php $days = ceil((strtotime(get_field('bewerbungs_frist')) - time())/(60*60*24)); echo $days. " tage "; ?> you opening wrong php tags between opened tags try $days = ceil((strtotime(the_field('bewerbungsfrist')) - time())/(60*60*24));

Scons Jenkins plugin does not read SConstruct -

Image
i trying build c++ project using scons on jenkins running on ubuntu box (running master). i have installed scons command-line using apt-get , have installed jenkins scons plugin : in master configuration have configured path scons binary: in job config (freestyle project) have: when run build get: building in workspace /var/lib/jenkins/workspace/my-project checkout:my-project / /var/lib/jenkins/workspace/my-project - hudson.remoting.localchannel@5d56ead7 using strategy: default last built revision: revision d919f00fb2e59ce1214e276e6c60e834d4035d5b (origin/master) fetching changes 1 remote git repository fetching upstream changes origin commencing build of revision d919f00fb2e59ce1214e276e6c60e834d4035d5b (origin/master) checking out revision d919f00fb2e59ce1214e276e6c60e834d4035d5b (origin/master) [my-project] $ /usr/bin/scons -f scons9080484787377372778.generated -c my-project scons: entering directory `/var/lib/jenkins/workspace/my-project' scons: reading sconscri

template tal - Accessing view reference in TAL with "python" namespace prefix -

how access view reference (and members) when tal used python namespace prefix? for example, got reference on records property of current view : <tal:block define="record view/records"> how achieve same python modifier: <tal:block define="python: ...."> you use attribute access: <tal:block define="python:view.records"> if records method, make sure call it: <tal:block define="python:view.records()">

multithreading - How to program Intel Xeon Phi with C#? -

i c# programmer c++ experience, on windows. with skill set, there options develop intel xeon phi processor? found link , not sure if that's best/only way. thanks advice. check out an overview of programming intel® xeon® processors , intel® xeon phi coprocessors .. overview. from section: compiler , programming models there recommendations can make based on has been working developers. fortran programmers, use openmp, concurrent , mpi. c++ programmers, use intel tbb, intel cilk plus , openmp. c programmers, use openmp , intel cilk plus. also same source: additional reading additional material regarding programming intel xeon phi coprocessors can found @ http://intel.com/software/mic . a new book titled “intel® xeon phitm coprocessor high performance programming, volume 1: essentials” jim jeffers , james reinders, © 2013, published intel press, expected available in 2013.

java - Converting 2D ArrayList<String> to 2D String Array -

i want convert 2d arraylist<string> 2d string array . here code import java.util.arraylist; import android.os.bundle; import android.app.activity; import android.util.log; import android.view.menu; public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); arraylist<string> parent = new arraylist<string>(); arraylist<string> child1 = new arraylist<string>(); arraylist<arraylist<string>> child = new arraylist<arraylist<string>>(); (int = 0; < 10; i++) { parent.add("" + i); (int j = 0; j <= i; j++) { child.add(new arraylist<string>()); child.get(i).add("" + j); } } system.out.println("asdasd"+child.size()); string[] parentstring=parent.toarray(new string[parent.size()]); stri

python - Django 1.5 extend admin/change_form.html object tools -

i'm new django i've been enjoying it. seem run places don't seem things correct. so, i'm asking , guidance. i'm trying extend object-tools 1 of models can have print button next history. my templates follows: project/app/templates/admin/ i'm successfully extending base_site.html no issues. project/app/templates/admin/base_site.html however, when add change_form.html so: project/app/templates/admin/change_form.html with following: {% extends 'admin/change_form.html' %} {% block object-tools %} <a href="one">one</a> <a href="one">two</a> {% endblock %} i exception: maximum recursion depth exceeded while calling python object this seems i'm missing quite basic. things i've tried: many variations of {% block %} extending base_site, base etc ... adding /model part of path (project/app/templates/admin/model/change_form.html) i'm confused , unsuccessful.

java - Compilation error, list not recognised -

i using trove collections, , more specifically, primitive arraylist ints. the declaration of list follows: tintarraylist list= new tintarraylist(); however, facing compilation error cannot explain. when declare list follows: import gnu.trove.list.array.tintarraylist; public class main { tintarraylist list= new tintarraylist(); } , code runs correctly expected. however, when declare list (with different import statement) follows: import gnu.trove.*; public class main { tintarraylist list= new tintarraylist(); } , compilation error appears not recognising tintarraylist. i wondering why error appears? thought using * list should recognized. error doesn't appear when java.util.*; used instead of java.util.arraylist; . the difference * not import sub-levels, in current level. if used import gnu.trove.list.array.* , work expect. the reason works on java.util.* because arraylist class in same folder wildcard.

.net - C# issue sending string to a different socket on the same computer -

i have program , sending string different socket on same computer every 45 seconds. below function send string on socket using built in socket class of c#. issue having when run program , give 127.0.0.1 not getting responses socket. when run program on different computer using ipaddress of computer works flawlessly. so questioned if allowed pass in 127.0.0.1 ip socket class , have recognize want send data different socket on same computer. have different make sure works on 127.0.0.1? thanks! static string queryminer(string command) { byte[] bytes = new byte[1024]; try { //code gettting current machines ip use code if client running on miner ipaddress ipaddr = ipaddress.parse("127.0.0.1"); //ipaddress ipaddr = ipaddress.parse("198.xxx.xxx.xxx"); ipendpoint ipendpoint = new ipendpoint(ipaddr, 4028); socket sender = new socket(addressfamily.internetwork, sockettype.stream, protocoltype.tcp); sender

sql server 2008 - Retaining existing table values using a Stored Procedure with Optional Parameter Values -

i have scenario ---- stored procedure may given parameter values optionally. if values empty/default retain existing values. is following way of handling case statements correct? works me there better way this? create procedure [updateuser] ( @userid int, @userkey varchar(32), @username varchar(50), @categoryid int = 0, ) begin set nocount on update [users] set [userkey] = (case when (len(rtrim(ltrim(@userkey)))>0) @userkey else userkey end ) ,[username] = (case when (len(rtrim(ltrim(@username)))>0) @username else username end ) ,[categoryid] = (case when (@categoryid>0) @categoryid else categoryid end ) [userid] = @userid end one "better" (in terms of syntax simplicity) way use nullif() , isnull / coalesce instead of case expressions: update [users] set userkey = coalesce(nullif(@userkey , ''), userkey ),

php - Save without get lastInsertId -

i have old database in postgresql multiple primary key . when try save information in these tables, error occurred because cakephp trying lastinsertid . because, know, cakephp doesn't support multiple primary key . so, wanna know, how can disable functionality/option? i tried this, doesn't work expected. $this->orderdrinkbase->saveall( $drinkbases, array('callbacks' => false, 'validate' => false) ); the solution above, works, approved answer. but, want explanation of how can disable function lastinsertid in cakephp in cases. use following code class grouptouser extends appmodel { var $name = 'grouptouser'; var $usetable = 'groups_users'; var $primarykeyarray = array('user_id','group_id'); function exists($reset = false) { if (!empty($this->__exists) && $reset !== true) { return $this->__exists; } $conditions = array

hadoop - ERROR security.UserGroupInformation: PriviledgedActionException -

i trying learn hadoop version 1.1.0 on hdinsights. followed step step instructions run commands on hadoop command line. first compiled java code , created jar file , executed map reduce command. when run mapreduce command, gives me error below. can me understand error means , need correct it? c:\hadoop-training\mrdcache>hadoop jar dcache.jar dcache mrdcache/input/nyse mrdcache/output 13/08/08 23:29:01 warn mapred.jobclient: use genericoptionsparser parsing arguments. applications should implement tool same. 13/08/08 23:29:01 info mapred.jobclient: cleaning staging area hdfs://localhost:8020/hadoop/hdfs/tmp/mapred/staging/ramya/.staging/job_201308082321_0001 13/08/08 23:29:01 error security.usergroupinformation: priviledgedactionexception as:myusername cause:java.io.filenotfoundexception: file not exist: mrdcache/output exception in thread "main" java.io.filenotfoundexception: file not exist: mrdcache/output @ org.apache.hadoop.hdfs.distributedfilesystem.getfile

What was the real reason why Google is chosing RenderScript instead of OpenCL? -

the question has been asked before in different form, i'd know android-developers think what's behind google's decision , not google's official answer is. opencl open standard , works on various devices, such cpus, desktop gpus, arm processors, fpgas , dsps. gives developers convenience of creating high performance software , libraries, works on devices. renderscript higher level language, focuses on media-manipulation , runs on both cpu , gpu. works on new android phones , tablets, not on other operating systems. big difference opencl renderscript handles scheduling, , not software. google's official answer factually incorrect on opencl, frustrated many in opencl-community , logically gave hefty reactions. please factual both renderscript , opencl - don't want question closed because nonsense being told. first, let deal answer this question tim murray. he states opencl/cuda execution model tied various factors of execution model register

internet explorer - Mobile-First Responsive Design IE 8 Widescreen Compatibility -

here link page i'm working on . i've switched on bootstrap 3's mobile-first framework. main difference instead of defaulting wide layout , using media queries shrink down mobile sizes, default size mobile , media queries used wider resolutions: so instead of: @media (max-width: 767px) {} we use: @media (min-width: 768px) {} when using old way, ie 8 (which doesn't support media queries) display page in widest format. displays page in mobile format, not desirable. is there way page default widest layout when media queries not supported? include respond.js have had no luck: <!-- html5 shim , respond.js ie8 support of html5 elements , media queries --> <!--[if lt ie 9]> <script src="js/html5shiv.js"></script> <script src="js/respond.min.js"></script> <![endif]--> a fix gets long way: add stylesheet ltie9 <!--[if lt ie 9]> <link href="sty

javascript - Global variables and asynchronous data -

i have problem global variable n : var n ; socket.on('connect', function(){ socket.on('news', function (mensaje) { n = mensaje.data; $('#string').val(n); // show data }); $('#string1').val(n); // can't see anything, why? ...}); // first, global variable n shows inside socket.on want show out function. the problem socket.on has not finished (or invoked callback) when problematic line executes. because on asynchronous operation: returns immediately , invokes callback "later" when data received. data can used after on callback run. here example of execution order , 1 "runs" before 2, before 3, etc.: // 1 var n; socket.on('connect', function(){ // 2 socket.on('news', function (mensaje) { // "on callback" // 4 n = mensaje.data; // 5 $('#string').val(n); }); // 3 - note occurs *before* 4 & 5 // run in asynchron

c# - Gridview not appearing -

i somehow come strange error. gridview won't appear. here code - first .aspx markup: <asp:gridview id="zakljucani" runat="server" autogeneratecolumns="false" onrowcommand="zakljucani_rowcommand" pagesize="300" height="127px" style=" visibility:visible; border-color:red" > <columns> <asp:boundfield datafield="korisnickoime" headertext="korisnicko ime" visible="true" /> <asp:boundfield datafield="mail" headertext="mail" visible="true" /> <asp:boundfield datafield="datumzakljucavanja" headertext="datum vrijeme zaključavanja" /> <asp:boundfield datafield="hourselapsed" headertext="protekli sati" /> <asp:templatefield headertext="otključaj"> <itemtemplate> &l

javascript - Best way to make sure content is ready to serve in a time limited environment? -

i developing html/javascript game requires use of images. user has amount of time answer question. asking best way download , cache files , make sure ready? appcache looking for? you need delay execution of game loop until required assets loaded. code modular enough allow this. the browser fires event when resource located @ src of image element has been downloaded. using event, can create basic preloading solution: var img = new image(); img.onload = function() { console.log('image loaded!'); }; img.src = '/images/my-image.jpg'; expand solution iterate on assets. once they're loaded, call code begins game loop. there number of prebuilt solutions available: http://www.createjs.com/#!/preloadjs http://thinkpixellab.com/pxloader/ https://github.com/nandastone/precook-backbone

How to change object in one sitepage?(three.js) -

i want build gallery of 3d objects,but when finish showing 1 object, how can change object pressing ?how delete first object , release memorise? knowledges should learn? i've tried build-and-remove iframes display object receive memory leak : here part of code: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script language="javascript"> <!-- $=function(s){return document.getelementbyid(s)} window.onload=function(){ var t=[]; var btn1=$('btn1'),btn2=$('btn2'),btn3=$('btn3'); btn1.onclick=function(){ if($('ifm1'))return; var c=$('content'); var ifm=document.createelement('iframe'); ifm.src='a.html'; ifm.id='ifm1'; c.appendchild(ifm); t.push(ifm); }

eclipse - Turnaround Time in Spring JBoss Eclispe -

i writing site in spring, thymeleaf, jboss , using spring tool suite. turnaround time horrible. have recompile , package app, every time make change , push out server. have advice on how make turnaround time quicker? thanks in advance, joe try jrebel. can free if spread social media love them. http://zeroturnaround.com/software/jrebel/

string - Python - Why is this function not returning the index for white space? -

this code return index of numbers , and non-alphanumeric characters. however, return index first white space not of others , i'm not sure why. shoestring = "fwefw1234132 lkjaldskf98:[]['asd fads fadsf" n in shoestring: if n.isalpha(): continue else: print n, shoestring.index(n) each time, you're calling shoestring.index(n) . n ' ' character. has no way of knowing whether want first space, or second, or 43rd, returns first space. the right way keep track of index, instead of searching find it.* enumerate function makes easy: for i, n in enumerate(shoestring): if n.isalpha(): continue else: print n, as side note, can make code lot simpler reversing if , don't need continue : for i, n in enumerate(shoestring): if not n.isalpha(): print n, you can have more fun using filter function or comprehension: nonalphas = ((n, i) i, n in enumerate(shoestring) if not n.isalp

vim - Encoding issue when changing vimrc file default location -

i'm using vim on windows, , in order "change" vimrc file location have following line in _vimrc file in home directory: source $home\.vim\.vimrc i thought worked fine way when tried changing symbol plugin (tagbar) fancy 1 this: let g:tagbar_iconchars = ['▸', '▾'] the plugin symbol didn't show glyph <br> character instead. noticed same problem appeared when attempting change symbol in several other plugins (vimfiler, airline, etc) , found out if changed symbols in _vimrc file rather in new .vimrc file issue fixed. is there encoding being set source command in _vimrc file triggering problem? thought "changing" vimrc file location way did fine, there other problems method? in pre-7.4 vim, cleanest way source "real" vimrc default user-level vimrc ( $home/_vimrc (windows) or $home/.vimrc (unix)) place in $home/vimfiles/ (windows) or $home/.vim/ (unix) , use line line in default user-level vimrc

python - Searching for a sequence in a text -

i have run logic problem. i have string declared follows: fruits = "banana grapes apple" vegetables = "potatoes cucumber carrot" now there text sentences, , have search word in front of text format <vegetables> <fruits> i ate carrot grapes ice cream dessert. answer : ate dad , mom brought banana cucumber , milk. answer : brought what thinking split sentence , put in array, , sequence, able break sentence matching sequence problem. wd = sentence.split(' ') x in wd.strip().split(): # have sequence now, have text in front of text format you're using wrong data-structures here, convert fruits , vegetables sets. problem easy solve: >>> fruits = set("banana grapes apple".split()) >>> vegetables = set("potatoes cucumber carrot".split()) >>> fruits_vegs = fruits | vegetables >>> string import punctuation def solve(text):

java - How to use regex to replace the string -

in java language, how use regular expression deal string $.store.book[random(1,9)].title and replace part of random(1,9) real random number between 1 9 ? so basically, result string $.store.book[3].title or $.store.book[5].title anybody can me? using regular expression capture arbitrary numbers (see online demo here): string input= "$.store.book[random(1,9)].title"; system.out.println("input: "+ input); pattern p = pattern.compile("(?<=\\[)random\\((\\d+),(\\d+)\\)(?=\\])"); matcher m = p.matcher(input); string output = input; if(m.find()) { int min = integer.valueof(m.group(1)); int max = integer.valueof(m.group(2)); int rand = min + (int)(math.random() * ((max - min) + 1)); output = output.substring(0, m.start()) + rand + output.substring(m.end()); } system.out.println("output: "+ output ); example output: input: $.store.book[random(1,9)].title output: $.store.book[6].title as utility method

Search table contents using javascript -

i working on javascript. in code have table , textbox. when enter data in textbox should show particular value typed doesn't search data table. how search data in table? here's jsfiddle http://jsfiddle.net/surwn/ html: <table name="tablecheck" class="data" id="results" > <thead> <tr> <th>&nbsp;</th> <th>&nbsp;</th> <th><center> <b>course code</b></center></th> <th><center>course name</center></th> </tr> </thead> <tbody> <tr id="rowupdate" class="tableheaderfooter"> <td > <center> <input type="text" name="input" value="course" ></center> <center> <input type="text" name="

.net - Regex to return the description in hyperlink -

hi i'm using code: dim expr string = "\<(.|\n)+?\>" and trying remove hyperlink below: <a href="https://support.sample.com/applications/managemyengagements/documents/solutioncontingency.html" target="_blank">demo </a> my target return hyperlink description "demo" when trying replace matched items empty string being replaced. desired result: demo please help thanks! your string has 3 parts: a: <a ...> b: demo c: </a> to match thous 3 parts use: /<a [^>]+>(.*?)<\/a>/ <a [^>]+> match a, string starting "" (.*?) match b, data not greedy <\/a> match c, string ""

c# - Using the StateMachineCompiler(SMC) in own code -

hello want use state machine compiler (smc) c# http://smc.sourceforge.net/ i have created sm-file describe state machine , generated c# code it. then created own class myclass,add generated class generated smc , implement methods. my problem how can run statemachine? while-loop, async call or task library ? elegant way? the statemachine behaivior sending data throught serialport. user can call myclass.send(data) , statemachine should work behind curtains. can give me example how use statemachine in own code? regards rubiktubik i've used smc in many application , satisfied it. hit same problem you. smc generates code c# synchronous , linear. means if issue transaction calling fsm.yourtransaction() , chance somewhere in middle of transaction issue transaction, directly called. dangerous, because breaks base principle of state machine - transactions atomic , system guaranteed in single state, or single transition time. when realized hidden problem implemented

unit testing - UnitTestIsolation instrumentation failed to initialize. Please restart Visual Studio and rerun this test -

my unit test fails on line shimscontext.create. error is: unittestisolation instrumentation failed initialize. please restart visual studio , rerun test as per existing posts, tried install nunit adapter , tried running test explorer, still no luck. any comments on doing wrong? thanks go testproject properties -> under debug section check "enable native code debugging" checkbox. this should do.

sql - Parents tree in mysql table (while-loop) -

sorry english. have mysql table this [ --------------------------] [ parent_id ] [ category_id ] [ --------------------------] site structured this: 0 -> 1 -> 2 -> -> 3 -> -> -> 5 -> 4 and table like 0 1 0 2 2 3 0 4 3 5 how write mysql while loop input 5 , list of it's parents until 0: 3 2 i know, how write in php, want 1 query database, when try run "while" examples official manuals, returns lot of errors. you can achieve procedures.. create procedure `root_connect`(in init char(1),out str char(15)) begin set @startchar:=(select category_id tablename parent_id = init); set @endloop := "no"; set @fullchar:= @startchar; set @newchar:= ""; if (@startchar !="-" or @startchar =null) while (@endloop = "no") set @newchar :=(select category_id tablename parent_id = @startchar); if(@newchar = '-')

codeigniter - Sending data and error from controller to view -

i have beginner problem please: i know how pass data view below: $data['documents'] = $this->documents_model->get_documents(); $data['main_content'] = 'document_view'; $this->load->view('layout', $data); i know how pass errors view below: $this->load->view('upload_view', array('error' => '')); but how can pass both data , error view? tried placing error $data-key below, gives me word 'array' in view don't want. $data['error'] = array('error' => ''); i tried sending $error , $data in load->view (as 2 params seperated comma) gives me syntax error. , ran out of limited ideas thought ask here. thank advice. try this: $data['error'] = "your message here"; now, in view echo message this: <?=(isset($error))?$error:''?>

iphone - Unable to upload video longer than 1 minute -

i working on application require video upload functionality. using nsurlrequest , working fine video less 1 minute in length, cause problem when video large. 1 have idea that??? nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; [request seturl:[nsurl urlwithstring:urlstring]]; [request setcachepolicy:nsurlrequestuseprotocolcachepolicy]; [request sethttpmethod:@"post"]; nsstring *boundary = @"----f00"; nsstring *contenttype = [nsstring stringwithformat:@"multipart/form-data; boundary=%@",boundary]; [request addvalue:contenttype forhttpheaderfield:@"content-type"]; filedata = [nsdata datawithcontentsofurl:[mediadict objectforkey:uiimagepickercontrollermediaurl]]; [body appenddata:[[nsstring stringwithformat:@"\r\n--%@\r\n", boundary] datausingencoding:nsutf8stringencoding]]; [body appenddata:[[nsstring stringwithformat:@"content-disposition: form-data; name=\"data[file_name]\"; filename=\"%

Android service not working -

i'm trying call service class update value of variable widget doesn't ever seem service class. i've had @ examples , can't figure out i'm doing wrong, , don't know services yet. appreciated. service class public class togglemonitoringservice extends service{ @override public ibinder onbind(intent intent) { return null; } @override public void oncreate() { log.d("me","creating service"); super.oncreate(); } @override public int onstartcommand(intent intent, int startid, int something) { // todo auto-generated method stub string toggle = intent.getextras().getstring("toggle"); log.d("me","toggle : " + toggle); if (toggle.equals("app1")) { updatewidgetservice.monitorapp1 = !updatewidgetservice.monitorapp1; } else if (toggle.equals("app2")) {

HOw to acces the Started WebServer PlayFramework Aplication on Amazon Ec2 Instace -

i have create amazon ec2 instance , deployed play framework play 1.2.5 , create project when started project using play start -httpd.port = 80 application started , log file thrown in log file shows waiting initial respose how access running server,i have entered instance ip address along port number in usual format not getting please me you have open tcp port in aws console: go security group settings find security group instance apart of click on inbound rules use drop down , add http (port 80) click apply

android - How to implement videocalls? -

i want implement videocall application. question if there api different sip, or should use these api? if exists api, api recommend videocalls? thank much i think can take @ google+ hangouts api, it's substituted google talk on android. https://developers.google.com/+/hangouts/

plc - Is mixing types allowed in ST (Structured Text) -

i wonder if allowed standard (iec 1131-3) mix different data types in expression. example var : bool; b : int; (* ... *) if (b , c) ... end_if you must use explicit type conversion functions when converting "down" in types. "up" conversion done implicitly. var : bool; b : int; (* ... *) if (int_to_bool(b) , c) ... end_if there forms of these type conversion in form of typea_to_typeb()

Saving and reloading a force layout using d3.js -

i trying find correct method able save out force diagram node layout positions once settled, later, reload layout , start again same settled state. i trying cloning dom elements containing diagram, removing , reloading it. this can do, in part indicated below:- _clone = $('#chart').clone(true,true); $('#chart').remove(); selects containing div, clones , removes it, later var _target = $('#p1content'); _target.append(_clone); selects div used hold chart , reloads it. reloaded diagram fixed. i don't know how reconnect force allow manipulation carry on. possible? want preserve settled position of nodes. another possibility, reload node positions , start force low alpha? <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>d3: force layout</title> <script src="./jquery-2.0.3.min.js" type="text/javascript"></script> <s

javascript - jQuery DataTables - Refactoring Code to remove 'aoColumn' duplication -

i'm using jquery datatables render timeline , each column represents day. have method called when each column (day) rendered , it's passed in date array. is there better way write code below i'm not repeating myself 7 times whilst still being able pass in array item? cannot see stands out in docs. datatable = $('#example').datatable({ "bretrieve":true, "bprocessing":true, "aadata": data, // datatables requires render function each column (day) "aocolumns":[ { "mdata":null, "fnrender":function (obj) { return day(obj, week[0]); } }, { "mdata":null, "fnrender":function (obj) { return day(obj, week[1]); } }, { "mdata":null, "fnrender":function (obj) { return day(obj, week[2]); } }, { "mdata":null, "f

vb.net - Read Csv file with LineFeeds within its fields -

i have code read csv file : dim strlinevalue string using sr streamreader = file.opentext("filepath") strlinevalue = sr.readline while strlinevalue isnot nothing strlinevalue = sr.readline n += 1 loop end using my problem come across csv file lines this: "text1 lf lf text2","text3",text4,text5, , , , ,lf "text6 lf lf text8","text9",text10,text11, , , , ,lf where lf line feed. so wrong text1 text2 text3 text4 text5 text6 text8 text9 text10 text11 any ideas how can overcome wrong behaviour of code in type of files ps. 1.if open csv file in excel recognises lines , have multiline first cell 2. thinking maybe first 2 lf lf , lf have in end of each line lf , cr how can see difference (i opened csv file in word see characters) you have fields enclosed in double-quotes - " . in csv files, indicates you're supposed take whole field , not parse it

java.lang.NoClassDefFoundError: In Rest API JAVA -

i using project1's class in rest api project2 in eclipse. have added project1 rest api project2's build path still getting exception: code have used : @path("/studentreq/json") @consumes({ mediatype.application_json }) @produces({ mediatype.application_json }) public response requestbasicreport(student stu) { operationresult operationresult = new operationresult(); boolean responseflag = false; try { if (operationresult.issuccessful()) { responseflag = true; } else { responseflag = false; // send message } } catch (exception ex) { responseflag = false; } { // nullify objects if (responseflag) { return response.ok(stu).build(); //put required object in ok(object) } else { return response.servererror().build(); } } } excepti