text:
Q: Write list containing lists to file, and then reading it again I'm quite new to python, and as a little project, I am trying to make an interactive program where I can store recipes, each recipe will be stored as a list of the format: [Name, Servings, [List of ingredients], [List of steps in method]]
The first function, that creates the list works (i.e. I have created and stored in the file [Scrambled eggs, 1, [2 eggs, milk.....], [Beat the eggs....]]
However when I then call the 'view_recipes' function, I get:
Name:  [
Servings:  '
Ingredients:
S
Method:
c

so it is clearly iterating over characters in the string.
Is it a problem with how I write my list to my file? (I've looked this up before and everyone says you just need to have f.write(str(list)) Else it must be a problem with the reading of a file: but how can I get python to import it as a list of lists?
My code so far:
import re
#Input file
f = open("bank.txt", "r+")

def add_recipe():
    recipe = []
    ingredients = []
    method = []
    #recipe = [name, servings, ingredients(as list), method(as list)]
    recipe.append(raw_input("Please enter a name for the dish: "))
    recipe.append(raw_input("How many servings does this recipe make? "))
    print "Ingredients"
    ans = True
    while ans:
        i = raw_input("Enter amount and ingredient name i.e. '250g Flour' or 'x' to continue: ")
        if i.lower() == "x":
            ans = False
        else:
            ans = False
            ingredients.append(i)
            ans = True
    print "Ingredients entered: "
    for ing in ingredients:
        print ing
    recipe.append(ingredients)
    print "Method: "
    ans2 = True
    while ans2:
        j = raw_input("Type next step or 'x' to end: ")
        if j.lower() == "x":
            ans2 = False
        else:
            ans2 = False
            method.append(j)
            ans2 = True
    print "Method: "
    for step in method:
        print step
    recipe.append(method)
    print "Writing recipe information to file..."
    print recipe
    f.write(str(recipe))
    f.write("\n")

def view_recipes():
    for line in f:
        print "Name: ", list(line)[0]
        print "Servings: ", list(line)[1]
        print "Ingredients: "
        for k in list(line)[2]:
            print k
        print "Method: "
        for l in list(line)[3]:
            print l

A: I think your problem is that list(line) transform a string into a list of characters:
>>> l = "abc"
>>> list(l)
['a', 'b', 'c']

You should use something like pickle to read/write data to a file.
See for example this answer.
Edit: In order to be able to add more recipes to your file, you can

*

*add all your recipes to some variable and read/write all at once

For instance something like
recipes = []
want_to_add_recipe = True
while want_to_add_recipe:
    recipes.append(add_recipe())
    ans = raw_input('more? ')
    want_to_add_recipe = True if ans == 'y' else False
with open("Recipe.txt", "wb") as fo:
    pickle.dump(recipe, fo)

And in add_recipe:
with open("Recipe.txt", "rb") as fo:
    recipes = pickle.load(fo)
for name, serving, ingredients, method in recipes:
    #print things

You will have to change add_recipe to return recipe.

*

*add recipe to your file each time you call add_recipe:

*

*read your file

*load recipes if they exist

*add your recipe to recipes

*write the new recipes to the file

Also, check @jonrsharpe comment. You could easily use sqlite3 to avoid drawbacks of both my methods.


text:
Q: Import only unique records into PostgreSQL I am trying to import CSV file into PostgreSQL using Python. I want to tell Python to only import the records/rows of data in CSV file which do not contain the duplicates (only the first unique builder record). I have attached the code I am using to find the duplicates in the CSV file. I am new to programming so please pardon my inexperience.
import csv
import psycopg2

database = psycopg2.connect (database = "***", user="***")

cursor = database.cursor()
delete = """Drop table if exists "Real".Noduplicates"""
print (delete)

mydata = cursor.execute(delete)

cursor.execute("""Create Table "Real".Noduplicates
            (UserName varchar(55),
            LastUpdate timestamp,
            Week date,
            Builder varchar(55),
            Traffic integer
            );""")

print "Table created successfully"

csv_data = csv.reader(file('SampleData2.csv'))

already_seen = set()

next(csv_data)

for row in csv_data:
    builder = row[3]
    if builder in already_seen:
        print('{} is a duplicate builder'.format(builder))
    else:
        print('{} is a new builder'.format(builder))
        already_seen.add(builder)

for row in csv_data:

    cursor.execute("""INSERT INTO "Real".Noduplicates (UserName, LastUpdate, Week, Builder, Traffic)"""\
                    """VALUES (%s,%s,%s,%s,%s)""",
           row)

cursor.close()
database.commit()
database.close()

print "CSV Imported"

A: Instead, import all rows to a temp table using COPY (much faster) and then INSERT a distinct set into the target table from there, using SELECT DISTINCT ... or SELECT DISTINCT ON (builder) or use aggregate functions). Finding dupes is a forte of any RDBMS.
Related code examples:

*

*How to update selected rows with values from a CSV file in Postgres?

*Check if records exists in a Postgres table
Or, while inserting rows one by one, the new UPSERT in Postgres 9.5 and a UNIQUE index on all 5 columns is all you need:

*

*INSERT into a table from SELECT only if value doesn't exist
But note the special role of NULL values (which are never considered equal in SQL):

*

*Allow null in unique column
If the column builder is all you need to identify dupes, just define that column UNIQUE:
...
builder varchar(55) UNIQUE NOT NULL,
...

and use a simple UPSERT:
INSERT INTO "Real".noduplicates (userName, lastUpdate, week, builder, Traffic)
VALUES (%s,%s,%s,%s,%s)
ON CONFLICT ON (builder) DO NOTHING;

Better don't use CaMelCase names in Postgres btw.:

*

*Are PostgreSQL column names case-sensitive?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Zooming in/out a UIView by a button iPhone Hi all I need to zoon in and out a UIView by a button/segmented controll  as seen below.
 Is that possible without using scroll view?Pleae help

A: Yes, you can set the view's transform. In particular CGAffineTransformMakeScale will probably be useful to you.

A: The ABOVE code is actually right!! But Here I am Just elaborating it..as what i have used..
-(IBAction)zoomin:(id)sender{
self.view.transform = CGAffineTransformMakeScale(.5,.5);
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.9];
//self.view.transform = CGAffineTransformMakeScale(1.5,1.5);
[UIView commitAnimations];

}
-(IBAction)zoomout:(id)sender{
self.view.transform = CGAffineTransformMakeScale(1,1);
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.9];
//self.view.transform = CGAffineTransformMakeScale(1.5,1.5);
[UIView commitAnimations];

}


text:
Q: In compound and complex sentences, are conjunctions part of the second clause or are they separate from both clauses? Which is the second main clause in the following sentence (I suppose it is a compound sentence)?
He teaches math and I teach history.
Is it "And I teach history." or "I teach history.", leaving out the coordinator 'and'?
I think "And I teach history" can be an independent clause and so the sentence is compound. Is that right?
Similarly,
I went to bed early because I was extremely tired. (I suppose it is a complex sentence)
Is the second clause "because I was extremely tired" ?
If the conjunction 'because' is left out, both clauses become independent. I wonder if "because I was extremely tired" can be an independent clause?
Can someone help me?

A: You understand the difference quite well. We consider the conjunction to be a part of the clause that it introduces.
As you write, the coordinating conjunctions introduce independent clauses. As such, they can be punctuated as independent sentences. (Some teachers dispute this position, but they are wrong.1, 2) Thus, And I teach history is an independent clause.
The subordinating conjunctions and relative pronouns introduce dependent clauses. Such clauses cannot be punctuated as independent sentences. Doing so creates a sentence fragment. Creative writers often write fragments deliberately, but fragments should be avoided in formal writing.
With reference to your specific question, because I was extremely tired should not be punctuated as an independent sentence. It should be attached to an independent clause.
As to your other terms, traditional textbooks call a sentence compound when it contains independent clauses joined by a coordinating conjunction. They call a sentence complex when it contains an independent clause and a dependent clause. They call a sentence compound-complex when it contains independent clauses joined by a coordinating conjunction AND a dependent clause. These labels are pretty useless.

1 and. A. Beginning Sentences with. It is rank superstition that this coordinating conjunction cannot properly begin a sentence.
2 but. A. Beginning Sentences with. It is a gross canard
that beginning a sentence with but is stylistically slipshod. In fact, doing so is highly desirable in any number of contexts
Bryan Garner, Garner's Modern English Usage


text:
Q: How to stop input text from being copied on the other window session? I run 2 sessions on localhost with Browsersync.
When I write something on one window, it's immediately being copied to the other window.
Why?

A: Its because I'm using Browsersync XD. Solved.


text:
Q: Can any path segments of a URI have a query component? According to the Section 3.3, Path Component of RFC2396 - Uniform Resource Identifiers,

The path may consist of a sequence of path segments separated by a single slash "/" character.  Within a path segment, the characters "/", ";", "=", and "?" are reserved.  Each path segment may include a sequence of parameters, indicated by the semicolon ";" character.  The parameters are not significant to the parsing of relative references.

However, I have never seen a URL with a query parameters in any segment other than the final one.  So, I am not sure if I am reading this correctly.
Is http://www.url.com/segment1?seg1param1=val1/page.html?pageparam1=val2 a valid URL?

A: What the RFC is referring to is something like this:
http://www.example.com/foo/bar;param=value/baz.html

That could be interpreted as the path /foo/bar/baz.html with the parameter param=value to the bar segment. No question marks are used.
Note that RFC 2396 has been obsoleted by RFC 3986, which omits specification of segment-specific parameters in favor of a general note that implementations can (and do) do different things to embed segment-specific parameters:

Aside from dot-segments in hierarchical paths, a path segment is
    considered opaque by the generic syntax.  URI producing applications
    often use the reserved characters allowed in a segment to delimit
    scheme-specific or dereference-handler-specific subcomponents.  For
    example, the semicolon (";") and equals ("=") reserved characters are
    often used to delimit parameters and parameter values applicable to
    that segment.  The comma (",") reserved character is often used for
    similar purposes.  For example, one URI producer might use a segment
    such as "name;v=1.1" to indicate a reference to version 1.1 of
    "name", whereas another might use a segment such as "name,1.1" to
    indicate the same.  Parameter types may be defined by scheme-specific
    semantics, but in most cases the syntax of a parameter is specific to
    the implementation of the URI's dereferencing algorithm.

A: When you look at the grammar which is just below, it is written:

  path          = [ abs_path | opaque_part ]

  path_segments = segment *( "/" segment )
  segment       = *pchar *( ";" param )
  param         = *pchar

  pchar         = unreserved | escaped |
                  ":" | "@" | "&" | "=" | "+" | "$" | ","

A segment is composed of pchar and param, param being itself a pchar.
When we continue to read, there is absolutely no "?" character in the pchar character components. So the parameters cannot have any "?", and there cannot be a "?" in segments.
So I agree with the answer of Edward Thomson, who says that "?" only delimit the query segment, and cannot be used inside a path.

A: According to my reading of RFC 2396, no.  The ? is a reserved character and serves only to delimit the query segment.  The ? is not allowed in either the path or the query segment.
In your example, the first ? marks the beginning of the query segment.  The second ? is inside the query segment, and is disallowed.

A: I believe you could do a get with that and most web servers would process it but I don't believe you would get the results you are expecting. That is the pageparam1=val2 would not evaluate.
If you want parameters like that you could always use the # symbol (as a lot of javascript based GUIs do now).


text:
Q: Can't return a string properly with mongoskin So I have this script:
var db = require('mongoskin').db('localhost:27017/titles', {safe:true});
var titles = db.collection('titles');

title = titles.findOne(function(err, result){
if (err) throw err;
return result.title;
});

console.log(title)

And this BSON object in the collection:
{"title": "Hello World", "postNumber": 0, "_id": ObjectId("509eeffbf8f11e8813000001")}

