Posts

Showing posts from January, 2011

How do I parse and save all the classes with their properties from an RDF file using Jena API in Java? -

i have project need parse rdf file , record data on have search specific data afterwards. searched web , find how query said rdf file want parse , save classes in objects. this how class looks in file: <bfo rdf:about="bfo:0000007"> <rdfs:label>process</rdfs:label> <definition> <rdf:description> <def>a process entity exists in time occurring or happening, has temporal parts , involves , depends on entity during time occurs.</def> </rdf:description> </definition> <is_a rdf:resource="efo:0000001"/> </bfo> update: yea u said worked, thank 1 last question:) namespaces have are: <?xml version='1.0' encoding='utf-8'?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns="http://www.ebi.ac.uk/efo/"> </rdf>

xml - What is the proper way in xsd to define a set of elements that may be child elements and may repeat? -

i trying determine proper way using xsd schema define element may contain of set of child elements including possible repeat child elements. for example, given following xml document: <?xml version="1.0" encoding="utf-8" ?> <encounterdefinitions xmlns="http://lavendersoftware.org/schemas/steamgame/data/xml/encounters.xsd"> <encounter name="sample encounter"> <task> <weapon/> <weapon/> <information/> </task> <task> <tool count="3"/> <ritual/> </task> </encounter> </encounterdefinitions> i've managed sus out xsd far. <?xml version="1.0" encoding="utf-8"?> <xs:schema id="encounters" targetnamespace="http://lavendersoftware.org/schemas/steamgame/data/xml/encounters.xsd" elementformdefault="qualified" xmlns="http://la

c# - checkBox1.Checked throwing an error -

new c# , visual studio. when testing line: string mystring = (checkbox1.checked) ? "it's checked" : "not checked"; i following error. error 1 event 'system.windows.controls.primitives.togglebutton.checked' can appear on left hand side of += or -= this when playing wpf application. following video tutorial , in demo worked perfectly. might have been using windows forms. edit: string mystring = (checkbox1.ischecked) ? "it's checked" : "not checked"; throws error error 1 'system.windows.controls.checkbox' not contain definition 'ischecked' , no extension method 'ischecked' accepting first argument of type 'system.windows.controls.checkbox' found (are missing using directive or assembly reference?) or error error 1 cannot implicitly convert type 'bool?' 'bool'. explicit conversion exists (are missing cast?) checked event. need use ische

android - Accessing a view from a fragment -

if take access textview out of java code works. i'm assuming made mistake somewhere it. can see problem? package com.projectcaruso.naturalfamilyplaning; import com.projectcaruso.naturalfamilyplanning.r; import android.os.bundle; import android.support.v4.app.fragment; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.textview; public class historyfragment extends fragment { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); sqlhelper entry = new sqlhelper(getactivity()); textview tv = (textview) getview().findviewbyid(r.id.tvsqlinfo); entry.open(); string results = entry.getdata(); entry.close(); tv.settext(results); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { return inflater.inflate(r.layout.

php - losing quality and size , after adding watermark to image -

i'm working on website didn't create/develop. users can upload image , when that, there's function creates duplicate of image watermark. but copy watermark of low quality , size smaller original image without watermark with watermark function watermark( $path ){ $watermark = imagecreatefrompng('files/watermark.png'); $wmsize = getimagesize('files/watermark.png'); $image = imagecreatefromjpeg($path); $size = getimagesize($path); $dest_x = (8); $dest_y = ($size[1] - 35 ); imagecopy($image, $watermark, $dest_x, $dest_y, 0, 0, $wmsize[0], $wmsize[1]); ob_start(); imagejpeg($image); $img2 = ob_get_contents(); ob_end_clean(); imagedestroy($image); return $img2 ; } the image quality decreased because of jpeg compression. every time save image jpeg decrease quality because jpeg uses lossy compression. can minimize loss setting compress quality 100%, if perform lossless compression

ios - Star Micronics TSP650II bluetooth printer, can't write to EASession.OutputStream -

i'm trying print label star micronics tsp650ii printer in monotouch app. the problem session.outputstream.hasspaceavailable() returns false. missing? the c# code have goes (cut simplicity): var manager = eaaccessorymanager.sharedaccessorymanager; var starprinter = manager.connectedaccessories.firstordefault (p => p.name.indexof ("star") >= 0); // find eaaccessory correctly var session = new easession (starprinter, starprinter.protocolstrings [0]); // second parameter resolves "jp.star-m.starpro" session.outputstream.schedule (nsrunloop.current, "kcfrunloopdefaultmode"); session.outputstream.open (); byte[] tosend = getinitdata(); // comes project same printer ethernet cable used in windows environment , worked, not null sure if (session.outputstream.hasspaceavailable()) { int byteswritten = session.outputstream.write (tosend, (uint)stilltosend.length); if (byteswritten < 0) {

Web Performance - jQuery fetching of HTML, CSS, JS, and IMGs -

