def getOutlierBound(rt): """ Analyzes the results of the 1st partcile analysis. Since the dilation of nuclear perimeter often causes overlap of neighboring neculeus 'terrirories', such nucleus are discarded from the measurements. Small nucelei are already removed, but since rejection of nuclei depends on standard outlier detection method, outliers in both smaller and larger sizes are discarded. """ area = rt.getColumn(rt.getColumnIndex('Area')) circ = rt.getColumn(rt.getColumnIndex("Circ.")) arealist = ArrayList(Arrays.asList(area.tolist())) circlist = ArrayList(Arrays.asList(circ.tolist())) bwc = InstBWC() ans = bwc.calculateBoxAndWhiskerStatistics(arealist) #anscirc = bwc.calculateBoxAndWhiskerStatistics(circlist) if (VERBOSE): print ans.toString() print ans.getOutliers() q1 = ans.getQ1() q3 = ans.getQ3() intrange = q3 - q1 outlier_offset = intrange * 1.5 # circularity better be fixed. #circq1 = anscirc.getQ1() #circq3 = anscirc.getQ3() #circintrange = circq3 - circq1 #circoutlier_offset = circintrange * 1.5 return q1, q3, outlier_offset
def getExtraParametersForStep(self, configurationAttributes, step): if (step == 1): return Arrays.asList("display_register_action") elif (step == 2): return Arrays.asList("oxpush2_auth_method", "oxpush2_request") return None
def getExtraParametersForStep(self, configurationAttributes, step): print "Passport. getExtraParametersForStep called" if step == 1: return Arrays.asList("selectedProvider", "externalProviders") elif step == 2: return Arrays.asList("passport_user_profile") return None
def setActiveChannel(self, channel): self.channel = channel # convert from List to Array items = self.channel.getItems().toArray() # sort news items Arrays.sort(items, ItemComparator(1)) self.items = items self.fireTableDataChanged()
def getExtraParametersForStep(self, configurationAttributes, step): if step == 1: if self.oneStep: return Arrays.asList("super_gluu_request") elif self.twoStep: return Arrays.asList("display_register_action") elif step == 2: return Arrays.asList("super_gluu_auth_method", "super_gluu_request") return None
def __queryNewestRefTime(self): from com.raytheon.uf.viz.core.catalog import CatalogQuery from java.util import Arrays from com.raytheon.uf.common.time import DataTime results = CatalogQuery.performQuery('dataTime.refTime', self._buildConstraints(None)) Arrays.sort(results) if len(results) == 0: if self.site: raise NoDataException.NoDataException("No data available for site " + self.site) else: raise NoDataException.NoDataException("No data available") dt = DataTime(results[len(results)-1]) return dt.getRefTime().getTime() / 1000
def test_vararg(self): from java.util import Arrays self.assertSequenceEqual((), Arrays.asList()) self.assertSequenceEqual(("1"), Arrays.asList("1")) self.assertSequenceEqual(("1","2"), Arrays.asList("1","2")) # Passing a tuple should convert the tuple elemnts to the varargs array. self.assertSequenceEqual(("1","2"), Arrays.asList(("1","2"))) # instance method as opposed to static method above self.assertSequenceEqual(("1","2"), self.test.testAllVarArgs("1","2")) # Multiple varargs goes through a different path then just one vararg so be sure to hit both. self.assertSequenceEqual(("1"), self.test.testAllVarArgs("1")) # mixing normal args with varargs self.assertSequenceEqual(("1","2", "3"), self.test.testMixedVarArgs("1","2", "3")) self.assertSequenceEqual(("1","2", "3", "4"), self.test.testMixedVarArgs("1","2", "3", "4"))
def run(self, ctx): engctx = ctx.getEnginesContext() if not engctx: print('Back-end engines not initialized') return projects = engctx.getProjects() if not projects: print('There is no opened project') return # get the first unit available units = RuntimeProjectUtil.findUnitsByType(projects[0], None, False) if not units: print('No unit available') return unit = units[0] print('Unit: %s' % unit) # retrieve the formatter, which is a producer of unit representations formatter = unit.getFormatter() # create a table document columnLabels = Arrays.asList('Key', 'Value', 'Comment') rows = ArrayList() rows.add(TableRow(Arrays.asList(Cell('foo'), Cell('bar'), Cell('none')))) rows.add(TableRow(Arrays.asList(Cell('type'), Cell('integer'), Cell('unset')))) extraDoc = StaticTableDocument(columnLabels, rows) extraPres0 = UnitRepresentationAdapter(101, 'Demo Table', False, extraDoc) # create a tree document columnLabels = Arrays.asList('Key', 'Value') root = KVNode('foo', 'bar') roots = Arrays.asList(root) root.addChild(KVNode('quantified', 'self')) root.addChild(KVNode('galaxy', 'milky way')) node = KVNode('black hole', '42') node.setClassId(ItemClassIdentifiers.INFO_DANGEROUS) root.addChild(node) extraDoc = StaticTreeDocument(roots, columnLabels, -1) extraPres1 = UnitRepresentationAdapter(102, 'Demo Tree', False, extraDoc) # add the newly created presentations to our unit, and notify clients # the second argument indicates that the presentation should be persisted when saving the project formatter.addPresentation(extraPres0, True) formatter.addPresentation(extraPres1, True) unit.notifyListeners(JebEvent(J.UnitChange));
def outlierDetection(pattern, measA): filtsdevA = [] for ind, sd in enumerate(measA[2]): if not measA[4][ind]: filtsdevA.append(sd) #sdevlist = ArrayList(Arrays.asList(measA[2])) sdevlist = ArrayList(Arrays.asList(filtsdevA)) bwc = InstBWC() ans = bwc.calculateBoxAndWhiskerStatistics(sdevlist) q1 = ans.getQ1() q3 = ans.getQ3() intrange = q3 - q1 outlier_offset = intrange * 1.5 outlow = q1 - outlier_offset outup = q3 + outlier_offset filtersummary = { 'n': len(measA[2]),'Mean': ans.getMean(), 'Median': ans.getMedian(), 'Outlier-Low': outlow, 'Outlier-Up': outup } for i, filep in enumerate(measA[0]): #res = re.search(pattern, filep) if (measA[2][i] < outlow) or (measA[2][i] > outup): #print 'xxxW', res.group(2), measA[2][i] measA[4][i] = 1 # else: #print 'W', res.group(2), measA[2][i] #measA[4].append(0) return filtersummary
def createLdapExtendedConfigurations(self, authConfiguration): ldapExtendedConfigurations = [] for ldapConfiguration in authConfiguration["ldap_configuration"]: configId = ldapConfiguration["configId"] servers = ldapConfiguration["servers"] bindDN = None bindPassword = None useAnonymousBind = True if (self.containsAttributeString(ldapConfiguration, "bindDN")): useAnonymousBind = False bindDN = ldapConfiguration["bindDN"] bindPassword = ldapConfiguration["bindPassword"] useSSL = ldapConfiguration["useSSL"] maxConnections = ldapConfiguration["maxConnections"] baseDNs = ldapConfiguration["baseDNs"] loginAttributes = ldapConfiguration["loginAttributes"] localLoginAttributes = ldapConfiguration["localLoginAttributes"] ldapConfiguration = GluuLdapConfiguration(configId, bindDN, bindPassword, Arrays.asList(servers), maxConnections, useSSL, Arrays.asList(baseDNs), loginAttributes[0], localLoginAttributes[0], useAnonymousBind) ldapExtendedConfigurations.append({ "ldapConfiguration" : ldapConfiguration, "loginAttributes" : loginAttributes, "localLoginAttributes" : localLoginAttributes }) return ldapExtendedConfigurations
def disjunct(cls, multiplier, *queries, **terms): "Return lucene DisjunctionMaxQuery from queries and terms." self = cls(search.DisjunctionMaxQuery, Arrays.asList(queries), multiplier) for name, values in terms.items(): for value in ([values] if isinstance(values, basestring) else values): self.add(cls.term(name, value)) return self
def __init__(self, searcher, query, field, terms=False, fields=False, tag='', formatter=None, encoder=None): if tag: formatter = highlight.SimpleHTMLFormatter('<{}>'.format(tag), '</{}>'.format(tag)) scorer = (highlight.QueryTermScorer if terms else highlight.QueryScorer)(query, *(searcher.indexReader, field) * (not fields)) highlight.Highlighter.__init__(self, *filter(None, [formatter, encoder, scorer])) self.searcher, self.field = searcher, field self.selector = HashSet(Arrays.asList([field]))
def getUniqueSrcIps(self, protocol=6): uniqueIps = HashSet() srcAddrSqlBuilder = SelectSqlBuilder('Agg_V5', 'srcAddr as ip', distinct=1) srcAddrSqlBuilder.where('prot=%d' % protocol) srcIps = self._sqlClient.execute(srcAddrSqlBuilder) if srcIps: uniqueIps.addAll(Arrays.asList([ipEntry.ip for ipEntry in srcIps])) return uniqueIps.toArray()
def test_java_object_arrays(self): jStringArr = array(String, [String("a"), String("b"), String("c")]) self.assert_( Arrays.equals(jStringArr.typecode, 'java.lang.String'), "String array typecode of wrong type, expected %s, found %s" % (jStringArr.typecode, str(String))) self.assertEqual(zeros(String, 5), Array.newInstance(String, 5)) import java.lang.String # require for eval to work self.assertEqual(jStringArr, eval(str(jStringArr)))
def test_java_object_arrays(): jStringArr = array(String, [String("a"), String("b"), String("c")]) verify(Arrays.equals(jStringArr.typecode, str(String)), "String array typecode of wrong type, expected %s, found %s" % (jStringArr.typecode, str(String))) verify(zeros(String, 5) == Array.newInstance(String, 5)) import java # require for eval to work if jStringArr != eval(str(jStringArr)): raise TestFailed, "eval(str(%s)) <> %s" % (jStringArr,)*2
def initialize_executors_holder(servers): server_names= [] for server in servers: server_name = server.getProperty("serverName") server_names.append(server_name) if executors_holder.RUNNING_EXECUTORS.containsKey(server_name): print "DEBUG: server name already in RUNNING EXECUTORS [%s]" % server_name current_size = executors_holder.RUNNING_EXECUTORS.get(server_name).maxSize() if current_size != server.getProperty("nrExecutors"): fixed = FixedSizeList.decorate(Arrays.asList(String[server.getProperty("nrExecutors")])); executors_holder.RUNNING_EXECUTORS.replace(server_name, fixed) else: print "DEBUG: server name not in RUNNING EXECUTORS [%s]" % server_name fixed = FixedSizeList.decorate(Arrays.asList(["available"] * server.getProperty("nrExecutors"))); executors_holder.RUNNING_EXECUTORS.put(server_name, fixed) # Remove any RUNNING_EXECUTORS that are not in servers for key in executors_holder.RUNNING_EXECUTORS.keySet(): if key not in server_names: print "DEBUG: Removing obsolete executors server [%s]" % key executors_holder.RUNNING_EXECUTORS.remove(key)
def addCommentsToDoc(self, unit): notes = unit.getNotes() # Get the notes of unit if isinstance(unit, IInteractiveUnit): # If the type of unit is IInteractiveUnit, which means it my has comments and we can use getComments() totalComments = unit.getComments() # Get all comments flag = True # If flag is true, we will add the unit name in the first column, and after that, it will be set to false, which means other rows of this unit will not be added the unit name. # So only the first row of the unit have the unit name if totalComments: for address in totalComments: if (totalComments[address] != None and totalComments[address] != ''): if (flag): self.rows.add(TableRow(Arrays.asList(Cell(unit.getName()), Cell(address), Cell(totalComments[address])))) flag = False else: self.rows.add(TableRow(Arrays.asList(Cell(''), Cell(address), Cell(totalComments[address])))) if totalComments and notes: self.rows.add(TableRow(Arrays.asList(Cell(''), Cell('Notes:'), Cell(unit.getNotes())))) return if notes: self.rows.add(TableRow(Arrays.asList(Cell(unit.getName()), Cell('Notes:'), Cell(unit.getNotes())))) return return if notes: self.rows.add(TableRow(Arrays.asList(Cell(unit.getName()), Cell('Notes:'), Cell(unit.getNotes()))))
def getExtraParametersForStep(self, configurationAttributes, step): print "Casa. getExtraParametersForStep %s" % str(step) if step > 1: list = ArrayList() acr = CdiUtil.bean(Identity).getWorkingParameter("ACR") if acr in self.authenticators: module = self.authenticators[acr] params = module.getExtraParametersForStep(module.configAttrs, step) if params != None: list.addAll(params) list.addAll(Arrays.asList("ACR", "methods", "trustedDevicesInfo")) print "extras are %s" % list return list return None
return false; } public static void main(String[] args) { // System.out.println("Hello World"); solution myCakeShop = new solution(); Scanner scanner = new Scanner(System.in).useDelimiter("\n");; int numberOfDays = Integer.parseInt(scanner.next()); List<Boolean> results = new ArrayList<Boolean>(); for (int i=0; i < numberOfDays; i++) { String cakesList = scanner.next(); String[] splited = cakesList.split(" "); // System.out.println(" DING DONG " + splited); int[] listOfCakes = Arrays.stream(splited).mapToInt(Integer::parseInt).toArray(); int goal = Integer.parseInt(scanner.next())+1; int sum = IntStream.of(listOfCakes).sum(); if(sum < goal) results.add(false); else if(sum == goal) results.add(true); else{ if(goal <= 13){ results.add(myCakeShop.canItBeDelivered(listOfCakes, goal)); } else{ ArrayList<Integer> newListOfCakes = new ArrayList<Integer>(); for(int j = 1; j < listOfCakes.length; j++) newListOfCakes.add(listOfCakes[j]);
def run(self, ctx): self.documentName = 'Comments Table' engctx = ctx.getEnginesContext() if not engctx: print('Back-end engines not initialized') return projects = engctx.getProjects() if not projects: print('There is no opened project') return prj = projects[0] print('Decompiling code units of %s...' % prj) units = RuntimeProjectUtil.findUnitsByType(prj, None, False) if not units: print('No unit exists') return targetUnit = units[0] # Get the top-level unit formatter = targetUnit.getFormatter() # Get the formatter of the unit # Set table column names columnLabels = Arrays.asList('Unit Name', 'Address', 'Comment') # Add comments to the arraylist rows self.rows = ArrayList() for unit in units: self.addCommentsToDoc(unit) # Create the table doc tableDoc = StaticTableDocument(columnLabels, self.rows) # Delete the old table doc and add the new table doc to presentations newId = 2 # Set the initial table doc Id (Do not use 1! 1 is default number used by "source") for i, document in enumerate( formatter.getPresentations()): # Find the old table doc if (self.documentName == document.getLabel()): newId = document.getId( ) + 1 # Adding 1 to the old table doc Id as the Id of the new doc (avoid the collision) formatter.removePresentation( i) # Delete the old table doc from presentations break adapter = UnitRepresentationAdapter(newId, self.documentName, False, tableDoc) # Get the new adapter formatter.addPresentation( adapter, True) # Add the new table doc to presentations # Jump to the table doc fragment in the top-level unit views = ctx.getViews( targetUnit) # Get all views of target unit(top-level unit) if not views: ctx.displayMessageBox('Warning', 'Please open the top-level unit', None, None) # Show the value directly return targetView = views.get(0) fragments = targetView.getFragments( ) # Get all fragments of target view if not fragments: ctx.displayMessageBox('Warning', 'No fragment exists', None, None) return targetFragment = targetView.getFragments().get( fragments.size() - 1) # Get the table doc just created # targetView.setActiveFragment(targetFragment) ctx.openView(targetUnit) # Open target Unit(top-level unit) targetUnit.notifyListeners(JebEvent(J.UnitChange))
String destinationName = "Destination"; UUID destinationId = authoringClient.models().addEntity() .withAppId(appId) .withVersionId(versionId) .withName(destinationName) .execute(); System.out.println("Created simple entity " + destinationName + " with ID " + destinationId.toString()); String className = "Class"; UUID classId = authoringClient.models().addHierarchicalEntity(appId, versionId, new HierarchicalEntityModel() .withName(className) .withChildren(Arrays.asList("First", "Business", "Economy"))); System.out.println("Created hierarchical entity " + className + " with ID " + classId.toString()); //============================================================= // This will create the "Flight" composite entity including "Class" and "Destination" System.out.println("Creating the \"Flight\" composite entity including \"Class\" and \"Destination\"."); String flightName = "Flight"; UUID flightId = authoringClient.models().addCompositeEntity(appId, versionId, new CompositeEntityModel() .withName(flightName) .withChildren(Arrays.asList(className, destinationName))); System.out.println("Created composite entity " + flightName + "with ID " + flightId.toString());
def getExtraParametersForStep(self, configurationAttributes, step): if step == 2: return Arrays.asList("code") return None
#ConsoleUtil.write("Error: There is no Key for \""+str(node)+"\" in NodeIndex[]") node="B" if not node.find("_"): if n==1: drawing=1 parent=node shortnode=node else: if n < len(node.split("_")): drawing=1 shortnode = node.split("_")[n] parent = node.split("_"+node.split("_")[n])[0] if drawing==1: ConsoleUtil.writeInfo("n="+str(n)+", parent="+parent) widget.setPropertyValue("visible","true") pindex = int(nodeLoader.NodeIndex[parent]) siblings = nodeLoader.SubNodeNames[pindex].rstrip("'").lstrip("'").split(",") siblings.sort() ConsoleUtil.writeInfo("subnodes="+nodeLoader.SubNodeNames[pindex]) subnodes = nodeLoader.SubNodeNames[pindex].rstrip("'").lstrip("'").split(",") widget.setPropertyValue("items",Arrays.asList(subnodes) ) widget.setPropertyValue("height",24*len(subnodes) ) selectedPV = pvArray[1] selectedPV.setValue(shortnode)
def getExtraParametersForStep(self, configurationAttributes, step): return Arrays.asList("bioID_auth_method","access_token","user_name","bioID_count_login_steps")
def consolidateDuplicateIssues(self, isb, isa): if Arrays.equals(isb.getHttpMessages()[0].getResponse(), isa.getHttpMessages()[0].getResponse()): return -1 else: return 0
def getExtraParametersForStep(self, configurationAttributes, step): return Arrays.asList("uaf_auth_method", "uaf_obb_auth_method", "uaf_obb_server_uri", "uaf_obb_start_response")
def getSupportedClaims(self, configurationAttributes): return Arrays.asList("work_phone")
# Examples of Jython-specific functionality # @category: Examples.Python # Using Java data structures from Jython python_list = [1, 2, 3] java_list = java.util.LinkedList(java.util.Arrays.asList(1, 2, 3)) print str(type(python_list)) print str(type(java_list)) # Importing Java packages for simpler Java calls from java.util import LinkedList, Arrays python_list = [1, 2, 3] java_list = LinkedList(Arrays.asList(1, 2, 3)) print str(type(python_list)) print str(type(java_list)) # Python adds helpful syntax to Java data structures print python_list[0] print java_list[0] # can't normally do this in java print java_list[0:2] # can't normally do this in java # Iterate over Java collection the Python way for entry in java_list: print entry # "in" keyword compatibility print str(3 in java_list) # Create GUI with Java Swing from javax.swing import JFrame frame = JFrame() # don't call constructor with "new"
def getExtraParametersForStep(self, configurationAttributes, step): print "MFA Enroll Recovery. getExtraParametersForStep called for step '%s'" % step return Arrays.asList("new_code")
# nodefull = node.split("_"+node.split("_")[len(node.split("_"))-1])[0] # index = int(nodeLoader.NodeIndex[nodefull]) #get index of node #if there are elements, make a list if ((len(nodeLoader.ElementRange[index]) > 2) and (len(nodeLoader.ElementNames[index]) > 2)): count = 0 itemlist = [] fullrange = nodeLoader.ElementRange[index].strip("'") #strip quotes fulllow = int(fullrange.split(",")[0]) #get element range values fullhigh = int(fullrange.split(",")[1]) elementList = nodeLoader.ElementNames[index].strip("'").split( ",") #get element names for t in range(fulllow, fullhigh + 1): #make list with names and indices itemlist.append(nodefull + "_" + elementList[count] + " " + str(t)) count += 1 widget.setPropertyValue("items", Arrays.asList(itemlist)) #set the relevant props widget.setPropertyValue("height", 24 * count) ConsoleUtil.writeInfo("NS4" + element) if element: pvArray[1].setValue(element) #make the pv the 1st item on the list widget.setPropertyValue("pv_value", element) else: pvArray[1].setValue(itemlist[0]) #make the pv the 1st item on the list widget.setPropertyValue("pv_value", itemlist[0])
def getExtraParametersForStep(self, configurationAttributes, step): if step > 1: return Arrays.asList("randCode", "numbers", "choppedNos") return None
def assertAsList(self, a, b): self.assertEqual(Arrays.asList(a), b)
def getExtraParametersForStep(self, configurationAttributes, step): if step == 2: return Arrays.asList("cas2_count_login_steps", "cas2_user_uid") return None
def getExtraParametersForStep(self, configurationAttributes, step): if (step in [2, 3]): return Arrays.asList("toopher_user_uid") return None
def getExtraParametersForStep(self, configurationAttributes, step): if (step == 1): return Arrays.asList("spnego_token","spnego_principal","spnego_auth_success","spnego_username","spnego_fatal_error") elif (step == 2): return Arrays.asList("spnego_token","spnego_principal","spnego_auth_success","spnego_username","spnego_fatal_error") return None
def getSupportedClaims(self, configurationAttributes): print "Dynamic scope [saml_nameid_scope]. Get supported claims = 'saml_nameid'" return Arrays.asList("saml_nameid")
def getExtraParametersForStep(self, configurationAttributes, step): return Arrays.asList("token", "emailIds", "token_valid", "sentmin")
def ident(self): return FunctionIdent(self.name(), Arrays.asList(DataTypes.INTEGER))
def getExtraParametersForStep(self, configurationAttributes, step): print "MFA OTP. getExtraParametersForStep called" return Arrays.asList("otp_auth_method", "otp_count_login_steps", "otp_secret_key", "otp_enrollment_request", "otp_info_submitted")
def getSupportedClaims(self, configurationAttributes): return Arrays.asList("role")
def run(title): gd = GenericDialog("Record Window") gd.addMessage("Maximum number of frames to record.\nZero means infinite, interrupt with ESC key.") gd.addNumericField("Max. frames:", 50, 0) gd.addNumericField("Milisecond interval:", 300, 0) gd.addSlider("Start in (seconds):", 0, 20, 5) frames = [] titles = [] for f in Frame.getFrames(): if f.isEnabled() and f.isVisible(): frames.append(f) titles.append(f.getTitle()) gd.addChoice("Window:", titles, titles[0]) gd.addCheckbox("To file", False) gd.showDialog() if gd.wasCanceled(): return n_frames = int(gd.getNextNumber()) interval = gd.getNextNumber() / 1000.0 # in seconds frame = frames[gd.getNextChoiceIndex()] delay = int(gd.getNextNumber()) tofile = gd.getNextBoolean() dir = None if tofile: dc = DirectoryChooser("Directory to store image frames") dir = dc.getDirectory() if dir is None: return # dialog canceled snaps = [] borders = None executors = Executors.newFixedThreadPool(1) try: while delay > 0: IJ.showStatus("Starting in " + str(delay) + "s.") time.sleep(1) # one second delay -= 1 IJ.showStatus("Capturing frame borders...") bounds = frame.getBounds() robot = Robot() frame.toFront() time.sleep(0.5) # half a second borders = robot.createScreenCapture(bounds) IJ.showStatus("Recording " + frame.getTitle()) # Set box to the inside borders of the frame insets = frame.getInsets() box = bounds.clone() box.x = insets.left box.y = insets.top box.width -= insets.left + insets.right box.height -= insets.top + insets.bottom start = System.currentTimeMillis() / 1000.0 # in seconds last = start intervals = [] real_interval = 0 i = 1 fus = None if tofile: fus = [] # 0 n_frames means continuous acquisition while 0 == n_frames or (len(snaps) < n_frames and last - start < n_frames * interval): now = System.currentTimeMillis() / 1000.0 # in seconds real_interval = now - last if real_interval >= interval: last = now img = snapshot(frame, box) if tofile: fus.append(executors.submit(Saver(i, dir, bounds, borders, img, insets))) # will flush img i += 1 else: snaps.append(img) intervals.append(real_interval) else: time.sleep(interval / 5) # interrupt capturing: if IJ.escapePressed(): IJ.showStatus("Recording user-interrupted") break # debug: # print "insets:", insets # print "bounds:", bounds # print "box:", box # print "snap dimensions:", snaps[0].getWidth(), snaps[0].getHeight() # Create stack stack = None if tofile: for fu in snaps: fu.get() # wait on all stack = VirtualStack(bounds.width, bounds.height, None, dir) files = File(dir).list(TifFilter()) Arrays.sort(files) for f in files: stack.addSlice(f) else: stack = ImageStack(bounds.width, bounds.height, None) t = 0 for snap, real_interval in zip(snaps, intervals): bi = BufferedImage(bounds.width, bounds.height, BufferedImage.TYPE_INT_RGB) g = bi.createGraphics() g.drawImage(borders, 0, 0, None) g.drawImage(snap, insets.left, insets.top, None) stack.addSlice(str(IJ.d2s(t, 3)), ImagePlus("", bi).getProcessor()) t += real_interval snap.flush() bi.flush() borders.flush() ImagePlus(frame.getTitle() + " recording", stack).show() IJ.showStatus("Done recording " + frame.getTitle()) except Exception, e: print "Some error ocurred:" print e.printStackTrace() IJ.showStatus("") if borders is not None: borders.flush() for snap in snaps: snap.flush()
def getExtraParametersForStep(self, configurationAttributes, step): return Arrays.asList("pwd_compromised","user_name")
def select(self, *fields): "Only load selected fields." self.fields = HashSet(Arrays.asList(fields))
int b1 = b.length; // resultant array size int c1 = a1 + b1; // create the resultant array int[] c = new int[c1]; // using the pre-defined function arraycopy System.arraycopy(a, 0, c, 0, a1); System.arraycopy(b, 0, c, a1, b1); // prints the resultant array System.out.println(Arrays.toString(c)); } }
def getExtraParametersForStep(self, configurationAttributes, step): return Arrays.asList("expDate")
def getSupportedClaims(self, configurationAttributes): return Arrays.asList("external_session_id")
def getExtraParametersForStep(self, configurationAttributes, step): #print("getExtraParametersForStep {}".format(step)) return Arrays.asList("transaction_message", "push_available", "otp_available", "mode")
def getExtraParametersForStep(self, configurationAttributes, step): return Arrays.asList("count_login_steps")
def getExtraParametersForStep(self, configurationAttributes, step): return Arrays.asList("cert_selected", "cert_valid", "cert_x509", "cert_x509_fingerprint", "cert_count_login_steps", "cert_user_external_uid")
def getExtraParametersForStep(self, configurationAttributes, step): if step == 2: return Arrays.asList("duo_count_login_steps", "cas2_user_uid") return None
def getExtraParametersForStep(self, configurationAttributes, step): if (step == 2): return Arrays.asList("gplus_user_uid") return None
def getSupportedClaims(self, configurationAttributes): return Arrays.asList("org_name")
def translateAttributes(self, context, configurationAttributes): print "Idp extension. Method: translateAttributes" # Return False to use default method #return False request = context.getRequest() userProfile = context.getUserProfile() principalAttributes = self.defaultNameTranslator.produceIdpAttributePrincipal( userProfile.getAttributes()) print "Idp extension. Converted user profile: '%s' to attribute principal: '%s'" % ( userProfile, principalAttributes) if not principalAttributes.isEmpty(): print "Idp extension. Found attributes from oxAuth. Processing..." # Start: Custom part # Add givenName attribute givenNameAttribute = IdPAttribute("oxEnrollmentCode") givenNameAttribute.setValues( ArrayList(Arrays.asList(StringAttributeValue("Dummy")))) principalAttributes.add(IdPAttributePrincipal(givenNameAttribute)) print "Idp extension. Updated attribute principal: '%s'" % principalAttributes # End: Custom part principals = HashSet() principals.addAll(principalAttributes) principals.add(UsernamePrincipal(userProfile.getId())) request.setAttribute( ExternalAuthentication.SUBJECT_KEY, Subject(False, Collections.singleton(principals), Collections.emptySet(), Collections.emptySet())) print "Created an IdP subject instance with principals containing attributes for: '%s'" % userProfile.getId( ) if False: idpAttributes = ArrayList() for principalAttribute in principalAttributes: idpAttributes.add(principalAttribute.getAttribute()) request.setAttribute(ExternalAuthentication.ATTRIBUTES_KEY, idpAttributes) authenticationKey = context.getAuthenticationKey() profileRequestContext = ExternalAuthentication.getProfileRequestContext( authenticationKey, request) authContext = profileRequestContext.getSubcontext( AuthenticationContext) extContext = authContext.getSubcontext( ExternalAuthenticationContext) extContext.setSubject( Subject(False, Collections.singleton(principals), Collections.emptySet(), Collections.emptySet())) extContext.getSubcontext( AttributeContext, True).setUnfilteredIdPAttributes(idpAttributes) extContext.getSubcontext(AttributeContext).setIdPAttributes( idpAttributes) else: print "No attributes released from oxAuth. Creating an IdP principal for: '%s'" % userProfile.getId( ) request.setAttribute(ExternalAuthentication.PRINCIPAL_NAME_KEY, userProfile.getId()) #Return True to specify that default method is not needed return False
def doInit(self): self.client = MemcachedClient(ConnectionFactoryBiggerTimeout(), Arrays.asList([InetSocketAddress("127.0.0.1", 11211)]))
def getSupportedClaims(self, configurationAttributes): return Arrays.asList("memberof")
def getExtraParametersForStep(self, configurationAttributes, step): if (step == 2): return Arrays.asList("saml_user_uid") return None
def getExtraParametersForStep(self, configurationAttributes, step): return Arrays.asList("otp_auth_method", "otp_count_login_steps", "otp_secret_key", "otp_enrollment_request","retry_current_step")