Posts

Showing posts from May, 2014

database - MariaDB on Windows - getting started help? -

i'm trying learn mariadb (v5.2.4), i'm running issues. can download , install it, doesn't seem running or i'm missing something. i'm looking resource 1st timer running on windows. a few specific questions: does require mysql run? alot of installation out there seems geared around upgrading mysql, want start fresh. is there management tool database (like sql server management studio)? if not, people typically use? you not need mysql run mariadb. once you've installed mariadb should able type net start mysql at command prompt , start mariadb (yes type mysql) to answer second part of question, know company called navicat used offer administrative gui, can't seem find on site anymore.

python - How to run programs in python2 and python3 -

i have python 2.6.6 , python 3.1.3 installed on machine (windows vista 64 bit) path variable includes directory of both versions. how can specify python want run program in. instance, if want run program in python 3, works if want run different program in python2 syntax error. how can run python 2 program in cmd? typing python in command line, python 3.1.3 1 shows up. you can specify version in executable name python2.6 , python3 .

console - Ruby Rails query selection criteria includes encrypted field -

i using rails 2.3.4 i looking less specific answer question, more general guidance in matter. in our (mysql) database, encrypt identifiable information (pii), such name, address, phone number, etc. requests dynamic queries time. for example, "can query db me entry values given date, users in list of area codes". so, selection criteria include of pii encrypted data, such area code of phone number. for discussion, user , entry tables have following fields of interest: user.id,user.phone entry.user_id,entry.value,entry.created_at because of encryption, can't connect sql client , query "easy" way entries on 11/21/2010 users in list of area codes (555,222,333), this: select e.value,substr(u.phone,2,3) users u inner join entries e on e.user_id = u.id date(e.sent_at) = '2010-11-21' , substr(u.phone,2,3) in ('555','222','333') i'd in console query might give me similar data. it appears encrypted f

xcode - Objective-C pathForResource doesn't find file, returns null -

the code i'm using below doesn't seem find file want, can help? nsstring *path = [[nsbundle mainbundle] pathforresource:@"itunes music library" oftype:@".xml" indirectory:@"~/music/itunes/"]; nslog(@"%@", path); thanks, sami. this looking inside bundle, /applications/my app.app/contents/resources/~/music/itunes (if "~" there legal). you're not looking bundle resource here. why making call find path of file know path to?

android - Parse an xml once for use across many activities -

i'm working saxparser parse xml. problem is, have few screens or activities coded. @ moment, every time transition new activity button press example, new activity needs parse xml on again, can populate screen specific content. is there way in parse xml once through life of program? thank you. sure, parse once , store want remember in variables. more completely, create class (or classes) classes represent properties same information in xml document. constructor of class take xml argument, parse it, , populate properties. hope helps.

java - How to get the text background color (RGB values) of a pdf file? -

does know how can find out text background color (rgb) of pdf file? thank you! there no background. pdf print media oriented, , background white. object (drawing, image etc.) beyond text , makes "background". have detect object , color of (this can not easy too, due different color spaces).

mysql - PHP user permissions - best practice? -

what best practice manage user permissions php/mysql? what have column in users table called 'permissions', string compared pages. if($_session['permissions'] == 'administrator' || $_session['permissions'] == 'moderator'){ // stuff } i'm sure there better way accomplished in simpler, easier way. recommendations? how managing 'mysql' permissions? mean controlling actions in website capable of performing database actions, or you're literally needing database access rights management? if via web, incorporate zend framework's acl if you're looking in depth, or other existing permissions system built in php.

php - Help Understanding Object Orientend Programming OOP -

i've been reading oop on several websites & looking though (so , find hard find shows decent example of full oop php application. give examples using cars doesn't resonate me in regards putting actual use 1 day. can show me full example off oop used in real website scenario. know may asking lot help. or there diagram somewhere shows real life relationship between methods, classes, objects, constructors etc. i know it's not simple explain appreciate attempt. thanks in advance what if change "car" little more familiar on web? $post = new blogpost(); $post->settitle($_post['title']); $post->setbody($_post['body']); $post->settags($_post['tags']); $post->save(); same idea. have blogpost class encapsulates representation , manipulation of blog posts. hides things turning comma-separated list of tags user separate rows in tags table when saving post, , how post saved. switch saving them text files saving t

JQUERY manipulate embed on click -

<object id="player" name="player" width="671" height="442"> <param name="movie" value="player.swf" /> <param name="allowfullscreen" value="true" /> <param name="allowscriptaccess" value="always" /> <param name="flashvars" value="file=video/video.mp4&image=preview.jpg" /> <embed type="application/x-shockwave-flash" id="player2" name="player2" src="player.swf" width="671" height="442" allowscriptaccess="always" allowfullscreen="true" flashvars="file=video/video.mp4" -------flashvars /> </object> <a href="video-test.mp4"><img></img></a>----------------- if click iwant value of href in flashva

sharepoint how to add code handler for button click -

i have sharepoint publishing page. added server button via spd, assign onclick handler btnsubscribe_click. question is, how , can add codes handler? if have inside dll, how can relate sharepoint page .cs file? you cannot add controls publishing pages spd, assume mean have added button page layout? or master page? to make onclick work, know, need have code behind, or script in code. 1) make code behind work, need make custom page layout class, extend microsoft.sharepoint.publishing.publishinglayoutpage then change page layout declaration use new page layout code: <%@ page language="c#" inherits="microsoft.sharepoint.publishing.publishinglayoutpage,microsoft.sharepoint.publishing,version=12.0.0.0,culture=neutral,publickeytoken=71e9bce111e9429c" %> 2) or can enable inline script through web.config, , have standard <script runat=server> sections 3) or better yet, write web part or control subscribe action. , add page layout.