i have app 10 html, 4 css, 8 js, , 15 img (png/jpg) files. want make site responsive , fast (ie. great user experience). therefore, on initial page load, browser cache every asset site asynchronously without 'browser busy'. according steve souders (google) need use xhr eval or xhr injection avoid 'browser busy'. see slide 23 of even faster web sites . i know can use xhr eval or xhr injection javascript. can use html, css, etc? i trying code (with jquery), can't quite work: $.ajax({ url:"/blog", cache:true, datatype:"text" }); $.ajax({ url:"/about", cache:true, datatype:"text" }); $.ajax({ url:"/blog/main.css", cache:true, datatype:"text" }); $.ajax({ url:"/about/logo.png", cache:true, datatype:"text" }); $.ajax({ url:"/blog/social.js", cache:true, datatype:"text" }); am way off or right track towards cached site fast user experience? before

stored procedures - How to do MySQL Multi-insert from select statement -

so here basics of question. have selected result set join of 2 tables. result set series of id values , email addresses. each row in result set, want insert new row third table called timestamps has timestamp now() , id value result set, not email address. know can achieve running loop within stored procedure. additionally think cannot run insert into statement because data inserting timestamps not come result set in entirety, result set data decides number of rows must inserted , ids, while need return email addresses other processing. searching clever way avoid using loop this. possible? can generate dynamic insert statement? thank gives time or help. suppose: table1 columns: id table2 columns: id, email table1 , table2 linked column id timestamps columns: id, time then query be: insert timestamps(id,time) select table1.id,now() table1 inner join table2 on table1.id = table2.id;

java - AccessibilityService stops receiving events on reboot -

i have app uses accessibility services listen notifications. works correctly unti user reboots. if reboot, have disable/re-enable service accessibility services menu. why app not events after reboot? @override protected void onserviceconnected() { pman = new preferencesmanager(this); bulbmanager = new bulbmanager(((context) this), pman.getbridge()); accessibilityserviceinfo info = new accessibilityserviceinfo(); info.eventtypes = accessibilityevent.type_notification_state_changed; info.notificationtimeout = 100; info.feedbacktype = accessibilityevent.types_all_mask; setserviceinfo(info); log.d("omg, started finally!", "right now!"); } and xml <accessibility-service xmlns:android="http://schemas.android.com/apk/res/android" android:accessibilityeventtypes="typenotificationstatechanged" android:packagenames="com.t3hh4xx0r.huenotifier" android:accessibilityfeedbacktype="feedba

multithreading - Python Multithread or Background Process? -

i know how optimize link-checker i've implemented webservice in python. cache responses database expires every 24 hours. every night have cron job refreshes cache cache never out-of-date. things slow, of course, if truncate cache, or if page being checked has lot of links not in cache. no computer scientist, i'd advice , concrete on how optimize using either threads, or processes. i thought of optimizing requesting each url background process (pseudocodish): # part of code gets response codes not in cache... responses = {} # begin, create dict of url process in background processes = {} url in urls: processes[url] = popen("curl " url + " &") # loop through again , responses url in processes response = processes[url].communicate() responses[url] = response # have responses dict has responses keyed url this cuts down time of script @ least 1/6 of use-cases opposed looping through each u

c# - An expression tree may not contain a dynamic operator -

i'm trying join 2 tables. user , scoreboard viewmodels>scoreboardvm.cs public class scoreboardvm { public ienumerable<dynamic> scoreboards { get; set; } } controller var db = new gamedbdatacontext(); var userlist = (from s in db.scoreboards join u in db.users on s.user equals u.userid select new { username = u.username }).take(5); var viewmodel = new scoreboardvm(); viewmodel.scoreboards = userlist; return view(viewmodel); view @model project.viewmodels.scoreboardvm @foreach (var item in model.scoreboards) { @html.displayfor(model => item.username) } the last line returns error "an expression tree may not contain dynamic operator" , i'm not sure means. the error aree getting because public ienumerable<dynamic> scoreboards dynamic , @foreach (var item in model.scoreboards) dynamic not supported lambda expression

c# - Sending/Pressing Keys through a socket -

is possible press keys a,b,c... on keyboard through socket? my code connects game server , want press keys on keyboard macro guess. how accomplish sending key through socket? possible? it client less, know, not possible. i've tried sendkeys("a") , sendwait("a") but believe these need window focus on, since clientless, there no window focus on, connected socket via program.

ruby on rails 3 - How can I click_link a specific row with Capybara -

i'm trying write capybara code not use css or funny matchers. acceptance test purposes, i'm using capybara navigate button , link text visible user. so have simple test asserts administrator can edit user: it 'allows administrator edit user' user = login_admin_user user1 = factorygirl.create(:user) click_link "users" current_path.should eq(users_path) click_link "edit" # problem current_path.should eq(edit_user_path(user1)) fill_in "last name", with: "myxzptlk" click_button "update user" page.should have_content("myxzptlk") end of course problem line above not specific enough; there 2 lines in table (user , user1). i'm pretty new tdd, how use capybara select correct link using visible text? i'm not sure why you're avoiding 'css or funny matchers'. if don't want put them in test, abstract them away helper methods. in specs have helper method this:

javascript - The position of pop up div changes over scroll -

