Search Results

Search found 409 results on 17 pages for 'ken bloom'.

Page 12/17 | < Previous Page | 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • I have a generic implementation of PHP mcrypt module and its not decrypting

    - by Ken Mitchner
    class Crypt_Data { protected $_mcrypt=null; protected $_iv=null; protected $_key=null; public function __construct() { $this->_mcrypt = mcrypt_module_open('rijndael_256', '', 'cbc', ''); $key_size = mcrypt_enc_get_key_size($this->_mcrypt); for($i=0;$i<$key_size;$i++) $test_key .= "0"; $this->_iv = $test_key; $this->_key = $test_key; mcrypt_generic_init($this->_mcrypt,$this->_key,$this->_iv); } public function dataEncrypt($data) { return base64_encode(mcrypt_generic($this->_mcrypt, $data)); } public function dataDecrypt($data) { return mdecrypt_generic($this->_mcrypt, base64_decode($data)); } } $crypt = new Crypt_Data(); $string = "encrypt me"; $encrypted = $crypt->dataEncrypt($string); echo $encrypted."<BR>"; $decrypted = $crypt->dataDecrypt($encrypted); echo $decrypted."<BR>"; output: JJKfKxZckkqwfZ5QWeyVR+3PkMQAsP0Gr1hWaygV20I= qÌÌi_ÖZí(®`iÜ¥wÝÿ ô0€Í6Ÿhf[%ër No idea why this isn't working, everything seems to be fine on my end.. i tried decrypting it with mcrypt_cbc(); and it decrypted it properly.. so it has something to do with my mdecrypt_generic.. any ideas?

    Read the article

  • Is there an ORM that supports composition w/o Joins

    - by Ken Downs
    EDIT: Changed title from "inheritance" to "composition". Left body of question unchanged. I'm curious if there is an ORM tool that supports inheritance w/o creating separate tables that have to be joined. Simple example. Assume a table of customers, with a Bill-to address, and a table of vendors, with a remit-to address. Keep it simple and assume one address each, not a child table of addresses for each. These addresses will have a handful of values in common: address 1, address 2, city, state/province, postal code. So let's say I'd have a class "addressBlock" and I want the customers and vendors to inherit from this class, and possibly from other classes. But I do not want separate tables that have to be joined, I want the columns in the customer and vendor tables respectively. Is there an ORM that supports this? The closest question I have found on StackOverflow that might be the same question is linked below, but I can't quite figure if the OP is asking what I am asking. He seems to be asking about foregoing inheritance precisely because there will be multiple tables. I'm looking for the case where you can use inheritance w/o generating the multiple tables. Model inheritance approach with Django's ORM

    Read the article

  • Does deleting a branch in git remove it from the history?

    - by Ken Liu
    Coming from svn, just starting to become familiar with git. When a branch is deleted in git, is it removed from the history? In svn, you can easily recover a branch by reverting the delete operation (reverse merge). Like all deletes in svn, the branch is never really deleted, it's just removed from the current tree. If the branch is actually deleted from the history in git, what happens to the changes that were merged from that branch? Are they retained?

    Read the article

  • Common Lisp condition system for transfer of control

    - by Ken
    I'll admit right up front that the following is a pretty terrible description of what I want to do. Apologies in advance. Please ask questions to help me explain. :-) I've written ETLs in other languages that consist of individual operations that look something like: // in class CountOperation IEnumerable<Row> Execute(IEnumerable<Row> rows) { var count = 0; foreach (var row in rows) { row["record number"] = count++; yield return row; } } Then you string a number of these operations together, and call The Dispatcher, which is responsible for calling Operations and pushing data between them. I'm trying to do something similar in Common Lisp, and I want to use the same basic structure, i.e., each operation is defined like a normal function that inputs a list and outputs a list, but lazily. I can define-condition a condition (have-value) to use for yield-like behavior, and I can run it in a single loop, and it works great. I'm defining the operations the same way, looping through the inputs: (defun count-records (rows) (loop for count from 0 for row in rows do (signal 'have-value :value `(:count ,count @,row)))) The trouble is if I want to string together several operations, and run them. My first attempt at writing a dispatcher for these looks something like: (let ((next-op ...)) ;; pick an op from the set of all ops (loop (handler-bind ((have-value (...))) ;; records output from operation (setq next-op ...) ;; pick a new next-op (call next-op))) But restarts have only dynamic extent: each operation will have the same restart names. The restart isn't a Lisp object I can store, to store the state of a function: it's something you call by name (symbol) inside the handler block, not a continuation you can store for later use. Is it possible to do something like I want here? Or am I better off just making each operation function explicitly look at its input queue, and explicitly place values on the output queue?

    Read the article

  • Creating New Objects in JavaScript

    - by Ken Ray
    I'm a relatively newbie to object oriented programming in JavaScript, and I'm unsure of the "best" way to define and use objects in JavaScript. I've seen the "canonical" way to define objects and instantiate a new instance, as shown below. function myObjectType(property1, propterty2) { this.property1 = property1, this.property2 = property2 } // now create a new instance var myNewvariable = new myObjectType('value for property1', 'value for property2'); But I've seen other ways to create new instances of objects in this manner: var anotherVariable = new someObjectType({ property1: "Some value for this named property", property2: "This is the value for property 2" }); I like how that second way appears - the code is self documenting. But my questions are: Which way is "better"? Can I use that second way to instantiate a variable of an object type that has been defined using the "classical"way of defining the object type with that implicit constructor? If I want to create an array of these objects, are there any other considerations? Thanks in advance.

    Read the article

  • Entity Framework 4.1 (Code First) audit column

    - by Ken Pespisa
    I'm using Entity Framework 4.1 with a Code-First approach on an ASP.NET MVC site Say I have an entity named Profile that keeps track of a user's favorite book, and I want to track when the user updates their favorite book. UPDATED: Using the class below as an example, I want to set the FavoriteBookLastUpdated property to the current date whenever the value of the FavoriteBook property changes. public class Profile { public int Id { get; set; } public string Name { get; set; } public string FavoriteBook { get; set; } public DateTime? FavoriteBookLastUpdated { get; set; } } Right now I just update that field, if appropriate, in the controller's Edit action before calling the DBContext's SaveChanges() method. Is there a way I can put that logic in my model somehow? I'd prefer not to use triggers on the database side.

    Read the article

  • SFML 2.0 crashes anytime a method is called

    - by Ken
    This code generates an exception: #include <SFML/Graphics.hpp> #include <SFML/Window.hpp> #include <SFML/System.hpp> int main() { sf::Clock clock; clock.getElapsedTime(); return 0; } However, this doesn't crash: #include <SFML/Graphics.hpp> #include <SFML/Window.hpp> #include <SFML/System.hpp> int main() { sf::Clock clock; return 0; } I'm using SFML 2.0, Windows 7, MinGW 4.70 (Code::Blocks). I don't know why, I followed all instructions to link the libraries and nothing seems to be working. I might be missing something simple through my anger (I've been trying to run sample code for a week, nothing has been working), so can anybody throw me a bone?

    Read the article

  • php - comparing timestamp dates to make sure user is of minimum age

    - by Micheal Ken
    When a user signs up the system has to check that they are old enough to do so, in this example they have to be atleast 8 years old $minAge = strtotime(date("d")."-".date("m")."-".(date("Y")-8)); $dob = strtotime($day."-".$month."-".$year); $minAge = 01-03-2004, $dob = 01-02-2011 I basically need to make sure this person was born before 2004 but I want to know whether I have to convert the timestamps to do a comparison or whether there is a more efficient way. Any help is appreciated, thank you

    Read the article

  • How to string multiple TextReaders together?

    - by Ken
    I have 3 TextReaders -- a combination of StreamReaders and StringReaders. Conceptually, the concatenation of them is a single text document. I want to call a method (not under my control) that takes a single TextReader. Is there any built-in or easy way to make a concatenating TextReader from multiple TextReaders? (I could write my own TextReader subclass, but it looks like a fair amount of work. In that case, I'd just write them all out to a temp file and then open it with a single StreamReader.) Is there an easy solution to this that I'm missing?

    Read the article

  • Operant conditioning algorithm?

    - by Ken
    What's the best way to implement real time operant conditioning (supervised reward/punishment-based learning) for an agent? Should I use a neural network (and what type)? Or something else? I want the agent to be able to be trained to follow commands like a dog. The commands would be in the form of gestures on a touchscreen. I want the agent to be able to be trained to follow a path (in continuous 2D space), make behavioral changes on command (modeled by FSM state transitions), and perform sequences of actions. The agent would be in a simulated physical environment.

    Read the article

  • Dealing with a shutdown during a file write?

    - by Ken
    All, I'm working on a Real-time system, VxWorks I think, I'm saving application settings to a file. What's the best way to handle preserving the settings if the system shuts down or loses power in the middle of a file write? All I can think of is shuffling a few files around or reducing the frequency at which i Save variables in order to reduce incidents.

    Read the article

  • Ant: use include and exclude together

    - by Ken
    OK, this seems like it should be really simple. I'm using Apache Ant 1.8, and I have a target which does: <delete file="output/program.tar.bz2"/> <tar basedir="input" destfile="output/program.tar.bz2" compression="bzip2"> <tarfileset dir="input"> <include name="goodfolder1/**"/> <include name="goodfolder2/**"/> <exclude name="**/badfile"/> <exclude name="**/*.badext"/> </tarfileset> </tar> I want it to make a .tar.bz2 of input/goodfolder1 and input/goodfolder2, excluding files named "badfile", and excluding files with extension ".badext". It's giving me a .tar.bz2, but it's including badfile and *.badext -- the excludes seem to be ignored. The order of include/exclude doesn't seem to make a difference. I tried wrapping the includes/excludes in a (the docs say it's implicit?), but it made no difference. I'm sure there's something simple I'm missing, since the manual has a very similar example, though in a somewhat different context. EDIT: It looks like it could be related to the dir="input" attribute: it's adding everything in "input", and then adding everything in the tarfileset to that. Files I want appear twice in the program.tar.bz2, but files that are excluded only appear once. But dir is mandatory, and I don't see how this is different from the examples in the manual.

    Read the article

  • Need help converting SQL to EF4 please

    - by Ken Eldridge
    I need help converting this SQL statement, into EF4: Select Posts.PostID, Post, Comment from Posts left join Comments on posts.PostID = Comments.PostID Where CommentID not in ( Select PostID from Votes where VoteTypeID = 4 --4 = flagged comment type ) In my database, the Votes table stores either the PostID of reported posts, or CommentID of reported comments in the column Votes.PostID Thanks in advance!

    Read the article

  • "Inherited" types in C++

    - by Ken Moynihan
    The following code does not compile. I get an error message: error C2039: 'Asub' : is not a member of 'C' Can someone help me to understand this? Tried VS2008 & 2010 compiler. template <class T> class B { typedef int Asub; public: void DoSomething(typename T::Asub it) { } }; class C : public B<C> { public: typedef int Asub; }; class A { public: typedef int Asub; }; int _tmain(int argc, _TCHAR* argv[]) { C theThing; theThing.DoSomething(C::Asub()); return 0; }

    Read the article

  • How to populate Range variable from a Sub/Function call?

    - by Ken Ingram
    I am trying to get this sub to work but the operationalRange variable is not being assigned. Despite the fact that the function selectBodyRow(bodyName) works fine. Sub sortRows(bodyName As String, ByRef wksht As Worksheet) Dim operationalRange As Range Set operationalRange = selectBodyRow(bodyName) Debug.Print "Sorting Worksheet: " & wksht.Name If Not operationalRange Is Nothing Then operationalRange.Select Debug.Print "Sorting " & operationalRange.Count & "Rows." ActiveWorkbook.Worksheets(wksht.Name).Sort.SortFields.Clear ActiveWorkbook.Worksheets(wksht.Name).Sort.SortFields.Add Key:=operationalRange, _ SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal ActiveWorkbook.Worksheets(wksht.Name).Sort.SortFields.Add Key:=operationalRange, _ SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets(wksht.Name).Sort .SetRange operationalRange .Header = xlGuess .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With Else MsgBox "Body is not being Set" End If End Sub The Sub being called by the above Sub is: Function selectBodyRow(bodyName As String) As Range Dim rangeStart As String, rangeEnd As String Dim selectionStart As Range, selectionEnd As Range Dim result As Range, srchRng As Range, cngrs As Variant If bodyName = "WEST" Then rangeStart = "<-WEST START->" rangeEnd = "<-WEST END->" ElseIf bodyName = "EAST" Then rangeStart = "<-EAST START->" rangeEnd = "<-EAST END->" End If Set srchRng = Range("A:A") srchRng.Select Set selectionStart = srchRng.Find(What:=rangeStart, After:=ActiveCell, LookIn _ :=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _ xlNext, MatchCase:=False, SearchFormat:=False) Set selectionEnd = srchRng.Find(What:=rangeEnd, After:=ActiveCell, LookIn _ :=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _ xlNext, MatchCase:=False, SearchFormat:=False) Set result = Range(selectionStart.Offset(1, 0), selectionEnd.Offset(-1, 0)) result.EntireRow.Select End Function

    Read the article

  • Abstract classes and Pod::Coverage

    - by Ken Williams
    I've recently started to try to use Dist::Zilla for maintaining Path::Class. I added the [PodCoverageTests] plugin, and it's reporting some failures in the Path::Class::Entity class, which is the abstract base class for Path::Class::File and Path::Class::Dir. What I'd like is some way to tell the testing code that Entity doesn't need docs, but its two derived classes do - even though the methods are only defined in the parent class. Anyone know some way to do that?

    Read the article

  • Run-time error 459 when using WithEvents with a class that implements another

    - by Ken Keenan
    I am developing a VBA project in Word and have encountered a problem with handling events when using a class that implements another. I define an empty class, IMyInterface: Public Sub Xyz() End Sub Public Event SomeEvent() And a class, MyClass that implements the above: Implements IMyInterface Public Event SomeEvent() Public Sub Xyz() ' ... code ... RaiseEvent SomeEvent End Sub Private Sub IMyInterface_Xyz() Xyz End Sub If I create a third class, OtherClass, that declares a member variable with the type of the interface class: Private WithEvents mMy As IMyInterface and try to initialize this variable with an instance of the implementing class: Set mMy = New MyClass I get a run-time error '459': This component doesn't support this set of events. The MSDN page for this error message states: "You tried to use a WithEvents variable with a component that can't work as an event source for the specified set of events. For example, you may be sinking events of an object, then create another object that Implements the first object. Although you might think you could sink the events from the implemented object, that isn't automatically the case. Implements only implements an interface for methods and properties." The above pretty much sums up what I'm trying to do. The wording, "that isn't automatically the case", rather than "this is flat-out impossible", seems to suggest that there is some bit of manual work I need to do to get it to work, but it doesn't tell me what! Does anybody know if this is possible in VBA?

    Read the article

  • How to select the most recent set of dated records from a mysql table

    - by Ken
    I am storing the response to various rpc calls in a mysql table with the following fields: Table: rpc_responses timestamp (date) method (varchar) id (varchar) response (mediumtext) PRIMARY KEY(timestamp,method,id) What is the best method of selecting the most recent responses for all existing combinations of method and id? For each date there can only be one response for a given method/id. Not all call combinations are necessarily present for a given date. There are dozens of methods, thousands of ids and at least 356 different dates Sample data: timestamp method id response 2009-01-10 getThud 16 "....." 2009-01-10 getFoo 12 "....." 2009-01-10 getBar 12 "....." 2009-01-11 getFoo 12 "....." 2009-01-11 getBar 16 "....." Desired result: 2009-01-10 getThud 16 "....." 2009-01-10 getBar 12 "....." 2009-01-11 getFoo 12 "....." 2009-01-11 getBar 16 "....." (I don't think this is the same question - it won't give me the most recent response)

    Read the article

  • Using $this when not in object context

    - by Ken
    I'm creating a function to show blog's. So I made a show blog function but it keeps giving "Using $this when not in object context" error Class Blog{ public function getLatestBlogsBig($cat = null){ $sqlString = "SELECT blog_id FROM jab_blog"; if($cat != null) $sqlString .= " WHERE blog_cat = " . $cat; $sqlString .= " ORDER BY blog_id DESC LIMIT 5"; $blog = mysql_query($sqlString); while($id = mysql_result($blog,"blog_id")){ $this->showBlog($id); //Error is on this line } } function showBlog($id,$small = false){ $sqlString = "SELECT blog_id FROM jab_blog WHERE blog_id=" . $id . ";"; $blog = mysql_query($sqlString); if($small = true){ echo "<ul>"; while($blogItem = mysql_fetch_array($blog)){ echo '<a href="' . $_SESSION['JAB_LINK'] . "blog/" . $blogItem['blog_id'] . "/" . SimpleUrl::toAscii($blogItem['blog_title']) .'">' . $blogItem['blog_title'] . '</a></li>'; } echo "</ul>"; }else{ while($blogItem = mysql_fetch_array($blog)){ ?> <div class="post"> <h2 class="title"><a href="<?php echo $_SESSION['JAB_LINK'] . "blog/" . $blogItem['blog_id'] . "/" . SimpleUrl::toAscii($blogItem['blog_title']);?>"><?php echo $blogItem['blog_title'];?></a></h2> <p class="meta"><span class="date">The date implement</span><span class="posted">Posted by <a href="#">Someone</a></span></p> <div style="clear: both;">&nbsp;</div> <div class="entry"> <?php echo $blogItem['blog_content'];?> </div> </div> <?php } } } }

    Read the article

  • Error with MySQL Query

    - by Ken
    Okay, I must be an idiot, because this is my 3rd question for today. Here's my code: date_default_timezone_set("America/Los_Angeles"); include("mainmenu.php"); $con = mysql_connect("localhost", "root", "********"); if(!$con){ die(mysql_error()); } $usrname = $_POST['usrname']; $fname = $_POST['fname']; $lname = $_POST['lname']; $password = $_POST['password']; $email = $_POST['email']; mysql_select_db("`users`, $con) or die(mysql_error()"); $query = ("INSERT INTO `users`.`data` (`id`, `usrname`, `fname`, `lname`, `email`, `password`) VALUES (NULL, '$usrname', '$fname', '$lname', '$email', 'password'))"); mysql_query('$query') or die(mysql_error()); mysql_close($con); echo("Thank you for registering!"); I always get the error returned as: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$query' at line 1. Help a newbie. I'm about to stab my monitor.

    Read the article

  • Assembly GDB Print String

    - by Ken
    So in assembly I declare the following String: Sample db "This is a sample string",0 In GDB I type "p Sample" (without quotes) and it spits out 0x73696854. I want the actual String to print out. So I tried "printf "%s", Sample" (again, without quotes) and it spits out "Cannot access memory at address 0x73696854." Short version: How do I print a string in GDB?

    Read the article

  • how do I best create a set of list classes to match my business objects

    - by ken-forslund
    I'm a bit fuzzy on the best way to solve the problem of needing a list for each of my business objects that implements some overridden functions. Here's the setup: I have a baseObject that sets up database, and has its proper Dispose() method All my other business objects inherit from it, and if necessary, override Dispose() Some of these classes also contain arrays (lists) of other objects. So I create a class that holds a List of these. I'm aware I could just use the generic List, but that doesn't let me add extra features like Dispose() so it will loop through and clean up. So if I had objects called User, Project and Schedule, I would create UserList, ProjectList, ScheduleList. In the past, I have simply had these inherit from List< with the appropriate class named and then written the pile of common functions I wanted it to have, like Dispose(). this meant I would verify by hand, that each of these List classes had the same set of methods. Some of these classes had pretty simple versions of these methods that could have been inherited from a base list class. I could write an interface, to force me to ensure that each of my List classes has the same functions, but interfaces don't let me write common base functions that SOME of the lists might override. I had tried to write a baseObjectList that inherited from List, and then make my other Lists inherit from that, but there are issues with that (which is really why I came here). One of which was trying to use the Find() method with a predicate. I've simplified the problem down to just a discussion of Dispose() method on the list that loops through and disposes its contents, but in reality, I have several other common functions that I want all my lists to have. What's the best practice to solve this organizational matter?

    Read the article

  • Publish Git repository to SVN

    - by Ken Williams
    I and my small team work in Git, and the larger group uses Subversion. I'd like to schedule a cron job to publish our repositories current HEADs every hour into a certain directory in the SVN repo. I thought I had this figured out, but the recipe I wrote down previously doesn't seem to be working now: git clone ssh://me@gitserver/git-repo/Projects/ProjX px2 cd px2 svn mkdir --parents http://me@svnserver/svn/repo/play/me/fromgit/ProjX git svn init -s http://me@svnserver/svn/repo/play/me/fromgit/ProjX git svn fetch git rebase trunk master git svn dcommit Here's what happens when I attempt: % git clone ssh://me@gitserver/git-repo/Projects/ProjX px2 Cloning into 'ProjX'... ... % cd px2 % svn mkdir --parents http://me@svnserver/svn/repo/play/me/fromgit/ProjX Committed revision 123. % git svn init -s http://me@svnserver/svn/repo/play/me/fromgit/ProjX Using higher level of URL: http://me@svnserver/svn/repo/play/me/fromgit/ProjX => http://me@svnserver/svn/repo % git svn fetch W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path '/play/me/fromgit/ProjX' W: Do not be alarmed at the above message git-svn is just searching aggressively for old history. This may take a while on large repositories % git rebase trunk master fatal: Needed a single revision invalid upstream trunk I could have sworn this worked previously, anyone have any suggestions? Thanks.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17  | Next Page >