swing - How to print content of a label in java? -

i have created label , added image using seticon property. want print image unable so. i tried .print(graphics g) method dont know graphics?? if can me in printing label, grateful you. thanks you should implenent printable interface see example here

silverlight - Access Control within RowDetailsTemplate on SelectionChange of ComboBox -

i want access checkbox in order change it's enable/disable in selectionchange event of combobox. both controls in rowdetailstemplate example: <grid x:name="layoutroot" background="white"> <sdk:datagrid autogeneratecolumns="false" > <sdk:datagrid.columns> <sdk:datagridtextcolumn visibility="collapsed"> </sdk:datagridtextcolumn> </sdk:datagrid.columns> <sdk:datagrid.rowdetailstemplate> <datatemplate> <stackpanel> <sdk:datagrid width="auto" flowdirection="righttoleft"> <sdk:datagrid.columns> <sdk:datagridtemplatecolumn > <sdk:datagridtemplatecolumn.celltemplate> <datatemplate> &l

java - Rendering nodes in JTree with multiple different fonts -

imagine have jtree showing multiple strings - example list of colors. how possible render such tree different color/font combination? how implement treecellrenderer correctly? thank help. you can extend defaulttreecellrenderer. in gettreecellrenderercomponent method call super() , check conditions e.g. analysing value. after call setfont(), setbackground() , setforeground() methods accordingly.

sharpsvn - How can I "svn delete" a folder and then add a folder with same name? -

i wrote deployment tool own programs based on sql , subversion. i'm able create different versions of applications , store them subversion while information stored in sql. until "deployment tool" worked quite fine found problem. when creating version of application checkout head revision , visualize in program. latest version can edited deleting, renaming, adding or overwriting files , folders. say, if have following tree structure in working copy: - programfiles - assemblies - data - type 1 - ... - type 2 - ... - type 3 - ... i want replace 1 directory (data). calls svn delete , after directory.delete, because "svn delete" marks folders delete when commit. want add folder named "data" again new subfolders , files exception "working copy admin area missing". far can tell problem directory .svn under programfiles stores information folder data shall deleted if read folder crashes

objective c - Adding time to url address -

i try add time informations url address. example: http://www.test.de/output/iphone.txt?%y%m%d%h%m%s like this. this first try: first tried recieve current time: nsdate *currentdate = [nsdate date]; // aktuelles datum und die uhrzeit nsstring *strdate = [[currentdate datewithcalendarformat:@"%y%m%d%h%m%s" timezone:nil] description]; + nsstring *sitestring = @"http://www.test.de/output/iphone.txt"; nsurl *siteurl = [nsurl urlwithstring:sitestring]; nsstring *mystring = [nsstring stringwithcontentsofurl:siteurl encoding:nsasciistringencoding error:&error]; now have 2 variables, strdate , sitestring . want combine these strings, @ end want have following string: nsstring *link = [sitestring "+" ? "+" strdate] that string should like: http://www.test.de/output/iphone.txt?yyyymmddhhmmss use standard string formatting function concatenate 2 pieces together.

javascript - Changing from hover to click? -

i've implemented small box on website @ bottom of page expand when mouse hovers on it... code , works great. css #box{ position:absolute; width:300px; height:20px; left: 33%; right: 33%; min-width: 32%; bottom:0; background-color: #353535; } javascript $('#box').hover(function() { $(this).animate({ height: '220px' }, 150); },function() { $(this).animate({ height: '20px' }, 500); }); but i'm curious how go changing open , close on click rather mouse hovering on it? i've edited to... $('#box').click(function() { $(this).animate({ height: '220px' }, 150); },function() { $(this).animate({ height: '20px' }, 500); }); and works open box. can't close again click. so close yet far! :p this should work $('#box').toggle(function() { $(this).animate({ height: '220px' }, 150);

jquery - If a has attr rel=lightbox then addClass, problem -