Image
i want pop div on position click page. have following html. <html> <body> <button id="popupbutton"> click </button> <div id="popupfilterdiv" class="popupfilterdiv" style="display:none;"> <input type="checkbox" name="statusfilter" value="active" /> active <br /> <input type="checkbox" name="statusfilter" value="expired" /> expired <br /> </div> </body> </html> the js is: $("#popupbutton").live('click', function (e) { leftval = e.pagex + "px"; topval = e.pagey + "px"; $('#popupfilterdiv').css({ left: leftval, top: topval }).show(); }); and css is: .popupfilterdiv { background-color:#ffffff; border:1px solid #999999; cursor:default; display:none; margin-top: 10px; position: absolute;

php - Append new row to excel file using phpExcel library -

i new php phpexcel . want save post data existing excel sheet every time new row. as searched on stackoverflow.com got reference of library phpexcel . i write down following code taking samples. <?php /** include phpexcel */ require_once 'classes/phpexcel.php'; $objphpexcel = new phpexcel(); $objphpexcel->setactivesheetindex(0); $objphpexcel->getactivesheet()->setcellvalue('a'.$row, $_post['name']); $objphpexcel->getactivesheet()->setcellvalue('b'.$row, $_post['email']); $objphpexcel->getactivesheet()->setcellvalue('c'.$row, $_post['phone']); $objphpexcel->getactivesheet()->setcellvalue('d'.$row, $_post['city']); $objphpexcel->getactivesheet()->setcellvalue('e'.$row, $_post['kid1']); $objphpexcel->getactivesheet()->setcellvalue('f'.$row, $_post['kid2']); $objwriter = new phpexcel_writer_excel2007($objphpexcel); $objwriter->

Python - How to save a list as an image? -

i generate regular list. possible save list jpeg image or png or whatever can open image , @ it? trying figure out using python imaging library (pil). here 1 of possible solutions: create empty image object using: image.new(mode, size, color) modify image object contain data "list" save image e.g.: new_img = image.new("l", (new_x_size, new_y_size), "white") new_img.putdata(new_img_list) new_img.save('out.tif')

android - listview error when scrolling down -

i have button , progress bar(invisible) in listview. when button clicks should disappear , progress bar should visible , start running ( downloading web server ) , when done running button should appear again. when click first item's button, progress bar runs if scroll down until first item goes off screen see progress bar running simultaneously first item's progress bar on last item of listview. if scroll first item's progressbar runs normally. happens same if click second item the second last item of listview same. problem , how solve it? please help!!! you have remember positions downloading, progress (if you're not showing indefinite bar), , update values in adapter's getview. gets complicated though- if want update view again when download finishes, have lot of careful coding how listviews work , way recycle views, or have update whole listview whenever file finishes downloading or updates progress, may result in flicker.

android - Implementing buttons in AlertDialog -

