Posts

Showing posts from March, 2011

php - I want to see "redirecting you to the login page" when a user successfully registers on my website. How can i do this? -

this php question. here's code inserting data database: $con=mysql_connect("localhost","root",""); if(!$con){ die('could not connect:' .mysql_error()); } echo "connected successfully."; $database=mysql_select_db('90210store'); if(!$database){ die('<br>could not select database:' .mysql_error()); } echo "<br>database selected"; $firstname=$_post['firstname']; //to information written in form $lastname=$_post['lastname']; $emailadd=$_post['emailadd']; $check_list=$_post['check_list']; $dob=$_post['dob']; $gender=$_post['gender']; $password=$_post['password']; $first= "insert login (firstname,lastname,emailadd,newsletter,dob,gender,password) values ('$firstname','$lastname','$emailadd','$check_list','$dob','$gender','$password')"; $result=mysql_query($first); if($res

ios - Locking UIPanGestureRecognizer to a certain direction -

i have uipangesturerecognizer , i'm trying swipe in 1 direction (up). haven't been able find solution works. thanks. current code: - (void)pangesture:(uipangesturerecognizer *)recognizer{ cgpoint t = [recognizer translationinview:self.view]; recognizer.view.center = cgpointmake(recognizer.view.center.x + t.x, recognizer.view.center.y + t.y); [recognizer settranslation:cgpointmake(0, 0) inview:self.view]; } - (void)pangesture:(uipangesturerecognizer *)recognizer { cgpoint t = [recognizer translationinview:self.view]; if (t.y < 0) { t = cgpointmake(0, t.y); } else { t = cgpointmake(0, 0); // @ } recognizer.view.center = cgpointmake(recognizer.view.center.x + t.x, recognizer.view.center.y + t.y); [recognizer settranslation:cgpointmake(0, 0) inview:self.view]; } to able drag , down use cgpointmake(0, t.y); instead of if

mysql - decode character from unicode using java -

i unable insert chinese character mysql. though of doing this. have excel sheet have chinese characters. 秀昭 , on. i got them converted unicode representations \uxxx using below code got so, , stored in mysql. private static string escapenonascii(string str) { list<string> arr = new arraylist<string>(); stringbuilder retstr = new stringbuilder(); (int = 0; < str.length(); i++) { int cp = character.codepointat(str, i); system.out.println("cp="+cp); int charcount = character.charcount(cp); if (charcount > 1) { += charcount - 1; // 2. if (i >= str.length()) { throw new illegalargumentexception("truncated unexpectedly"); } } if (cp < 128) { retstr.appendcodepoint(cp); } else { retstr.append(string.format("\\u%x", cp)); arr.add(string.format("\\\\u%x", cp));

javascript - Youtube video api plays muted, How to unmute it? -

so since i'm complete noob in javascript, tried fixing problem myself keep messing up. here's code : ` var tag = document.createelement('script'); tag.src = "http://www.youtube.com/player_api"; var firstscripttag = document.getelementsbytagname('script')[0]; firstscripttag.parentnode.insertbefore(tag, firstscripttag); var player; function onyoutubeplayerapiready() { player = new yt.player('player', { height: '100%', width: '100%', playervars: { 'rel':0 , 'autoplay': 1, 'loop':1, 'controls':1, 'start':0, 'autohide':1,'wmode':'opaque' }, videoid: 'k1-travp_xs', events: { 'onready': onplayerready, 'onstatechange': onplayerstatechange} }); } function onplayerready(event) { event.target.mute(); } function onplayerstatechange(event)

php - strip text with regex -

Image
i want extract text between [ , ] regex in php: example input: hello, [good] test [regex] test desired output: good regex how can extract them? use regex /\[(.*?)\]/ <?php $str='hello, [good] test [regex] test'; preg_match_all('/\[(.*?)\]/', $str, $matches); print_r($matches[1]); output : array ( [0] => [1] => regex )

c# - MS Interop Word, Excel multiple opened files DocumentBeforeClose handling -

i have module windows explorer in app. want handle opening , closing word , excel files in module. when i'm opening f.e. 4-5 files @ same time, close handler doesn't work correctly. the problem is: after closing word app, app not stopping on breakpoint @ beginning of worddocevents_documentbeforeclose function. seems related inter process communication, because every opened document new process. if known issue please help, otherwise i'll try in codes. code snapshot: if (_wordapp == null) { _wordapp = new word.application(); _worddocevents = (word.applicationevents4_event)_wordapp; if (!islocked) { //_worddocevents.quit += new word.applicationevents4_quiteventhandler(worddocevents_quit); _worddocevents.documentbeforeclose += new word.applicationevents4_documentbeforecloseeventhandler(worddocevents_documentbeforeclose); _worddocevents.documentbeforesave += new word.applicationevents4_documentbeforesaveeventhandler(worddocev

python - OpenGL 4.2+ and shader_image_load_store for 3D textures not working? -

i trying figure out why i'm not able write 3d textures using (now built-in) shader_image_load_store extension. i created 2 simple examples (in python make easier): 1 write 2d texture, works, , 1 write 3d texture not work the (working) 2d version following: #! /usr/bin/env python pyqt4 import qtgui, qtcore pyqt4.qtopengl import * opengl.gl import * opengl.glu import * import sys itexsize = 256 _vsclearsource = """ #version 440 compatibility void main() { gl_position = ftransform(); gl_frontcolor = gl_color; } """ _fsclearsource = """ #version 440 compatibility uniform int iprimitivecount; uniform int isliceindex; layout(size4x32, binding=0) coherent uniform image2d volcolorvolume; const int imaxtexsize = 255; void main() { ivec2 ivecvolumecoordinate = ivec2(gl_fragcoord.x, gl_fragcoord.y ); //, isliceindex); vec4 vecvolumevalue = vec4(0,1,0,1); // vec4(

How to populate dependant select menus dynamically using jQuery, PHP and MySQL? -

i have searched quite bit on here topic. not find solution problem. i'd appreciate lot if me, school project working on. i have database table ("main_table") , columns including "sector" , "sub_sector". want have 2 select boxes, first 1 load records database in "sector" column , second 1 load records database in "sub_sector" column depending on selection value of first select box. (for example: if select "plastics" on first select box, second select box should updated sub_sector values sector value equal "plastics"). i have managed load options values database first select box when click on selection, not load option second select box. can find codes below. did not put "sector_options.php" below, seems work fine. index.html shown below: <script> $(document).ready(function() { $('#filter_sector') .load('/php/sector_options.php'); //this part works fine - uploads option

AVSystemController to disable iOS System sounds gives not found for architecture i386 error -

i want silent ringer volume. using link - how disable ios system sounds if use code: - (void) setsystemvolumelevelto:(float)newvolumelevel { class avsystemcontrollerclass = nsclassfromstring(@"avsystemcontroller"); id avsystemcontrollerinstance = [avsystemcontrollerclass performselector:@selector(sharedavsystemcontroller)]; nsstring *soundcategory = @"ringtone"; nsinvocation *volumeinvocation = [nsinvocation invocationwithmethodsignature: [avsystemcontrollerclass instancemethodsignatureforselector: @selector(setvolumeto:forcategory:)]]; [volumeinvocation settarget:avsystemcontrollerinstance]; [volumeinvocation setselector:@selector(setvolumeto:forcategory:)]; [volumeinvocation setargument:&newvolumelevel atindex:2]; [volumeinvocation setargument:&soundcategory atindex:3]; [volumeinvocation invoke]; } it crashes on nsinvocation *volumeinvocation = [nsinvocation invocat

python - CMD auto-completion not working correctly -

(python 3.3.4) i using cmd module build application, reason can't completion work correctly. whenever hit tab indents input string!! so, if have this: (myshell)>> ta«cursor here» hit «tab» , this: (myshell)>> ta «cursor here» i have tried in idle, windows power shell , in python interpreter itself, guess... neither completion of commands nor completion of arguments work!! the code this: class myshell(cmd.cmd): def __init__(self): cmd.cmd.__init__(self) self.intro = "welcome myshell test.\npowered rodrigo serrão" self.prompt = "(myshell)>>" def do_talk(self, text): print("hello") stuff = ["blabla", "bananas!", "noodles"] def complete_talk(self, text, line, s, e): if text: return [i in stuff if i.startswith(text)] else: return stuff myshell().cmdloop() i have read questions this, including one:

xml - PHP DOM with namespace - parsing custom tags in a HTML template -

my goal create custom templating system html documents in php. i'm using domdocument, i'm having trouble getting recognize custom namespace special tags want introduce. the beginning of test script looks this: $document = new domdocument(); $document->loadhtml(' <div> <example:content /> </div>', libxml_html_noimplied); $elements = $document->getelementsbytagnamens('example', 'content'); when run following warning. don't mind suppressing if can namespace work. warning: domdocument::loadhtml(): tag example:content invalid in entity, line: 3 in /users/ryanwilliams/sites/test xml/test.php on line 8 when var_dump $elements following output (it found no results). object(domnodelist)#2 (1) { ["length"]=> int(0) } when echo parsed template following results. note stripped out namespace. <!doctype html public "-//w3c//dtd html 4.0 transitional//en" "

r - Computing difference between rows in a data frame -

i have data frame. compute how "far" each row given row. let consider 1st row. let data frame follows: > sampledf x1 x2 x3 1 5 5 4 2 2 2 9 1 7 7 3 what wish following: compute difference between 1st row & others: sampledf[1,]-sampledf[2,] consider absolute value: abs(sampledf[1,]-sampledf[2,]) compute sum of newly formed data frame of differences: rowsums(newdf) now whole data frame. newdf <- sapply(2:4,function(x) { return (abs(sampledf[1,]-sampledf[x,]));}) this creates problem in result transposed list. hence, newdf <- as.data.frame(t(sapply(2:4,function(x) { return (abs(sampledf[1,]-sampledf[x,]));}))) but problem arises while computing rowsums: > class(newdf) [1] "data.frame" > rowsums(newdf) error in base::rowsums(x, na.rm = na.rm, dims = dims, ...) : 'x' must numeric > newdf x1 x2 x3 1 3 3 3 2 1 4 4 3 6 2 2 > puzzle 1 : why error? did noti

html - Firefox browser showing extra space between menu and slider[resolved] -

i helping friend site , using ie, chrome , firefox safari make sure site multi browser compatible. chrome, ie , safari show menu should firefox adds 10 pixels between menu , slider. tried find source of error using chrome , mozilla developer tools, , cannot see comming from. here link adding negative margin div containging slider resolved issue.

Current section indicator - HTML and CSS -

Image
i want create section indicator in image, highlight current section shown on screen. can me create mockup in htm , css(no need js now) have @ blog post: http://blog.sathomas.me/post/tracking-progress-in-pure-css you don't need javascript

C Readline Function Not Working -

i'm reading bignerdranch book on objective-c , it's running me through how take lines stdin in regular c. reason, example code that's supposed run readline duplicating input (small bug) not functioning. builds after taking input in if type mikey displays mmiikkeeyy , i get: (lldb) implicit declaration of function readline thread1:exc_bad_access(code=1,address=0x20000) code: #include <stdio.h> int main(int argc, const char * argv[]) { printf("who cool? "); const char *name = readline(null); printf("%s cool!\n\n", name); return 0; } any appreciated. you did not include header file readline() declared. therefore compiler assumes function returns int . reason crash @ runtime. if use gnu readline library add #include <readline/readline.h> #include <readline/history.h> to code. question assume compiling xcode on os x. os x has "libedit" library has "readline wrapper". in c

types - MYSQL Database Structure - Storing Multiple Values -

Image
i have questions regarding new database structure. 1. let's user can create recipe. each recipe have several ingredients. each ingredient have following 4 fields. 1. ingredients 2. quantity of ingredients 3. unit size of ingredients 4. prep method ingredients i have been racking brain trying figure out how structure this. should create 4 rows , contain each 1 of inputs array , store in row belongs to? best way , efficient? 2. if have description field , directions field length of characters unknown, blob type best here? thanks! as ingredients can appear @ many recipes , different recipes can contain same ingredientes have n:n relation between recipes , ingredients. on other hand, have called relation attributes try like: recipes table: recipes igredients table: ingredients recipe - has - ingredient relation: stored in table: has_ingredient where: quantity , unit size , pre method fields , recipes primary key , ingredients primary key foreing key

php - Updating new class Magic Minifier in CodeIgniter? -

lot of times have put new class in codeigniter, hepler, have problem, on server got error 500? dont know why. this class want implement in ci magic minifier magicmin php based javascript , stylesheet minification , merging class. http://www.phpclasses.org/browse/file/46461.html i done , put in ci helper made construct, on view when try call object got error 500, , no error log in server? can me that, have made work put class outside of ci, , done include, , working ok, dont want that, want have view, clean :) when in controller function __construct() { parent::__construct(); require( './application/third_party/class.magic-min.php' ); $vars = array( 'encode' => true, 'timer' => true, 'gzip' => true, 'closure' => true); $data->minified = new minifier( $vars ); } it working dont want have require in construct?

jquery - How to get the result of a javascript function from a python code using Beautiful Soup? -

i want scrap data website using beautiful soup in python. site changes values of drop down menu based on selection user. there no api call in changing values of drop down menu. on taking closer look, observed there 1 javascript function called internally values of drop down menu. problem values of drop down menu not there in page source. got calling js function sice there no api call, can't request values. can tell me how can call javascript function python code. i'm using beautiful soup web scrapping. thanks you might interested in pyv8 module ; lets embed javascript interpreter in python code, not include browser dom. give short example in why beautifulsoup not finding specific table class? for javascript makes more extensive use of browser features, may prefer ghost.py , headless webkit-based browser python api. failing that, if gave page url, take @ javascript , see if there's quick way duplicate call in python.

Neo4j: Exception handling and explict invoking of failure()/close()? -

i trying handle exceptions in neo4j try transaction. try(transaction tx = graphdb.begintx()) { // more code tx.sucess(); } the code posted standard, keeps transaction in variable tx , upon end of try block tx.close() automatically called. hows 1 handle exceptions in type of block? know following works: transaction tx = graphdb.begintx(); try{ // more code tx.sucess(); // must called } catch(exception e) { tx.failure(); // exception arised, best call this. } { tx.close(); // tx.close called automatically, or must call did here? } so have 2 questions, first sample of code: how 1 handle exceptions in one? second sample of code: must call explicitly , automatically called? simply add exception handling, omit finally: try(transaction tx = graphdb.begintx()) { // more code tx.sucess(); } catch(exception e) { // .. }

Persisting Data in a Twisted App -

i'm trying understand how persist data in twisted application. let's i've decided write twisted server that: accepts inbound smtp requests sends message 3rd party system modification relays modified message destination a typical twisted tutorial have build app using deferreds , callbacks, roughly: a factory handles inbound requests each time full email received call sent remote message processor, returning deferred add errback substitutes original message if goes wrong in modify call. add callback send message on recipient, again returns deferred. a real server add/include additional call/errbacks retry or notify sender or whatnot. again simplicity, assume consider acceptable amount of effort , log errors. of course, persists no data in event of crash/restart/something else. solution involves 3rd party persistent datastore (rabbitmq mentioned) , come dozen random ways achieve outcome. however, imagine there few approaches work best in twisted app

c# - Passing multiple Collections of data from View to Controller (ASP.NET MVC 5) -

in view have next structure ( control of subject* s each *group ): @using (html.beginform()) { @html.antiforgerytoken() <div class="form-horizontal"> @for (int = 0; < viewbag.allgroups.count; i++) { <h4>@viewbag.allgroups[i].code</h4> <select id="e-@i" multiple="multiple"> @foreach (subject subject in viewbag.allsubjects) { <option value="@subject.name">@subject.name</option> } </select> } <input type="submit" value="generate" class="btn btn-default" /> </div> } the question how can retreive data (i want receive (1)list of groups , and want (2)list of selected subjects each group in list(1)) in controller? thank in advance.

javascript - JQuery: dropped divs are sortable only after second click -

when drop divs sortable pane, can grab newly created divs after second time click on them. suppose refresh-related issue, cannot figure out how make work. here jsfiddle: http://jsfiddle.net/dve5q/ , code: $(".box").draggable({ helper: 'clone' }); $("#left").droppable({ accept: '.box.out', drop: function (e, ui) { $(this).append('<div class="box"></div>'); var droppedbox = $(this).children().last(); $(droppedbox).html(ui.helper.html()); } }); $("#left").sortable(); thanks help! i use attribute connecttosortable: '#left' demo http://jsfiddle.net/dve5q/1/ $(".box").draggable({ helper: 'clone', connecttosortable: '#left' }); $("#left").droppable({ accept: '.box.out', drop: function (e, ui) { } }); $("#left").sortable();

java - How to add a column header to the dynamic table -

i creating dynamic table display results database. tried ages not working. how can add 2 header columns table? private void buildtable() { sqlcon.open(); cursor c = sqlcon.readentry(); int rows = c.getcount(); int cols = c.getcolumncount(); c.movetofirst(); // outer loop (int = 0; < rows; i++) { tablerow row = new tablerow(this); row.setlayoutparams(new layoutparams(layoutparams.match_parent, layoutparams.wrap_content)); // inner loop (int j = 0; j < cols; j++) { textview tv = new textview(this); tv.setlayoutparams(new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content)); //tv.setbackgroundresource(r.drawable.cell_shape); tv.setgravity(gravity.center); tv.settextsize(18); tv.setpadding(0, 5, 0, 5);

java - How does Modulus work with negative integers? -

i running loop , inside loop have following: for(int = 0; < 12; = + 2){ system.out.println("i = " + i); system.out.print("3 - % 3 (i @ " + + ") = " + (3 - % 3)); system.out.println(); system.out.println("3 - (" + (i) + ") = " + (3 - i)); } i understand how modulus works or positive numbers, not understand how works negative integers? can explain me please? many thanks. 4 % 3 == 1 -4 % 3 == -1 4 % -3 == 1 -4 % -3 == -1 changing sign of first number changes sign of result. sign of second number doesn't matter. this true in many languages (c, c++, java, javascript) not languages (python, ruby).

html - Why is H2 larger than H1? -

in following code snippet, why h2 content larger h1 content? <article> <section> <header> <h1>first header</h1> </header> </section> <section> <header> <h2>second header</h2> </header> </section> </article> http://jsfiddle.net/abugp/ why h1 content larger in snippet below not 1 above? <h1>first line</h1> <h2>second line</h2> http://jsfiddle.net/59t43/ since haven't specified styles, size of headings determined browser's default style sheet. in particular, means relative size of 2 headers may vary depending on viewer's browser. looking @ fiddle in chrome 33, see effect describe. right-clicking headings , selecting "inspect element" reveals issue cause presence of <article> and/or <section> tags around headings. in particular, chrome's default style sheet includes ru

"String cannot be converted to PubliclyCloneable" Java Issue -

so trying add few strings doubly linked list keep getting error string cannot converted publiclycloneable (an interface extends cloneable, use purposes of creating clone() , copy constructor, la textbook's explanation). here demo code looks like: public static void main(string[] args) { doublylinkedlist list1 = new doublylinkedlist(); doublylinkedlist.doublylinkediterator = list1.iterator(); string pittsburgh1 = new string("penguins"); string pittsburgh2 = new string("pirates"); string pittsburgh3 = new string("steelers"); list1.addtostart(pittsburgh1); list1.addtostart(pittsburgh2); list1.addtostart(pittsburgh3); system.out.println("list contains:"); i.restart(); while (i.hasnext()) system.out.println(i.next()); system.out.println(""); here beginning part of class doublylinkedlist: public class doublylinkedlist<t extends publiclycloneable> implements public

ios - Effectively saving using MagicalRecord -

i using magicalrecord in ios app, , not sure right way save. my app chatting, , every time logged in user received message, need update time token. now this: [magicalrecord savewithblock:^(nsmanagedobjectcontext *localcontext) { user *currentuser = [user mr_findfirstbyattribute:@"id" withvalue:@(_current_user_id) incontext:localcontext]; currentuser.lastchatmessagetimetoken = [nsdate date]; }]; however, believe not efficient because once user logged in, id determined, , currentuser same. i thinking should cache currentuser instance variable, cannot find corresponding magicalrecord method perform. also, told not cache nsmanagedobject because bind context. so not sure should do. help? you correct in fetching, updating, , saving single object not efficient. can hold on reference of currentuser object long know context belongs. there, code this; c

Bind List<Object> to a comboxbox in c# wpf -

i have static class named building contains list<beam> beams property; public static class building { public static readonly list<beam> beams = new list<beam>(); } public class beam { public string story; public double elevation; } i'm trying bind building.beams combobox in xaml elevation , story properties of each item in building.beams list displayed in different columns in combobox. have been able implement 2 columns, can't bind these properties. here have tried far: <combobox x:name="cmbbuilding" itemssource="{binding}"> <combobox.itemtemplate> <datatemplate> <grid width="300"> <textblock width="150" text="{binding path=story }"/> <textblock width="150" text="{binding path=elevation}"/> </grid> </datatemplate> </combobox.itemtemp

java - Summing the results of an array multiplication -

i need sum result of multiplication of these 2 arrays: item store 0 1 2 3 4 0 25 64 23 45 14 1 12 82 19 34 63 2 54 22 17 32 35 item cost per item 0 $12.00 1 $17.95 2 $95.00 3 $86.50 4 $78.00 i have sum results of first row, second row, , third row , display them separately , add them up. code i'm using program following: import java.util.*; public class asd { public static void main(string[] args) { double items[][]= new double[3][5]; double cost[]=new double[5]; loadarray(items, cost); system.out.println("total amount of sales each store : "); computecost(items, cost); printarray(items, cost); } public static void loadarray(double items[][], double cost[]) { scanner input = new scanner(system.in); string s1; int num, x, y; for(x=0; x<it

C++ delete doesn't allways work as expected in windows -

i'm frustrated on simple (or guess), in matter appreciated. (sorry if has been answered, haven't had luck of finding somewhere else, that's why i'm asking...) so, i've written following simple program, test purposes. class myclass{ int x[99999]; public: myclass(){} }; int main(){ myclass *x = new myclass; delete x; } having used break point in 1st line of main, it's easy me (using visual studio 2010 , windows resource monitor) realize, after delete called, reserved memory program not released after delete x. if change x[99999] in myclass, x[999999] (adding 9), allocated memory indeed freed. i'm worried peculiar behavior (which happens in various similar tests), expected, program not what's worrying me... first problem that, i'm not sure if can trust windows resource monitor or not. updating output time? or when amounts of space (de)allocated? if it's second, please recommend me tool monitors resources precisely? secondly,

Using php to count rows in mysql database? -

i trying count rows demos table got error catchable fatal error: object of class mysqli_result not converted string in c:\xampp\htdocs\working_scripts\test_2.php on line 8 php code is: <?php $con=mysqli_connect("localhost","root","","test"); if (mysqli_connect_errno()) { echo"error connecting database". mysqli_connect_error(); } $comment_counter=mysqli_query($con,"select count(*) total demos"); echo $comment_counter; ?> you have use mysqli_fetch_array <?php $con = mysqli_connect("localhost","root","","test"); if (mysqli_connect_errno()) { echo"error connecting database". mysqli_connect_error(); } $result = mysqli_query($con, "select count(*) total demos"); if($row = mysqli_fetch_array($result)) { echo $row["total"]; } ?>

javascript - Using background.js with popup.html -

Image
popup.js document.addeventlistener('domcontentloaded', function () { document.body.innerhtml = '<div class="mydiv"><img src="loading.gif"/></div>'; // document.body.style.backgroundcolor = '#f5f5f5'; document.body.style.backgroundcolor = '#fafafa'; document.body.style.borderradius = '4px'; var span = document.createelement('span'); span.innerhtml = 'processing'; span.style.position = 'relative'; span.style.left = 'auto'; span.style.right = 'auto'; span.style.width = '100%'; span.style.textalign = 'center' span.style.display = 'inline-block'; span.style.fontsize = '30px'; document.queryselector('.mydiv').appendchild(span); }); manifest.json { "manifest_version": 2, "name": "note parser", "description": "this extension demonstrates 'brows

eclipse - Java organize subclasses into different folders -

my problem eclipse, seems super simple don't know enough figure out how it. want put subclasses of objects have created folders in default package organize them don't have dozens of objects jumbled together, when create new folder in package explorer , drop them in, no longer connect superclasses. how connect them? create packages organize classes not folders. folders created store app resources, e.g., images , icons. right-click on project's src node in package explorer, new -> other -> package . having created packages , moved classes under them, should organize imports. you opening each class file , hitting key combination ctrl+shift+o .

java - Return text between divs in jsoup -

so need time between divs. <div class="episodetime">12:00 am</div> using jsoup, closest answer find was: document doc = jsoup.parse(html); elements times = doc.select("div[class=episodetime]"); element time = times.first(); however, time continues return null. have scoured jsoup documentation along questions here , cannot find correct answer. i'm not jsoup guru appreciated. this worked me since needed these objects in for loop: time.text();

c++ - using templates in a struct -

i need have variable struct inside struct. so, want able include data kind of struct in struct. think possible template isn't working out: namespace basestructs { template<typedef t> struct packet { int id; t data; }; } so, have if make object of struct this: basestructs::packet packet; it doesn't work because program wants me choose template struct want "data" variable changeable. ideas on how solve this? what want create small object holds id in example , need add data object (which might differ in number of variables , such). a template struct - template. impossible initialize instance of template without giving specific type should locked to. when happens, new concrete type created templte. for example, code: basestructs::packet<foo> foopacket; basestructs::packet<bar> barpacket; would cause compiler create 2 new concrete types following definitions: struct { int id; foo data

java - Having trouble with "replaceall" command -

i have string s1 = "7+8"; and s2 = "7+"; i using following code subtract s2 s1 system.out.println(s1.replaceall(s2,"")); but giving output as "+8" why happening?? the regular expression "7+" matches 1 or more instances of "7" . replaced, leaving "+8" . if want match exact strings, rather regular expressions, use replace instead of replaceall . s1.replace(s2, "")

Add lines to tabular-inline, after saving... django-admin -

first of want thank in advance provide global community, invaluable service. write code hobby, , want finish project (my first) have personal goal , serve nonprofit organization, find myself in somehow awkward position, since english not native language, finding answer (which on stackoverflow) problem me. first question ever... hope well. btw django it's fantastic... have these 2 models: # models.py class cabmovimiento(infocomun): """ guarda información de la cabecera de los movimientos internos de equipos, salvo préstamos. hereda de infocomun los campos. """ nro = models.integerfield( default=lambda: ult_nro_mov('cm'), verbose_name="número", blank=true) det = models.manytomanyfield( 'inventario.equipo', through='detmov', verbose_name="componente") class meta: verbose_name = 'movimiento interno' verbose_name_plural = 'movimie

c# - Using a sharepoint datasource in .rdlc report file in VS2012 -

i'm banging head against wall here. i've got sharepoint list want datasource in .rdlc file. go "add dataset", name it, select "new" create new datasource. vs walks me through creating new datasource, when i'm finished shows service reference , can use in code. now, annoying part. still doesn't show in drop-down list. doesn't matter how many times create datasource or put report, refuses acknowledge existence of new datasource , doesn't let me use it. any , appreciated here. if need more information, let me know.

ios - UITableViewCell on delete doesn't move UITableViewCell's contentView -

Image
i'm running ios 7 on xcode 5.1 have simple table view cell subclass couple labels , switch. all uiview elements in cell's contentview. logged tableviewcell's contentview , see 2 labels , switch. reading other posts, thought that's had put elements in uitableviewcell's contentview are. have constraints setup ib put in me see if move labels when edit button selected, not. looks this: i'd move on labels when edit button selected. thoughts? in advance! try using tableview reloadinputview or reloaddata. if doesnt work, @ of tableviews delegate methods, , respond event happening table or cell using 1 of methods

multithreading - When using RabbitMQ as a java work queue, how should you handle concurrency and transient errors? -

i'm considering setting rabbitmq broker handle basic task processing java web application. basic idea producer web server wants speedy processing requests, needs data processing. accomplish this, knows job dtos can serialized amqp messages, , somewhere out there consumer knows how process these jobs. classic. after reading rabbitmq documentation, i'm still left couple of questions. i want consumer application utilize cpu processing messages, , i'm wondering if rabbitmq provides worker pool. assuming wanted 4 worker threads, enough register 4 channels 1 consumer each on same connection? in case, work done in handledelivery() , ack sent if completes. or rather, should use 1 consumer , manage pool of workers @ own layer of application? consumers talking database, means transient errors occur; deadlocks, optimistic locking violations, database server restarts, , on. intended behavior if consumer can't process job? issue nack , wait broker resend job, or delay ack

java - Error with compareTo method -

everything runs in post office file except when run post office file, says there problem compareto method in letters file. error reads: ----jgrasp exec: java postoffice exception in thread "main" java.lang.nullpointerexception @ letter.compareto(letter.java:33) @ letter.compareto(letter.java:1) @ sortsearchutil.selectionsort(sortsearchutil.java:106) @ postoffice.sortletters(postoffice.java:73) @ postoffice.main(postoffice.java:15) ----jgrasp wedge: exit code process 1. ----jgrasp: operation complete. i don't know wrong method. compareto method supposed compare current letter 1 passed in first zip code, street value of address if zip codes same. here's post office method: import java.util.*; import java.io.*; public class postoffice { private final int max = 1000; private letter [] ltrara = new letter[max]; private int count; public static void main(string [] args) { postoffice postoffice = new postoffice();

java - JSch shell returns into StringArray -

i trying relearn java after 10 years of not touching it. want create library using jsch other apps looking write. have connections ironed out using stdin , stdout right now. looking have method accepts single command in string , returns arraylist results. any assistance great! //this vars in class. private jsch _jsch; private session _session; private channel _channel; here connection method public boolean connect () throws jschexception { try { _jsch = new jsch(); _session = _jsch.getsession(_user, _hostname, _port); _session.setpassword(_password); _session.setconfig("stricthostkeychecking", "no"); _channel = _session.openchannel("shell"); //((channelshell)_channel).setptytype("vt100"); _channel.setinputstream(bais); _channel.setoutputstream(baos); _channel.connect(3000); }//try connect catch (jschexception ex) {