My goal is got get the string "Hello World" to output to the console, but instead I get this:
{ emitter: { _events: { open: [Object] }, _maxListeners: 50 },
  state: 1,
  options: undefined,
  skinDb:
   { emitter: { _events: [Object], _maxListeners: 100 },
     state: 1,
     _dbconn:
      { databaseName: 'titles',
    serverConfig: [Object],
    options: [Object],
    _applicationClosed: false,
    native_parser: true,
    bsonLib: [Object],
    bson: {},
    bson_deserializer: [Object],
    bson_serializer: [Object],
    _state: 'connecting',
    pkFactory: [Object],
    forceServerObjectId: false,
    safe: true,
    notReplied: {},
    isInitializing: true,
    auths: [],
    openCalled: true,
    commands: [],
    _callBackStore: [Object],
    logger: [Object],
    slaveOk: false,
    tag: 1352682584657,
    eventHandlers: [Object],
    serializeFunctions: false,
    raw: false,
    recordQueryStats: false,
    reaperEnabled: false,
    _lastReaperTimestamp: 1352682584657,
    retryMiliSeconds: 1000,
    numberOfRetries: 60,
    reaperInterval: 10000,
    reaperTimeout: 30000,
    readPreference: undefined },
 db: null,
 username: '',
 password: undefined,
 admin: { emitter: {}, state: 0, skinDb: [Circular], admin: null },
 _collections: { titles: [Circular] },
 bson_serializer:
  { BSON: [Object],
    Long: [Object],
    ObjectID: [Object],
    DBRef: [Function: DBRef],
    Code: [Function: Code],
    Timestamp: [Object],
    Binary: [Object],
    Double: [Function: Double],
    MaxKey: [Function: MaxKey],
    MinKey: [Function: MinKey],
    Symbol: [Function: Symbol] },
 ObjectID:
  { [Function: ObjectID]
    index: 0,
    createPk: [Function: createPk],
    createFromTime: [Function: createFromTime],
    createFromHexString: [Function: createFromHexString] } },
  ObjectID:
   { [Function: ObjectID]
 index: 0,
 createPk: [Function: createPk],
 createFromTime: [Function: createFromTime],
 createFromHexString: [Function: createFromHexString] },
  collectionName: 'titles',
  collection: null,
  internalHint: null,
  hint: [Getter/Setter] }

It works just fine when I put the console.log() inside the function, I just can't return the string for some reason.
Solved:
read = function(callback){
    titles.findOne(function(err, result){
        if (err) throw err;
        callback(result.title);
    });
};

read(function(title){
console.log(title);
});

A: you need to understand javascript callback.
1 - findOne will return a db object not the result of your string. I never read the mongoskin doco but I think it will be a db collection or some sort which is what you see in the console.log print out.
2 - in the callback your do return result.title; will never return the title back as you would expect. so that is why I suggest to do some reading on how callback work.
The correct way to print the title will be putting the console.log inside the callback function as you mention.


text:
Q: Android: How to display database data in ListView? I've got no clue how to do this...Please help!
I have it all setup as of now to add an athletes name, age, tier, and date added to a database. I wish to add each of these athletes to a listView and be able to click on the name to open another activity which I will create later. I mainly just want to add these names to a listview from my database but don't know how. I have tried to use adapters but to no success.
public void onClick_btnDisplayList(View view) {
    // What do I put in this to display what is in my database
}

onCreate method:
DatabaseHandler db = new DatabaseHandler(this);
ListView listView;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_user);

    listView = (ListView) findViewById(R.id.listView);

}

Add to database method:
public void onClick_btnAddAthlete(View view) {
    DatabaseHandler db = new DatabaseHandler(this);
    EditText editName = (EditText) findViewById(R.id.editName);

    Log.d("Insert: ", "Inserting ..");
    db.addContact(new Athlete("Ravi", "20", "2", "10/12/13"));
    db.addContact(new Athlete("Srinivas", "23", "4", "4/2/12"));
    db.addContact(new Athlete("Tommy", "43", "1", "7/11/14"));
    db.addContact(new Athlete("Karthik", "6", "3", "1/3/12"));

    // Reading all contacts
    Log.d("Reading: ", "Reading all contacts..");
    List<Athlete> athletes = db.getAllAthletes();

    for (Athlete cn : athletes) {
        String log = "Id: " + cn.getID() + " ,Name: " + cn.getName() + " ,Phone: " + cn.getAge() +
                " ,Tier: " + cn.getTier() + " ,Date: " + cn.getDate();
        // Writing Contacts to log
        Log.d("Name: ", log);
    }
}

A: *

*First of all you need to create a Custom adapter for this purpose.

*Then you need to query your database for fetching the records.(Use AsyncTask)

*Create an ArrayList of your Athlete class and store the value from db there.

*Finally set this list to your Custom adapter.

Creating a Custom Adapter

A: I will extend on this some more when I get a chance but
public class MyCustomAdapter extends BaseAdapter{

     private Context context;
     private List<Athlete> athletes;

     public MyCustomAdapter(Context context, List athletes){
         this.context = context;
         this.athletes = athletes;
     }

     @Override
     public int getCount(){
         return athletes.size();
     }

     @Override
     public Athlete getItem(int position){
         return athletes.get(position);
     }

     @Override
     public int getItemId(int position){
         return position;
     }

     @Override
     public void getView(int position, View convertView, ViewGroup parent){
         LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

         convertView = inflater.inflate(R.layout.list_item_layout_name, parent, false);

         // Get views with something like
         // TextView text = (TextView) convertView.findViewById(R.id.text_view_name);

         Athlete currAthlete = getItem(position);

         // Do what you want with your athlete, like
         // text.setText(currAthlete.getName());
    }
}

Then in your Activity
listView.setAdapter(new MyCustomAdapter(this, athletes));

This isn't a complete answer, but was too long for a comment and I don't have time right now to complete it. It should give you an idea of how to use an adapter.

A: What you are asking for here is practically an entire app. I don't mean to scare you, but you need to step back and remember object oriented programming (OOP):

*

*You need an Athlete class with all the data you want to display for an athlete; which you seem to already have. So good.

*You need a class for getting the data from your database into an ArrayList: ArrayList<Athlete> mAthletes; So this class should have a method for getting the data from the db. In that method you need an anonymous asyncTask, which will populate the field mAthlete for you. Call this class AthleteLoader. Athlete loader should extend Observable so to tell the Activity when the data is loaded. Your Activity class should call this method inside onCreate or onResume depending on your design. Also you may want to place a check inside the method so that it only queries the db when the ArrayList is empty. Again, you decide based on your design.

*In your Activity class, you need to implement Observer so that when the data is ready from AthleteLoader, you can call notifyObservers() to broadcast the information.

*Inside your activity class, inside the update method (due to Observer), pass the data to the adapter by calling notifyDataSetChanged on the adapter.

*Inside the adapter you need to grab each athlete from the class AthleteLoader. There are many ways for doing this. One way is to simply have mAthletes in your adapter point to mAthletes in AthleteLoader. So that when the data is there, then it's there (excuse the tautology, but here I am assuming you understand OOP and pointers in java). So that the call from the Activity to notifyDataSetChanged will be enough.

*Also the adapter should extend the base adapter so that all the methods are populated with mAthletes. So for example, getItem should simply return mAthletes.get(location);
If you are a true newbie this is definitely a lot of information. But then again you are asking for a lot of help with that simple question. So good luck to you and I hope you can use this list to guide you in your quest.


text:
Q: How convert a csv into .xlsx file? I'm a french student in engineering school.
I have a work to do in my company (yes I work too).
I already developped an application that take xlsx file in input, I use NPOI library.
But now I need to take csv in input file, I tried several things without success.
I just need to convert a csv file as XSSFworkbook and sheet.
I'm newbie but I really want to improve my competences with c#.
Thanks for your help.

A: I've found on Github a sample that could help you:
class Program
{
        static void Main(string[] args)
    {
        string csvDocument = @"FL_insurance_sample.csv";
        var lines = ReadCsv(csvDocument, delimiter: ',');
        ConvertWithNPOI("NPOI.xlsx", "NPOI", lines);
    }

        private static bool ConvertWithNPOI(string excelFileName, string worksheetName, IEnumerable<string[]> csvLines)
        {
            if (csvLines == null || csvLines.Count() == 0)
            {
                return (false);
            }

            int rowCount = 0;
            int colCount = 0;

            IWorkbook workbook = new XSSFWorkbook();
            ISheet worksheet = workbook.CreateSheet(worksheetName);

            foreach (var line in csvLines)
            {
                IRow row = worksheet.CreateRow(rowCount);

                colCount = 0;
                foreach (var col in line)
                {
                    row.CreateCell(colCount).SetCellValue(TypeConverter.TryConvert(col));
                    colCount++;
                }
                rowCount++;
            }

            using (FileStream fileWriter = File.Create(excelFileName))
            {
                workbook.Write(fileWriter);
                fileWriter.Close();
            }

            worksheet = null;
            workbook = null;

            return true;
    }

    private static bool ConvertWithEPPlus(string csvFileName, string excelFileName, string worksheetName, char delimiter = ';')
    {
            bool firstRowIsHeader = false;

            var format = new ExcelTextFormat();
            format.Delimiter = delimiter;
            format.EOL = "\r";              // DEFAULT IS "\r\n";
            // format.TextQualifier = '"';

            using (ExcelPackage package = new ExcelPackage(new FileInfo(excelFileName)))
            {
                ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(worksheetName);
                worksheet.Cells["A1"].LoadFromText(new FileInfo(csvFileName), format, OfficeOpenXml.Table.TableStyles.Medium27, firstRowIsHeader);
                package.Save();
            }

            return (true);
    }
    private static IEnumerable<string[]> ReadCsv(string fileName, char delimiter = ';')
    {
        var lines = System.IO.File.ReadAllLines(fileName, Encoding.UTF8).Select(a => a.Split(delimiter));
        return (lines);
    }
}

original https://github.com/Leftyx/ConvertCsvToExcel/blob/master/ConvertCsvToExcel/Program.cs


text:
Q: What's the difference between /usr/include/linux and the include folder in linux kernel source? On a freshly installed Ubuntu , i found kernel headers in both /usr/include/linux , and /usr/src/kernel-version-headers/include/linux
Are they mutually the same ?

A: They are very different; the /usr/include/linux headers are the headers that were used when compiling the system's standard C library. They are owned by the C library packaging, and updated in lockstep with the standard C library. They exist to provide the userland interface to the kernel, as understood and "brokered"1 by the C library.
The /usr/src/linux-headers-$(uname -r)/include/linux headers are used via the /lib/modules/$(uname -r)/build symbolic links. They are owned by the kernel headers packages and updated in lockstep with the kernel. These are a subset of the kernel headers and enough of the Kbuild system required to build out-of-tree kernel modules. These files represent the kernel internals -- modules must build against these if they are to properly understand in-memory objects. See the kernel's Documentation/kbuild/modules.txt file for some details.

1: "Mediated" was my first word choice, but it implies some sort of access controls, which isn't the case. "Brokered" implies a third-party process, but that is also not the case. Consider: when a C program calls _exit(), it is actually calling the Standard C library's _exit() wrapper, which calls the exit(2) system call. The select(2) interface has an upper limit on the number of file descriptors that can be tracked, and that limit is compiled into the standard C library. Even if the kernel's interface were extended, the C library would also need to be recompiled.


text:
Q: Why am I not able to use SearchEngine() from uszipcodes to get city names? I have a pd dataframe with zipcodes for customers and I am trying to add a new row into the dataframe that containts city obtained from uszipcodes using SearchEngine()
!pip install uszipcode
from uszipcode import SearchEngine, SimpleZipcode
import numpy as np
import pandas as pd

data = pd.read_csv(dataset)

data['City_Name'] = np.nan
search = SearchEngine()
for i in data['ZIPCode']:
    data['City_Name'] = search.by_zipcode(i).city

I get this error:
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call last)
> Input In [35], in <cell line: 2>()
> 1 search = SearchEngine()
> 2 for i in data['ZIPCode']:
> 3     #city = search.by_zipcode(i).city
> 4     SearchEngine().by_zipcode(i).city
>
> AttributeError: 'NoneType' object has no attribute 'city'

When trying this just to test:
city = search.by_zipcode(75024).city

It works fine.
Not sure what's going on, any help would be greatly appreciated!
edit:
I figured out that it was failing at ZIP 92717, and proceeded to drop that row and run the same code again. now I'm getting this error.
> --------------------------------------------------------------------------- TypeError             Traceback (most recent call
> last) Input In [96], in <cell line: 4>()
>       2 search = SearchEngine()
>       3 num = 0
> ----> 4 for i in data['ZIPCode']:
>       5     data['City_Name'] = search.by_zipcode(i).city
>
> TypeError: 'NoneType' object is not subscriptable