when adding layout buttons alertdialog. doesnt show anything, force stops app. how implement set onclicklistener buttons in alertdialog. want show timepicker on button press layoutinflater li = layoutinflater.from(this); final view promptsview = li.inflate(r.layout.prompts, null); alertdialog.builder alertdialogbuilder = new alertdialog.builder(this); alertdialogbuilder.setview(promptsview); final edittext userinput = (edittext) promptsview .findviewbyid(r.id.edittextdialoguserinput); starttimebutton=(button)promptsview.findviewbyid(r.id.buttonstarttime); stoptimebutton=(button)promptsview.findviewbyid(r.id.buttonstoptime); starttimebutton.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { toast.maketext(getapplicationcontext(), "btn clocled", toast.length_long).show(); // showdialog(time_dialog_id); }

c# - Build up LINQ expression before querying -

i'm querying data using linq sql, i'd add expressions before submit query. far, have this: public virtual iqueryable<t> query<t>(expression<func<t, bool>> expression = null) t : class { var table = gettable<t>(); return expression != null ? table.where(expression).orderby("orderby") : table; } if wanted change expression, or add or orderby, before query actual table? this: public virtual iqueryable<t> query<t>(expression<func<t, bool>> expression = null) t : class { var table = gettable<t>(); expression.where(my1stwhereclause).where(my2ndwhereclause); expression.orderby("my1stcolumn"); expression.thenby("my2ndcolumn"); return expression != null ? table.where(expression) : table; } you need use return value each method call, this: public iqueryable<t> query<t>(expression<func&

java - Where I can find all wsdl in glassfish? -

similar question there tool or url in glassfish can find list of generated wsdl? (it not type classname + "service?wsdl" dozen classes @webservice annotation) you can going admin console (i believe localhost:4848 default) , looking @ items under web services tree on left. if click on one, there link view wsdl in details.

floating point - How to get the opposite side of round()/floor() in C? -

i have double a=1234.5678 , can 1234 floor(a) , how 0.5678 ? know can subtract a-floor(a) , there function in runtime library? modf break double value in 2 parts double param, fractpart, intpart; param = 3.14159265; fractpart = modf (param , &intpart); printf ("%f = %f + %f \n", param, intpart, fractpart); return 0; output: 3.141593 = 3.000000 + 0.141593 you have include math.h http://www.cplusplus.com/reference/cmath/modf/

go - Why 'Total MB' in golang heap profile is less than 'RES' in top? -

i have service written in go takes 6-7g memory @ runtime (res in top). used pprof tool trying figure out problem is. go tool pprof --pdf http://<service>/debug/pprof/heap > heap_prof.pdf but there 1-2g memory in result ('total mb' in pdf). where's rest ? and i've tried profile service gogc=off, result 'total mb' same 'res' in top. seems memory gced haven't been return kernel won't profiled. any idea? p.s, i've tested in both 1.0.3 , 1.1rc3. this because go not give memory of gc-ed objects operating system, precise, objects smaller predefined limit (32kb). instead memory cached speed future allocations go:malloc . also, seems going fixed in future todo .

javascript - How to make a Jquery snippet only apply to some certain tags? -

i came across snippet function wrap img tag span , make image background image of span. question is, how can make apply img tag or img tags in div? $(document).ready(function(){ $("img").load(function() { $(this).wrap(function(){ return '<span class="image-wrap ' + $(this).attr('class') + '" style="position:relative; display:inline-block; background:url(' + $(this).attr('src') + ') no-repeat center center; width: ' + $(this).width() + 'px; height: ' + $(this).height() + 'px;" />'; }); $(this).css("opacity","0"); }); }); easy peasy, replace $("img") different selector run "wrapping" code on different set of images rather images on site. example use $(".extra img") target img inside tag class "extra" (class="extra"). it's basic, trivial knowledge of jquery - advice rea

debugging - Start several gdb processes in terminal emulator in split screen modus -

i'm using gdb debug parallel mpi-code 'prog'. use small number of processes, 'm' , like mpiexec -n m xterm -e gdb ./prog this pops m xterms each of them running 1 gdb process on 1 of files prog. resulting cluttering of screen individual windows can rather cumbersome. there way, using known split-window terminal emulator (say, terminator), such have m gdb processes starting in one window, split m parts start? what want called 'terminal multiplexer'; screen or tmux edit : want; issue following commands in shell tmux new-session -d bash # start bash shell tmux split-window -v python # start python shell below tmux attach-session -d # enter tmux session

c++ - Character array reuse -

i'm writing win32 console application in visual studio 2010. consider 1 function take 2 char* parameters. following prototype of function: void writeapplicationfile(char *mappname,char* messagestring) { //do file related stuffs. } now following calls working perfectly: writeapplicationfile("firstone", "append me"); writeapplicationfile("firstone", "append another"); but if try same thing character array thing give me assertion, , throw me on assembly. the following code not working: char * localbuffer = new char[100]; sprintf(localbuffer,"number of jobs in queue %d",jobscount); writeapplicationfile("saazshadowprotect",localbuffer); free(localbuffer); localbuffer = null; //work fine. //... localbuffer = new char[100]; sprintf(localbuffer,"log file name %s",logfilecharname); writeapplicationfile("saazshadowprotect",localbuffer); free(localbuffer); // got assertion here.. loca

javascript - Cannot access a Iframe elements from other Iframe on a page -

i have problems iframes in chrome . have 3 iframes in page. trying access elements of 1 iframe another. i using code: navframe = window.parent.frames[0]; lnktags = navframe.document.getelementsbytagname('a'); i getting following error : cannot call method 'getelementsbytagname' of undefined i read in forums window.parent not work in chrome. possible differently. you need use contentwindow property so: navframe = window.parent.frames[0]; lnktags = navframe.contentwindow.document.getelementsbytagname('a');

android - javaNullPointer on display.getRotation() -

after having comment code know error was, found came mdisplay.getrotation(). general idea of code information accelerometer when it's in orientation. here's code public void onsensorchanged(sensorevent event) { // todo auto-generated method stub // récupérer les valeurs du capteur float x, y, z; string s1 = "stringx", s2 = "stringy", s3 = "stringz"; if (event.sensor.gettype() == sensor.type_accelerometer) { switch (mdisplay.getrotation()) { case surface.rotation_0: x = event.values[0]; y = event.values[1]; s1 = "" + x; s2 = "" + y; break; case surface.rotation_90: x = -event.values[1]; y = event.values[0]; s1 = "" + x; s2 = "" + y; break; case surface.rotation_180: x = -event.values[0]; y = -event.values[1];

python - Instantiate children class from parent without changing parent code -

first of all, here (pseudo) code: somemodule.py: class parentclass(object): def __init__(self): if(not prevent_infinite_reursion) #just make shure not problem ;) self.somefunction() def somefunction(): # ... deep down in function ... # want "monkey patch" call constructor of childclass, # not parentclass parentclass() othermodule.py from somemodule import parentclass class childclass(parentclass): def __init__(self): # ... preprocessing ... super(childclass, self).__init__() the problem is, want monkey patch parent class, call constructor of childclass , without changing code of somemodule.py . doesn't matter if it's patched in class instance(that's shure better) or globally. i know can override somefunction , contains many lines of code, being sane. thanks! you use mock.patch this: class childclass(parentclass): def somefunction(self):

Static Maps: Drawing polygons with many points. (2048 char limitation) -

because there limitation 2048 characters in request, not able generate image google static maps contains polygon great number of polygon points. especially if try draw many complex polygons on 1 map. if use google maps api, have no problem - works well! want have image (jpg or png)... so, there opportunity create image google maps api? or way 'trick' 2048 char limitation? thanks! there's no way 'trick' character limit, possible simplify polyline bring encoded polyline string below character limit. may or may not result in polygon of suitable fidelity needs. one additional caveat (to best of knowledge) static maps api allows single encoded polyline drawn on map (this can polygon, if either close or fill it, it's still polyline, not polygon). one option simplifying polyline douglas peucker algorithm. below implementation extends google.maps.polyline object simplify method. this relies on having google maps js api loaded, may not want if

php - i cant creat my table in mysql database -

what problem code? explorer show error when run php code. mysql_query("create table user( username varchar(10) not null, primary key(username), name varchar(20) not null, family varchar(35) not null, graduate int(1) not null, single int(1) not null, children int(1), address varchar, father varchar(20) not null, birthday int not null, start int(50), grade int(1) not null, unit varchar(20) not null, manager varchar(10), mobile varchar(13), officetell varchar(13), tell varchar(13), email varchar(100), sex int(1) not null)") or die(mysql_error()); i think problem here : address varchar, you should specify max length of address field since varchar type: address varchar(255),

ios - How to use a UIImagePickerController with UINavigationController -

Image
i've browsed different similar questions here couldn't find useful problem. i'm struggling quite simple can't figure out. i'm using xcode 4.6.2 , storyboarding. here storyboard: here workflow i'd have: taping on cell in tablevc should push edit document view , offer , done buttons. taping on camera picture should "load" (push/modal?) cameravc subclass of uiimagepickercontroller. i've added custom overlay on top of picker , use custom button take picture. on event perform segue leading previewdocumentview (modally presented) , when "use" button tapped present edit document view. problem edit document view not have navigation bar if try set property self.navigationbarhidden = no; seems normal me though since i've presented views modally how then? i tried pushing cameravc tablevc error saying stacking 2 navigationcontrollers prohibited (since cameravc subclass of uiimagepickercontroller subclass of uinavigationcontrolle

java - How can I reduce code duplication in my database access layer? -

i new java , i'm trying implement basic database access layer. i'm using apache dbutils reduce jdbc boilerplate code , working well. the problem implementation uses separate class crud each table in database , feels wrong duplicating functionality. is acceptable design , if not can reduce code duplication? refactor solution use generics in fashion? i realize use orm (mybatis, hibernate etc) solution try stick dbutils , plain jdbc if can it. just clarification: lets have 2 tables... --------------------- user | file --------------------- userid | fileid name | path age | size --------------------- in current solution create 2 classes (userstore, filestore) , each class implement similar basic crud methods: protected boolean create(user newuser) { queryrunner run = new queryrunner(datasource); try { run.update("insert user (name, age) " + "values (?, ?)", newuser.getname()

javascript - Not getting updated test in tinyMCE editor -

i using tinymce showing editor in asp.net site add , edit article functionality. code follows <script type="text/javascript" language="javascript"> tinymce.init({ // general options mode: "exact", elements: '<%=txttextbox.clientid%>', theme: "advanced", width: "650", height: "500", plugins: "style,advhr,advimage,advlink,inlinepopups,preview,media,searchreplace,contextmenu,paste,noneditable,visualchars,nonbreaking,wordcount", // theme options theme_advanced_buttons1: "undo,redo,separator,bold,italic,underline,separator,cut,copy,paste,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,image,media,link,separator,forecolor,backcolor,separator,preview", theme_advanced_buttons2: "fontsizeselect,fontselect",

r - Right way to convert data.frame to a numeric matrix, when df also contains strings? -

i have data frame taken .csv-file contains numeric , character values. want convert data frame matrix. containing information numbers (the non-number-rows deleted), should possible convert data frame numeric matrix. however, character matrix. i found way solve use as.numeric each , every row, quite time-consuming. quite sure there way kind of if(i in 1:n) -form, cannot figure out how might work. or way start numeric values, proposed here( making matrix numeric , name orders )? probably easy thing of :p the matrix lot bigger, first few rows... here's code: cbind( as.numeric(sfi.matrix[ ,1]), as.numeric(sfi.matrix[ ,2]), as.numeric(sfi.matrix[ ,3]), as.numeric(sfi.matrix[ ,4]), as.numeric(sfi.matrix[ ,5]), as.numeric(sfi.matrix[ ,6])) # again: social.assistance danger.poverty gini s80s20 low.edu unemployment 0.147 0.125 0.34 5.5 0.149 0.135 0.18683691 0.258 0.229 0.27 3.8 0.211 0.175 0.22329362

html5 - force div to surround another div -

Image
at moment have parent div containing 2 div's, both div's have own border. try have 1 div in left top corner , other div surround on right , bottom margin between them. image below: is possible, using css3 , html5? edit: here layout of div's. <div id="main"> <div id="leftdiv"> here text , image displayed </div> <div id="rightdiv"> <div class="profile"><h4>some text</h4><img src="...."></div> <div class="profile"><h4>some text</h4><img src="...."></div> <div class="profile"><h4>some text</h4><img src="...."></div> <div class="profile"><h4>some text</h4><img src="...."></div> <div class="profile"><h4>some text</h4><img src=&qu

visual studio 2012 - How to prevent asterisk with Enter is pressed inside C# /* */ comments -

Image
in vs2012 c# text editor, when enter pressed inside /* */ comments, new line added, beginning * . possible disable behaviour , empty new line? from visual studio box, installed products: microsoft visual studio professional 2012 microsoft team explorer visual studio 2012 microsoft visual basic 2012 microsoft visual c# 2012 microsoft visual c++ 2012 microsoft visual f# 2012 microsoft® visual studio® 2012 code analysis spell checker nuget package manager preemptive analytics visualizer it seems has annoyed other people long time, can see if read thread, there non-intuitive hack stop doing this. have set following option unchecked: text editor > c# > advanced > generate xml documentation comments /// screenshot below: the downside, - original post says: unfortunately, turning off not disables leading asterisk block comments, of course disables auto-complete feature xml documentation comments.

c# - How to generate dependencies in nuspec (or nupkg contains dependencies in its metadata) from csproj -

say there solution, contains project a, b. a referenced b in traditional way. (add reference -> projects -> b) b depends on .net framework libs. here do: nuget pack a.csproj it generate a.nupkg without <dependencies> <dependency id="b" version="3.0" /> </dependencies> what want a.nupkg contains dependency on b in metadata. i know can place a.nuspec under same folder of a.csproj, , set dependence on b in a.nuspec. costs manual work generate , maintain. since a.csproj knows b, there way can done without manual work? or any suggestion on this? achieved add 2 targets in msbuild build script: <genspeccommand>$(nugetcommand) spec -force</genspeccommand> <buildcommand>$(nugetcommand) pack "$(projectpath)" -p configuration=$(configuration) -o "$(packageoutputdir)" -includereferencedprojects</buildcommand> hope useful others.

amazon s3 - AWS S3 cross-origin request failed on ie9 -

Image
i'm trying make web font , have deployed on aws s3. works fine in browsers except ie9 says cross-origin request failed when trying load woff file. i've read lots , lots on many forums people having issue, i've not been able find fix. i think it's cors setup on s3 not sending correct data or ie9? (works in firefox, chrome, ie7,8, etc) the suggestions i've seen fix problem are, spinning ec2 instance , making web host fonts (complete overkill!) , other 1 naming css file .php , setting headers in php (but daft). anyone know how (if @ possible) fix issue? thanks edit my cors config: <?xml version="1.0" encoding="utf-8"?> <corsconfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <corsrule> <allowedorigin>*</allowedorigin> <allowedmethod>get</allowedmethod> <allowedheader>*</allowedheader> </corsrule> </corsconfigura

ios - Leveled UITableView without NavigationController -

i have data structured tree (and showed in uitableview) , show way done using uinavigationcontroller , pushing child views on stack. problem uitableview (in ipad app) takes 1/6 of screen (there uinavigationcontroller handles other fullscreen ipad screens in app, using navigationcontroller control levels of table way). is there simple way visual effect of changing levels of tableview without using navigationcontroller ? right change data source , reload data, flicker on screen (the user can't see, structure of data tree-like). i thought of creating few tableviews , animating resize (from full width 0 tableview leaving, , 0 width @ same time of one) of table make segue effect - not sure if approach. you can use reloadsections:withrowanimation: uitableviewrowanimationleft , uitableviewrowanimationright instead of default reloaddata . push looking for. reference: http://developer.apple.com/library/ios/documentation/uikit/reference/uitableview_class/referenc

CSS - break long list into columns by height -

Image
i'm trying create multi-column list result i'm getting not desired. in this example , need break right list 2nd column @ when height reaches i.e. 400px , same rest of <li> elements (in link above, want break column 2 after "baby gifts" , put "men" in second column. i've tested many things such this is there way break list columns? , this doesn't create column want. here's result i'm after , here's jsfiddle any suggestions? the solutions in both questions you've referenced involve columns property work should. content can't split want because 400px cutoff small. http://jsfiddle.net/hvzkg/1/ #productsitemap { -webkit-columns: 3; -moz-columns: 3; columns: 3; height: 400px; }

java - Jetbrains / Intellij keyboard shortcut to collapse all methods -

i'm working on legacy code has class 10,000+ lines of code , has 100s of methods. there shortcut jetbrains ide (since shortcut shared across of them) collapse methods / functions method signatures shown? something this: public string mymethod(string arg1, int arg2){...} public string mysecondmethod(string arg1, int arg2){...} you may take @ intellij code folding shortcuts . guess ctrl + shift + - need.

jquery - JavaScript Date.toString() radix argument error -

why won't following code output date string!? var d1 = date.parse('10/29/1990 12:00:00 am'); console.log(d1.tostring('dd/mm/yyyy')); the error is: uncaught rangeerror: tostring() radix argument must between 2 , 36 just trying format date... because d1 not date object , number. date.parse returns milliseconds representation, need feed new date or use date constructor directly. and because javascript not have native date-formatting function, there implementation-dependent tostring , tolocalstring , standardized toisostring , toutcstring (though not supported in older ie). instead, have formatting manually getting single components , concatenating them. luckily, there's bunch of libaries that.

mysql - PDO query fails to execute when AUTO_INCREMENT included in creation script, but query seems to be valid -

i'm trying test scripts set phpunit using in-memory databases, i'm having trouble creating databases correctly. when first ran queries running fine, i'd forgotten add auto_increment id field. once added that, pdo drop out fatal error time script ran. i've tried running same query through phpmyadmin see if works (it goes through without complaints) , used perform action wanted , copied sql ran without luck, i'm kind of @ loss what's going on. if can give me hand it'd big help. query can found below create table if not exists `checks` ( `id` int(60) not null auto_increment, `check_type` varchar(255), `purchase_id` varchar(255), `price` varchar(255), `time` varchar(255), `user_id` varchar(255), `email` varchar(255), `site_id` varchar(255), primary key (`id`) ) engine=myisam default charset=latin1 auto_increment=1 ; varchar's used except id because running through automated script , data type can vary. it's mys

sql - How to make a record belong to all options of a field -

i have database of records called "services", each service has 30 attributes , each service has associated country attribute. problem services offered countries. on front end of database have drop-down menu selects records based on country filter. how able include service offered countries without needing duplicate record service , replacing country name. p.s. interested in actual implementation, using drupal nodes represent each service , view exposed filters select country. if have sql work can too. your where clause follow pattern where (counrtyid = passedvariable or passedvariable = 'all')

c++ - Is it considered good style to dereference `new` pointer? -

to avoid keep having use -> , instead work directly object, acceptable practice do: obj x = *(new obj(...)); ... delete &obj; this not poor practice, but: leaking memory (most likely, unless using pattern not visible code provided), since obj store copy of original object created new expression, , pointer object returned new lost; most importantly, undefined behavior , since passing delete pointer object not allocated new . per paragraph 5.3.5/2 of c++11 standard: [...] in first alternative (delete object), value of operand of delete may null pointer value, pointer non-array object created previous new-expression , or pointer subobject (1.8) representing base class of such object (clause 10). if not, behavior undefined .

asp.net mvc - Determine security on shared layout -

in asp mvc 3 website, need way determine user security on shared layout page. layout page houses navbar needs display drop down items based on user's security level. originally had thought make ajax call , populate viewbag item, use determine show/not show. however, won't work unless want put same method in every controller/method. given set (navbar located on shared layout), best method determining items show user navigates across different controllers/methods? you go 2 ways this. you check in view: @if (user.identity.isauthenticated){ // show logged in view } else{ // show logged out view } or build viewmodel , populate shared action. example: viewmodel public class vm { public string text{get; set;} } shared action on shared controller: public class sharedcontroller{ public partialviewresult getmenu(){ vm newvm = new vm(text = "not logged in"); if (user.identity.isauthenticated){ newvm.text

zeromq - how to use "inproc" for connecting C# and C++ (how to share context?) -

i want connect c++ , c# side of application using "inproc" binding. need share context somehow, because both c# , c++ parts should use same context. how can that? i'm using official c++ , c# bindings. i.e. on c# side need zeromq.zmqcontext. and on c++ side need zmq::context_t. and both instances should point same context can use "inproc".

Karma + Rails: File structure? -

when using karma javascript test library (née testacular) rails, should test files , mocked data go placed? it seems weird have them in /assets/ because don’t want serve them users. (but guess if never precompiled, that’s not actual problem, right?) via post: https://groups.google.com/forum/#!topic/angular/mg8yjkwbej8 i'm experimenting looks this: // list of files / patterns load in browser files: [ 'http://localhost:3000/assets/application.js', 'spec/javascripts/*_spec.coffee', { pattern: 'app/assets/javascripts/*.{js,coffee}', watched: true, included: false, served: false } ], it watches app js files, doesn't include them or serve them, instead including application.js served rails , sprockets. i've been fiddling https://github.com/lucaong/sprockets-chain , haven't found way use requirejs include js files within gems (such jquery-rails or angularjs-rails).

github - Ignore a git directory in composer package -

i have composer library hosted package on packagist through github. repository includes directory named sample samples on how use code , directory not needed when using package. is there way have directory ignored when composer update/install ? you technically can using .gitattributes , export-ignore directive. see http://git-scm.com/book/ch7-2.html#exporting-your-repository more details.

c# - Retrieving friendly name as claims user in SharePoint -

i'll explain i'm trying first. have claims identifier being passed in, example, 0e.t|saml provider|first.last@domain.local . want trim first.last@domain.local . i aware can done simple string formatting, however, not flexible, if gets passed in don't expect, string formatting fail. it's more prone issues. i want dynamically instead. here's i've tried. attempting ensureuser claims identifier above, calling spuser.name: spuser spuser = spcontext.current.web.ensureuser(spusername); username = spuser.name; i've tried following strings parameter in ensureuser , result in exception: the user specified logonname cannot found in active directory. 0e.t|saml provider|first.last@domain.local saml provider|first.last@domain.local first.last@domain.local again, of fail. another approach tried, using spclaimprovidermanager (pulled this blog ): spclaimprovidermanager mgr = spclaimprovidermanager.local; if (mgr != null && spclaimproviderm

Refactoring project structure in Visual Studio 2012 -

say have class library project feel getting large , unwieldy , want break out smaller class library projects easier distribution , deployment. there way in vs2012 use refactor capability accomplish seamlessly? so example assembly has io package want move it's own project, right might be: myassembly.io.readers myassembly.io.writers etc and want refactor references have in different project (e.g. myiospecificassembly). there easy way this? thanks with resharper , drag-n-drop file project (while holding shift move instead of copy ), use adjust namespaces refactoring. resharper has various other refactorings might useful in context, such moving type file, folder or namespace.

field - Typo3 6.0 - Extending tx_news -

i new in typo3, , tried extend news following tutorial : http://docs.typo3.org/typo3cms/extensions/news/main/tutorial/extendingnews/index.html my main goal create new extension, did using extension builder, , extend news can add new field , use it. i followed every step described in tutorial, there's 1 point i'm not sure how proceed. , how supposed use new custom field in template? in tutorial, written : "you can use new field in template using {newsitem.txworkshoptitle}or {newsitem.workshoptitle}". where supposed put line ? need make custom template in own extension? don't quite understand. first, create custom templates copying default fluid templates ext:news/resources/private/* new folder, example fileadmin/templates/ext/news/ then need configure path custom template typoscript: plugin.tx_news { view { templaterootpath = fileadmin/templates/ext/news/templates partialrootpath = fileadmin/templates/ext/news

assembly - MIPS recursion: How to compute end result from stack -

my task implement egyptian multiplication in mips assembler recursively. think understood of relevant stuff, can't behind 1 thing: how end result computed? example in code(taken this question): # int fact(int n) fact: subu sp, sp, 32 # allocate 32-byte stack frame sw ra, 20(sp) # save return address sw fp, 16(sp) # save old frame pointer addiu fp, sp, 28 # setup new frame pointer sw a0, 0(fp) # save argument (n) stack lw v0, 0(fp) # load n v0 bgtz v0, l2 # if n > 0 jump rest of function li v0, 1 # n==1, return 1 j l1 # jump frame clean-up code l2: lw v1, 0(fp) # load n v1 subu v0, v1, 1 # compute n-1 move a0, v0 # move n-1 first argument jal fact # recursive call lw v1, 0(fp) # load n v1 mul v0, v0, v1 # compute fact(n-1) * n #result in v0, clean stack , return l1: lw ra, 20(sp) # restore return address lw fp, 16(sp) # restore frame pointer addiu sp, sp, 32 # pop stack jr ra # return .end

ruby on rails 3.2 - Migration runs but RSpec still can't find the table -

exactly trying run chapter 1 example paul dix's book in here: https://github.com/pauldix/service-oriented-design-with-ruby/tree/master/chapter_01 so bundle install , works fine. rake db:migrate , works fine too, outputting like: ➜ chapter_01 git:(master) ✗ rake db:migrate d, [2013-05-13t13:55:13.316178 #9154] debug -- : (0.5ms) select "schema_migrations"."version" "schema_migrations" i, [2013-05-13t13:55:13.316265 #9154] info -- : migrating createusers (1) now run rspec spec/service_spec.rb , gives me following error saying can't fun "users" table. chapter_01 git:(master) ✗ rspec spec/service_spec.rb d, [2013-05-13t13:57:16.893140 #9166] debug -- : env: test d, [2013-05-13t13:57:16.936232 #9166] debug -- : db/test.sqlite3 database connection established... /users/ba018938/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:472:in `table_structure': not find

asp.net mvc - Custom css font display with interference after publishing site to Azure -

trying post web-site @ different hostings (somee.com, azure, localhost). site @ asp.net mvc 4. displaying @ localhost , somee.com: https://dl.dropboxusercontent.com/u/58930284/testing/font_local.png at azure web site: https://dl.dropboxusercontent.com/u/58930284/testing/font_azure.png css: @font-face { font-family: 'font name'; src: url("fonts/font name.eot"); src: url("fonts/font name.eot?#iefix") format("embedded-opentype"), url("fonts/font name.woff") format("woff"), url("fonts/font name.ttf") format("truetype"), url("fonts/font name.svg") format("svg"); font-weight: normal; font-style: normal; } iis 7 not return file types not added element or have mappings in element default. behavior prevents unauthorized access files not have mappings in iis 7 configuration settings. basically, iis not return static files not know me

actionscript 3 - as3 ARRAY SHIFT - the End of array now what? -

i having alphabet go on , off screen. using array shift go next letter. when last element of array, letter z, how can go beginning? another example if had array of pictures , after done viewing last 1 code take begining again , start viewing there. here code need set shift zero. var letter:movieclip; function fl_mouseclickhandler_2(event:mouseevent):void { if(letter) { var gone:movieclip = letter movieclip; tweenmax.to(letter, 1, { x:0 , ease:back.easeout, oncomplete:removeletter}); function removeletter(){ removechild(gone); } } if(alphabet.length!=0) { letter = new alphabetletter(); addchild(letter); /// key code line uses shift letter.letter.text = alphabet.shift(); tweenmax.fromto(letter, 2, {x:stage.stagewidth}, {x:stage.stagewidth/2-letter.width, ease:expo.easeout}); } else { //// tried not work alphabet.unshift(2

javascript - Hide siblings and parent's siblings until the given id using JQuery -

i trying expand inner div due space issues on button click. when user clicks on button, want hide siblings , parent's siblings until specified id. how in javascript using jquery? following example: dom: <div id="p"> <div id="p1-1"> <div id="c1-1-1"> <button id="expand"></button> </div> <div id="c1-1-2"> </div> </div> <div id="p1-2"> <div id="c1-2-1"> </div> </div> <div id="p1-3"> <div id="c1-3-1"> </div> </div> </div> result dom: <div id="p"> <div id="p1-1"> <div id="c1-1-1"> <button id="expand"></button> </div> </div> </div> find elemen