i wonder why doesn't work? var attr = $("a").attr('rel'); if (typeof attr == 'lightbox') { $(this).addclass("lightbox"); } i want add class link has rel attribute set "lightbox". this should work... right? $('a[rel="lightbox"]').addclass("lightbox"); that should trick. typeof - returns data type not value! trying compare type (string) value (lightbox).

compact framework - XmlRoot attribute c# -

i'm in need serialize string valid xml object. thing object 2 arrays of other objects, , don't know if following annotation correct: [xmlroot("data")] public class data { [xmlarray("servicourgente")] public servicourgente[] servicosurgentes; [xmlarray("mensagem")] public mensagem[] mensagens; } [xmlroot("mensagem")] public class mensagem { [xmlelement("touserid")] public int touserid; [xmlelement("message")] public int message; [xmlelement("timestamp")] public datetime timestamp; } [xmlroot("servicourgente")] public class servicourgente { [xmlelement("servicoid")] public int servicoid; [xmlelement("touserid")] public int touserid; [xmlelement("fromuserid")] public int fromuserid; [xmlelement("fromusername")] public string fromusername; [xmlelement("datainicioprevis

iphone - Invoke model method with block that will run on the main thread -

one of central tenets of architecture of latest app i'm going call methods on app's model async , accept failure , success scenario blocks. i.e., ui calls model method 2 blocks, 1 success , 1 failure. this great because context of original call retained, however, block called on background thread. there anyway of calling block on main thread?? hopefully have explianed ok, if not, basically, model methods async, return , create new thread on run op. once op returns invoke block postprocess returned data, need call block success scenario defined called inside ui. however, success , failure scenario blocks defined in ui should called in main thread because need interact ui elements should done on main thread believe. many something you're after: - (void) dosomethingwhichtakesageswitharg: (id) thearg resulthandler: (void (^)(bool, id, nserror *)) handler { // run in background, on default priority queue dispatch_asyn

sql - select query on two tables with no unique keys -

i have 2 tables. table1 col1 col2 col3 100 1000 100 1000 100 1002 100 b 1003 100 c 1004 table2 col1 col2 colc 100 1x 100 2x 100 3x 100 b 4x 100 c 5x in above table colc value unique. i want ouptput this, colc values unique here also. col1 col2 col3 colc 100 1000 1x 100 1000 2x 100 1002 3x 100 b 1003 4x 100 c 1004 5x i have use col1 , col2 key join. is possible that. got duplicates comming in first 2 records, when tried inner , left outer joins. tia something this? select a.col1, a.col2, a.col3, b.colc ( select row_number() on (partition col1, col2 order 1) r, col1, col2 table1 ) a, ( select row_number() on (partition col1, col2 order 1) r, col1, col2 table2 ) b a.r = b.r , a.col1 = b.col1 , a.col2 = b.col2;

git - Problem Of Hudson using GitHub Repositories -

i using hudson in windows takes data github repository unable clone data because of ssh key given in github.how provide information of ssh in hudson can access github repository. thnx in advance.... you don't have provide ssh key clone github repo. can read-only cloned using either: https://github.com/user/reponame.git or git://github.com/user/reponame.git

unit testing - RAD: Dependency Injection - benefits? -

are there benefits of using dependency injection @ when using rad - or not using unit testing in general? yeh there several benefits follows: reduced dependencies reduced dependency carrying more reusable code more testable code more readable code for more reference click here

Is there an easier way to display/create rollover images than batching in Photoshop/Fireworks? -

is there easier way display/create rollover images batching in photoshop/fireworks? ideally done through css or javascript , somehow creating semi-transparent white layer on image when moused over. have photoshop process images +10% brightness, , rest in dreamweaver find/replace. it'd nice not have create separate rollover images each picture. thanks! with images don't have create new image rollovers, can edit css decrease opacity of element: .myelement { background.image: url(path/to/file/image.png); } .myelement:hover { filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity: 0.5; } also think you'd benefit looking css sprites: css-tricks sprites tuorial a list apart's css sprites css sprites.com generator

persistenc​e gtk.view with shelve module -

i have difficult manage persistence of gtk.view object shelve module. i use python 2.6.5 , pygtk. my first test implemented process basic object this #!/usr/bin/env python - - coding: iso-8859-1 - - '''test de shelve ''' import gtk import gobject import shelve import os class shelvedemo(object): def init (self): self.variable1 ='essai' self.variable2 ='1' self.variable3 ='15' self.variable4 =15000 def affiche(self): print self.variable1 print self.variable2 print self.variable3 print self.variable4 def save(self,objet): save_file = os.path.abspath( "d:\sphinx" + os.sep + 'essai2.tvw') db = shelve.open(save_file) db['cle1']=objet print print "liste des clé enregistrée",db.keys print db.close() print('sauvegarde ok') def load(self): save_file = os.path.abspath("d:\sphinx" + os.sep + &

javascript - link Click tracking does not work on Safari browser -

i have basic html page has links point different site. want track clicks. doing sending 0 pixel image call on click event of link without returning false on click event. the same works fine on browsers except safari(on windows os). when link clicked using javascript delay redirect , send image request on server , log click on server side. have tried increasing delay no success... trackers work gr8 on browsers except safari not sent request @ all. i dont know why possibly safari waits complete js executed before making request , after whole js executed gets redirected.... ========================================================= <html> <head> <script type="text/javascript"> function logevent(){ image = new image(1,1); image.onload=function(){alert("loaded");}; image.onload=function(){alert("error");}; image.src='http://#path_to_logger_php#/log.php?'+math.random(0, 1000) + '=' + math

design - Where does idea that "inheritance is to be avoided" originate from? -

recently discussed defect mentioned here , 1 of parties said "yes, that's why books inheritance should avoided . i've been using inheritance years , find useful , convenient in many design cases. i'm sure person arguing @ least misunderstood "books say". is there idea inheritance kind of bad , should avoided? originate , can learn more? i think might have meant inheritance can overused, in cases composition better solution. discussed in several books, e.g. effective java 2nd edition , item 16: favor composition on inheritance inheritance powerful way achieve code reuse, not best tool job. used inappropriately, leads fragile software. safe use inheritance within package, subclass , superclass implementations under control of same programmers. safe use inheritance when extending classes designed , documented extension (item 17). inheriting ordinary concrete classes across package boundaries, however, dangerous. reminder, b

wordpress - CSS horizontal alignment for divs inside div container? -

having trouble wp 3.0.4 not displaying css styling horizontal alignment of 4 boxes (divs) inside container div. note: same css styling works fine html 4.01 transitional//en on hand-coded html/php website. wp 3.0.4 displays 4 boxes stepped down each other, staircase. i'm using firefox 3.6.13, btw. css: div .box-container { display: inline; margin: 0.63em 0pt; padding: 10px; width: 640px; background-color: rgb(229, 231, 225); position: relative; float: left; overflow: hidden; } div .small-box { border: 1px solid rgb(153, 51, 102); margin: 10px 5px; padding: 0.325em; float: left; background-color: rgb(255, 244, 227); width: 128px; line-height: 0.85em; max-height: 8em; min-height: 8em; position: relative; } html goes this: <div class="box-container"> <div class="small-box">some text & image</div> <div class="small-box">some text & image</div> <div class="small-box">some

jquery - make query strings visible -

i doing this: $.ajax({ type: 'get', url: this.href, async: true, data: $('form').first().serialize(), beforesend: function() { $.blockui({ message: 'please wait ...' }); }, complete: function() { $.unblockui(); }, success: function(result) { $("#grid").replacewith($("#grid", result)); }, datatype: "text" }); is possible show query strings obtained form user can store link? thanks. christian sure, pre-calculate serialized form: var the_data = $('form').first().serialize(); $.ajax({ type : 'get', url : this.href, async : true, data : the_data, beforesend: function() { $.blockui({ message: 'please wait ...' }); }, complete : function() { $.unblockui(); }, success : function(result) { $("#grid").replacewith($("#grid", result));

math - Good Java Class to use for collection of mathematical Vectors -

i'm implementing graph (as in vertices, edges, not cartesian). i'm modelling graph physical collection of nodes (a class i've made). i want have collection of forces, vectors (in maths sense), represent forces acting upon each node, , ideally able perform lookup node key, sounds me kind of hash lookup table. what's collection use, or have make own? if needs clarifying, ask. thanks if have understood needs correctly, want one-to-many mapping of node->vector. provided node implements hashcode() , equals(), use multimap google guava. provides map<node,collection<vector>> mapping automatically. the benefit of using multimap don't need this: collection<vector> vectors = nodetovectormapping.get(node); if (vectors == null) { vectors = new hashset<vector>(); nodetovectormapping.put(node, vectors); } vectors.add(vector); instead, need this: nodetovectormapping.put(node,vector); the multimap takes care of c

get first item only in a Android ListView? -

how first list item in listview? want @ textview in first list item. doing this: view listitem=(view)mylist.getchildat(0); textview txtdep=(textview)listitem.findviewbyid(r.id.txtdepart); txtdep.settext("hello!"); but not changing text in first item in every 8th, 16th , on items. change text in first(top) item only. thank you. views recycled textview used many different items in list. if want change specific item displays need change data behind listitem , being served listadapter (in getview() method). whenever listview shows item in list, adapter show correct data in textview. and when change data in list or whatever, need call notifydatasetchanged() on adapter.

Asking for 'Pairing Request' in android 2.1 when connecting to Bluetooth Socket SPP on Samsung Galaxy -

i'm trying connected bluetooth socket spp using samsung galaxy tablet using uuid of "00001101-0000-1000-8000-00805f9b34fb" , doesn't not work me. and have tried using following: method m = device.getclass().getmethod("createrfcommsocket", new class[] { int.class }); sock = (bluetoothsocket) m.invoke(device, integer.valueof(1)); sock.connect(); this working fine, everytime try connect, it's asking pairing request pin, failing of leading failure of bluetooth connection. how can set/save pair information should not prompt pairing request every time connect. i got problem well. android ics issue. workaround can use insecure socket method m = device.getclass().getmethod("createinsecurerfcommsocket", new class[] { int.class }); sock = (bluetoothsocket) m.invoke(device, integer.valueof(1)); sock.connect();

jquery - ajax form postback with file upload controls -

i using iframe support posting form contains file upload controls (without requiring full-page refresh). there more 'up-to-date' ajax mechanism these days posting form in way? jquery ajax support file upload controls in forms? xmlhttprequest (ajax) doesn't support file uploads (yet). iframe way stock html4. you try using plugin http://www.plupload.com/ uses gears, flash, silverlight, html5 gears or html4 based on browser.

Alternatives to macro substitution in java -

i have log statement in use this.getclass().getsimplename() as 1st parameter. put in sort of macro constant , use in log statements. learned java has no such simple mechanism unlike c++. what best way achieve sort of functionality in java? my example log statements (from android) follows.. log.v(this.getclass().getsimplename(),"starting lociden service..."); java doesn't have macros can make code shorter: log.v(this, "starting lociden service..."); and in log class: public void v(object object, string s) { _v(object.getclass().getsimplename(), s); } another approach inspect call stack.

javascript - Help with creating a redirect-like or replacement command -

here's looking do: a person goes site , quicktime movie plays. at end of movie, new image appears (ideally fades in). i guess there 3 ways can happen: a. quicktime image window replaced image. b. quicktime image window moves background/behind existing image on page (or background image comes forward on top of quicktime image window). c. after completion of quicktime movie, site automatically redirects new page. i have components page, have not been able locate code out there can make happen. thanks in advance :) you don't have access plugin that's playing mov. you'd have use native html 5 video. in case: if it's same video - , same length - try running javascript timer in background. when time's up, 1 of things mentioned. html 5 video brings along new media events can use. in case ended event seems appropriate. you'd bind video element other event. on it's simple dom scripting, like: function myhandler(e) { if(!e) {

swing - Java table formatting -

Image
i’im programing in java netbeans. i have table list patients. read information in xml file. here have code: package digiscope; import java.awt.event.mouseadapter; import java.awt.event.mouseevent; import java.io.file; /** * * @author daniel */ public class tabelapaciente extends javax.swing.jpanel { string numero_processo; int localizador = 0; /** creates new form tabelapaciente */ public tabelapaciente() { initcomponents(); load_table(); } public void setnumeroproc(string numero) { numero_processo = numero; } public string getnumeroproc() { return numero_processo; } public int getlocalizador() { return localizador; } string[][] concat(string[][] a, string[][] b) { string[][] c = new string[a.length + b.length][a.length + b.length]; system.arraycopy(a, 0, c, 0, a.length); system.arraycopy(b, 0, c, a.length, b.length); return c; } private vo

winforms - C# Windows Forms. Moveable areas on the PictureBox -

i'm working images like: http://imgur.com/a2vkb i've managed find vertical line between pages on scanned image. there errors , need make option user change line position , angle. think nice within picturebox. i need somehow draw line between 2 movable points on picturebox current image. when move point, position of line , it's angle have changed properly. here sample code can use need. uses 4 events : - paint - mousedown - mousemove - mouseup you can copy-paste code form called form1, picture box called picturebox1 int handleradius = 3; int mpointmoveinprogress = 0; point mpoint1, mpoint2; public form1() { initializecomponent(); mpoint1 = new point(50, 50); // set correct default values mpoint1 = new point(50, 300); // set correct default values } private void picturebox1_paint(object sender, painteventargs e) { // draw line e.graphics.drawline(new pen(color.black, 2), mpoi

Android: obtaining uuid of a bluetooth device -

i need uuid of bluetooth device connect it, don't know uuid. specific each device , how know device's uuid . can done using code? you should more explicit when make question. want connect bt device, or connected , want use particular service? if want connect device need bt address ( like mac ). the uuid related services offered bt device: http://www.bluecove.org/bluecove/apidocs/javax/bluetooth/uuid.html here have list of uuids.

javascript - Neither cookies nor HTML5 local storage working in anything except Chrome -

i'm working on javascript-driven tool store user's selections locally , repopulate when page next navigated to. it's working fine in chrome not @ in ie8 or safari. i've tried store information in cookies using standard javascript, , using jquery.cookie.js plugin, , more i've tried using local storage instead. i'm storing lump of xml, theory perhaps it's large store in cookie, there's no way it's large local storage. i'm testing on local iis under localhost. can think of reason why other browsers aren't working? i'm finding strange affects both cookies , local storage. can think it's kind of security setting that's restricting kind of local storage, cookie or otherwise. i've played around settings in ie, settings in iis, can't work out. thoughts or ideas welcome! regards, matt is xml in string, or in object dom reference? believe ie8's localstorage can take strings keys , values...or primative val

Simplify Couchdb JSON response -

i'm storing location data in couchdb, , looking way array of values, instead of key: value every record. example: the current response {"total rows": 250, "offset": 0, "rows":[ {"id": "ec5de6de2cf7bcac9a2a2a76de5738e4", "key": "user1", "value": {"city": "san francisco", "address":"1001 bayhill dr"}, {"id": "ec5de6de2cf7bcac9a2a2a76de573ae4","key": "user1", "value": {"city": "palo alto", "address":"583 waverley st"} ... (etc). ]} i need: [{"city": "san francisco", "address":"1001 bayhill dr"}, {"city": "palo alto", "address":"583 waverley st"}, ...] the reason minimize amount of bandwidth json response consumes. can't seem find way transform view simple array. sugges

JQuery Contact Modal Plugin doesnt run from Visual Studio Casini browser nor IIS -

im trying run demo visual studio, built-in casini browser iis, , not firing @ all. however, work if fire-up html zip file. to run demo doesnt require web server php enabled because html modified slightly. here modified html: <!doctype html> <html> <head> <title> simplemodal contact form </title> <meta name='author' content='eric martin' /> <meta name='copyright' content='2010 - eric martin' /> <!-- page styles --> <link type='text/css' href='css/demo.css' rel='stylesheet' media='screen' /> <!-- contact form css files --> <link type='text/css' href='css/contact.css' rel='stylesheet' media='screen' /> <!-- js files loaded @ bottom of page --> </head> <body> <div id='container'> <div id='logo'> <h1>simple<span>modal</span></h1> <span

c++ - Pointer Initialization in Classes -

is following code valid? class foo() { int* bar; public: foo() { *bar = 123; } } in other words, bar point real memory space before value assigned space in constructor? or have do this: class foo() { int* bar; public: foo() { bar = new int[1]; *bar = 123; } ~foo() { delete[] bar; } } you need assign memory did in second example. if try run code in first example, crash access violation error since trying write integer 123 in whatever part of memory value of uninitialized bar pointer pointing to.

dns - How to determine which domain registrars (e.g., GoDaddy, Register.com) support which top level domains (TLDs)? -

if wants .ly tld (top level domain) or .io tld, how determine domain registrar (e.g., godaddy, register.com) supports purchasing of tld? if looking registrar niche domain best way visit registry's web site. these may list authorised registrars. problem going non authorised registrars in turn have go via authorised registrar , put price pay. the list of .io registrars can found here: http://www.nic.io/registrars.html the list of .ly (libya) registrars can found here: http://www.nic.ly/lyregistrars.php update 13/3: best place find list of registrars registry's web site located @ http://www.nic.[tld]. there list of icann-accredited registrars can found @ http://www.icann.org/en/registrars/accredited-list.html hope helps. jonathan

Deserialize JSON object array in C# using LitJson -

i'm limited unity3d 3 new security measures using litjson web player application, otherwise won't compile. is there simple way serialize output object (contents of userecoget.text): {"building_id":"1","building_level":"0","workers":"0","building_health":"100"}{"building_id":"2","building_level":"0","workers":"0","building_health":"100"}...{"building_id":"32","building_level":"0","workers":"0","building_health":"100"} this code enters first object json: using unityengine; using system.collections; using litjson; ... public ecodata localecodata; ... localecodata = jsonmapper.toobject<ecodata>(userecoget.text); ... public class ecodata { public string building_id; public string building_level; public string workers;

java - Remove multiple elements from ArrayList -

i have bunch of indexes , want remove elements @ these indexes arraylist . can't simple sequence of remove() s because elements shifted after each removal. how solve this? sort indices in descending order , remove them 1 one. if that, there's no way remove affect indices later want remove. how sort them depend on collection using store indices. if it's list, can this: list<integer> indices; collections.sort(indices, new comparator<integer>() { public int compare(integer a, integer b) { //todo: handle null return b.compareto(a); } } edit @aioobe found helper failed find. instead of above, can use collections.sort(indices, collections.reverseorder());

python - How to wrap this into a recursive call -

i'm writing little spider in python. hits page, gets links on page according pattern, goes each of pages, , repeats. i need make recursive somehow. below url patterns: www.example.com then links based on regex, visit each page. recursive part: say visiting page url like: www.example.com/category/1 now if page contains links like: www.example.com/category/1_234 (basically same url, except has additional "_234234") i visit page, check url like: www.example.com/category/1_234_4232 (again, same url plus underscore , number) i keep doing until there no more links fitting pattern. 1. visit category page 2. contain links same url + "_dddd" if yes, visit page 3. #2 unless no links i don't need regex, need structuring recursive call. just-recursion, in manner asking for, might not best approach. for 1 thing, if there more 1000 pages indexed, might 'bottom out' call stack , crash. another, if not careful releasing

java - Handle System as a dependency -

is there way java.lang.system used in dependency injection? currently build classes public class myclass { private final dependency idependency; public myclass(dependency pdependency) { this.idependency = pdependeny; } public static myclass createinstance() { final dependency tdependency = dependency.createinstance(); final myclass tinstance = new myclass(tdependency); return tinstance; } // ... class methods ... } and create using: myclass tmyclass = myclass.createinstance(); and test use: @test public void testmethod() { // setup dependency ttestdependency = new testdependency(); myclass tmyclass = new myclass(ttestdependency); // test tmyclass.method(); } now have problem have java.lang.system dependency want write console logger. have no problem setting system datatyp dependency eclipse says no when want set system parameter. error "system cannot resolved variable".

sql - MySQL: Multi-column join on several tables -

i have several tables joining need add table , can't seem right query. here have - table 1 carid, catid, makeid, modelid, caryear table 2 makeid, makename table 3 modelid, modelname table 4 catid, catname the query using join these is: select * table1 join table2 b on a.makeid=b.makeid join table3 c on a.modelid=c.modelid join table4 d on a.catid=d.catid a.carid = $carid; now need add 5th table getting 3rd party having hard time adding existing query. new table has these fields - table 5 id, year, make, model, citympg, hwympg i need citympg , hwympg based on caryear table 1, makename table 2, , modelname table 3. know can second query values, prefer single query , have of data in single row. can done in single query? if so, how? it's possible have more condition in join. work? select a.*, e.citympg, e.hwympg table1 join table2 b on a.makeid=b.makeid join table3 c on a.modelid=c.modelid join table4 d on a.catid=d.catid join ta

android application design -

i have develop application have continuously collect gps, accelerometer data [esp. when user in motion i.e traveling, else can relaxed). have communicate web server , handle response sever. this(handling response ) part application should continuously poll. based on response server have show ui user. i not clear design. do have create activity start service. should service ran separate thread(this runs in background). i planning create 2 services. 1 service continuously collect gps data. other service communicating web server[start timer/alarm manager] polling. can these 2 services communicate each other. also after processing response frm server service should able start user interface show form. not clear how handle this. also acquiring wakelock required if have collect gps data continuously. please clarify. thanks you can use alarmmanager polling. need set interval. notice components application, service, activity contexts. can application context.

Is it possible to limit the size of Hibernate second-level-cache for a specific entity? -

i have scenario hibernate second-level-cache enabled , i'd cache entity 1000 instances created every day , retained 8 years queries deal recent 2 days. avoid having create history table because rare cases historical lookup, code dependent on date. is possible in hibernate, infinispan level-2 provider, configure specifically, particular cache specific attributes (eviction policy, size, etc.) hibernate should use entity foo? yes. in hibernate, can have n cache "regions", can have different configurations , can specific entities. configuration dependent on provider (infinispan, in case). see document more details on infinispan configuration: http://community.jboss.org/wiki/usinginfinispanasjpahibernatesecondlevelcacheprovider#advanced_configuration look @ examples on how override defaults entity/collection. there, can set eviction strategy, lifespan , number of entities keep in cache.

Static analysis of Java call graph -

what i'd scan set of java classes, , trace method calls specific method of abstract class, , within context, build list of code performs operation (in case, instantiates instance of class). want know, line number, , arguments supplied. i've begun looking @ bcel, doesn't seem have call graph tracing built in? i'm hesitant write own because getting overloading, type signatures , polymorphic dispatch right might be tricky. i half expected tool or example code exist, haven't found yet. feels i'm reinvent wheel. if open source wheel , available on github ;-) ps: find existing question " how generator java call graph ", because sounds identical, it's not @ need. you can use java-callgraph tool suite create accurate enough static , dynamic callgraphs java.

android - layout_height always wrapping content -

it's simple question: i have layout file presented item inside of listview. set height of relativelayout 100dp, not work, it's wrapping content, no matter layout use. can set fixed value layout height without having wrapping? thanks help. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="100dp"> <!-- attribute seems ignored --> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true"> <progressbar xmlns:android="http://schemas.android.com/apk/res/android&qu

iphone - Way to set OAuth Token on TTUrlRequest -

i'm implementing oauth in app using gtm-oauth or oauthconsumer (haven't decided yet 1 easier). the thing is, server api calls i'm using tturlrequest, there easy way associate access token tturlrequest there nsmutableurlrequest ? thanks ended using oauthconsumer , , setting header manually.

sql - MySQL: Union, Count, and Group By -

( select root_tags.tag_id, root_tags.tag_name, count( root_tagged.pg_id ) root_tags left join root_tagged on ( root_tagged.tag_id = root_tags.tag_id ) left join root_pages on ( root_pages.pg_id = root_tagged.pg_id ) left join root_granted on ( root_granted.pg_id = root_tagged.pg_id ) root_pages.parent_id = '5' , root_granted.mem_id = '3' group root_tags.tag_id order 3 desc ) union ( select root_tags.tag_id, root_tags.tag_name, count( root_tagged.pg_id ) root_tags left join root_tagged on ( root_tagged.tag_id = root_tags.tag_id ) left join root_pages on ( root_pages.pg_id = root_tagged.pg_id ) root_pages.parent_id = '5' , not exists ( select * root_granted root_granted.pg_id = root_pages.pg_id ) group root_tags.tag_id order 3 desc ) the query above returns result below, tag_id tag_name count(root_tags.tag_id) 16 expert-category-c 2 14 expert-category-a 1 15 expert-category-b 1 16

subsonic - Error The type or namespace name 'name of my tables' could not be found()are you missing a ussing directive or an assembly refrence?) -

i error (the type or namespace name 'name of tables' not found()are missing ussing directive or assembly refrence?)) in context.cs file when compile asp.net mvc2 web application. follow these guide http://subsonicproject.com/docs/setting_up_subsonic_3.0 cant solve problem. i have seen error after made customizations sqlserver.ttinclude include tables, forgot make corresponding changes in activerecord.tt. if setting , have made no modifications, not seeing error same reason. maybe try reloading .tt , .ttinclude files subsonic distribution sure didn't accidentally modify them (other setting connection string etc.).

security - IPSec vs OpenSSL vs PGP -

ipsec employed @ ip level, ssl @ transport level , pgp @ application level. in lecture not says: ipsec: general solution least flexible ssl: still general , flexibility pgp: least general flexibel. i guess general refers kind of protocol can secure. ipsec can secure uses tcp or udp. pgp least general because encrypts emails , therefore specific. understanding right? however have no idea flexibilty refers in context, idea? has extensibility? thanks ipsec: internet layer protocol, means runs above ip layer, such tcp or udp example, or other newer protocol, encrypted ipsec. however, protocol encryption/authentication of packets/protocol above , this, less flexible in some sense compared other 2 still flexible if need network encryption. ssl: encryption protocol, similar (i guess) ipsec, operates @ higher layer ipsec. operates on application layer means protocol runs on top of tcp, udp, etc... now 1 problem ipsec flexible in respect in lower in network layer, p

Unified way of closing a browser window in JavaScript? -

is there way close browser window, guaranteed ? last time heard, calling window.close() or self.close() works when current window launched window. there way majority of browsers close current window when isn't so? there no way close parent window via script without prompting in major browser. so nope, no guarantees. on child window, window.close , self.close both work great.

asp.net - Is it safe to use an HttpModule for localization? -

i'm considering making use of httpmodule localization purposes (based on example in this article ) - i'm curious, safe? here's code, reference: public class cookielocalizationmodule : ihttpmodule { public void dispose() { } public void init(httpapplication context) { context.beginrequest += new eventhandler(context_beginrequest); } void context_beginrequest(object sender, eventargs e) { // eat cookie (if any) , set culture if (httpcontext.current.request.cookies["lang"] != null) { httpcookie cookie = httpcontext.current.request.cookies["lang"]; string lang = cookie.value; var culture = new system.globalization.cultureinfo(lang); // safe in situations? thread.currentthread.currentculture = culture; thread.currentthread.currentuiculture = culture; } } } i under impression multiple threads potentiall

xslt - parsing xml to skip tags -

i have following stylesheet skip tags xyz_1, xyz_2. how work xyz_* also, in output tags skipped have empty lines, how suppress them. thanks in advance. <?xml version="1.0" ?> <xsl:stylesheet version="2.0" xmlns="http://www.w3.org/1999/xsl/transform" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="html" indent="no" encoding="utf-8" omit-xml-declaration="yes" /> <xsl:template match="*"> <xsl:copy> <xsl:copy-of select="@*" /> <xsl:apply-templates /> </xsl:copy> </xsl:template> <xsl:template match="xyz_1" /> <xsl:template match="xyz_2" /> </xsl:stylesheet> here sample xml <?xml version="1.0" encoding="utf-8"?> <tags> <tag> <tag1>tagname1</tag1>