Posts

Showing posts from April, 2012

combinatorics - Weekly group assignment algorithm with odd number of participants -

there round-robin solution question i asked before . works great number of people none of suggestions seem work once implement algorithm , try them out. i've tried many variations , (grouping last 1 whole bunch of other people, second group last group, different combinations, 2 , 4 last of bottom row, thought give me optimal solution still many duplicates). can suggest way go, or proof there cannot solution without 2 people working more once can stop trying make work. if want algorithm in java can post can play it. thanks. 14 weeks 23 students in groups of 2 , 1 3 sufficiently undemanding local search able find solution. 18 1 11| 3 4| 5 7| 9 6| 0 17| 2 12| 10 19| 15 16| 21 8| 14 20| 13 22| 6 13 18| 17 4| 5 0| 20 1| 12 11| 10 9| 2 14| 15 7| 3 8| 19 16| 21 22| 21 17 7| 19 22| 3 1| 2 8| 0 10| 14 12| 13 11| 6 16| 5 15| 18 20| 9 4| 8 1 13| 18 2| 6 11| 20 0| 12 10| 14 15| 5 17| 9 21| 4 19| 3 22| 16 7| 0 4 16| 17 20| 21 3|

javascript - How to add a new Dijit widget to a page? -

i have form variable number of inputs. behavior looking have link in user can click on , add new input form can filled. this html: <form id="myform"> <input data-dojo-type="dijit.form.textarea"/> <a href="#" onclick="add_new_input()"> add new input</a> </form> javascript: <script> function add_new_input(){ var newinput = $("<input data-dojo-type='dijit.form.textarea'/> "); $('#myform').append(newinput); } </script> this add regular text input html , not dijit widget! have suggestions? i defining class input file , bind input type on ($document).ready() did not work either! :( it pretty simple problem solve creating textarea widget programmatically (as mentioned @paul grime). can see example here textareas created link dijit widgets. did not use jquery in fiddle, need change add_new_input function to function ad

iphone - list style not showing up on chrome iOS -

i'm in process of building web site needs viewable on mobile devices. when viewing in safari on iphone 4s looks great. if view chrome on same device none of styles navigation list show up. ends looking basic html links. links in question are, va leadership, nursing, , anesthesiology staff bellow link live dev site, css. link: http://xeroproject.com/sqwm/category/resources/ css: #leftnav{ max-width:402px; } #leftnav ul li { list-style-type: none !important; width:100%; text-decoration:none; font-weight:bold; font-size:24px; color:#fff; } #leftnav ul a:hover { color:#85b6ce; } #leftnav ul li:nth-child(odd){ padding:10px; margin-bottom:5px; background: #0b5a42 url('images/arrow_dark.jpg') no-repeat right; } #leftnav ul li:nth-child(even){ padding:10px; margin-bottom:5px; background: #688879 url('images/arrow_light.jpg') no-repeat right; } the site renders fine me using google chrome ios latest on iphone 4s (at least looks same on safari running

Javascript "this" scope -

i writing javascript code. little confused keyword. how access logger variable in datareceivedhandler function? myclass: { logger: null, init: function() { logger = logfactory.getlogger(); }, loaddata: function() { var datareceivedhandler = function() { // how access logger variable here? } // more stuff } }; assuming loaddata called so: myclass.loaddata(); then: loaddata: function() { var self = this; var datareceivedhandler = function() { self.logger ... } // more stuff }

Google maps on none google API build target Android -

is possible run google maps (api v1 fine) on none google api build target? have special emulator not have google api built in. when try adding maps.jar libs folder in project mapactivity can reference getting stack trace shown below. using google maps api v1 maps.jar this. i have tried setting manifest use , , removed it, both not work. thanks! 04-04 17:23:20.553: e/androidruntime(12458): fatal exception: main 04-04 17:23:20.553: e/androidruntime(12458): java.lang.runtimeexception: unable instantiate activity componentinfo{com.google.android.maps/com.google.android.maps.mapmainactivity}: java.lang.runtimeexception: stub 04-04 17:23:20.553: e/androidruntime(12458): @ android.app.activitythread.performlaunchactivity(activitythread.java:1569) 04-04 17:23:20.553: e/androidruntime(12458): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1663) 04-04 17:23:20.553: e/androidruntime(12458): @ android.app.activitythread.access$1500(

php - Break a WordPress post on paragraph tags -

i have site 2 databases. 1 attached wordpress install runs part of content of site; other runs site overall. let's call them cwordpress , tdasite. i have figured out how access wordpress database , pull content it, i'm not sure how break down on p tags, because i'm pulling post_content file. need display text in sidebar, , readability it's nice have in actual paragraphs. articles i'm pulling short, there 3 5 paragraphs in each. i'm not seeing how wordpress saves formatting. does, since wordpress pages display appropriately, , tags show in view source, they're not visible in database. otherwise, i'd use explode break them paragraphs , display them way. far, can't turn post_content object variable , print it! i'm trying possible, or need reconcept? this query code. //define query retrieve international news posts $newsquery = 'select wp_posts.post_title, wp_posts.id, wp_posts.post_content wp_posts, wp_term_relationships, wp_te

javascript - Loop through folder images in Canvas -

i'm trying have canvas element on page loop through set of images within folder. i've figured out how set image on canvas im not sure how multiple images 1 after another. i've thought possible using loop , array im not sure best way store images in array. this site working 1 image. onload shows image, after set time canvas hidden , reply button appears: http://www3.carleton.ca/clubs/sissa/html5/ what i'm trying images (25) show 1 after pretty fast. kinda marvel intro animation lot worst :) this i've done far canvas set up window.addeventlistener("load", initcanvas); var canvas, play, ctx, playlenght, img; function initcanvas(){ getelements(); setcanvas(); } function getelements(){ canvas = document.getelementbyid('canvas'); play = document.getelementbyid('canvasplay'); play.addeventlistener("click",setcanvas); } function setcanvas(){ //hide ctx play button play.style.visibil

c - How to do strcmp correctly? -

i have compare string "death" to 5 character string in text file. i can't seem function work can't see doing wrong. have suggestion? *notes: strcmp returns -1 or 1 never 0 #include <stdio.h> #include <stdbool.h> #include <string.h> //function check if strings match regardless of case bool doesmatch (char testtext[], char testdeath[]) { if (strcasecmp(testdeath, testtext) == 0) { return true; } else return false; } int main (int argc, char *argv[]) { char test1[5] = {getchar(), getchar(), getchar(), getchar(), getchar()}; bool testmatch; char test2[5] = {'d','e','a','t','h'}; //test arrays until end of file while (test1[4] != eof) { testmatch = doesmatch(test1, test2); if (testmatch == true) { printf ("match!\n"); } //"slide" array down 1 character test1[0] = test1[1]; test1[1] = test1[2]; test1[2] = test

mime types - How to view C# .cs file in google drive? -

i have .cs c# source code files in google drive i'd able view directly without having download them. how can this? , in general, when there text file non-supported file extension how can view text google drive? unfortunately many code file types not supported yet. from support docs .txt supported there no way view file as other type other underlying mime type assigned on upload. in case of c# mime type text/x-csharp . means changing extension of file not either because not modify mime type. (tried it. no go.) from google docs: google drive lets view these file types: image files (.jpeg, .png, .gif, .tiff, .bmp) video files (webm, .mpeg4, .3gpp, .mov, .avi, .mpegps, .wmv, .flv) text files (.txt) markup/code (.css, .html, .php, .c, .cpp, .h, .hpp, .js) microsoft word (.doc , .docx) microsoft excel (.xls , .xlsx) microsoft powerpoint (.ppt , .pptx) adobe portable document format (.pdf) apple pages (.pages) adobe illustrator (.ai) adobe photoshop (.psd) tagged i

css - Wordpress Image Not Swapping Out -

i have strange issue wordpress. had image loaded header, later decided wanted swap out image one. image swapped moved same directory, , given same name (obviously replaced file completely). old image still appears in header. can't new 1 take place. doesn't make sense. any suggestions? thanks.

haskell - ghc 7.4.2, Dynamically calling modules -

i trying load , execute module dynamically, below code testmodule.hs module testmodule evaluate = "hello !!!" invoke.hs module invoke import ghc import dynflags import ghc.paths (libdir) import unsafe.coerce (unsafecoerce) import data.dynamic execfnghc :: string -> string -> ghc execfnghc modname fn = mod <- findmodule (mkmodulename modname) nothing --setcontext [iimodule mod] ghc.setcontext [ ghc.iidecl $ (ghc.simpleimportdecl . ghc.mkmodulename $ modname) {ghc.ideclqualified = true} ] value <- compileexpr (modname ++ "." ++ fn) let value' = (unsafecoerce value) :: return value' main2.hs import ghc.paths (libdir) import ghc import invoke -- import testmodule main :: io () main = runghc (just libdir) $ str <- execfnghc "testmodule" "evaluate" return str when try run program show me below

Convert C# string to Byte for COM Interop -

i calling c++ com component using interop , marshalling requires 1 of parameters passed in ref byte . argument string. how convert string (or char array) byte pass method? method idl [helpstring("method read")] hresult _stdcall read( [in] unsigned char* path, [in] unsigned char command, [in] unsigned char nshortaddr, [out] short* pndatasize, [out] unsigned char** ppbydata, [out] unsigned long* pnerror); the il .method public hidebysig newslot virtual instance void read([in] uint8& path, [in] uint8 command, [in] uint8 nshortaddr, [out] int16& pndatasize, [out] native int ppbydata, [out] uint32& pnerror) runtime managed internalcall the method in wrapper seen in visual studio

c# - How can needn't install Adobe Acrobat software but could regist Acrobat.dll -

acrobat.cacropddoc pdfdoc = (acrobat.cacropddoc)microsoft.visualbasic.interaction.createobject("acroexch.pddoc", ""); in .net want use acrobat.dll don't want install whole adobe acrobat software. is acrobat.dll com or com+ , have register gac? if not, screw it!!! guess want deploy application server don't want install adobe acrobat reader on server, right? if right, embed dll package , deploy server.

SignalR -- Error in getting to /signalR/hubs -

i trying run sample signalr code. when run inbuild webserver works fine. when host code in virtualdirectory getting following error line 35: object null it comes down point looks couldnt locate autogenerated signalr/hubs file .... i have following code <script src="scripts/jquery-1.6.4.min.js" ></script> <script src="scripts/jquery.signalr-1.0.1.min.js"></script> <script src="signalr/hubs" type="text/javascript"></script> i have used fiddler shows me looking file in following direction get http://myserver/signalrchat/signalr/hubs 404 not found (text/html) http://myserver/signalrchat/signalr/hubs 404 not found (text/html) i have change following line of none of them seems work <script type="text/javascript" src="/signalr/hubs"> <script type="text/javascript" src="~/signalr/hubs"> or <script type="text/javascript" src=&qu

php - Need to acces localhost from my android device -

i have php file in following folder: c:\wamp\www\android_test\fetch_data2 i need able access file application unable access of now. here java code , highlight need fix. can access php file computer through localhost/android_data......, cannot access phone browser. have no code written in accompanying xml file , maybe why php file not show on application. addition notes: want app display php file connected mysql data base , outputs: [{"name":"user1","received_power":"-75.12207037710479","tower":"4","status":"0"},{"name":"user2","received_power":"18.89454151068304","tower":"3","status":"0"}] my java file called mysqldata.java has following inside: package com.example.qosmetre2; import java.io.bufferedreader; import java.io.inputstream; import java.io.inputstreamreader; import java.util.arraylist; import org.apac

c++ - How to call a function from a separate cpp file in the main.cpp file? -

i have following timer.cpp, timer.h, , main.cpp files. trying call functions timer.cpp file in main.cpp file , have included timer.h in main, still not working. can please explain why? little rusty c++ , feel making silly mistake. in advance help. #timer.h file #ifndef __notes__timer__ #define __notes__timer__ #include <iostream> class timer { public: timer(); void start(); void stop(); void clear(); float getdelta(); }; #endif #timer.cpp file #include "timer.h" clock_t starttime; clock_t stoptime; timer::timer(){ starttime = 0; stoptime = 0; }//timer void start(){ starttime = clock(); }//start void stop(){ stoptime = clock(); }//stop float getdelta(){ return stoptime-starttime; }//getdelta #main.cpp file #include "timer.h" #include <iostream> using namespace std; int main(){ char quit; start(); cout << "would quit? y or n: "; cin >> quit; if

uitextfield - Multiple textfields in iOS Application -

Image
i have many textfields in particular view of ios application. textfields have popover controller while others have textfields can typed. the problem face when touch textfields. before end editing of particular textfield, if touch popovercontroller, both popovercontroller , textfields appear on ui. how avoid this? sorry being vague. here image. want texteditor go off when textfield being touched. tried doing this: - (bool)textfieldshouldbeginediting:(uitextfield *)textfield { nsarray *subviews = [self.view subviews]; (id objects in subviews) { if ([objects iskindofclass:[uitextfield class]]) { uitextfield *thetextfield = objects; if ([objects isfirstresponder]) { [thetextfield resignfirstresponder]; } } } return yes; } not working either... need guidance on this... tried well: -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event{ nsarray *subviews = [self.view subvi

nsstring - sprintf to objective c -

i have line of code: sprintf ( label, "lon %s lat %s", lonstr, latstr ); which want replace one: nsstring*label = [nsstring stringwithformat:@"%s %s", lonstr, latstr]; once replace warning stating unused variable ' label ' . well, text supposed show no longer appears. label declared this: char label[256] = { 0 }; is there missing here? hi again, so after following advice , doing research solution. note tha variables 'label', 'labeltwo' , 'labelthree' c++ code had convert objective-c: coordlabel.text = [nsstring stringwithformat:@"%@ %@", [nsstring stringwithcstring:label encoding:nsisolatin1stringencoding], [nsstring stringwithcstring:labeltwo encoding:nsisolatin1stringencoding]]; thank you i fear missing basic understanding of objective-c , relationship c. nsstring *label = [nsstring stringwithformat:@"%s %s", lonstr, latstr]; will create nsstring object pointed variable

python - Accessing keys in dictionaries -

if wanted access keys in dictionary , check if sequences (atgc) key have "gc". how access keys check if contains string "gc"? many thanks! matches = [ k k in yourdictionary.keys() if 'gc' in k.lower() ] number_of_matches = len(matches) you regex or string.find ( returns -1 if not found ) or string.count -- if substring in string works , cleaner illustrate point. cast key lowercase , compared against lowercase string, case insensitive match.

python - How to accumulate unique sum of columns across pandas index -

i have pandas dateframe, df created with df = pd.read_table('sorted_df_changes.txt', index_col=0, parse_dates=true, names=['date', 'rev_id', 'score']) which structured so: page_id score date 2001-05-23 19:50:14 2430 7.632989 2001-05-25 11:53:55 1814033 18.946234 2001-05-27 17:36:37 2115 3.398154 2001-08-04 21:00:51 311 19.386016 2001-08-04 21:07:42 314 14.886722 date index , of type datetimeindex. every page_id may appear in 1 or more dates (not unique) , large in size ~1 million. of pages make document . i need score entire document @ every time in date while counting latest score given page_id. example example data page_id score date 2001-05-23 19:50:14 1 3 2001-05-25 11:53:55 2 4 2001-05-27 17:36:37 1 5 2001-05-28 19:36:37 1 1 example solution score date 2001-05-23 19

c - ALSA snd_pcm_drop() is not clearing complete buffer -

i using alsa api snd_pcm_drop() clear buffers. when continue audio later snd_pcm_prepare() , can hear part of previous audio supposed cleared. happens when have high value of snd_pcm_sw_params_set_stop_threshold() . if using lower value, partial audio previous audio session wont played. what happening here ? how clear off buffer ? (i new alsa) thanks " can hear part of previous audio supposed cleared." because there still audio data left in alsa buffer, , data not big enough play.enlarge audio package when put alsa buffer may solve problem.

objective c - how to run the loop many times -

i apending string, running loop many times app crashed. it's show error message how mange error message malloc: * mmap(size=16777216) failed (error code=12) error: can't allocate region set breakpoint in malloc_error_break debug * terminating app due uncaught exception 'nsmallocexception', reason: 'out of memory. suggest restarting application. if have unsaved document, create backup copy in finder, try save.' , code ` nsmutablestring * str = [nsmutablestring stringwithcapacity:100000]; int i; for(i=0;i<1000000;i++){ [str appendstring:@"abcd"]; }` without knowing details of actually doing , impossible say. in general, when run out of memory, answer use less memory. for operation involving massive chunk of data, need move operation buffers through disk. can done via number of means. 1 used depends on details of whatever trying do. if appending text buffer, open file descriptor (or nsfilehandle ) , write instead.

ibm mobilefirst - Ecma Error: TypeError: Cannot call property -

Image
i have written java code in adapter in worklight project. when m trying call java method, getting error saying "responseid":"6","errors": {ecma error: typeerror: cannot call property downloadfile in object javapackage java.classes.fileioplugin]. not function, \"object\".} i have followed procedure stated in following link. using java in adapters this project structure. there wrong structure or should add more this? this how trying call java non-static method in adapter-impl.js function downloadfile() { var fileinstance = new com.worklight.javacode.fileioplugin(); return { result: fileinstance.downloadfile(); }; } we have identified possible solution this. change java compiler level 1.6 default jre 1.6:

python - How can you divide an input answer? -

im making calculator finds average of persons test scores eg: 16/20 + 17/20/2 im having trouble figuring out how divide users marks eg: if person enters 18/20, how divide it? you split up: numerator, denominator = '18/20'.split('/') decimal = float(numerator) / float(denominator)

java - Android Splash Screen only opens if I install the app -

i teen programmer looking help. i wrote simple splash screen thingy , works if uninstall , reinstall app. please have , see if doing wrong. thanks! package ca._____.test; import android.app.activity; import android.content.intent; import android.os.bundle; import android.util.log; import android.view.window; import android.view.windowmanager; public class splash extends activity { private static string tag = splash.class.getname(); private static long sleep_time = 5; // sleep time @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.requestwindowfeature(window.feature_no_title); // removes title bar this.getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); // removes notification bar setcontentview(r.layout.spash_screen); // start timer , launch main activity intentlauncher launcher = new intentlauncher(); launcher.start();

Android Fragment - move from one View to another? -

can first add fragment view, "detach" it, , "re-attach" view? in code, want to: fragone 1 = new fragone(); getsupportfragmentmanager().begintransaction() .add(r.id.left, one, "tag").commit(); getsupportfragmentmanager().begintransaction() .detach(one).commit(); // or .remove(), or .addtobackstack(null).remove() getsupportfragmentmanager().executependingtransactions(); getsupportfragmentmanager().begintransaction() .add(r.id.right, one).commit(); but throws error: 04-05 13:28:03.492: e/androidruntime(7195): java.lang.runtimeexception: unable start activity componentinfo{com.example.trybackstack/com.example.trybackstack.mainactivity}: java.lang.illegalstateexception: can't change container id of fragment fragone{40523130 #0 id=0x7f080000 tag}: 2131230720 2131230721 thanks help! i had same problem found needed reparent fragment's view , not fragment itself, avoiding fragmentmanager transaction.

iphone - How to find out from which scene the segue happend? -

i have multiple view controllers take common view controller using prepareforsegue method. problem how find out in common view controller controller got segue to.... a segue object has source , destination properties can at. so, common destination view controller, can @ source of segue.

c# - Second Linq filter for multiple conditions -

i have class (simplified) follows: class appmeta { public int id { get; set; } public string scope { get; set; } public user createdby { get; set; } } i've created linq statement filters results cross referencing list of integers, , discarding matches: var hiddenapps = list<int>(); //populate hiddenapps var listitems = list<rawdata>; //populate listitems list<appmeta> apps = appmeta.collection(listitems).where(i => !hiddenapps.contains(i.id)).tolist() my question is, need further filter list follows, (where scope == "user" && user.loginname == currentuser.loginname) can still in 1 linq statement, i.e. can combine line above? what's best way this? you can specify multiple conditions in where clause. modify clause as: .where(i => !hiddenapps.contains(i.id) && i.scope == "user" && i.createdby.loginname == currentuser.loginname ) so query be: lis

python 3.x - how to apply motion to a model in blender -

i doing 1 experiment in need capture skeleton data kinect , apply data model, have captured data kinect , have stored in file, i.e in file have location of each joint in each frame, want model in blender take joint position file, , move accordingly. dont have idea on how start. have written small script in python read position file , update position of 1 bone: obj.channels['head'].location = vector((float(xs),float(ys),float(zs))) but not move anything. doing in wrong way, or cannot move armature updating position?? please guide me on topic, new python , blender i don't think best solution, can export data bvh file , save lot of headaches. you can find lot of kinect-sdk bvh tutorials on net , bvh de-facto standard store data motion capture events, there no reasons why should re-invent wheel , doing work. to use bvh file in blender can follow one of many tutorial on subject.

android - Eclipse get hang after some time with error of java -

Image
i using eclipse juno android development purpose. i working on project contain 4-5 library in it. know reason after several use of same project eclipse hang. thing hang while trying run app eclipse. after eclipse stop working , in not responding condition. when click on that, got below message closing of eclipse. message: i don't know reason causing of this. please me regarding issue. it because of corrupted workspace. for, solution refer this the error due corrupt workspace. disable workspace check in startup couldn’t select workspace since eclipse wouldn’t start. rename workspace e.g. “workspace1″. eclipse start , create new uncorrupted workspace , work without problems. afterwards can import project new workspace , in end remove old corrupted workspace. so, have create new workspace

Calling Ajax method using javascript function -

i'm working jquery mobile. my code move details div :: <a href="#details" data-ajax="true" data-transition="pop" data-role="button" data-inline="false" data-icon="info">go details</a> now, want authenticate user facebook. so have applied :: <a href="javascript:userlogin()" data-ajax="true" data-transition="pop" data-role="button" data-inline="false" data-icon="info"> login faceook </a> function calling authentication function userlogin() { fb.login( function(response) { if (response.authresponse) { alert('logged in'); fb.api('/me', function(response) { alert("welcome " + response.name); }); } else { alert('not logged in'); }

jstl - set size for jsp:include tag -

is there way set size jsp:include tab? have following code <div class="tab-pane fade in active" id="fromdatabase"> <jsp:include page="genericdb.jsp" flush="true" /> </div> the page contents less. still showing scroll bar in page. tried set width in div tag. <div class="tab-pane fade in active" id="fromdatabase" style="width:800px"> <jsp:include page="genericdb.jsp" flush="true" /> </div> then size reduced showing scroll bar inside div area. there anyway size of jsp:include? thanks

android - how do I install the traceroute functionality from busybox programmatically -

i working on implementing traceroute functionality in android , need help. i aksed question on over so . and in answer user of suggested me following : the busybox utility includes traceroute. can run busybox on device without rooting phone following youtube tutorial . should able use first code segment posted query traceroute within app. of course, need make sure use correct path when calling traceroute. now think why asking same again watched video , coudnt understand how make work in application if want make app how can install busybox apk in user's device. so please show me code can understand it.

java - Generate XPath expression of Google search engine -

what xpath expression should use parse google xhtml results page? i'm not able retrieve using xpathexpression expr = xpath.compile(".//li[@class='g']/div/h3/em/text()"); if it's xhtml, need namespace binding on expression namspace ns = namespave.getnamespace("x", "http://www.w3.org/1999/xhtml"); xpathexpression expr = xpath.compile( ".//x:li[@class='g']/x:div/x:h3/x:em/text()", null, null, ns);

syntax - What does the "at" (@) symbol do in Python? -

i'm looking @ python code used @ symbol, have no idea does. not know search searching python docs or google not return relevant results when @ symbol included. the @ symbol used class, function , method decorators . read more here: pep 318: decorators python decorators the common python decorators you'll run are: @property @classmethod @staticmethod

Is there any Managment API for Azure VM location? -

we analyzed managment apis not able find api finding azure vm location.azure vm location equivalent cloud service location? since create virtual machine windows azure automatically creates cloud service (and hosts vm in that), make use of get hosted service properties functionality find location , location of vm. if created vm using location, should sufficient. however if created vm using affinity group, won't location in api call you'll affinity group. in case, can call get affinity group properties , location of affinity group , location of vm.

c# - Entity Framework Caching Issue -

i new entity framework. i have values in database using ef. returns perfectly, , values shown in labels. when delete values in table (without using ef), ef query returning old values. know ef stores values in cache , returns cached data subsequent runs. correct? so how can solve problem when have deleted values in database, ef returns old values? edit : now used datamodel.savechanges() . it's return same old values. my sample query below: schoolbriefcaseentities datamodel = new schoolbriefcaseentities(); datamodel.savechanges(); list<compliance> compliance=new list<compliance>(); ilist<compliancemodel> compliancemodel; if (httpcontext.current.user.isinrole("superadmin")) { compliance = datamodel.compliances.where(c => c.school.districtid == districtid).tolist(); } if know changes happened outside of ef , want refresh ctxt specific entity, can call objectcontext.refresh datamodel.refresh(refreshmode.storewins, orders);

java - Maven package with source and attached dependecies -

i'm having hard time adding java source files , attached dependencies output jar file using maven. what want archive having compiled classes, source files , dependencies (without sources) in 1 jar can distributed. - com/name/project/*.class - com/name/project/*.java - lib/*.jar - meta-inf/manifest.mf here pom.xml have far: <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-dependency-plugin</artifactid> <version>2.7</version> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputdirectory>${project.build.directory}/lib</outputdirector

c# - Why does Concurrent Dictionary not have a visible Add() Method? -

i wondering how possible concurrentdictionary not have add method visible in visual studio ide. seem tryx methods e.g tryadd, tryupdate etc. i can see concurrentdictionary implements idictionary , if cast idictionary add method back. i have looked @ class through ilspy , can see add method implemented , call concurrent tryadd method under hood. i expecting see sort of attribute on add method surpress not seeing anything. has been baked ide microsoft hide add method default ?? if shed light on appreciated that's because of explicit interface implementation . see http://msdn.microsoft.com/en-us/library/aa288461(v=vs.71).aspx

mysql - Why one of the columns of my SQL table cannot be extracted (a text column)? -

when trying extract 1 of columns(containing text) of table in mysql getting syntax error: unexpected key_sym while not case other columns. anyone has idea problem be? i trying simple code: select key, name data1.info if replace column "key" other column names work not one. the key column contains keys: 8997897986575625757576557576523686812638612836263816283618263861826361836 key is reserved word have use backticks(`) around column names when use reserved words select `key`,name data1.info a list of reserved words

format.js not working in rails 2 -

i have 2 controller named client/orders , notary/orders . have click_me link in "client/orders".when click link should pass ajax request notary/orders/pending_orders , reload notary/orders/pending_orders page. this ajax call in client/orders/new <script> jquery.noconflict(); jquery(document).ready(function(){ alert(9); jquery(".test_link").live("click", function(){ alert("am clicked"); jquery.ajax({ url: "/notary/orders/pending_orders", datatype: 'script', type: "get", data: {data:'hi'}, success:function(){ alert("success"); }, error:function(){ alert("failure"); } }); }) }); <%= link_to "click me", "javascript:void(0);" , :class => "test_link" %> this code in notary/orders/pending_orders if request.xhr? respond_to |format| format.js { r

JQuery "on appear" event -

my application adds elements dom after $(document).ready has been called. i'm using jquery 1.9.0 the following example works. $(document).on("click", "#box-descr", function(evt) { console.log("i showed up"); }); however, want execute function when element appears on screen. couldn't see event purpose here http://api.jquery.com/category/events/ basically it's single page application, document ready called once elements come in , out of screen user interacts ui. may want .ready() function : $("#box-descr").ready(function(){ console.log("i showed up"); }); or if fading in : $("#box-descr").fadein(1000, function(){ console.log("i showed up"); }); update: @jeff tian 's comment- you need delegate event either closest static parent or document this: $(document).on("ready", "#box-descr", function(){ console.log("i showed up"

jquery - Using .val to populate textarea -

i'm trying populate text area values multiple inputs typed, problem everytime go new input, clears previous information text area , adds new, there anyway can keep information previous fields , add new info. html <input type="text" name="fname" ><br> <input type="text" name="lname"><br> <textarea type="text" id="content"></textarea><br> jquery $("input").keyup(function () { var value = $(this).val(); $("#content").text(value); }).keyup(); codepen http://codepen.io/michael52/pen/uzeqs why don't build textarea's content based on other 2 boxes, not old value of textarea: <input type="text" name="fname" id="fname"><br> <input type="text" name="lname" id="lname"><br> <textarea type="text" id="content"></textarea&g

Parsing the C# datetime to javascript datetime -

i know question similar others didn't found solution problem. i have c# datetime property public datetime mydate { get;set;} when use ajax information, wrote in javascript like: $.each(object, function(k,v){ alert(object.mydate); }); it returns like: /date(1362478277517)/ it possible convert datetime javascript date ? thank you. new date(object.mydate); should work. edit: var date = new date(parseint(object.mydate.substr(6))); i've seen method: var milli = "/date(1245398693390)/".replace(/\/date\((-?\d+)\)\//, '$1'); var d = new date(parseint(milli));

Hibernate statistic TransactionCount vs SuccessfulTransactionCount -

i have enabled hibernate statistic on application. through jconsole.exe found following entries transactioncount = 62 successfultransactioncount = 31 transactioncount value reflects total of transactions while successfultransactioncount reflects successful transaction. mean there 31 failed transactions ?

ios - How do I obtain results of FBRequest requestForMyFriends as a JSON formatted file? -

i'm using objective-c , developing iphone. i'm sending request friends of logged in user , writing data file disk so: [[fbrequest requestformyfriends] startwithcompletionhandler:^(fbrequestconnection *connection, nsdictionary *results, nserror *error) { if(!error){ nsdictionary* friends = results; nslog(@"found %i friends", friends.count); nsarray* paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *docdir = [paths objectatindex:0]; nsstring* filename = [docdir stringbyappendingpathcomponent:@"userinfo.dat"]; if ([friends writetofile:filename atomically:yes]) { nslog(@"wrote friends file disk!"); sendfbevent(fb_event_details_friends, [filename utf8string]); } else{ nslog(@"couldn't write friends details disk!"); } this work

html - How to hover a div and hover some elements? -

i want when mouse stay on of div hello , paragraph class nice_day , image dont affected. how should using css3? <div class="hello"> <div class="stack"><img src="1.png"/></div> <div class="overflow"><p class="ilove"><img src="2.png"/>im text</p> <p class ="programming"im other text</p> <div class="have"> <img src="3.png"/> <p class="nice_day"></p> </div> </div> </div> thanks option #1 - add selectively this approach looks @ :hover state of ancestor , adds styles desired. simple: http://jsfiddle.net/gf7ju/2/ multiple elements: http://jsfiddle.net/gf7ju/3/ css /* formatting can see boxes */ .hello { border: 1px solid red; } .hello > div { padding: 6px; border: 1px solid silver; } /*

html - jQuery Alpabetical Filter by name within a table, A,B,C etc list -

i have working demo listview, need able click on a,b,c etc list @ top filter contact name within table. so click on a, display names within table start 'a'. as mentioned works list view, not sure how working within table? http://jsfiddle.net/37uxt/1/ hope can help. based on plugin http://www.ihwy.com/labs/jquery-listnav-plugin.aspx not sure or how manually new jquery. $('ul.list-nav').listnav({ includeall: false, nomatchtext: 'sorry, nothing matched filter, please try letter.', includeall: true, initletter: 'n', showcounts: false }); thanks i believe there numerous "table sorter" plugins out there short , simple code achieve you're looking script var alphas = 'abcdefghijklmnopqrstuvwxyz'; $(document).ready(function () { var tmp = ''; (var x = 0; x < 26; x++) tmp += '<a href="#"&

Using the rand () php function to display random xml files -

this question has answer here: how use php generate random xml files? 1 answer i trying write php generates xml files randomly. php generate random number between 1-10 inclusive , each number 1-10 have xml file assigned in php appear when respective number generated. so far have: <?php print rand() . "<br>"; print rand(1, 10); ?> how integrate xml files php? using xml example: example 1 <?xml version="3.0" encoding="utf-8" ?> <channel> <title>the dog in park</title> <link>http://pets.com/doginthepark/</link> <description> dog in park <item> <guid>1234</guid> <title>poodle's video</title> example 2 <?xml version="3.0" encoding="utf-8" ?> <channel> <title>the cat in park</title> <

eclipse - Python doesn't appear in preference window -

i trying install pydev in eclipse helios on windows 7. have done through help/install new software . when attempting configure eclipse find installed python, ( window -> preferences ) list appears not contain python. when browse in google this, suggests run eclipse administrator. when try install software again, says that software being installed: pydev mylyn integration 0.4.0 (org.python.pydev.mylyn.feature.feature.group 0.4.0) missing requirement: pydev mylyn integration 0.4.0 (org.python.pydev.mylyn.feature.feature.group 0.4.0) requires 'org.eclipse.mylyn.context.core 0.0.0' not found why using old version of eclipse? try first download stable eclipse version (currently juno), open new workspace location (to avoid old config files being loaded) , install pydev using suggested method (add pydev.org/updates software source , select packages). if still experience problems after doing this, let know - personally, never had similar trouble.

powershell - Simple increment/decrement counter -

i make simple counter in powershell. must prompt user whether they'd higher or lower number. starting number must 0, , can't lower 0 or higher 10. if user wants higher number, must increment number 1, if lower decrement 1. must able stop @ desired number. number can set registry value. i don't know efficient way prompt user. can use read-host cmdlet ask if typed "higher" or "lower", there more efficient way accomplish this? for example, $i = 0 while (($i -gt 0) -or ($i -lt 10)){ $j = read-host "the current number $i, higher/lower number, or quit?" if ($j -eq "higher") { $i++ write-host "the current number $i" } elseif ($j -eq "lower") { $i-- write-host "the current number $i" } elseif ($j -eq "quit") { write-host "final number is: $i" break } } how can this? you use yes/no prompt window user inp

asp.net mvc - MVC Razor View not found if filename contains a dot -

i have problems accessing route, if contains dot. reproducing, create default mvc4 webapi application. take default route... routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional } ); write controller follows... public class homecontroller : controller { public actionresult index(string id) { if (id == null) { return view(); } else { return partialview(id); } } } and create 2 files "test.cshtml" , "test.menu.cshtml" next existing "index.cshtml". opening /home/index/test works expected. brings contents of "test.cshtml". however, opening /home/index/test.menu brings 404 error. why happen? , how can avoided? the 404 error seeing iis. module mvc routing never getting control. adding following option modules section

c# - Getting error when trying to delete a file in asp.net -

i have html data in literal , make pdf file scan.pdf html using itextsharp .but when try delete created pdf file using file.delete() method,it shows error like d:\hosting\filepath\scan.pdf' because being used process how can solve it? this code creating pdf file html , send mailid attachment string mailformat = searchdt.rows[0][1].tostring(); emalbody.append(mailformat); emalbody.replace("[date]", datetime.today.tostring()); string emailbody = emalbody.tostring(); message.body = emalbody.tostring(); ***htmltopdf(emailbody, "scan.pdf");*** system.net.mail.attachment attachment; attachment = new system.net.mail.attachment(server.mappath("scan.pdf")); message.attachments.add(attachment); message.isbodyhtml = true; message.subject = ""; smtpclient.send(message); file.delete("d://file

javascript - send input value via ajax without using val() function -

my use-case : have several input : <label class="minilabel">field1</label><input type="text"> ... <label class="minilabel">fieldn </label><input type="text"> i have value of each input , send via ajax (a post request). set id each input retrieve through $("#id1").val() .. $("#idn").val() , such intricate. there alternative way these values? $('form').serialize(); ...is friend. turns data in form query string pass in data attribute. i ideally wrap elements in form (unless these dynamically created) can reference "action" attribute when sending ajax post request , page remains html4/5 compliant. this: var $form = $('form'); $.ajax({ "type": "post", "url": $form.attr('action'), "data": $form.serialize(), "success": function (r) { } }); on other side

ios - uiscrollview's unusual contentsize property -

i quite new ios application development. i working uiscrollview , found strange behavior. hope explain me. i tried 2 methods , found outputs different. 1). uiscrollview added view in interface builder, , view (uiview) added scrollview earlier. set view's bounds manually in ib, , set scrollview 's content size in class file. observation : scrollview doesn't scroll setcontentsize , rather takes unusual content size , independent of else, own bounds. 2). same uiscrollview again added in interface builder, view added time programmatically. observation : time works out quite good. i don't understand have gone wrong. can explain , elaborate i'm not sure problem is, if want able add views uiscrollview in ib, create uiscrollview subclass , this: - (void)awakefromnib { [super awakefromnib]; cgrect bounds = cgrectzero; (uiview* view in self.subviews) { bounds = cgrectunion(bounds, view.frame); } [se

css - web page width and height is smaller in mac pc than windows pc -

is px different mac pc , windows pc. how can set same size both mac , windows css .div { width: 900px; height: auto; margin-left:auto; margin-right:auto; margin-top: 1px; border: 0px solid #a3a3a3; overflow: hidden; background-color:#ffffff; }