text:
Q: Every map $S^1 \rightarrow X$ extends to a map $D^2 \rightarrow X$ implies $\pi_1(X,x_0)$ is trivial Every map $S^1 \rightarrow X$ extends to a map $D^2 \rightarrow X$ implies $\pi_1(X,x_0)$ is trivial
I know this has been posted before, but I was hoping somebody could verify my proof for me:
Let $[f] \in \pi(X,x_0)$
Then we have $f$ is a map:
$f: I \rightarrow X$
such that
$f(0)=f(1)$
So we can consider $f$ a map from $S^1$ into $X$:
$f: S^1 \rightarrow X$
this map extends to $D^2$ by hypothesis:
$\tilde{f}: D^2 \rightarrow X$ where $S^1 = \delta D^2$
Define a homotopy $H: D^2 \times I \rightarrow X$ by
$((r,\theta),s) \rightarrow \tilde{f}(sr,\theta)$
Then we have:
$H((r,\theta),1)=\tilde{f}(r,\theta)$
$H((r,\theta),0)=\tilde{f}(0,\theta)=c_0$
And we can define $F(\theta,s)=H((1,\theta),s): S^1 \times I \rightarrow X$
So that:
$F(\theta,0)=H((1,\theta),0)=c_0$
$F(\theta,1)=H((1,\theta),1)=f(\theta)$
So that $F$ is a homotopy between $f$ and the constant map, $c_0$, and therefore $[f]=[c_0]$

A: Defining $F(z,t)=\tilde{f}(tz)$ is not enough because this maps doesn't fixe the base point. Instead you can define $F(z,t)=\tilde{f}((1-t)z+t)$ which satisfies $F(1,\cdot)=x_0$.
Edit: I just add a picture to visualize the homotopy.


text:
Q: How can i get rid of message box after user clicks cancel in dialog box in vb.net? I have a SaveAs dialog in my form to save an excel sheet. when i click the cancel in the dialog box, a another message box  appears asking "Do you want to save the changes made to  Book1?". i wish to get rid of this message box since the user has already decided not to save the excel  by clicking Cancel...please help.. thanks...
         Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim xlApp As Microsoft.Office.Interop.Excel.Application
    Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook
    Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
    Dim misValue As Object = System.Reflection.Missing.Value

    Dim myArray(DataGridView1.Rows.Count - 1, DataGridView1.Columns.Count - 1) As Object

    Dim r As Integer
    Dim c As Integer

    xlApp = New Microsoft.Office.Interop.Excel.ApplicationClass
    xlWorkBook = xlApp.Workbooks.Add(misValue)
    xlWorkSheet = CType(xlWorkBook.Worksheets.Item("sheet1"), Microsoft.Office.Interop.Excel.Worksheet)
                                                                                For r = 0 To DataGridView1.Rows.Count - 1
        For c = 0 To DataGridView1.Columns.Count - 1
            myArray(r, c) = DataGridView1.Rows(r).Cells(c).Value
        Next cc
       xlWorkSheet.Range("A1").Resize(DataGridView1.Rows.Count, DataGridView1.Columns.Count).Value = myArray
      Dim saveFileDialog As New SaveFileDialog()
    saveFileDialog.Filter = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*"
    saveFileDialog.FilterIndex = 2
    saveFileDialog.RestoreDirectory = True

    If saveFileDialog.ShowDialog() = DialogResult.OK Then
        xlWorkSheet.SaveAs(saveFileDialog.FileName)
        MsgBox(" Your file has been saved")

    End If

    xlWorkBook.Close()
    xlApp.Quit()
    xlApp = Nothing
    xlWorkBook = Nothing
    xlWorkSheet = Nothing
 End Sub

A: Try this before quitting:
xlApp.DisplayAlerts = False

Or pass the False value to the close method:
xlWorkBook.Close(False)

A: Call the close method with false to show no dialog.
xlWorkBook.Close(False)

More on MSDN


text:
Q: Perl: how to extract from "d days, h:mm:ss" I wish to do math with a device uptime in this format "d days, h:mm:ss" (or "h:mm:ss" if device not up longer than a day but I can program how to check for that)
My ask is a routine how to extract the d, h, mm and ss from the string so I can do calculation with it (using DateTime which I found here too)

A: This can be solved with a simple regex with some capturing groups.
This will take a time formatted as "d days, h:mm:ss" and will give you the days, hours, minutes, and seconds.
#!/usr/bin/perl
use strict;
use warnings;

# Define a random time
my $time = '4 days, 03:44:23';

# Extract the data from the time
my ($days, $h, $m, $s) = $time =~ m/([0-9]+)\sdays,\s([0-9]+):([0-9]+):([0-9]+)/;

# Print the output
print 'time: '.$time."\n\n";
print 'days: '.$days."\n";
print 'h   : '.$h."\n";
print 'm   : '.$m."\n";
print 's   : '.$s."\n";

For more information on how to use regular expressions you may find this helpful: perlre (regular expression tutorial)
Also since you're new to Perl I will add that you should ALWAYS add use strict; and use warnings; at the top of your code.  It will stop you from making silly mistakes (like attempting to use an undefined variable for example) and save you a lot of headaches.

You can also validate whether you have good data by putting the match in an if statement.  It is good to get in the habit of doing this.
my ($days, $h, $m, $s);
if ($time =~ m/([0-9]+)\sdays,\s([0-9]+):([0-9]+):([0-9]+)/) {
    ($days, $h, $m, $s) = ($1, $2, $3, $4)
}
else {
    die "Invalid date format encountered!";
}

A: Since this looks like a teachable moment, I'm going to add that tjwrona1992's regex
my ($days, $h, $m, $s) = $time =~ m/([0-9]+)\sdays,\s([0-9]+):([0-9]+):([0-9]+)/;

could be written using the /x modifier to allow whitespace and comments to make it more digestible to human consumers:
    my ($days, $h, $m, $s) = $time =~ m/
              ([0-9]+) \s days, # $1 will be days
              \s
              ([0-9]+) :        # $2 = hours
              ([0-9]+) :        # $3 = minutes
              ([0-9]+)          # $4 = seconds

        /x or die "the regex did not match '$time'";


text:
Q: JDBC ResultSet Type_Scroll_Sensitive I have been playing with JDBC and the different types of ResultSet and have a question about making it TYPE_SCROLL_SENSITIVE (this question is to do with the sensitive part, not the type scroll part). The theory says changes in the database are reflected in the ResultSet and vice-versa but this is not happening for me.
Here is something I've tried:
Connection conn = null;
try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    String url = "jdbc:oracle:thin:@oracle.myCompany.com:1521:xe";
    conn = DriverManager.getConnection(url, "username", "password");
    Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

    String query = "SELECT user_id, first_name, last_name FROM Users";
    ResultSet rs = stmt.executeQuery(query);

    while(rs.next()){
        System.out.println("-----------------------------");
        System.out.println(rs.getInt(1));
        System.out.println(rs.getString("first_name"));
        System.out.println(rs.getString("last_name"));

        int id = rs.getInt(1);
        rs.updateInt(1,100+id);
    }

} catch (SQLException e) {
    e.printStackTrace();
} finally{
    conn.close();
}

When I update the ID, adding 100 to it, the change isn't shown in the database (if, below this, I add rs.updateRow() then it does update the database. But this also updates the database if I make it TYPE_SCROLL_INSENSITIVE).
Another thing I tried was this:
Connection conn = null;
try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    String url = "jdbc:oracle:thin:@oracle.myCompany.com:1521:xe";
    conn = DriverManager.getConnection(url, "username", "password");
    Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

    String query = "SELECT user_id, first_name, last_name FROM Users";
    ResultSet rs = stmt.executeQuery(query);

    String query2 = "INSERT INTO User VALUES (4, 'Joe', 'Bloggs')";
    stmt.executeUpdate(query2);

    while(rs.next()){
        System.out.println("-----------------------------");
        System.out.println(rs.getInt(1));
        System.out.println(rs.getString("first_name"));
        System.out.println(rs.getString("last_name"));

        int id = rs.getInt(1);
        rs.updateInt(1,100+id);
    }

} catch (SQLException e) {
    e.printStackTrace();
} finally{
    conn.close();
}

But if I run this code, and expect the new row to be in the resultSet because it's sensitive... I get a NullPointerException on the line: while(rs.next()){
So could someone please explain how the sensitive ResultSet works and what I am doing wrong? Possibly with an example?

A: TYPE_SCROLL_SENSITIVE means that if a change happened to the table while you are iterating over its data, you will see it. To reproduce this behavior make a break on
System.out.println("-----------------------------");

change the first_name using an external tool, then execute this line
System.out.println(rs.getString("first_name"));

the change should be visible.
Note that this feature is optional. To test if it's enabled run this
boolean res = conn.getMetaData().ownDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE);
System.out.println(res);

A: All updates to a field like you did with updateInt require an invocation of updateRow to become effective. This has nothing to do with the scroll type. Depending on the particular database you may even update ResultSets which are TYPE_FORWARD_ONLY (if supported, it's the fastest alternative). The only constraint is, they have to be CONCUR_UPDATABLE.
The mistake of your second code is to use the same statement for the update than you used to get the ResultSet. So the ResultSet becomes invalid when you perform the update. You have to use two statements for this.
Change
Statement stmt = conn.createStatement(
  ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

String query = "SELECT user_id, first_name, last_name FROM Users";
ResultSet rs = stmt.executeQuery(query); // you use stmt here

String query2 = "INSERT INTO User VALUES (4, 'Joe', 'Bloggs')";
stmt.executeUpdate(query2); // here you use stmt again

to
Statement stmt = conn.createStatement(
  ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

String query = "SELECT user_id, first_name, last_name FROM Users";
ResultSet rs = stmt.executeQuery(query);

Statement stmt2 = conn.createStatement();// new statement for the insertion
String query2 = "INSERT INTO User VALUES (4, 'Joe', 'Bloggs')";
stmt2.executeUpdate(query2);

A: while iterating the data from resultset object to see the changes first you need to stop the program execution for sometime for that you can use System.in.read(),after that u can go to database change table data and come to program to see that updated row in resultset you use refreshrow() on resultset object .
You can use refreshrow() method to get the updated row data from database to resultset.
Statement stmt = conn.createStatement(
  ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

  String query = "SELECT user_id, first_name, last_name FROM Users";
   ResultSet rs = stmt.executeQuery(query); // you use stmt here

    while(rs.next()){
     System.out.println("-----------------------------");
      System.in.read();
    System.out.println(rs.getInt(1));

   rs.refreshRow();
    System.out.println(rs.getString("first_name"));
    System.out.println(rs.getString("last_name"));
      }


text:
Q: Android HttpPost Request Timeout In my application, I have to get data from 4 different urls and then after the completion of fetching data, I have to show items in a particular sequence. I am using HttoPost to send post request. I am sending 4 requests each in a different thread. When a thread get data, it increment a count. When count reaches to 4, it means that all the 4 threads have fetched data. The problem is that sometimes one of the four threads don't respond means the defaultHttpClient.execute(post) don't return. Due to this, my count don't reaches 4 even it don't throws exception and only wait dialog keeps showing. I want that after a fixed time, it must return regardless of whether it get response from server or not. Any idea?

A: Its not working. I am using the following class:
public class ConnectionManager {

private  ArrayList <NameValuePair> params;
private  ArrayList <NameValuePair> headers;
private String url;

public ConnectionManager(String url) {
    this.url = url;
    params = new ArrayList<NameValuePair>();
    headers = new ArrayList<NameValuePair>();
}

public void addParam(String name, String value)
{
    params.add(new BasicNameValuePair(name, value));
}

public void addHeader(String name, String value)
{
    headers.add(new BasicNameValuePair(name, value));
}

public String sendRequest() throws Exception {
    String serverResponse = "";
    HttpPost httpPostRequest = new HttpPost(url);
    httpPostRequest.getParams().setParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, Boolean.FALSE);
    //add headers
    for(int i = 0; i < headers.size(); i++) {
        StringEntity entity = new StringEntity(headers.get(i).getValue(),"UTF-8");
        httpPostRequest.setEntity(entity);
    }

    if(!params.isEmpty()){
        HttpEntity httpEntity = new UrlEncodedFormEntity(params,HTTP.UTF_8);
        httpPostRequest.setEntity(httpEntity);
    }

    serverResponse = executeRequest(httpPostRequest);
    return serverResponse;
}

private String executeRequest(HttpUriRequest request) throws Exception  {

    HttpParams params = new BasicHttpParams();
    HttpConnectionParams.setConnectionTimeout(params, 3000);
    HttpConnectionParams.setSoTimeout(params, 10000);
    DefaultHttpClient client = new DefaultHttpClient(params);

    HttpResponse httpResponse;
    String serverResponse = "";
    httpResponse = client.execute(request);
    HttpEntity entity = httpResponse.getEntity();
    if (entity != null) {
        InputStream instream = entity.getContent();
        serverResponse = convertStreamToString(instream);
        instream.close();
    }
    Log.d("server response", serverResponse);
    return serverResponse;
}

private String convertStreamToString(InputStream is) {

    BufferedReader reader = new BufferedReader(new InputStreamReader(is));
    StringBuilder sb = new StringBuilder();

    String line = null;
    try {
        while ((line = reader.readLine()) != null) {
            sb.append(line + "\n");
        }
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        try {
            is.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return sb.toString();
}

A: use
HttpParams httpParameters = new BasicHttpParams();
// Set the timeout in milliseconds until a connection is established.
int timeoutConnection = 3000;
HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
// Set the default socket timeout (SO_TIMEOUT)
// in milliseconds which is the timeout for waiting for data.
int timeoutSocket = 3000;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);


text:
Q: Change bitmap palette for an image I have a TIFF image for which I wish to change the BitmapPalette for a specific frame of the image.
I have the following code:
var width = image.Frames[0].PixelWidth;
var height = image.Frames[0].PixelHeight;
var dpiX = image.Frames[0].DpiX;
var dpiY = image.Frames[0].DpiY;

var listOfColors = new List<System.Windows.Media.Color>();
for (int i = 0; i < 256; i++)
{
      listOfColors.Add(System.Windows.Media.Color.FromRgb((byte)i, (byte)i, (byte)i));
}
var pallet = new BitmapPalette(listOfColors);

newImage = new WriteableBitmap(width, height, dpiX, dpiY, PixelFormats.Indexed8, pallet );

This returns an white image: why? What am I doing wrong here?
Also, if you have any information on how can I parse a GGR file into a BitmapPalette, that would be nice.

A: You only filled in the bitmappalette(pallete),  not the writeablebitmap inage (newImage).
The bitmap palette plays the role of a look-up table  for your writeablebitmap image.
You should fill in your writeablebitmap image (newImage) with indexes to the bitmappalette(palette).


text:
Q: ParseException when parsing 3 character abbreviated month using SimpleDateFormat Here is my code,
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
Date dft  = (Date) format.parse("16-MAY-2018 09:30:22:000");

I am getting below exception

java.text.ParseException: Unparseable date: "16-MAY-2018 09:30:22"

What's to be used to parse milliseconds?

A: The pattern should be MMM because there are three characters in the month.
You should also prefer java.time classes to the ones you're currently using if you're on Java 8 or above:
DateTimeFormatter formatter = new DateTimeFormatterBuilder()
    .appendPattern("dd-MMM-yyyy")
    .appendLiteral(' ')
    .append(ISO_LOCAL_TIME)
    .toFormatter();

LocalDateTime timestamp = LocalDateTime.parse("16-May-2018 09:30:22", formatter);

A: Use this pattern: dd-MMM-yyyy HH:mm:ss

A: "16-MAY-2018 09:30:22" is not parsable with that time format. If you want to parse that you have to change date format to "dd-MMM-yyyy HH:mm:ss". The double M is only for numbered months (so should be 05 for May).
Check the SimpleDateFormat javadoc for more details: here

A: Date dft  = (Date) format.parse("16-05-2018 09:30:22");

OR change it to
SimpleDateFormat format = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");

A: you are using dd-MM-yyyy HH:mm:ss, so parsable is
16-05-2018 09:30:22

and if you want 16-MAY-2018 09:30:22 then use
dd-MMM-yyyy HH:mm:ss


text:
Q: What are some gdb commands that I can use to improve my debugging skills? What are the available commands for gdb in Xcode 4 which I can use to debug my app?
(Although a relatively seasoned developer, I'm looking to expand my skills with this question.)

A: You can start from here http://darkdust.net/files/GDB%20Cheat%20Sheet.pdf, come is very handy.
Points worth mentioning

*

*You can attach gdb to an already running process, there by start
debugging

*Enter on gdb command line will execute last instruction, comes in
very handy

*You can do some amount of scripting with GDB, use -x falg to point to
your script suppose you want to connect to a target over ip (remote
debugging), and you dont want to remember its ip / kepp entering it
every time. Starting from gdb 7.1 Python scripts are also supported
so much more powerful now
echo "target remote 192.168.XX.XX:1234" > gscript
gdb -x gscript application
Ok some niche stuffs -
(gdb)start
(gdb)layout split               // list the assembly and c
(gdb)ni                         // exec next instruction in assembly
(gdb)print $pc                  // prints the contents of register PC(use $)

you can try doing some unit testing on the go
(gdb)start
(gdb)call factorial(5)

Suppose you dont want to disturb the the application timing (reatime behaviour) but still want to view some variable updates, you can try following
(gdb)start
(gdb)break <func>:<line>
(gdb)commands 1                  // '1' is the break number
> silent
> printf "var1 = %d\t var2 =%d\n",var1,var2
> continue
> end

data break points, conditional breakpoints can be very useful when debugging memory corruptions
(gdb)start
(gdb)watch var
(gdb)watch 0x80001212

debugging threads
(gdb)info threads
(gdb)thread 2                      // switch to thread '2'


text:
Q: Mask white color out of PNG image on iPhone I know that there are already 2 relevant posts on that, but it's not clear...
So the case is this...:
I have a UIImage which consists of a png file requested from a url on the net.
Is it possible to mask out the white color so it becomes transparent?
Everything I have tried so far with CGImageCreateWithMaskingColors, returns a white image...
Any help guys would be precious :)

A: Ok since I found a solution and it's working fine, I am answering my question and I really believe that this will be useful to many people having the same need.
First of all I thought that would be nice to extend my UIImages via a category:
UIImage+Utils.h
#import <UIKit/UIKit.h>

@interface UIImage (Utils)

- (UIImage*)imageByClearingWhitePixels;
@end

UIImage+Utils.m
#import "UIImage+Utils.h"

@implementation UIImage (Utils)

#pragma mark Private Methods
- (CGImageRef) CopyImageAndAddAlphaChannel:(CGImageRef) sourceImage {
    CGImageRef retVal = NULL;

    size_t width = CGImageGetWidth(sourceImage);
    size_t height = CGImageGetHeight(sourceImage);

    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

    CGContextRef offscreenContext = CGBitmapContextCreate(NULL, width, height, 8, 0, colorSpace, kCGImageAlphaPremultipliedFirst);

    if (offscreenContext != NULL) {
        CGContextDrawImage(offscreenContext, CGRectMake(0, 0, width, height), sourceImage);

        retVal = CGBitmapContextCreateImage(offscreenContext);
        CGContextRelease(offscreenContext);
    }

    CGColorSpaceRelease(colorSpace);

    return retVal;
}

- (UIImage *) getMaskedArtworkFromPicture:(UIImage *)image withMask:(UIImage *)mask{

    UIImage *maskedImage;
    CGImageRef imageRef = [self CopyImageAndAddAlphaChannel:image.CGImage];
    CGImageRef maskRef = mask.CGImage;
    CGImageRef maskToApply = CGImageMaskCreate(CGImageGetWidth(maskRef),CGImageGetHeight(maskRef),CGImageGetBitsPerComponent(maskRef),CGImageGetBitsPerPixel(maskRef),CGImageGetBytesPerRow(maskRef),CGImageGetDataProvider(maskRef), NULL, NO);
    CGImageRef masked = CGImageCreateWithMask(imageRef, maskToApply);
    maskedImage = [UIImage imageWithCGImage:masked];
    CGImageRelease(imageRef);
    CGImageRelease(maskToApply);
    CGImageRelease(masked);
    return maskedImage;

}

#pragma mark Public Methods
- (UIImage*)imageByClearingWhitePixels{

    //Copy image bitmaps
    float originalWidth = self.size.width;
    float originalHeight = self.size.height;
    CGSize newSize;

    newSize = CGSizeMake(originalWidth, originalHeight);

    UIGraphicsBeginImageContext( newSize );

    [self drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];

    UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    //Clear white color by masking with self
    newImage = [self getMaskedArtworkFromPicture:newImage withMask:newImage];

    return newImage;
}

@end

Finally, I am able to use it like this: (After I have imported UIImage+Utils.h of course)
UIImage *myImage = [...]; //A local png file or a file from a url
UIImage *myWhitelessImage = [myImage imageByClearingWhitePixels]; // Hooray!

A: It is not really possible, at least no easy way, certainly no API call. It is basically an image editing problem usually done with Photoshop.  Most images that have a transparent background were created that way.


text:
Q: Scala: Getting original iteratee after applying enumeratee (example from play documentation doesn't compile) I want to apply an enumeratee to an iteratee and afterwards get the original iteratee back, so I can apply further stuff. There is an example in the play documentation which uses an Iteratee[Int,Int] that just sums up its input (http://www.playframework.org/documentation/2.0.1/Enumeratees). Then they use an Enumeratee[String,Int] that allows strings like "3" and "6" as input. The example is as follows:
val sum:Iteratee[Int,Int] = Iteratee.fold[Int,Int](0){ (s,e) => s + e }

//create am Enumeratee using the map method on Enumeratee
val toInt: Enumeratee[String,Int] = Enumeratee.map[String]{ s => s.toInt }

val adaptedIteratee: Iteratee[String,Iteratee[Int,Int]] = toInt(sum)

// pushing some strings
val afterPushingStrings: Iteratee[String,Iteratee[Int,Int]] = {
  Enumerator("1","2","3","4") >>> adaptedIteratee
}

val originalIteratee: Iteratee[Int,Int] = flatten(afterPushingString.run)

val moreInts: Iteratee[Int,Int] = Enumerator(5,6,7) >>> originalIteratee

moreInts.run.onRedeem(sum => println(sum) ) // eventually prints 28

But this doesn't compile, because Enumerator.>>> takes another Enumerator as parameter - not an iteratee. I tried it using |>> instead:
val sum: Iteratee[Int, Int] = Iteratee.fold[Int, Int](0) { (s, e) => s + e }

//create am Enumeratee using the map method on Enumeratee
val toInt: Enumeratee[String, Int] = Enumeratee.map[String] { s => s.toInt }

val adaptedIteratee: Iteratee[String, Iteratee[Int, Int]] = toInt(sum)

// pushing some strings
val afterPushingStrings: Iteratee[String, Iteratee[Int, Int]] = {
  Iteratee.flatten(Enumerator("1", "2", "3", "4") |>> adaptedIteratee)
}

val originalIteratee: Iteratee[Int, Int] = Iteratee.flatten(afterPushingStrings.run)

val moreInts: Iteratee[Int, Int] = Iteratee.flatten(Enumerator(5, 6, 7) |>> originalIteratee)

moreInts.run.onRedeem(sum => println("Sum="+sum)) // eventually prints 28

But this example doesn't print "28" but "10". It seems to only consider the parts added to the adapted iteratee.
How can I get the original iteratee back when using an enumeratee?

A: If you are using 2.0 release then this is a bug that was fixed in later releases. Enumeratee used to send along the EOF it receives, and that was the bug.


text:
Q: Kernel panic in old MacBook Pro after upgrading to El Capitan I'm trying to get my old 15-inch MacBook Pro (Mac-F42D86C8) from late 2008, back to life.
I installed El Capitan operating system upgrade and since then, everytime I boot I reach a kernel panic and the laptop reboots again and again.
I've managed to start the system in safe mode and read the kernel panic information (attached below). However, It looks like a problem with the graphics system. I've tried following some online troubleshooting manuals without much luck.
I've reinstalled El Capitan several times without better results. I'm not sure why it works in safe mode.

Mon Dec 14 22:32:31 2015

*** Panic Report ***
panic(cpu 1 caller 0xffffff80003d6bba): Kernel trap at 0xffffff7f823a80fb, type 14=page fault, registers:
CR0: 0x0000000080010033, CR2: 0x0000000000000000, CR3: 0x000000011cd22000, CR4: 0x0000000000002660
RAX: 0x0000000000000000, RBX: 0xffffff806a8d3000, RCX: 0xffffff8000b27338, RDX: 0xffffff800a021db0
RSP: 0xffffff90990fb780, RBP: 0xffffff90990fb790, RSI: 0x0000000000007059, RDI: 0xffffff806a8d3000
R8:  0xffffff90990fb4a8, R9:  0xffffff90990fb4a0, R10: 0x0000000000000000, R11: 0x0000000000c06000
R12: 0xffffff806a8d3000, R13: 0xffffff8000b27338, R14: 0x0000000000000000, R15: 0x0000000000000080
RFL: 0x0000000000010297, RIP: 0xffffff7f823a80fb, CS:  0x0000000000000008, SS:  0x0000000000000010
Fault CR2: 0x0000000000000000, Error code: 0x0000000000000000, Fault CPU: 0x1, PL: 0

Backtrace (CPU 1), Frame : Return Address
0xffffff90990fb410 : 0xffffff80002e5307
0xffffff90990fb490 : 0xffffff80003d6bba
0xffffff90990fb670 : 0xffffff80003f4313
0xffffff90990fb690 : 0xffffff7f823a80fb
0xffffff90990fb790 : 0xffffff7f8239cb2b
0xffffff90990fb7c0 : 0xffffff7f8239c9b0
0xffffff90990fb820 : 0xffffff7f8239ea5f
0xffffff90990fb9b0 : 0xffffff7f821ab2e0
0xffffff90990fba30 : 0xffffff7f81e4e939
0xffffff90990fbb60 : 0xffffff7f81e4d93f
0xffffff90990fbbd0 : 0xffffff7f821ac355
0xffffff90990fbc10 : 0xffffff7f81dac535
0xffffff90990fbca0 : 0xffffff7f81da414b
0xffffff90990fbcd0 : 0xffffff7f821acae8
0xffffff90990fbd20 : 0xffffff8000897241
0xffffff90990fbd70 : 0xffffff80008e0a69
0xffffff90990fbde0 : 0xffffff80003a02a1
0xffffff90990fbe30 : 0xffffff80002e9aa3
0xffffff90990fbe60 : 0xffffff80002cd478
0xffffff90990fbea0 : 0xffffff80002dcfd5
0xffffff90990fbf10 : 0xffffff80003c13aa
0xffffff90990fbfb0 : 0xffffff80003f4b36
      Kernel Extensions in backtrace:
         com.apple.iokit.IOGraphicsFamily(2.4.1)[48AC8EA9-BD3C-3FDC-908D-09850215AA32]@0xffffff7f81d9a000->0xffffff7f81dd3fff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[8E5F549E-0055-3C0E-93F8-E872A048E31B]@0xffffff7f80b2d000
         com.apple.iokit.IONDRVSupport(2.4.1)[814A7F4B-03EF-384A-B205-9840F0594421]@0xffffff7f81e4c000->0xffffff7f81e59fff
            dependency: com.apple.iokit.IOGraphicsFamily(2.4.1)[48AC8EA9-BD3C-3FDC-908D-09850215AA32]@0xffffff7f81d9a000
            dependency: com.apple.iokit.IOPCIFamily(2.9)[8E5F549E-0055-3C0E-93F8-E872A048E31B]@0xffffff7f80b2d000
         com.apple.nvidia.classic.NVDAResmanTesla(10.0)[05FC5D7E-BB0B-3232-BBBD-8A49B6870D8B]@0xffffff7f821a9000->0xffffff7f8241dfff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[8E5F549E-0055-3C0E-93F8-E872A048E31B]@0xffffff7f80b2d000
            dependency: com.apple.iokit.IONDRVSupport(2.4.1)[814A7F4B-03EF-384A-B205-9840F0594421]@0xffffff7f81e4c000
            dependency: com.apple.iokit.IOGraphicsFamily(2.4.1)[48AC8EA9-BD3C-3FDC-908D-09850215AA32]@0xffffff7f81d9a000

BSD process name corresponding to current thread: WindowServer
Boot args: -x

Mac OS version:
15B42

Kernel version:
Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64
Kernel UUID: AB5FC1B4-12E7-311E-8E6F-9023985D8C1D
__HIB  text base: 0xffffff8000100000
System model name: MacBookPro5,1 (Mac-F42D86C8)

System uptime in nanoseconds: 104766501851
last loaded kext at 98757521179: com.apple.iokit.IOSurface  108.0.1 (addr 0xffffff7f826e9000, size 77824)
loaded kexts:
com.apple.Dont_Steal_Mac_OS_X   7.0.0
com.apple.driver.AGPM   110.20.21
com.apple.driver.AppleBacklight 170.8.1
com.apple.nvenet    2.0.22
com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport 4.4.2f1
com.apple.driver.AirPort.Brcm4331   800.20.24
com.apple.driver.AppleMuxControl    3.11.33b1
com.apple.driver.ACPI_SMC_PlatformPlugin    1.0.0
com.apple.driver.AppleLPC   3.1
com.apple.driver.AppleMCCSControl   1.2.13
com.apple.nvidia.NVDAStartup    10.0.6
com.apple.filesystems.autofs    3.0
com.apple.driver.AppleUSBTCButtons  245.4
com.apple.driver.AppleUSBTCKeyEventDriver   245.4
com.apple.driver.AppleUSBTCKeyboard 245.4
com.apple.driver.AppleFileSystemDriver  3.0.1
com.apple.AppleFSCompression.AppleFSCompressionTypeDataless 1.0.0d1
com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0
com.apple.BootCache 37
com.apple.driver.AppleIRController  327.5
com.apple.iokit.SCSITaskUserClient  3.7.7
com.apple.iokit.IOAHCIBlockStorage  2.8.0
com.apple.driver.AppleFWOHCI    5.5.2
com.apple.driver.AppleAHCIPort  3.1.5
com.apple.driver.usb.AppleUSBEHCIPCI    1.0.1
com.apple.driver.usb.AppleUSBOHCIPCI    1.0.1
com.apple.driver.AppleSmartBatteryManager   161.0.0
com.apple.driver.AppleRTC   2.0
com.apple.driver.AppleHPET  1.8
com.apple.driver.AppleACPIButtons   4.0
com.apple.driver.AppleSMBIOS    2.1
com.apple.driver.AppleACPIEC    4.0
com.apple.driver.AppleAPIC  1.7
com.apple.driver.AppleIntelCPUPowerManagementClient 218.0.0
com.apple.nke.applicationfirewall   163
com.apple.security.quarantine   3
com.apple.security.TMSafetyNet  8
com.apple.driver.AppleIntelCPUPowerManagement   218.0.0
com.apple.iokit.IOSurface   108.0.1
com.apple.AppleGraphicsDeviceControl    3.11.33b1
com.apple.nvidia.classic.NVDANV50HalTesla   10.0.0
com.apple.nvidia.classic.NVDAResmanTesla    10.0.0
com.apple.iokit.IOBluetoothHostControllerUSBTransport   4.4.2f1
com.apple.iokit.IOBluetoothFamily   4.4.2f1
com.apple.iokit.IO80211Family   1101.24
com.apple.driver.corecapture    1.0.4
com.apple.driver.AppleBacklightExpert   1.1.0
com.apple.iokit.IONDRVSupport   2.4.1
com.apple.driver.AppleGraphicsControl   3.11.33b1
com.apple.driver.NVSMU  2.2.9
com.apple.driver.IOPlatformPluginLegacy 1.0.0
com.apple.driver.AppleSMBusPCI  1.0.14d1
com.apple.driver.IOPlatformPluginFamily 6.0.0d7
com.apple.driver.AppleSMC   3.1.9
com.apple.driver.AppleSMBusController   1.0.14d1
com.apple.iokit.IOGraphicsFamily    2.4.1
com.apple.kext.triggers 1.0
com.apple.driver.AppleUSBMultitouch 250.4
com.apple.iokit.IONetworkingFamily  3.2
com.apple.driver.usb.AppleUSBHub    1.0.1
com.apple.iokit.IOUSBHIDDriver  900.4.1
com.apple.driver.usb.AppleUSBHostCompositeDevice    1.0.1
com.apple.iokit.IOSCSIMultimediaCommandsDevice  3.7.7
com.apple.iokit.IOBDStorageFamily   1.8
com.apple.iokit.IODVDStorageFamily  1.8
com.apple.iokit.IOCDStorageFamily   1.8
com.apple.iokit.IOAHCISerialATAPI   2.6.2
com.apple.iokit.IOSCSIArchitectureModelFamily   3.7.7
com.apple.driver.AppleXsanScheme    3
com.apple.driver.AppleUSBMergeNub   900.4.1
com.apple.iokit.IOFireWireFamily    4.5.8
com.apple.iokit.IOAHCIFamily    2.8.0
com.apple.driver.usb.AppleUSBOHCI   1.0.1
com.apple.driver.usb.AppleUSBEHCI   1.0.1
com.apple.iokit.IOUSBFamily 900.4.1
com.apple.iokit.IOUSBHostFamily 1.0.1
com.apple.driver.AppleUSBHostMergeProperties    1.0.1
com.apple.driver.AppleEFINVRAM  2.0
com.apple.driver.AppleEFIRuntime    2.0
com.apple.iokit.IOHIDFamily 2.0.0
com.apple.iokit.IOSMBusFamily   1.1
com.apple.security.sandbox  300.0
com.apple.kext.AppleMatch   1.0.0d1
com.apple.driver.AppleKeyStore  2
com.apple.driver.AppleMobileFileIntegrity   1.0.5
com.apple.driver.AppleCredentialManager 1.0
com.apple.driver.DiskImages 415
com.apple.iokit.IOStorageFamily 2.1
com.apple.iokit.IOReportFamily  31
com.apple.driver.AppleFDEKeyStore   28.30
com.apple.driver.AppleACPIPlatform  4.0
com.apple.iokit.IOPCIFamily 2.9
com.apple.iokit.IOACPIFamily    1.4
com.apple.kec.pthread   1
com.apple.kec.corecrypto    1.0
Model: MacBookPro5,1, BootROM MBP51.007E.B06, 2 processors, Intel Core 2 Duo, 2,4 GHz, 4 GB, SMC 1.33f8
Graphics: NVIDIA GeForce 9400M, NVIDIA GeForce 9400M, PCI, 256 MB
Graphics: NVIDIA GeForce 9600M GT, NVIDIA GeForce 9600M GT, PCIe, 256 MB
Memory Module: BANK 0/DIMM0, 2 GB, DDR3, 1067 MHz, 0x80CE, 0x4D34373142353637334448312D4346382020
Memory Module: BANK 0/DIMM1, 2 GB, DDR3, 1067 MHz, 0x80CE, 0x4D34373142353637334448312D4346382020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x8D), Broadcom BCM43xx 1.0 (5.106.98.100.24)
Bluetooth: Version 4.4.2f1 16391, 3 services, 27 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en1
Serial ATA Device: TOSHIBA MK5076GSX, 500,11 GB
Serial ATA Device: MATSHITADVD-R   UJ-868
USB Device: USB 2.0 Bus
USB Device: USB 2.0 Bus
USB Device: Built-in iSight
USB Device: USB Bus
USB Device: Apple Internal Keyboard / Trackpad
USB Device: IR Receiver
USB Device: USB Bus
USB Device: BRCM2046 Hub
USB Device: Bluetooth USB Host Controller
Thunderbolt Bus:

UPDATE 2016-01-03
I've removed the HD from my MacBook Pro from 2008 and put it today in a White Macbook I have at home and I've been able to finish the El Capitan install and get it working without issues.
So I've removed the HD from the White Macbook and put it back in the MacBook Pro 2008 and It has booted correctly the first time. I've started Safari, I've gone to youtube and when starting to watch the first video, it has kernel paniced. Now I'm unable to boot the computer again.
BTW, I'm using a 3rd party Hard drive, but I believe it's not the issue because it works flawless in the White Macbook. My understanding is the issue is related with the two graphic cards, and I'm unable to upgrade the EFI as suggested by @kenjikato
2nd UPDATE 2016-01-03
Every time I boot my HD in my white MacBook and then put it back in my MBPro it works the first boot.
This time I switched to high performance in Energy Saver and it did work. However seconds after that, the screen started to turn purple. It looks like something is wrong with one of these graphic cards.
You can see the video here
3rd UPDATE 2016-01-04
I've managed to boot sometimes in El Capitan, however it's quite unstable, and the operating system doesn't seem to remember the high performance mode after a crash. This is another kernel panic I captured today, I believe it's different enough from the previous one.

Anonymous UUID:       A4F7B385-F7EB-6327-54C1-E8D48CD11866

Sun Jan  3 08:41:23 2016

*** Panic Report ***
panic(cpu 1 caller 0xffffff801d9d155a): Kernel trap at 0xffffff7f9ff5437d, type 14=page fault, registers:
CR0: 0x0000000080010033, CR2: 0x0000000000000010, CR3: 0x0000000016ef9000, CR4: 0x0000000000002660
RAX: 0x3803a69ac0f30001, RBX: 0xffffff80876c8000, RCX: 0x0000000000000001, RDX: 0x00000000ffffffff
RSP: 0xffffff90b693bae0, RBP: 0xffffff90b693bae0, RSI: 0x0000000000000000, RDI: 0x0000000000000000
R8:  0x00000000ffffffff, R9:  0x0000000000000002, R10: 0xffffff802b2c10d0, R11: 0x000000000000002c
R12: 0x0000000000000000, R13: 0x000000000000073c, R14: 0xffffff80876c8268, R15: 0xffffff80876c8000
RFL: 0x0000000000010293, RIP: 0xffffff7f9ff5437d, CS:  0x0000000000000008, SS:  0x0000000000000010
Fault CR2: 0x0000000000000010, Error code: 0x0000000000000000, Fault CPU: 0x1, PL: 0

Backtrace (CPU 1), Frame : Return Address
0xffffff90b693b770 : 0xffffff801d8de792
0xffffff90b693b7f0 : 0xffffff801d9d155a
0xffffff90b693b9d0 : 0xffffff801d9ef233
0xffffff90b693b9f0 : 0xffffff7f9ff5437d
0xffffff90b693bae0 : 0xffffff7f9ff3e9b4
0xffffff90b693bb40 : 0xffffff7f9ff3e8f8
0xffffff90b693bb60 : 0xffffff7f9ff1a77a
0xffffff90b693bba0 : 0xffffff7f9f2fe0f5
0xffffff90b693bbf0 : 0xffffff7f9f2fe008
0xffffff90b693bc10 : 0xffffff7f9f302572
0xffffff90b693bca0 : 0xffffff7f9f2fa14b
0xffffff90b693bcd0 : 0xffffff7f9f9f7ae8
0xffffff90b693bd20 : 0xffffff801de95f91
0xffffff90b693bd70 : 0xffffff801dedfb19
0xffffff90b693bde0 : 0xffffff801d99a8f1
0xffffff90b693be30 : 0xffffff801d8e2ef3
0xffffff90b693be60 : 0xffffff801d8c68a8
0xffffff90b693bea0 : 0xffffff801d8d62e5
0xffffff90b693bf10 : 0xffffff801d9bbd2a
0xffffff90b693bfb0 : 0xffffff801d9efa56
      Kernel Extensions in backtrace:
         com.apple.iokit.IOGraphicsFamily(2.4.1)[48AC8EA9-BD3C-3FDC-908D-09850215AA32]@0xffffff7f9f2f0000->0xffffff7f9f329fff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[6ADFE830-2986-35D2-8C2F-6ABEDBC94F6A]@0xffffff7f9e12c000
         com.apple.nvidia.classic.NVDAResmanTesla(10.0)[05FC5D7E-BB0B-3232-BBBD-8A49B6870D8B]@0xffffff7f9f9f4000->0xffffff7f9fc68fff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[6ADFE830-2986-35D2-8C2F-6ABEDBC94F6A]@0xffffff7f9e12c000
            dependency: com.apple.iokit.IONDRVSupport(2.4.1)[814A7F4B-03EF-384A-B205-9840F0594421]@0xffffff7f9f675000
            dependency: com.apple.iokit.IOGraphicsFamily(2.4.1)[48AC8EA9-BD3C-3FDC-908D-09850215AA32]@0xffffff7f9f2f0000
         com.apple.GeForceTesla(10.0)[FA931FAA-37C3-36C9-A992-63632B1496AF]@0xffffff7f9ff17000->0xffffff7f9ffe2fff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[6ADFE830-2986-35D2-8C2F-6ABEDBC94F6A]@0xffffff7f9e12c000
            dependency: com.apple.iokit.IONDRVSupport(2.4.1)[814A7F4B-03EF-384A-B205-9840F0594421]@0xffffff7f9f675000
            dependency: com.apple.iokit.IOGraphicsFamily(2.4.1)[48AC8EA9-BD3C-3FDC-908D-09850215AA32]@0xffffff7f9f2f0000
            dependency: com.apple.nvidia.classic.NVDAResmanTesla(10.0.0)[05FC5D7E-BB0B-3232-BBBD-8A49B6870D8B]@0xffffff7f9f9f4000

BSD process name corresponding to current thread: WindowServer

Mac OS version:
15C50

Kernel version:
Darwin Kernel Version 15.2.0: Fri Nov 13 19:56:56 PST 2015; root:xnu-3248.20.55~2/RELEASE_X86_64
Kernel UUID: 17EA3101-D2E4-31BF-BDA9-931F51049F93
Kernel slide:     0x000000001d600000
Kernel text base: 0xffffff801d800000
__HIB  text base: 0xffffff801d700000
System model name: MacBookPro5,1 (Mac-F42D86C8)

System uptime in nanoseconds: 59624319088
last loaded kext at 55760580027: com.apple.driver.pmtelemetry   1 (addr 0xffffff7fa004c000, size 49152)
loaded kexts:
com.apple.driver.pmtelemetry    1
com.apple.iokit.IOUserEthernet  1.0.1
com.apple.iokit.IOBluetoothSerialManager    4.4.3f4
com.apple.Dont_Steal_Mac_OS_X   7.0.0
com.apple.driver.AppleUpstreamUserClient    3.6.1
com.apple.driver.AppleHDAHardwareConfigDriver   272.51.3
com.apple.driver.AppleTyMCEDriver   1.0.2d2
com.apple.driver.AGPM   110.20.21
com.apple.driver.AppleMikeyHIDDriver    124
com.apple.GeForceTesla  10.0.0
com.apple.driver.AppleHDA   272.51.3
com.apple.driver.AppleOSXWatchdog   1
com.apple.driver.AppleMikeyDriver   272.51.3
com.apple.driver.AppleHV    1
com.apple.driver.AppleBacklight 170.8.3
com.apple.nvenet    2.0.22
com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport 4.4.3f4
com.apple.iokit.IOBluetoothUSBDFU   4.4.3f4
com.apple.driver.AppleSMCLMU    208
com.apple.driver.AppleMuxControl    3.12.6
com.apple.driver.AirPort.Brcm4331   800.20.24
com.apple.driver.ACPI_SMC_PlatformPlugin    1.0.0
com.apple.driver.AppleLPC   3.1
com.apple.driver.AppleIntelSlowAdaptiveClocking 4.0.0
com.apple.driver.AppleFIVRDriver    4.1.0
com.apple.driver.AppleMCCSControl   1.2.13
com.apple.nvidia.NVDAStartup    10.0.8
com.apple.driver.SMCMotionSensor    3.0.4d1
com.apple.filesystems.autofs    3.0
com.apple.driver.AppleUSBTCButtons  245.4
com.apple.driver.AppleFileSystemDriver  3.0.1
com.apple.AppleFSCompression.AppleFSCompressionTypeDataless 1.0.0d1
com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0
com.apple.BootCache 38
com.apple.driver.AppleUSBTCKeyEventDriver   245.4
com.apple.driver.AppleUSBTCKeyboard 245.4
com.apple.driver.AppleIRController  327.5
com.apple.iokit.SCSITaskUserClient  3.7.7
com.apple.iokit.IOAHCIBlockStorage  2.8.5
com.apple.driver.usb.AppleUSBOHCIPCI    1.0.1
com.apple.driver.AppleSmartBatteryManager   161.0.0
com.apple.driver.AppleFWOHCI    5.5.2
com.apple.driver.AppleAHCIPort  3.1.8
com.apple.driver.usb.AppleUSBEHCIPCI    1.0.1
com.apple.driver.AppleRTC   2.0
com.apple.driver.AppleHPET  1.8
com.apple.driver.AppleACPIButtons   4.0
com.apple.driver.AppleSMBIOS    2.1
com.apple.driver.AppleACPIEC    4.0
com.apple.driver.AppleAPIC  1.7
com.apple.driver.AppleIntelCPUPowerManagementClient 218.0.0
com.apple.nke.applicationfirewall   163
com.apple.security.quarantine   3
com.apple.security.TMSafetyNet  8
com.apple.driver.AppleIntelCPUPowerManagement   218.0.0
com.apple.iokit.IOSurface   108.0.1
com.apple.iokit.IOSerialFamily  11
com.apple.AppleGraphicsDeviceControl    3.12.6
com.apple.driver.CoreCaptureResponder   1
com.apple.nvidia.classic.NVDANV50HalTesla   10.0.0
com.apple.nvidia.classic.NVDAResmanTesla    10.0.0
com.apple.driver.DspFuncLib 272.51.3
com.apple.kext.OSvKernDSPLib    525
com.apple.iokit.IOBluetoothHostControllerUSBTransport   4.4.3f4
com.apple.iokit.IOBluetoothFamily   4.4.3f4
com.apple.iokit.IOFireWireIP    2.2.6
com.apple.driver.AppleHDAController 272.51.3
com.apple.iokit.IOHDAFamily 272.51.3
com.apple.iokit.IOAudioFamily   204.3
com.apple.vecLib.kext   1.2.0
com.apple.kec.Libm  1
com.apple.driver.AppleBacklightExpert   1.1.0
com.apple.iokit.IONDRVSupport   2.4.1
com.apple.driver.AppleGraphicsControl   3.12.6
com.apple.iokit.IO80211Family   1110.26
com.apple.driver.corecapture    1.0.4
com.apple.driver.NVSMU  2.2.9
com.apple.driver.AppleSMBusPCI  1.0.14d1
com.apple.driver.IOPlatformPluginLegacy 1.0.0
com.apple.driver.IOPlatformPluginFamily 6.0.0d7
com.apple.iokit.IOSlowAdaptiveClockingFamily    1.0.0
com.apple.driver.AppleSMBusController   1.0.14d1
com.apple.iokit.IOGraphicsFamily    2.4.1
com.apple.driver.AppleSMC   3.1.9
com.apple.kext.triggers 1.0
com.apple.iokit.IONetworkingFamily  3.2
com.apple.driver.usb.IOUSBHostHIDDevice 1.0.1
com.apple.driver.AppleUSBMultitouch 250.5
com.apple.driver.usb.AppleUSBHub    1.0.1
com.apple.iokit.IOUSBHIDDriver  900.4.1
com.apple.driver.usb.AppleUSBHostCompositeDevice    1.0.1
com.apple.iokit.IOSCSIMultimediaCommandsDevice  3.7.7
com.apple.iokit.IOBDStorageFamily   1.8
com.apple.iokit.IODVDStorageFamily  1.8
com.apple.iokit.IOCDStorageFamily   1.8
com.apple.driver.AppleXsanScheme    3
com.apple.iokit.IOAHCISerialATAPI   2.6.2
com.apple.iokit.IOSCSIArchitectureModelFamily   3.7.7
com.apple.driver.AppleUSBMergeNub   900.4.1
com.apple.driver.usb.AppleUSBOHCI   1.0.1
com.apple.iokit.IOFireWireFamily    4.5.8
com.apple.driver.AppleEFINVRAM  2.0
com.apple.iokit.IOAHCIFamily    2.8.1
com.apple.driver.usb.AppleUSBEHCI   1.0.1
com.apple.iokit.IOUSBFamily 900.4.1
com.apple.iokit.IOUSBHostFamily 1.0.1
com.apple.driver.AppleUSBHostMergeProperties    1.0.1
com.apple.driver.AppleEFIRuntime    2.0
com.apple.iokit.IOHIDFamily 2.0.0
com.apple.iokit.IOSMBusFamily   1.1
com.apple.security.sandbox  300.0
com.apple.kext.AppleMatch   1.0.0d1
com.apple.driver.AppleKeyStore  2
com.apple.driver.AppleMobileFileIntegrity   1.0.5
com.apple.driver.AppleCredentialManager 1.0
com.apple.driver.DiskImages 417.1
com.apple.iokit.IOStorageFamily 2.1
com.apple.iokit.IOReportFamily  31
com.apple.driver.AppleFDEKeyStore   28.30
com.apple.driver.AppleACPIPlatform  4.0
com.apple.iokit.IOPCIFamily 2.9
com.apple.iokit.IOACPIFamily    1.4
com.apple.kec.pthread   1
com.apple.kec.corecrypto    1.0
Model: MacBook6,1, BootROM MB61.00C8.B00, 2 processors, Intel Core 2 Duo, 2,26 GHz, 2 GB, SMC 1.51f53
Graphics: NVIDIA GeForce 9400M, NVIDIA GeForce 9400M, PCI, 256 MB
Memory Module: BANK 0/DIMM0, 1 GB, DDR3, 1067 MHz, 0x80AD, 0x484D54313132533642465236432D47372020
Memory Module: BANK 1/DIMM0, 1 GB, DDR3, 1067 MHz, 0x80AD, 0x484D54313132533642465236432D47372020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x93), Broadcom BCM43xx 1.0 (5.106.98.100.24)
Bluetooth: Version 4.4.3f4 16616, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en1
Serial ATA Device: TOSHIBA MK5076GSX, 500,11 GB
Serial ATA Device: MATSHITADVD-R   UJ-898
USB Device: USB 2.0 Bus
USB Device: Built-in iSight
USB Device: USB 2.0 Bus
USB Device: USB Bus
USB Device: BRCM2070 Hub
USB Device: Bluetooth USB Host Controller
USB Device: USB Bus
USB Device: Apple Internal Keyboard / Trackpad
Thunderbolt Bus:

A: I think I found your problem.  It appears that you have one of the faulty Nvidia 9400m graphics cards in your computer. If you search on your model you will find lots of discussions (Apple Support, GoodBytes) about this system, and problems with the 9400m graphics card.
If you were running your system in "High Performance" graphics mode, then the system relied on the 9600m graphics card rather than the 9400m. So you would not have seen the dreaded flickering and green flash so many people reported on.
There is a fix, Apple released an EFI Firmware Update 2.8 for several systems including your MacBook in 2012.
But if you read through your kernel panic log you will see that you only have the 2.0 EFI Firmware in installed.
com.apple.driver.AppleEFINVRAM  2.0
com.apple.driver.AppleEFIRuntime    2.0

Hence the kernel panic you are seeing.
I would suggest that if you made a backup before you tried updating the system (you did make a backup right?) that you:

*

*Boot your computer from your Snow Leopard pre-upgrade backup.

*Go to  -> System Prefs -> Energy Saver and set your graphics card to High performance.

*Try installing the EFI Firmware Update 2.8 from Snow Leopard.NOTE: The installer will ONLY work from Mac OS X 10.5.8, 10.6.8 or 10.7.3. according to the Apple website.

*Reboot to the internal drive, and the new El Capitan OS you already installed.

You might have to rerun the El Capitan installer again to get things working, but I have a feeling that you should be able to just boot up into El Capitan.
I hope this solves your problem.
ADDITION:
One additional workaround for this problem came to me from a friend.
You can try and disable (in Mavericks 10.9, Yosemite 10.10 and El Capitan 10.11) the Automatic Graphics Switching if you can boot into the the updated OS, and get to the System Prefs. This may disable the 9400m enough that you "might" not see the kernel panic again.

A: here i think you can get some help
have you tried erasing your HDD and then reinstall via CMD + R?
greetings :)


text:
Q: Google Compute Engine doesn't recognize main.py I'm trying to deploy a Flask app on Google Compute Engine. I have it all configured, but when I try to deploy it with gcloud app deploy, it says ModuleNotFoundError: No module named 'main'. This is my file structure:
└── gpt-redteam-api/
    ├── app.yaml
    ├── main.py
    └── ...other files

and I am deploying it from inside gpt-redteam-api. Is this a common problem/are there any elementary fixes I'm missing?

A: For your issue you need to add a custom entrypoint to recognize the main.py
Entrypoint: Optional. Overrides the default startup behavior by executing the entrypoint command when your app starts. For your app to receive HTTP requests, the entrypoint element should contain a command which starts a web server that listens on port 8080.
You need to configure the entrypoint field by the following steps.
This line says to look for the variable named app in the module named main.py:
entrypoint: gunicorn -b:$PORT main:app

You could either rename your app.py to main.py or update this line to:
entrypoint: gunicorn -b:$PORT app:app

For more information follow this doc and  refer to this stack question also.


text:
Q: Maximum ram I can put in a laptop? I m looking to buy a new cheaper laptop with DDR4 (8gb) and upgrade the RAM after to 32GB DDR4. I will only look for laptops that have processors that can support 32GB and have 2 slots.
So : Can a laptop handle as much RAM memory as it's CPU processor can handle (manufacturer data) if there are enough ram slots inside it to fit that memory? Or can the motherboard have  less ram support than what the processor can ?

A: There are a couple of pieces to the puzzle.
The CPU chip may have an integrated memory controller (more modern) or a separate chip that talks to memory. Those chips will have some supported max configuration. They may also have configuration restrictions around banking or dram timing. The max dimm size may not be the only restriction: the exact supported dram chip configurations may be limited (this is a complicated thing to describe why not all 4Gbit dram chips are the same feature set, even if labelled DDR3 etc)
They may have supported voltage restrictions.
On the motherboard, it's possible that not all signals from the chip were routed to the dram slots. So you have to check what the max the motherboard supports. This would include restrictions on number of dimm connectors, and what kind
There could also be power restrictions, such that the laptop doesn't overheat. But most people don't worry about that. Sometimes there is more variance between dram vendors then you might expect
Then there is the problem of what the BIOS does. Nowadays, most modern BIOS's read the SPD info from the DIMM, that tells it what the DIMM supports, and programs the memory controller or CPU to make that work. But it's possible that it could be hardwired (in the old days)
So, the short answer to your question: download hwinfo (assuming this is windows) and run it (https://www.hwinfo.com/download.php )
You'll get a report on the CPU, the Motherboard, the Chipset (if any) and the BIOS, along with info on existing DIMM (good for determining voltage required and DIMM connector)
report back with all the info on the System Summary popup (snap a jpeg or just the text of the info I mentioned) and I'll tell you how I'd digest the info and decide what dimms would work (a lot of dram seller sites now also do compatibility reporting...so just knowing the motherboard may be sufficient, but good to get it all to double check)


text:
Q: Diamond's background height is more than for initial part of the name in iOS app When the topic starter is a mod, and he have post a comment then  the text background height for the diamond is slightly more in the iOS app. E.g. Tim Post's comment:

In the web version background height is same for whole name:

*

*App Version: 1.6.6.2

*Device: Unknown (iPad7,3)

*OS Version: Version 11.2.1 (Build 15C153)


text:
Q: Data encoding in new protocol handshake hybi-10 I'm using a WebSocket for python and JavaScriptand until now the handshake protocol for Google Chrome was draft hybi-00. I guess Google Chrome changed the protocol to draft hybi-10 recently.
So today I updated the handshake code and now the WebSocket is succefully created and opened. On the onopen event in JavaScript, I send a simple text message:
viz.ws = new WebSocket("ws://127.0.0.1:5500");

viz.ws.onopen = function() {
    viz.ws.send("TEST\n");
};

My server in Python receives this data. However, it is encoded somehow and I can't get the simple text "TEST\n" I sent:
    def recv_data(self, client, count):

        try:
            data = client.recv(count)

        except:
            return False

        print data
        print data.decode('utf-8','ignore')

        return data.decode('utf-8', 'ignore')

The prints return this:
üàÍu┬¯é0æ║▄
u0

And they're always different, but the sent text is always TEST\n.
Also, the server receives this data, but the client isn't receiving any data sent from the server.
I read that hybi-10 uses binaries... Am I missing a data conversion in that code? I'm sorry, I'm really new to WebSockets and these protocols are messing with my head...

A: The way data is framed in HyBi (HyBi-00 is really Hixie-76) is significantly changed. The new frame format is described in this diagram.
Also, for data that is sent from the client to the server, the data is masked. The mask is the first 4 bytes of the frame payload and is decoded (and encoded actually) in place using this simple algorithm:
data[i] = data[i] XOR mask[j MOD 4]

The mask key is different with every frame which is why you are getting a different payload every time even though you are sending the same data.
If the client isn't receiving data that you sent, chances are that you aren't framing the data right. Also note that Chrome 14 and Firefox 6/7 do not yet support binary data so the opcode needs to be 1 to denote a text (UTF-8) frame.


text:
Q: form_tag not going to correct controller So I'm trying to create a simple form in a blog edit view that will just take in an id number and pass that through to the controller method. In my veiw I have

<%= _("Foo blog") %>

      <%= form_tag foo_path, :method => 'get' do %>
        <%= label_tag(:fooid, "Blog ID") %>
        <%= text_field_tag(:fooid) %>
        <%= submit_tag("submit foo") %>
      <% end %>

So I want clicking "submit foo" to submit the ID to the foo action in the controller.
In my controller I have:
def foo
  respond_to do |format|
    format.html {
      if params[:fooid]
        redirect_to '/'
      else
        redirect_to '/'
      end
    }
  end
end

And when I run rake routes I get:
 foo        /admin/content/foo(.:format)     {:controller=>"admin/content", :action=>"foo"}

But every time I click submit foo it doesn't get to that method and instead behaves as if I was trying to save the blog article. How do I get the form to redirect to the foo action in the admin/content controller?

A: Did you add the #Foo action to your routes?
You likely have something similar to:    resources :admins, and should change it to
resources :admins do
    resources :contents do
        member do
            post 'foo'
        end
    end
end

More information available at the Rails Routing docs


text:
Q: por que al colocar esta sentencia me genera error 1064 (42000)at line 1 El div wrapper se usará para facilitar el estilo de toda la página. El div menu obviamente contiene un menú con enlaces a páginas que todavía tenemos que crear, pero ayuda un poco a ver hacia dónde vamos. El div userbar se usará para una pequeña barra superior que contiene cierta información como el nombre de usuario y un enlace a la página de cierre de sesión. La página de contenido abarca el contenido real de la página, obviamente.
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="description" content="A short description." />
    <meta name="keywords" content="put, keywords, here" />
    <title>PHP-MySQL forum</title>
    <link rel="stylesheet" href="style.css" type="text/css">

My forum

        Home -
        Create a topic -
        Create a category

Hello Example. Not you? Log out.


text:
Q: How to return Task from a method? Please consider the code :
public class TestResource<T>
{
        public Task<T> Get()
        {
            String measures = null;
            // Some heavy action that put data in "measures"

            // now return Task<T> with "measures" for T="Measure" ...
            return measures as Task<T>;  // alwsys returns null ...
        }
}

With its MAIN:
   TestResource<Measure> testMeasure = new TestResource<Measure>();
   Task<Measure> taskMeasure = testMeasure.Get();
   Measure result = taskMeasure.Result;    // !! This one is ALWAYS NULL
   if (result != null)
   {
     // Show result to the user
   }

taskMeasure is always NULL.
How can we return the Task<T> (with the correct value for the requested T) from the GET method properly ?


text:
Q: Ideal image size for iOS If I want to display an icon with 24x24 in an app, what sizes should I provide in the app?
For example, is it sufficient to save the image as 128x128 in the app?
Or are @1x @2x @3x sizes required?
It is a simple icon (width == height), example:

A: Different sizes are not necessarily required, but they can help reducing binary sizes.
For an image that you want to show in the dimensions of 24x24, you should provide a 24x24, a 48x48 and a 72x72 image.
For simple graphics like this, it's usually more suitable if you create a vector asset.


text:
Q: Full Text Catalog Indexes Not Populating I ran sp_Blitz on a server and it indicated that full text indexes were not populating.  I got a list of the indexes that are not populating and looked at the definitions of the indexes.  The syntax of those indexes does not look like BOL examples for full text index creation, but instead they look like traditional row indexes.  And they are on BigInt data types not text. Here is the code that returns the full text indexes that are not populating.
SELECT FTCatalogName = c.name
      ,TableName     = t.name
      ,IndexName     = i.name
      ,LastCrawlEnd  = fi.crawl_end_date
 FROM sys.fulltext_indexes fi
 JOIN sys.tables t
   ON t.[object_id] = fi.[object_id]
 JOIN sys.fulltext_catalogs c
   ON fi.fulltext_catalog_id =  c.fulltext_catalog_id
 JOIN sys.indexes i
   ON fi.unique_index_id = i.index_id
  AND fi.[object_id] = i.[object_id]
   WHERE fi.is_enabled = 1
     AND fi.crawl_end_date < DATEADD(DAY, -7, GETDATE())
ORDER BY fi.crawl_end_date, t.name, i.name;

I'm not particularly familiar with full text indexing but it seems sp_Blitz is highlighting full text index issues that aren't really full text indexes.  Just confused by what I'm seeing.
Here is an example of the DDL of one of the indexes that is identified as a full text index.  but, it appears to me to be a traditional row based index.  The DDL doesn't look like what would be used to create a full text index.
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id =
OBJECT_ID(N'[dbo].[tblIntAnalysedItems_106]') AND name = N'PK_tblIntAnalysedItems_106')
ALTER TABLE [dbo].[tblIntAnalysedItems_106] ADD  CONSTRAINT
[PK_tblIntAnalysedItems_106] PRIMARY KEY CLUSTERED
(
[RowId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF,
IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS =
ON, FILLFACTOR = 70)
ON [SomeObject]


text:
Q: Recursividade- elemindices Sabem como definir recursivamente a função elemindices, pré-definida na Prelude.
Eu defini de uma forma, mas não dá o resultado esperado.
myElemIndices :: Eq a => a -> [a] -> [Int]
myElemIndices x [] = []
myElemIndices x (h:t) | x == h = 0 : myElemIndices x t
                      | otherwise = myElemIndices x t

A: Vou explicar duas formas que funcionam mas não sei se é realmente o que você deseja:
myElemIndices :: Eq a => a -> [a] -> [Int]
myElemIndices x [] = []
myElemIndices a xs = indexed a (zip xs [0..])
    where indexed _ [] = []
          indexed a ((x,i):xs)
              | x == a = i:indexed a xs
              | otherwise = indexed a xs

Estou usando uma função interna chamada indexed que atribui índices à lista usando a função zip. Essa função retorna tuplas com a união das listas, no caso fica (x1, 1), (x2, 2) ... (xn , n). A cada rodada recursiva em que a igualdade x == a é verdadeira eu faço o append do índice no resultado. (Veja no repl.it - créditos ao autor: Counting positions in a list haskell)
Ou pode fazer uso de uma função auxiliar diferente:
myElemIndices :: Eq a => a -> [a] -> [Int]
myElemIndices x [] = []
myElemIndices x xs = count 0 x xs

count :: Eq a => Int -> a -> [a] -> [Int]
count c x [] = []
count c x (y:ys)
   | x == y = c:count (c+1) x ys
   | otherwise = count (c+1) x ys

No caso acima eu uso uma função com um argumento a mais para contar. Quando x = y ele da um append no contador atual e passa adiante com contador + 1. (Veja funcionando no repl.it)


text:
Q: How to skip the the first lag N days in ARIMA model (python)? I have data containing daily sales of 21 weeks (17 weeks of training data, 4 weeks of validation data), and want to forecast daily sales for the next week, e.g. standing on the Monday of week 10, I want to use the data of week 1-9 to predict daily sales of week 11 in python.
Since there is missing 1-2 weeks of data before the target date (for week 11 Mon, I miss lag 1-7, for week 11 Sun, I miss lag 1-13), how should I construct the independent variables, data structure or config arima model, so that in training data it can reflect the missing dates and won't take the recent lags as input?
Thank you!

A: I see two possibilities for this here.

*

*I assume you are using statsmodels ARIMA class. You can specify which lags ARIMA is supposed to use when defining the order. E.g., if you give order=(4,0,0) it will use the last four lags for the autoregression component. If you give order=([1,0,1,1],0,0) it will only use the last, third and fourth last lags while ignoring the second last. In the [] you can define which lags to use with a 1 and which to ignore with a 0 for the specific component.

*You could use imputing to fill the missing values. There are many ways to do this and you need to find a good one for your usecase, for starters you can have a look here: https://machinelearningmastery.com/statistical-imputation-for-missing-values-in-machine-learning/
I do not know your usecase, but I would suggest the second way.


text:
Q: Error when declaring a recursive function with default parameter in C++ Firstly, I would like to say that I'm a beginner in C++ and on StackOverflow as well, I'm open to critique and advice.
Now to the main issue, I'm messing with recursion and I wrote the code below:
#include<iostream>
using namespace std; //not best practice, but it was supposed to be a quick test

unsigned long long sum_range(unsigned long long, unsigned long long = 0); //most likely the issue

int main(){
    unsigned long long result = sum_range(100);
    cout << result << endl;
}

unsigned long long sum_range(unsigned long long range, unsigned long long current = 0){ //it works if i put the actual funcition's code above the main()
    /*
    This is a basic recursive function that returns the sum of all the number within the specified range.
    range : it is the last value of the range, being 0-{value of "range"}, it includes the value of range in the sum.
    current : this is the variable that stores the sum throughout the recursion.
    */
    if (range == 0){
        return current;
    }
    else{
        current += range;
        return sum_range(--range, current=current);
    }
}

To me, the code above seems fine, but when i try to compile with g++ this error appears:
>>> g++ -o test.exe test.cpp

test.cpp:11:20: error: default argument given for parameter 2 of 'long long unsigned int sum_range(long long unsigned int, long long unsigned int)' [-fpermissive]
   11 | unsigned long long sum_range(unsigned long long range, unsigned long long current = 0){ //it seems to work, if i put the actual funcition above the main()
      |                    ^~~~~~~~~
test.cpp:4:20: note: previous specification in 'long long unsigned int sum_range(long long unsigned int, long long unsigned int)' here
    4 | unsigned long long sum_range(unsigned long long, unsigned long long = 0); //most likely the issue
      |                    ^~~~~~~~~

But I can't figure out what's wrong, as commented in the code above, I tried to put the function's code above main() and it worked, which makes me believe that the problem is with this declaration:
unsigned long long sum_range(unsigned long long, unsigned long long = 0);
I also tried to reformat it like this:
unsigned long long sum_range(unsigned long long range , unsigned long long current = 0);
still, the same error and I got stuck, I don't have the slightest clue on how to fix it, so I'm hoping someone could clarify what's the issue here.


text:
Q: What are the FEZ tetris codes for the PC? Everywhere I search, I can't find the tetris codes for the PC. Could someone help me on this?
I already know the directions, and I'm assuming left and right trigger are the equivalents of A and D, and I think A on XBOX is the ctrl equivalent, except this isn't working.

A: The keyboard has been remappable since v1.08 and the tetrominos map to functions (up/down/left/right/jump/rotate left/rotate right), so the "codes" will change based on your setup.
By default, A and D are mapped to rotate left/right (respectively), the arrow keys are for movement, and Space by default.


text:
Q: calling Stored Procedure String via Rest API returns empty instead of valid String As a back-end developer, I would like to call stored procedure connecting Oracle 9i database to fetch the single output string.
In reality, the result of the output parameter as string, returns empty.
Would you please tell me what to modify the work?
Here is my rest controller:
@GetMapping(value = { "/third"})
public String getVariable (){
   String  result = "" ;

   Connection conn;
   conn = getConnection() ;

   CallableStatement cstmt = null;

   try {
       String SQL = "{call pkg1234.get_pc_lookup_value_second(?,?)}";
       cstmt = conn.prepareCall (SQL);
       cstmt.setString(1, "TES");
       cstmt.registerOutParameter(2,  oracle.jdbc.OracleTypes.VARCHAR );
       cstmt.execute();

       String dddresult = cstmt.getString(2);
       System.out.println(" Record :"+dddresult);
       result = dddresult;
    }
   catch (SQLException e) {
       System.out.println(" go this");
       e.printStackTrace();
  }
   return result ;
}

Here is my stored procedure:
PROCEDURE get_pc_lookup_value_second (
    i_lookup_code    IN       VARCHAR2,
    o_lookup_value   OUT      VARCHAR2
)
o_lookup_value := '456';
END get_pc_lookup_value_second;

A: Try my own library for simplicity:
<dependency>
   <groupId>com.github.buckelieg</groupId>
   <artifactId>db-fn</artifactId>
   <version>0.3.4</version>
</dependency>

And then in code:
try(DB db = new DB("your-connection-string")) {
    String result = db.procedure("{call pkg1234.get_pc_lookup_value_second(?,?)}", P.in("TES"), P.out(JDBCType.VARCHAR)).call(cs -> cs.getString(2)).orElse("Unknown");
}

See more here
You have reported the following as your code:
try(DB db = new DB("jdbc:oracle:thin:username/password@10.8.12.6:1521:dev")) {
    String thisString = db.procedure("{call b_pc_mob_portal_pkg.get_pc_lookup_value_second(?,?)}",
            P.in("TES" , "i_lookup_code"),
            P.out(JDBCType.LONGNVARCHAR , "o_lookup_value" )).call(cs -> cs.getString(2)).orElse("Unknown");
    System.out.println( "thisString String  :" + thisString );

}

You have reported that this gives:

[Ljava.lang.Object; cannot be cast to [Lbuckelieg.fn.db.P;

You have asked:

How can I check on whether this method need to be revised.

This is because you try to combine named parameters with anonymous ones. Either remove parameter names:
db.procedure("{call b_pc_mob_portal_pkg.get_pc_lookup_value_second(?,?)}", P.in("TES"), P.out(JDBCTtype.VARCHAR))...

or add names to procedure call statement:
db.procedure("{call b_pc_mob_portal_pkg.get_pc_lookup_value_second(:i_lookup_code,:o_lookup_value)}", P.in("i_lookup_code", "TES"), P.out(JDBCType.VARCHAR , "o_lookup_value" ))...

You have also reported that you have tried this code:
try(DB db = new DB("jdbc:oracle:thin:username/password@10.8.12.6:1521:dev")) {
        String thisString = db.procedure("{call b_pc_mob_portal_pkg.get_pc_lookup_value_second(?,?)}",
                P.in("TES" ),
                P.out(JDBCType.VARCHAR )).call(cs -> cs.getString(2)).orElse("Unknown");
        System.out.println( "thisString String  :" + thisString );
        }

And you have said:

when I do it in this way, it gives:

buckelieg.fn.db.SQLRuntimeException: [registerOutParameter not implemented]

I think the problem is in JDBC driver. Which version do you use? Can it be updated for newer one?
You have said that this is your database:

And also that you have downloaded:

OJDBC7.jar
https://www.oracle.com/database/technologies/jdbc-drivers-12c-downloads.html
Here is the Oracle IDE Version fetched by the Oracle SQL Developer

Very interesting. I will look into this issue.
As a temporal workaround I suggest to do the following:
Rewrite procedure as follows:
CREATE OR REPLACE FUNCTION b_pc_mob_portal_pkg.get_pc_lookup_value_second(IN param1 VARCHAR2 DEFAULT 'TES')
RETURN VARCHAR2 IS
BEGIN
    RETURN '456';
END b_pc_mob_portal_pkg.get_pc_lookup_value_second;

And then in code:
String value = db.select("SELECT b_pc_mob_portal_pkg.get_pc_lookup_value_second(?) AS output FROM DUAL", "TES").single(rs -> rs.getString("output")).orElse("Unknown");

How about procedure?

Have you tried latest version (0.3.6) of library?
 <dependency>
  <groupId>com.github.buckelieg</groupId>
  <artifactId>db-fn</artifactId>
  <version>0.3.6</version>
</dependency>

A: @raju,
It may help you,Using Jpa Template with Springboot annotation.
 Controller class
    {
    @Autowired
    B b;
    @GetMapping(value = { "/third"})
        public String    getVariable (){
        return b.getInfo();
    }
    }
    @service
    B
    {
    @Autowired
    A a;
    public String getInfo()
    {
    return a.getoutput();
    }
    @repository
    interface A extends JpaRepository<Mention your Entity,String>()
    {
    @procedure(name="Execute your_procedure name")
    //return type
    public String getoutput();
    }
    }


text:
Q: Disable Save button in jquery, to avoid multiple submittion but should call server side code I have a portal created on MVC, When 'Save' button is clicked it calls ' public IActionResult OnPost(string participantIds)' method and creates a record in CRM, On multiple click of 'Save' button multiple records are created. I want to disable Save button after user clicks on it once. If i do so, It does not create record in CRM, Below is the existing .js code
$(".save").click(function () {
    finished = true;
    window.location.hash = '';
});

I updated it to:
$(".save").click(function () {
    $('.save').prop('value', 'Saving...');
    $('.save').prop('disabled', true);
    finished = true;
    window.location.hash = '';
});

Now it does not call OnPost() method but disables the button and change label to Saving..
I want it to get disabled and create record in CRM.
My HTML looks like below:
 <div class="text-right">
            <input type="submit" name="save" class="btn btn-primary save" value="@localizer.GetString("Save")" />
    </div>